@stacksjs/stx 0.2.305 → 0.2.307

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 (163) hide show
  1. package/dist/{chunk-0gz0rhvs.js → chunk-0gbptqh2.js} +1 -1
  2. package/dist/{chunk-g97atepq.js → chunk-0mnv8pf5.js} +1 -1
  3. package/dist/{chunk-4mrhxtn3.js → chunk-0va2vsqa.js} +2 -2
  4. package/dist/chunk-0wwgr4wv.js +2 -0
  5. package/dist/{chunk-nqq7y7m9.js → chunk-18p8dqya.js} +1 -1
  6. package/dist/chunk-1vwgywtn.js +2 -0
  7. package/dist/{chunk-awj7yy37.js → chunk-1ztjv7a4.js} +1 -1
  8. package/dist/{chunk-eans1ct0.js → chunk-20yc1zrp.js} +1 -1
  9. package/dist/{chunk-f1cgyd2h.js → chunk-24bgm3hh.js} +1 -1
  10. package/dist/{chunk-rvyfyc43.js → chunk-2559vc7d.js} +1 -1
  11. package/dist/{chunk-9nf3hgvq.js → chunk-286rffvb.js} +2 -2
  12. package/dist/{chunk-qev11kg8.js → chunk-2kv2gnzc.js} +1 -1
  13. package/dist/chunk-2pv79p7x.js +2 -0
  14. package/dist/{chunk-b4xwbh8a.js → chunk-322qz0cj.js} +1 -1
  15. package/dist/{chunk-t51mwjyq.js → chunk-397rqs12.js} +1 -1
  16. package/dist/{chunk-env6knrs.js → chunk-3by4c2g9.js} +1 -1
  17. package/dist/{chunk-tt4r8q4v.js → chunk-3pv0qj5f.js} +1 -1
  18. package/dist/chunk-455m2k1y.js +2 -0
  19. package/dist/{chunk-c131k3mt.js → chunk-4ee1aaet.js} +1 -1
  20. package/dist/{chunk-d3srvh3q.js → chunk-4hk5ewgp.js} +1 -1
  21. package/dist/chunk-4z3yyryn.js +2 -0
  22. package/dist/{chunk-wx13qmaw.js → chunk-51gea48g.js} +1 -1
  23. package/dist/{chunk-bk95q0bw.js → chunk-58xpr98x.js} +1 -1
  24. package/dist/chunk-59fva5cz.js +2 -0
  25. package/dist/{chunk-gbwhbasw.js → chunk-5g39e9ra.js} +1 -1
  26. package/dist/{chunk-xsfwcj6x.js → chunk-604qr43v.js} +1 -1
  27. package/dist/chunk-64ttktzc.js +4 -0
  28. package/dist/chunk-6dmrpd71.js +2 -0
  29. package/dist/chunk-6vt9ddra.js +2 -0
  30. package/dist/{chunk-k23r03qj.js → chunk-6xqgkfb3.js} +1 -1
  31. package/dist/chunk-75vxhxn1.js +2 -0
  32. package/dist/{chunk-6zt2y7q3.js → chunk-769jvq54.js} +1 -1
  33. package/dist/{chunk-gssbag3e.js → chunk-7c1qq9zq.js} +1 -1
  34. package/dist/chunk-7n6fq2t7.js +2 -0
  35. package/dist/{chunk-ta398s3d.js → chunk-7xrvkrrx.js} +10 -10
  36. package/dist/{chunk-yyyxt326.js → chunk-7yzyn9k7.js} +1 -1
  37. package/dist/chunk-80rmf67y.js +2 -0
  38. package/dist/{chunk-ppyz9623.js → chunk-85p4dmft.js} +1 -1
  39. package/dist/{chunk-c1ae6afc.js → chunk-8g6jwkjy.js} +2 -2
  40. package/dist/{chunk-8ee62a9q.js → chunk-8q8gj45z.js} +1 -1
  41. package/dist/chunk-8tkn0yxq.js +2 -0
  42. package/dist/{chunk-gecmqs6p.js → chunk-8wqhts61.js} +1 -1
  43. package/dist/chunk-9aw5d4rr.js +2 -0
  44. package/dist/{chunk-fp7ms6e7.js → chunk-9ebfmdyb.js} +1 -1
  45. package/dist/{chunk-rzevgemj.js → chunk-a50hb40e.js} +1 -1
  46. package/dist/{chunk-jfzfrmzy.js → chunk-ajhrz96a.js} +1 -1
  47. package/dist/{chunk-wfffa8zm.js → chunk-aqrp68m6.js} +1 -1
  48. package/dist/{chunk-8jam44my.js → chunk-at84gyvf.js} +1 -1
  49. package/dist/{chunk-ess2pgt5.js → chunk-b8cteeha.js} +1 -1
  50. package/dist/chunk-ba5t40dx.js +2 -0
  51. package/dist/{chunk-mbmqpaq1.js → chunk-bnq0p4r4.js} +1 -1
  52. package/dist/chunk-bzmxbz48.js +2 -0
  53. package/dist/{chunk-wnamjw6n.js → chunk-cpsepyzg.js} +1 -1
  54. package/dist/chunk-czje8k8c.js +2 -0
  55. package/dist/chunk-d4b67e6m.js +2 -0
  56. package/dist/chunk-e16hkjh9.js +2 -0
  57. package/dist/{chunk-gt8ja700.js → chunk-f044qmn3.js} +1 -1
  58. package/dist/chunk-f7e286pa.js +2 -0
  59. package/dist/{chunk-f325jzsk.js → chunk-f91yrkcz.js} +2 -2
  60. package/dist/chunk-fsee2x1q.js +2 -0
  61. package/dist/chunk-fwdn408g.js +2 -0
  62. package/dist/chunk-gy3sf0fw.js +2 -0
  63. package/dist/chunk-h78pksyp.js +2 -0
  64. package/dist/chunk-hg7ptfd4.js +2 -0
  65. package/dist/{chunk-s3dnk3gc.js → chunk-hsbrta4s.js} +1 -1
  66. package/dist/{chunk-695fkras.js → chunk-j3ajrx2n.js} +1 -1
  67. package/dist/{chunk-jsg1rthc.js → chunk-jd9nv63q.js} +1 -1
  68. package/dist/{chunk-jp2f8yzw.js → chunk-jryjwara.js} +1 -1
  69. package/dist/{chunk-4evbx7sz.js → chunk-jwnbwemq.js} +1 -1
  70. package/dist/{chunk-zhcs8m2a.js → chunk-k14nr7rz.js} +1 -1
  71. package/dist/{chunk-mv5fdcwc.js → chunk-k1qzydkj.js} +3 -3
  72. package/dist/chunk-k48jp969.js +2 -0
  73. package/dist/{chunk-hg2afckn.js → chunk-ka2xspj3.js} +1 -1
  74. package/dist/{chunk-mygq61f5.js → chunk-ka5wtqmw.js} +1 -1
  75. package/dist/{chunk-d5cqnwdd.js → chunk-kexk6z9s.js} +1 -1
  76. package/dist/{chunk-m8n0s4tk.js → chunk-kh9r3pfb.js} +1 -1
  77. package/dist/{chunk-qeyw5za9.js → chunk-ksqba0cq.js} +1 -1
  78. package/dist/chunk-kwjgt9jx.js +2 -0
  79. package/dist/{chunk-t8fqjb25.js → chunk-mk0j30e1.js} +1 -1
  80. package/dist/{chunk-m31n9pkr.js → chunk-msmhta0w.js} +1 -1
  81. package/dist/chunk-mvj75wef.js +2 -0
  82. package/dist/{chunk-1jbjrc0w.js → chunk-mvyadg84.js} +1 -1
  83. package/dist/{chunk-cbgh359m.js → chunk-n43zq50e.js} +1 -1
  84. package/dist/{chunk-g912mb7x.js → chunk-nnv8wytm.js} +1 -1
  85. package/dist/{chunk-w6d91maa.js → chunk-ns8fx1f9.js} +1 -1
  86. package/dist/{chunk-ydgdq45a.js → chunk-pwv15j35.js} +1 -1
  87. package/dist/{chunk-fczfdsab.js → chunk-r7qap4bh.js} +2 -2
  88. package/dist/{chunk-fg0nf7cv.js → chunk-r8z1rexd.js} +277 -272
  89. package/dist/chunk-raxr83fs.js +60 -0
  90. package/dist/{chunk-jxxv18a0.js → chunk-ry1key0g.js} +1 -1
  91. package/dist/{chunk-9c835qjn.js → chunk-s3pvp8qv.js} +1 -1
  92. package/dist/{chunk-sart9ehj.js → chunk-snmtft92.js} +1 -1
  93. package/dist/{chunk-zs5y7xnt.js → chunk-t5kwx6fa.js} +1 -1
  94. package/dist/{chunk-rrankpmj.js → chunk-ttny9g8k.js} +1 -1
  95. package/dist/chunk-v0ne90ft.js +2 -0
  96. package/dist/chunk-v33qvj8y.js +2 -0
  97. package/dist/{chunk-ze44hhxb.js → chunk-vbwq7he6.js} +2 -2
  98. package/dist/{chunk-d19tvdvv.js → chunk-vhan24as.js} +1 -1
  99. package/dist/chunk-vpbw6g2t.js +2 -0
  100. package/dist/{chunk-ek8cgwcg.js → chunk-vtd5bgt9.js} +1 -1
  101. package/dist/{chunk-00rtz7nw.js → chunk-vwq4kwwj.js} +1 -1
  102. package/dist/{chunk-bd9wrcq1.js → chunk-w8hkprzv.js} +1 -1
  103. package/dist/chunk-wbt9kz3j.js +2 -0
  104. package/dist/{chunk-ghw5p1yk.js → chunk-wm86mmgq.js} +1 -1
  105. package/dist/{chunk-d57gb0v2.js → chunk-wwghzbbg.js} +1 -1
  106. package/dist/{chunk-kxavsh3m.js → chunk-xcsf7my7.js} +1 -1
  107. package/dist/{chunk-hrcxfvh1.js → chunk-y4dd2n2n.js} +1 -1
  108. package/dist/{chunk-7skk34dh.js → chunk-ybct46zd.js} +1 -1
  109. package/dist/chunk-yp0jymdz.js +2 -0
  110. package/dist/{chunk-7m4yhzhb.js → chunk-yyxhjfgd.js} +2 -2
  111. package/dist/{chunk-t3qb9s6s.js → chunk-zdzd2jb4.js} +1 -1
  112. package/dist/{chunk-7gqbr8nr.js → chunk-zr1r73p3.js} +1 -1
  113. package/dist/cli.js +14 -14
  114. package/dist/craft-entry.js +1 -1
  115. package/dist/craft.js +1 -1
  116. package/dist/database.js +1 -1
  117. package/dist/expressions.d.ts +10 -1
  118. package/dist/expressions.js +42 -11
  119. package/dist/head.d.ts +12 -0
  120. package/dist/head.js +21 -2
  121. package/dist/pwa.js +2 -2
  122. package/dist/safe-evaluator.d.ts +18 -0
  123. package/dist/safe-evaluator.js +100 -17
  124. package/dist/seo.js +56 -4
  125. package/dist/ssg.js +2 -2
  126. package/dist/types/config-types.d.ts +20 -0
  127. package/dist/types/index.d.ts +1 -1
  128. package/dist/visual-testing.js +1 -1
  129. package/package.json +5 -5
  130. package/dist/chunk-02hm88m5.js +0 -2
  131. package/dist/chunk-044mychj.js +0 -2
  132. package/dist/chunk-113y4ywy.js +0 -2
  133. package/dist/chunk-1c2j4eby.js +0 -4
  134. package/dist/chunk-2h94c5hm.js +0 -60
  135. package/dist/chunk-3eervtf9.js +0 -2
  136. package/dist/chunk-4jgr954p.js +0 -2
  137. package/dist/chunk-57ea6ye2.js +0 -2
  138. package/dist/chunk-8z0n5mtg.js +0 -2
  139. package/dist/chunk-92zzryxw.js +0 -2
  140. package/dist/chunk-a87jqtmd.js +0 -2
  141. package/dist/chunk-bezqaxqt.js +0 -2
  142. package/dist/chunk-dgpjxmhs.js +0 -2
  143. package/dist/chunk-er848s6f.js +0 -2
  144. package/dist/chunk-hftqr8ej.js +0 -2
  145. package/dist/chunk-hzav4hyd.js +0 -2
  146. package/dist/chunk-m537zgay.js +0 -2
  147. package/dist/chunk-n99ajrwv.js +0 -2
  148. package/dist/chunk-ncrfrp95.js +0 -2
  149. package/dist/chunk-nws8fbde.js +0 -2
  150. package/dist/chunk-phcvbqzn.js +0 -2
  151. package/dist/chunk-qpzxgkc5.js +0 -2
  152. package/dist/chunk-qt2dmyq5.js +0 -2
  153. package/dist/chunk-r2k2sewg.js +0 -2
  154. package/dist/chunk-r808fpme.js +0 -2
  155. package/dist/chunk-sen2cxqm.js +0 -2
  156. package/dist/chunk-tc6gqeha.js +0 -2
  157. package/dist/chunk-twbw18vs.js +0 -2
  158. package/dist/chunk-wjdfhfj6.js +0 -2
  159. package/dist/chunk-x10mrzgp.js +0 -2
  160. package/dist/chunk-xd5ahrtn.js +0 -2
  161. package/dist/chunk-xzgvcrnz.js +0 -2
  162. package/dist/chunk-yd7jyyr7.js +0 -2
  163. package/dist/chunk-zs95z9tf.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Kr as J0,Mr as B9,Or as V9,Ps as z8,Ts as q8,Vr as I2,Yr as Y8,_r as X0,bt as G7,cs as T2,ct as z7,ds as Q8,fs as o0,gs as G8,ns as y4,os as e,ps as q0,qs as E0,rs as H9,ss as Z2,ts as W0,us as _9}from"./chunk-2h94c5hm.js";import{ht as u0,it as a8}from"./chunk-t51mwjyq.js";import{nt as p2}from"./chunk-wfffa8zm.js";import{At as X2,Bt as u2,Ct as j9,Dt as M2,Et as l6,Ft as b6,Gt as B1,Ht as n0,It as u9,Mt as H8,Nt as b9,_t as j8,st as i1,tt as v1,ut as U8,vt as k1,xt as H1,yt as d8,zt as m8}from"./chunk-mv5fdcwc.js";import{$t as p7}from"./chunk-4evbx7sz.js";import{du as U7,eu as H7,fu as r2,gu as a2}from"./chunk-jxxv18a0.js";import{iu as q7,ku as K7,lu as W7,nu as W2}from"./chunk-c131k3mt.js";import{ou as y9}from"./chunk-9nf3hgvq.js";import{qu as M8,ru as I8,su as T8,tu as k8,uu as E8,wu as W8}from"./chunk-nqq7y7m9.js";import{Bu as n2,Du as b8,xu as B8}from"./chunk-1c2j4eby.js";import{Nu as $1}from"./chunk-kxavsh3m.js";import{Qu as V8}from"./chunk-qev11kg8.js";import{Ru as Y3,Su as o8,Tu as u8,Uu as p1,Yu as r8,Zu as p$,_u as E6,av as W4,dv as O4}from"./chunk-rrankpmj.js";import{Pv as K8,Rv as WG,Sv as a9,Uv as G2,ov as F$,rv as B6,yv as G$}from"./chunk-fczfdsab.js";import{Zv as j7}from"./chunk-fp7ms6e7.js";import{cw as x}from"./chunk-jp2f8yzw.js";import b1 from"path";import E2 from"fs";var m$=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"]),l$={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"},XZ=new Set(["ctrl","alt","shift","meta"]),i$={left:0,middle:1,right:2};function c$($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(XZ.has(X))Z.systemKeys.push(X);else if(X in i$)Z.mouse=X;else if(X in l$||/^[a-z]$/.test(X))Z.keys.push(l$[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Y=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(X.startsWith("throttle")){let Y=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function n$($){let Z=[],J=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=X.exec($))!==null){let[Q,G,z]=Y,q=Y.index,K=q+Q.length,W=`__stx_evt_${J++}`,U=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(z))!==null){let[,V,F]=j,_=V.split("."),O=_[0];if(!m$.has(O))continue;U.push({attribute:`@${V}`,event:O,handler:F,modifiers:c$(_.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,F]=j,_=V.split("."),O=_[0];if(!m$.has(O))continue;U.push({attribute:`@${V}`,event:O,handler:F,modifiers:c$(_.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:Q,elementId:W,events:U,startIndex:q,endIndex:K})}return Z}function YZ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=i$[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function QZ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function x9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function GZ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=YZ($),Y=QZ(x9($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2
+ import{$r as X0,Lr as J0,Nr as V9,Or as z3,Pr as _9,Rs as B8,Vs as V8,Wr as T2,Zr as U8,ds as k2,dt as j7,es as H8,et as B7,gs as o0,hs as j8,os as q3,ps as g4,qs as e,rs as W0,ss as E0,ts as j9,us as Z2,vs as K0,ws as L9}from"./chunk-raxr83fs.js";import{jt as u0,kt as YZ}from"./chunk-397rqs12.js";import{pt as i2}from"./chunk-aqrp68m6.js";import{At as s8,Bt as o8,Ct as Y2,Dt as d2,Et as B9,Ft as I2,Gt as r6,Ht as x6,It as B1,Jt as n0,Kt as m9,Ot as F8,Pt as y9,au as w8,ut as i1,vt as v1,wt as O8,xt as k1,zt as H1}from"./chunk-k1qzydkj.js";import{bu as t7}from"./chunk-jwnbwemq.js";import{fu as O7,gu as F7,hu as a2,iu as t2}from"./chunk-ry1key0g.js";import{ku as V7,mu as _7,nu as L7,pu as U2}from"./chunk-4ee1aaet.js";import{qu as C9}from"./chunk-286rffvb.js";import{su as C8,tu as S8,uu as P8,vu as v8,wu as f8,yu as L8}from"./chunk-18p8dqya.js";import{Du as s2,Fu as x8,zu as R8}from"./chunk-64ttktzc.js";import{Pu as $1}from"./chunk-xcsf7my7.js";import{Su as N8}from"./chunk-2kv2gnzc.js";import{$u as n$,Tu as K3,Uu as JZ,Vu as n8,Wu as p1,_u as XZ,av as f6,cv as L4,fv as M4}from"./chunk-ttny9g8k.js";import{Av as q$,Rv as _8,Tv as NG,Uv as e9,Wv as z2,qv as R$,tv as R6}from"./chunk-r7qap4bh.js";import{$v as w7}from"./chunk-9ebfmdyb.js";import{ew as x}from"./chunk-jryjwara.js";import b1 from"path";import b2 from"fs";var c$=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"]),p$={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"},WZ=new Set(["ctrl","alt","shift","meta"]),s$={left:0,middle:1,right:2};function i$($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let X=J.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(WZ.has(X))Z.systemKeys.push(X);else if(X in s$)Z.mouse=X;else if(X in p$||/^[a-z]$/.test(X))Z.keys.push(p$[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Y=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(X.startsWith("throttle")){let Y=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function o$($){let Z=[],J=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=X.exec($))!==null){let[Q,G,z]=Y,q=Y.index,K=q+Q.length,W=`__stx_evt_${J++}`,U=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(z))!==null){let[,V,F]=j,_=V.split("."),O=_[0];if(!c$.has(O))continue;U.push({attribute:`@${V}`,event:O,handler:F,modifiers:i$(_.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,V,F]=j,_=V.split("."),O=_[0];if(!c$.has(O))continue;U.push({attribute:`@${V}`,event:O,handler:F,modifiers:i$(_.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:Q,elementId:W,events:U,startIndex:q,endIndex:K})}return Z}function UZ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let X of J.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(J.keys.length>0){let X=J.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(J.mouse!==null){let X=s$[J.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function HZ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function g9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function jZ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=UZ($),Y=HZ(g9($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${J}');
5
5
  if (!$el) return;
@@ -53,7 +53,7 @@ else {
53
53
  __stx_runHandler('${z}', $event, $el);
54
54
  }
55
55
  }${G});
56
- })();`}function g9($){if($.length===0)return"";return`
56
+ })();`}function h9($){if($.length===0)return"";return`
57
57
  <script data-stx-events>
58
58
  (function() {
59
59
  'use strict';
@@ -108,11 +108,11 @@ else {
108
108
  }
109
109
 
110
110
  // Event listeners
111
- ${$.map(GZ).join(`
111
+ ${$.map(jZ).join(`
112
112
  `)}
113
113
  })();
114
- </script>`}function zZ($){let Z=n$($);if(Z.length===0)return{template:$,bindings:[]};let J=$,X=[];for(let Y=Z.length-1;Y>=0;Y--){let Q=Z[Y],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let z=G.match(/id=["']([^"']+)["']/);if(z)for(let q of Q.events)q.elementId=z[1]}for(let z of Q.events){let q=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(K,""),G=G.replace(W,"")}J=J.slice(0,Q.startIndex)+G+J.slice(Q.endIndex),X.push(...Q.events)}return{template:J,bindings:X}}function s$($,Z,J){if(p$($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:z,bindings:q}=zZ($),K=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...K,...q],z}let X=n$($);if(X.length===0)return $;let Y=$;for(let z=X.length-1;z>=0;z--){let q=X[z],K=q.originalTag;if(!K.includes(" id="))K=K.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let W=K.match(/id=["']([^"']+)["']/);if(W)for(let U of q.events)U.elementId=W[1]}for(let W of q.events){let U=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");K=K.replace(H,""),K=K.replace(j,"")}Y=Y.slice(0,q.startIndex)+K+Y.slice(q.endIndex)}let Q=g9(X.flatMap((z)=>z.events)),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
115
- `+Y.slice(G);else Y+=Q;return Y}function bz($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}import l8 from"fs";import g from"path";import{createHash as qZ}from"crypto";var f2="__stx_component_client_factories";function x2($){let Z=$[f2];return Z instanceof Map?Z:null}function r$($){$[f2]=new Map}function h9($,Z){let J=x2($);if(!J)return null;let X=qZ("sha256").update(Z).digest("hex").slice(0,16),Y=J.get(X);if(Y)Y.instances++;else J.set(X,{body:Z,instances:1});return X}function a$($,Z){let J=x2(Z);if(!J?.size)return $;let X=new Map;for(let[W,U]of J)if(U.instances===1)X.set(W,U.body);let Y=[];if(X.size>0){let W=[...X.keys()].map((j)=>JSON.stringify(j).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),U=new RegExp(`window\\.__stxComponentFactories\\[(${W})\\]\\(("[^"]+")\\);`,"g"),H=U.exec($);while(H!==null){let j=X.get(JSON.parse(H[1]));if(j!==void 0)Y.push({start:H.index,end:H.index+H[0].length,replacement:`(${j})(${H[2]});`});H=U.exec($)}}let Q=[...J].filter(([,W])=>W.instances>1);if(Q.length===0)return o$($,Y);let z=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
114
+ </script>`}function BZ($){let Z=o$($);if(Z.length===0)return{template:$,bindings:[]};let J=$,X=[];for(let Y=Z.length-1;Y>=0;Y--){let Q=Z[Y],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let z=G.match(/id=["']([^"']+)["']/);if(z)for(let q of Q.events)q.elementId=z[1]}for(let z of Q.events){let q=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(K,""),G=G.replace(W,"")}J=J.slice(0,Q.startIndex)+G+J.slice(Q.endIndex),X.push(...Q.events)}return{template:J,bindings:X}}function r$($,Z,J){if(n$($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:z,bindings:q}=BZ($),K=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...K,...q],z}let X=o$($);if(X.length===0)return $;let Y=$;for(let z=X.length-1;z>=0;z--){let q=X[z],K=q.originalTag;if(!K.includes(" id="))K=K.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let W=K.match(/id=["']([^"']+)["']/);if(W)for(let U of q.events)U.elementId=W[1]}for(let W of q.events){let U=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");K=K.replace(H,""),K=K.replace(j,"")}Y=Y.slice(0,q.startIndex)+K+Y.slice(q.endIndex)}let Q=h9(X.flatMap((z)=>z.events)),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
115
+ `+Y.slice(G);else Y+=Q;return Y}function mz($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}import r8 from"fs";import g from"path";import{createHash as VZ}from"crypto";var x2="__stx_component_client_factories";function g2($){let Z=$[x2];return Z instanceof Map?Z:null}function t$($){$[x2]=new Map}function u9($,Z){let J=g2($);if(!J)return null;let X=VZ("sha256").update(Z).digest("hex").slice(0,16),Y=J.get(X);if(Y)Y.instances++;else J.set(X,{body:Z,instances:1});return X}function e$($,Z){let J=g2(Z);if(!J?.size)return $;let X=new Map;for(let[W,U]of J)if(U.instances===1)X.set(W,U.body);let Y=[];if(X.size>0){let W=[...X.keys()].map((j)=>JSON.stringify(j).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),U=new RegExp(`window\\.__stxComponentFactories\\[(${W})\\]\\(("[^"]+")\\);`,"g"),H=U.exec($);while(H!==null){let j=X.get(JSON.parse(H[1]));if(j!==void 0)Y.push({start:H.index,end:H.index+H[0].length,replacement:`(${j})(${H[2]});`});H=U.exec($)}}let Q=[...J].filter(([,W])=>W.instances>1);if(Q.length===0)return a$($,Y);let z=`<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
  ${Q.map(([W,U])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${U.body}; }
@@ -120,7 +120,8 @@ ${Q.map(([W,U])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.str
120
120
  `)}
121
121
  })();
122
122
  </script>`,q=$.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),K=q<0?0:q;return Y.push({start:K,end:K,replacement:`${z}
123
- `}),o$($,Y)}function o$($,Z){if(Z.length===0)return $;Z.sort((Q,G)=>Q.start-G.start||Q.end-G.end);let J=Array(Z.length*2+1),X=0,Y=0;for(let Q of Z)J[Y++]=$.slice(X,Q.start),J[Y++]=Q.replacement,X=Q.end;return J[Y]=$.slice(X),J.join("")}function t$($){let Z=x2($),J=new Map;if(Z)for(let[X,Y]of Z)J.set(X,Y.instances);return J}function e$($,Z){let J=x2($);if(!J)return[];let X=[];for(let[Y,Q]of J){let G=Q.instances-(Z.get(Y)??0);if(G>0)X.push({body:Q.body,count:G})}return X}function $3($,Z){for(let{body:J,count:X}of Z)for(let Y=0;Y<X;Y++)h9($,J)}var Z3=0,g2=new Map;function Pz(){Z3=0,g2.clear()}function h2($,Z){let J=Z3++,X=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return g2.set(X,{type:$,expression:Z}),X}function vz(){let $={};for(let[Z,J]of g2)$[Z]={type:J.type,expression:J.expression};return $}function fz($){let Z={},J=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=J.exec($))!==null){let Y=X[0],Q=X[1].toLowerCase(),G=g2.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function xz($,Z){let J=$;for(let[X,Y]of Z)J=J.split(X).join(Y);return J}function gz($){return $.includes("<!--__STX_")}var Y2={},J3=new Map;function KZ($){let Z=J3.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),J3.set($,Z)}return Z.lastIndex=0,Z}var d2={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return Q3(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Y?$:"";let z=String(G);return Object.entries(J).forEach(([q,K])=>{z=z.replace(KZ(q),String(K))}),z},t:($,Z,J={})=>{return d2.translate($,Z,J)},truncate:($,Z,J=50,X="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=J)return Y;if(J<=X.length)return X.substring(0,J);return Y.substring(0,J-X.length)+X},date:($,Z,J="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return Y.toISOString();return new Intl.DateTimeFormat(X,Q[J]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,J="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:J}).format(Y)}catch{return String($)}},pluralize:($,Z,J,X)=>{let Y=Number($);if(Number.isNaN(Y))return J;let Q=X||`${J}s`;return Y===1?J:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let J=String($);return J.charAt(J.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,X);return $},replace:($,Z,J,X="")=>{if($===void 0||$===null)return"";let Y=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Y=10**J;return Math.round(X*Y)/Y}};function WZ($,Z){if($ in d2)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);Y2[$]=Z}function iz($){for(let[Z,J]of Object.entries($))WZ(Z,J)}function UZ(){return{...d2,...Y2}}function nz(){for(let $ of Object.keys(Y2))delete Y2[$]}function d9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Q3($){return d9($).replace(/\{{2,}/g,(Z)=>HZ(Z.length)).replace(/\{(?=!)/g,`&#123;${G3}`)}var G3="&#8288;";function HZ($){return Array.from({length:$},()=>"&#123;").join(G3)}function X1($,Z){let{scripts:J}=n0($);for(let X of J){let Y=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let Q=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0;if(Y3(Q,Z))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function X3($,Z){let J=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let K=0;K<X.length;K++){let W=X[K];if(!Q&&W==="`"){Q=!0,G=0;continue}if(Q){if(W==="`"&&G===0){Q=!1;continue}if(W==="$"&&X[K+1]==="{"){G++,K++,Y+=" ";continue}if(W==="}"&&G>0){G--;continue}if(G>0){Y+=W;continue}continue}Y+=W}X=Y;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=z.exec(X))!==null){let K=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!J.includes(K)&&!(K in Z))return!1}}return!0}function jZ($,Z){let J=Z.__stx_serverDeclared;if(!J||J.size===0)return!1;let X=u0($);for(let Y of J)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(X))return!0;return!1}function m9($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Y)=>{try{let Q=x0(Y,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(X,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=x0(Y,Z);if(G===void 0)return X;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return X}}),J}function BZ($,Z){if(!$.includes("{"))return $;let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Y)=>{try{let Q=x0(Y,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(X,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=x0(Y,Z);if(G===void 0)return X;if(G===null)return"";return String(G).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return X}}),J}function sz($,Z,J={}){let{output:X,scripts:Y}=n0($),Q=Y.map((G)=>{let z=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),K=G.search(/<\/script\s*>$/i);if(!z||!q||K===-1)return G;let W=z[1],U=z[2];if(/\bdata-raw\b/.test(W))return G;if(J.skipServer&&/\bserver\b/.test(W))return G;let j=`<script${BZ(W,Z)}>`;if(/\bsrc\s*=/.test(W)||/\btype\s*=\s*["']application\/json["']/.test(W))return j+U+G.slice(K);return j+m9(U,Z)+G.slice(K)});return u9(X,Q)}function V1($,Z,J){let X=$,Y=(U,H)=>{let j=u2(U,H);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(H,j))?-1:j},Q=(U,H,j,B)=>{let V=j.length,{output:F,tokens:_}=B1(U,H,(O,L)=>B(V+L));return j.push(..._),F},G=[];X=Q(X,Y,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let z=[];X=Q(X,X2,z,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let q=Z?.__stx_signals_gate===!0||X1($),K=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),W=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);if(X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,H,j)=>{try{let B=x0(H,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let V=B instanceof Error?B.message:String(B);return H0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${V}`,J,$,j,U)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(U,H,j)=>{try{let B=x0(H,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return h2("raw",H.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return h2("raw",H.trim());let V=B instanceof Error?B.message:String(B);return H0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${V}`,J,$,j,U)}}),X=Q(X,X2,z,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),X=Q(X,Y,G,(U)=>`<!--__STX_STYLE_${U}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(U,H,j)=>{let B=H.trim();if(W.has(B))return U;let V=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,O=B.match(F)?.[1],L=O&&((O in Z)||V.includes(O)),w=Boolean(O&&K.has(O)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=B.match(R),A=D&&!V.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let T=x0(H,Z);if(w)return U;if(q&&!X3(B,Z))return U;if(Z.__stx_buildMode==="compile"&&!q&&(T===void 0||jZ(B,Z)))return h2("expr",B);return T!==void 0&&T!==null?Q3(String(T)):""}catch(T){if(w)return U;if(q&&!X3(B,Z))return U;if(A)return U;let N=T instanceof Error?T.message:String(T);return H0("Expression",`Error evaluating: {{ ${B} }}: ${N}`,J,$,j,U)}}),z.length>0)X=X.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(U,H)=>z[Number(H)]??U);if(G.length>0)X=X.replace(/<!--__STX_STYLE_(\d+)__-->/g,(U,H)=>G[Number(H)]??U);return X}function VZ($,Z,J){if(!Z.trim())return $;let X=$,Y=Z.trim();while(Y.length>0){let Q=Y.match(/^(\w+)/);if(!Q)break;let G=Q[1];Y=Y.substring(G.length).trim();let z=Y2[G]||d2[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(UZ()).join(", ")}`);let q=[];if(Y.startsWith(":")){let K=Y.match(/^:([^|\s]+)/);if(K){let W=K[1].trim();try{let U=Number(W);q=[Number.isNaN(U)?W:U]}catch{q=[W]}Y=Y.substring(K[0].length).trim()}}else if(Y.startsWith("(")){let K=1,W=1;while(K>0&&W<Y.length){if(Y[W]==="(")K++;if(Y[W]===")")K--;W++}if(K===0){let U=Y.substring(1,W-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[x0(`(${U})`,J,!0)];else{let H=[],j="",B=null,V=0,F=0,_=0,O=!1;for(let L=0;L<U.length;L++){let w=U[L];if(O){j+=w,O=!1;continue}if(w==="\\"){j+=w,O=!0;continue}if(B){if(j+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,j+=w;continue}if(w==="(")V++;else if(w===")")V--;else if(w==="[")F++;else if(w==="]")F--;else if(w==="{")_++;else if(w==="}")_--;if(w===","&&V===0&&F===0&&_===0){H.push(j),j="";continue}j+=w}if(j)H.push(j);q=H.map((L)=>{let w=L.trim();return x0(w,J,!0)})}}catch{q=[U]}Y=Y.substring(W).trim()}}try{X=z(X,J,...q)}catch(K){let W=K instanceof Error?K.message:String(K);throw Error(`Error applying filter '${G}': ${W}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return X}function _Z($){let Z=!1,J="",X=0,Y=0,Q=0,G=!1;for(let z=0;z<$.length;z++){let q=$[z],K=$[z+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,J=q;else if(q===J)Z=!1,J="";continue}if(Z&&J==="`"&&q==="$"&&K==="{"){let W=1;z+=2;while(z<$.length&&W>0){if($[z]==="{")W++;else if($[z]==="}")W--;if(W>0)z++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Y++;else if(q==="]")Y--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&X===0&&Y===0&&Q===0){if(K==="|"){z++;continue}if(K==="="){z++;continue}return z}}return-1}function x0($,Z,J=!1){try{let X=$.trim(),Y=_Z(X);if(Y>0){let Q=X.substring(0,Y).trim(),G=X.substring(Y+1).trim(),z=x0(Q,Z,!0);return VZ(z,G,Z)}if(!q0(X)){if(!J)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return e(X,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return W0(X,Q)(...G)}catch{return e(X,Z)}}catch(X){if(X instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(X.message);if(Y){let Q=Y[1],G=LZ(Q,Object.keys(Z));if(G&&G!==Q)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,X);throw X}}function LZ($,Z){let J=null;for(let Y of Z){if(Y===$)continue;let Q=OZ($,Y);if(J===null||Q<J.dist)J={key:Y,dist:Q}}if(!J)return null;let X=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/X<=0.35)return J.key;return null}function OZ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,X]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(J.length+1),Q=Array(J.length+1);for(let G=0;G<=J.length;G++)Y[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let z=1;z<=J.length;z++){let q=J[z-1]===X[G-1]?0:1;Q[z]=Math.min(Q[z-1]+1,Y[z]+1,Y[z-1]+q)}for(let z=0;z<=J.length;z++)Y[z]=Q[z]}return Y[J.length]}function oz($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import UG from"fs";import T0 from"path";var l9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],z3=/<body\b([^>]*)>/gi;function s0($){let Z=0,J,X=l9.map(()=>{return});while(Z<$.length){if(J===void 0||J!==null&&J.index<Z)z3.lastIndex=Z,J=z3.exec($);if(!J)return null;let Y=J.index,Q=-1,G=null;for(let q=0;q<l9.length;q++){let K=l9[q],W=X[q];if(W===void 0||W!==null&&W.index<Z)K.open.lastIndex=Z,W=K.open.exec($),X[q]=W;if(!W)continue;if(W.index<Y&&(Q===-1||W.index<Q))Q=W.index,G=K.close}if(Q===-1||!G)return{index:Y,tag:J[0],attrs:J[1]??""};G.lastIndex=Q;let z=G.exec($);if(!z)return null;Z=z.index+z[0].length}return null}function y1($,Z){let J=s0($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var q3=null;function FZ($){if(!q3)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return q3}function tz($){let Z=FZ("onUpdate");if(Z)Z.updateHooks.push($)}function K3(){return`
123
+ `}),a$($,Y)}function a$($,Z){if(Z.length===0)return $;Z.sort((Q,G)=>Q.start-G.start||Q.end-G.end);let J=Array(Z.length*2+1),X=0,Y=0;for(let Q of Z)J[Y++]=$.slice(X,Q.start),J[Y++]=Q.replacement,X=Q.end;return J[Y]=$.slice(X),J.join("")}function $3($){let Z=g2($),J=new Map;if(Z)for(let[X,Y]of Z)J.set(X,Y.instances);return J}function Z3($,Z){let J=g2($);if(!J)return[];let X=[];for(let[Y,Q]of J){let G=Q.instances-(Z.get(Y)??0);if(G>0)X.push({body:Q.body,count:G})}return X}function J3($,Z){for(let{body:J,count:X}of Z)for(let Y=0;Y<X;Y++)u9($,J)}import Y3 from"fs";var X3=0,h2=new Map;function iz(){X3=0,h2.clear()}function u2($,Z){let J=X3++,X=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return h2.set(X,{type:$,expression:Z}),X}function nz(){let $={};for(let[Z,J]of h2)$[Z]={type:J.type,expression:J.expression};return $}function sz($){let Z={},J=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=J.exec($))!==null){let Y=X[0],Q=X[1].toLowerCase(),G=h2.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function oz($,Z){let J=$;for(let[X,Y]of Z)J=J.split(X).join(Y);return J}function rz($){return $.includes("<!--__STX_")}var Q2={},Q3=new Map;function _Z($){let Z=Q3.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),Q3.set($,Z)}return Z.lastIndex=0,Z}var m2={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return W3(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Y?$:"";let z=String(G);return Object.entries(J).forEach(([q,K])=>{z=z.replace(_Z(q),String(K))}),z},t:($,Z,J={})=>{return m2.translate($,Z,J)},truncate:($,Z,J=50,X="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=J)return Y;if(J<=X.length)return X.substring(0,J);return Y.substring(0,J-X.length)+X},date:($,Z,J="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return Y.toISOString();return new Intl.DateTimeFormat(X,Q[J]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,J="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:J}).format(Y)}catch{return String($)}},pluralize:($,Z,J,X)=>{let Y=Number($);if(Number.isNaN(Y))return J;let Q=X||`${J}s`;return Y===1?J:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let J=String($);return J.charAt(J.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,X);return $},replace:($,Z,J,X="")=>{if($===void 0||$===null)return"";let Y=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Y=10**J;return Math.round(X*Y)/Y}};function LZ($,Z){if($ in m2)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);Q2[$]=Z}function Gq($){for(let[Z,J]of Object.entries($))LZ(Z,J)}function OZ(){return{...m2,...Q2}}function zq(){for(let $ of Object.keys(Q2))delete Q2[$]}function l9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function W3($){return l9($).replace(/\{{2,}/g,(Z)=>FZ(Z.length)).replace(/\{(?=!)/g,`&#123;${U3}`)}var U3="&#8288;";function FZ($){return Array.from({length:$},()=>"&#123;").join(U3)}function X1($,Z){let{scripts:J}=n0($);for(let X of J){let Y=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let Q=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0;if(K3(Q,Z))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function G3($,Z){let J=["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"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let K=0;K<X.length;K++){let W=X[K];if(!Q&&W==="`"){Q=!0,G=0;continue}if(Q){if(W==="`"&&G===0){Q=!1;continue}if(W==="$"&&X[K+1]==="{"){G++,K++,Y+=" ";continue}if(W==="}"&&G>0){G--;continue}if(G>0){Y+=W;continue}continue}Y+=W}X=Y;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=z.exec(X))!==null){let K=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!J.includes(K)&&!(K in Z))return!1}}return!0}function wZ($,Z){let J=Z.__stx_serverDeclared;if(!J||J.size===0)return!1;let X=u0($);for(let Y of J)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(X))return!0;return!1}function c9($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Y)=>{try{let Q=x0(Y,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(X,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=x0(Y,Z);if(G===void 0)return X;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return X}}),J}function RZ($,Z){if(!$.includes("{"))return $;let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Y)=>{try{let Q=x0(Y,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(X,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=x0(Y,Z);if(G===void 0)return X;if(G===null)return"";return String(G).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return X}}),J}function qq($,Z,J={}){let{output:X,scripts:Y}=n0($),Q=Y.map((G)=>{let z=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),K=G.search(/<\/script\s*>$/i);if(!z||!q||K===-1)return G;let W=z[1],U=z[2];if(/\bdata-raw\b/.test(W))return G;if(J.skipServer&&/\bserver\b/.test(W))return G;let j=`<script${RZ(W,Z)}>`;if(/\bsrc\s*=/.test(W)||/\btype\s*=\s*["']application\/json["']/.test(W))return j+U+G.slice(K);return j+c9(U,Z)+G.slice(K)});return m9(X,Q)}function V1($,Z,J){let X=$,Y=(U,H)=>{let j=d2(U,H);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(H,j))?-1:j},Q=(U,H,j,B)=>{let V=j.length,{output:F,tokens:_}=B1(U,H,(O,L)=>B(V+L));return j.push(..._),F},G=[];X=Q(X,Y,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let z=[];X=Q(X,Y2,z,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let q=Z?.__stx_signals_gate===!0||X1($),K=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),W=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);if(X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,H,j)=>{try{let B=x0(H,Z,!1,(V)=>d9(V,U,J,$));return B!==void 0&&B!==null?String(B):""}catch(B){let V=B instanceof Error?B.message:String(B);return H0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${V}`,J,$,j,U)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(U,H,j)=>{try{let B=x0(H,Z,!1,(V)=>d9(V,U,J,$));if(B===void 0&&Z.__stx_buildMode==="compile")return u2("raw",H.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return u2("raw",H.trim());let V=B instanceof Error?B.message:String(B);return H0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${V}`,J,$,j,U)}}),X=Q(X,Y2,z,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),X=Q(X,Y,G,(U)=>`<!--__STX_STYLE_${U}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(U,H,j)=>{let B=H.trim();if(W.has(B))return U;let V=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,O=B.match(F)?.[1],L=O&&((O in Z)||V.includes(O)),w=Boolean(O&&K.has(O)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=B.match(R),A=N&&!V.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";let T;try{let D=x0(H,Z,!1,(M)=>{T=M});if(w)return U;if(q&&!G3(B,Z))return U;if(T)d9(T,U,J,$);if(Z.__stx_buildMode==="compile"&&!q&&(D===void 0||wZ(B,Z)))return u2("expr",B);return D!==void 0&&D!==null?W3(String(D)):""}catch(D){if(w)return U;if(q&&!G3(B,Z))return U;if(A)return U;let M=D instanceof Error?D.message:String(D);return H0("Expression",`Error evaluating: {{ ${B} }}: ${M}`,J,$,j,U)}}),z.length>0)X=X.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(U,H)=>z[Number(H)]??U);if(G.length>0)X=X.replace(/<!--__STX_STYLE_(\d+)__-->/g,(U,H)=>G[Number(H)]??U);return X}function NZ($,Z,J){if(!Z.trim())return $;let X=$,Y=Z.trim();while(Y.length>0){let Q=Y.match(/^(\w+)/);if(!Q)break;let G=Q[1];Y=Y.substring(G.length).trim();let z=Q2[G]||m2[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(OZ()).join(", ")}`);let q=[];if(Y.startsWith(":")){let K=Y.match(/^:([^|\s]+)/);if(K){let W=K[1].trim();try{let U=Number(W);q=[Number.isNaN(U)?W:U]}catch{q=[W]}Y=Y.substring(K[0].length).trim()}}else if(Y.startsWith("(")){let K=1,W=1;while(K>0&&W<Y.length){if(Y[W]==="(")K++;if(Y[W]===")")K--;W++}if(K===0){let U=Y.substring(1,W-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[x0(`(${U})`,J,!0)];else{let H=[],j="",B=null,V=0,F=0,_=0,O=!1;for(let L=0;L<U.length;L++){let w=U[L];if(O){j+=w,O=!1;continue}if(w==="\\"){j+=w,O=!0;continue}if(B){if(j+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,j+=w;continue}if(w==="(")V++;else if(w===")")V--;else if(w==="[")F++;else if(w==="]")F--;else if(w==="{")_++;else if(w==="}")_--;if(w===","&&V===0&&F===0&&_===0){H.push(j),j="";continue}j+=w}if(j)H.push(j);q=H.map((L)=>{let w=L.trim();return x0(w,J,!0)})}}catch{q=[U]}Y=Y.substring(W).trim()}}try{X=z(X,J,...q)}catch(K){let W=K instanceof Error?K.message:String(K);throw Error(`Error applying filter '${G}': ${W}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return X}function DZ($){let Z=!1,J="",X=0,Y=0,Q=0,G=!1;for(let z=0;z<$.length;z++){let q=$[z],K=$[z+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,J=q;else if(q===J)Z=!1,J="";continue}if(Z&&J==="`"&&q==="$"&&K==="{"){let W=1;z+=2;while(z<$.length&&W>0){if($[z]==="{")W++;else if($[z]==="}")W--;if(W>0)z++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Y++;else if(q==="]")Y--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&X===0&&Y===0&&Q===0){if(K==="|"){z++;continue}if(K==="="){z++;continue}return z}}return-1}var X2=new Set,AZ=1000;function Kq(){X2.clear()}function d9($,Z,J,X){if(!z3())return;let Y=`${J}\x00${$.expression}`;if(X2.has(Y))return;if(X2.size>=AZ)X2.clear();X2.add(Y);let Q=J,G=X;try{if(J&&Y3.existsSync(J))G=Y3.readFileSync(J,"utf8")}catch{}let z=G.indexOf(Z);if(z>=0)Q=`${J}:${G.slice(0,z).split(`
124
+ `).length}`;console.warn(`${Q}: stx warning: ${Z} rendered as an empty string. The safe evaluator rejected \`${$.expression}\` (${$.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function x0($,Z,J=!1,X){try{let Y=$.trim(),Q=DZ(Y);if(Q>0){let z=Y.substring(0,Q).trim(),q=Y.substring(Q+1).trim(),K=x0(z,Z,!0,X);return NZ(K,q,Z)}let G=q3(Y);if(G!==null){X?.({expression:Y,rule:G});return}try{let z=Object.keys(Z),q=Object.values(Z);return K0(Y,z)(...q)}catch{return e(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(Y.message);if(Q){let G=Q[1],z=MZ(G,Object.keys(Z));if(z&&z!==G)Y.message=`${Y.message} \u2014 did you mean '${z}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function MZ($,Z){let J=null;for(let Y of Z){if(Y===$)continue;let Q=IZ($,Y);if(J===null||Q<J.dist)J={key:Y,dist:Q}}if(!J)return null;let X=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/X<=0.35)return J.key;return null}function IZ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,X]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(J.length+1),Q=Array(J.length+1);for(let G=0;G<=J.length;G++)Y[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let z=1;z<=J.length;z++){let q=J[z-1]===X[G-1]?0:1;Q[z]=Math.min(Q[z-1]+1,Y[z]+1,Y[z-1]+q)}for(let z=0;z<=J.length;z++)Y[z]=Q[z]}return Y[J.length]}function Wq($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import DG from"fs";import T0 from"path";var p9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],H3=/<body\b([^>]*)>/gi;function s0($){let Z=0,J,X=p9.map(()=>{return});while(Z<$.length){if(J===void 0||J!==null&&J.index<Z)H3.lastIndex=Z,J=H3.exec($);if(!J)return null;let Y=J.index,Q=-1,G=null;for(let q=0;q<p9.length;q++){let K=p9[q],W=X[q];if(W===void 0||W!==null&&W.index<Z)K.open.lastIndex=Z,W=K.open.exec($),X[q]=W;if(!W)continue;if(W.index<Y&&(Q===-1||W.index<Q))Q=W.index,G=K.close}if(Q===-1||!G)return{index:Y,tag:J[0],attrs:J[1]??""};G.lastIndex=Q;let z=G.exec($);if(!z)return null;Z=z.index+z[0].length}return null}function y1($,Z){let J=s0($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var j3=null;function TZ($){if(!j3)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return j3}function jq($){let Z=TZ("onUpdate");if(Z)Z.updateHooks.push($)}function B3(){return`
124
125
  // STX Lifecycle Runtime
125
126
  (function() {
126
127
  if (typeof window === 'undefined') return;
@@ -468,7 +469,7 @@ else {
468
469
 
469
470
  console.log('[stx] Lifecycle runtime initialized');
470
471
  })();
471
- `}function c9($){return Symbol($)}var ez=c9("theme"),$q=c9("router"),Zq=c9("i18n");import*as U3 from"crypto";function W3($){let Z=/\$(\w+)\./g,J=[],X;while((X=Z.exec($))!==null)if(!J.includes(X[1]))J.push(X[1]);return J}function wZ(){return`stx-${U3.randomBytes(4).toString("hex")}`}function RZ($){return/\$\w+\./.test($)}function DZ($){if(!$.includes("{{")||!/\$\w+\./.test($))return{html:$,bindings:[],stores:new Set};let Z=[],J=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(X,(Q,G,z,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let K=[],W=!1,U=z,H=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...z.matchAll(H)];for(let F of j){let _=F[0],O=F[1],L=F[2];if(RZ(L)){W=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(K.push({attr:O,expr:R,fullMatch:_,originalAttr:O}),W3(R).forEach((A)=>J.add(A)),O==="text")U=U.replace(_,"");else if(O==="class")U=U.replace(_,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(_,"");else U=U.replace(_,`${O}=""`)}}}if(!W)return Q;let B=U.match(/\bid\s*=\s*"([^"]+)"/),V;if(B)V=B[1];else V=wZ(),U=` id="${V}"${U}`;for(let F of K)Z.push({elementId:V,attribute:F.attr,expression:F.expr,stores:W3(F.expr)});return`<${G}${U}${q}`}),{html:Y,bindings:Z,stores:J}}function NZ($,Z){if($.length===0)return"";let J=Array.from(Z),X=`
472
+ `}function i9($){return Symbol($)}var Bq=i9("theme"),Vq=i9("router"),_q=i9("i18n");import*as _3 from"crypto";function V3($){let Z=/\$(\w+)\./g,J=[],X;while((X=Z.exec($))!==null)if(!J.includes(X[1]))J.push(X[1]);return J}function kZ(){return`stx-${_3.randomBytes(4).toString("hex")}`}function EZ($){return/\$\w+\./.test($)}function bZ($){if(!$.includes("{{")||!/\$\w+\./.test($))return{html:$,bindings:[],stores:new Set};let Z=[],J=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(X,(Q,G,z,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let K=[],W=!1,U=z,H=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...z.matchAll(H)];for(let F of j){let _=F[0],O=F[1],L=F[2];if(EZ(L)){W=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(K.push({attr:O,expr:R,fullMatch:_,originalAttr:O}),V3(R).forEach((A)=>J.add(A)),O==="text")U=U.replace(_,"");else if(O==="class")U=U.replace(_,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(_,"");else U=U.replace(_,`${O}=""`)}}}if(!W)return Q;let B=U.match(/\bid\s*=\s*"([^"]+)"/),V;if(B)V=B[1];else V=kZ(),U=` id="${V}"${U}`;for(let F of K)Z.push({elementId:V,attribute:F.attr,expression:F.expr,stores:V3(F.expr)});return`<${G}${U}${q}`}),{html:Y,bindings:Z,stores:J}}function yZ($,Z){if($.length===0)return"";let J=Array.from(Z),X=`
472
473
  <script>
473
474
  (function() {
474
475
  'use strict';
@@ -626,10 +627,10 @@ else {
626
627
  }
627
628
  })();
628
629
  </script>
629
- `,X}function H3($){let{html:Z,bindings:J,stores:X}=DZ($);if(J.length===0)return $;let Y=NZ(J,X),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function j3($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return AZ(Z);case"google-analytics":return MZ(Z);case"plausible":return IZ(Z);case"self-hosted":return TZ(Z);case"custom":return kZ(Z);default:return""}}function AZ($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Y=[`data-site="${g0(Z.siteId)}"`];if(Z.honorDnt)Y.push('data-honor-dnt="true"');if(Z.spa)Y.push('data-spa="auto"');if(Z.canonical)Y.push(`data-canonical="${g0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
630
+ `,X}function L3($){let{html:Z,bindings:J,stores:X}=bZ($);if(J.length===0)return $;let Y=yZ(J,X),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function O3($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return CZ(Z);case"google-analytics":return SZ(Z);case"plausible":return PZ(Z);case"self-hosted":return vZ(Z);case"custom":return fZ(Z);default:return""}}function CZ($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Y=[`data-site="${g0(Z.siteId)}"`];if(Z.honorDnt)Y.push('data-honor-dnt="true"');if(Z.spa)Y.push('data-spa="auto"');if(Z.canonical)Y.push(`data-canonical="${g0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
630
631
  <!-- Fathom Analytics -->
631
632
  <script src="${g0(J)}" ${Y.join(" ")}${X}></script>
632
- `}function MZ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=g0(Z.measurementId),X=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
633
+ `}function SZ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=g0(Z.measurementId),X=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
633
634
  <!-- Google Analytics -->
634
635
  <script async src="https://www.googletagmanager.com/gtag/js?id=${J}"></script>
635
636
  <script>
@@ -639,10 +640,10 @@ else {
639
640
  gtag('config', '${J}');
640
641
  ${X}
641
642
  </script>
642
- `}function IZ($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${g0(Z.domain)}"`],Y=J,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&J==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
643
+ `}function PZ($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${g0(Z.domain)}"`],Y=J,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&J==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
643
644
  <!-- Plausible Analytics -->
644
645
  <script defer data-domain="${g0(Z.domain)}" src="${g0(Y)}"></script>
645
- `}function TZ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=g0(Z.siteId),X=g0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
646
+ `}function vZ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=g0(Z.siteId),X=g0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
646
647
  d.addEventListener('click',function(e){
647
648
  var a=e.target.closest('a');
648
649
  if(a&&a.hostname!==location.hostname){
@@ -675,7 +676,7 @@ else {
675
676
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
676
677
  })();
677
678
  </script>
678
- `}function kZ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
679
+ `}function fZ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
679
680
  <!-- Custom Analytics -->
680
681
  <script>
681
682
  ${Z.inlineScript}
@@ -683,7 +684,7 @@ ${Z.inlineScript}
683
684
  `;if(!Z.scriptUrl)return"";let J=[];if(Z.scriptId)J.push(`id="${g0(Z.scriptId)}"`);if(Z.attributes)for(let[Y,Q]of Object.entries(Z.attributes))J.push(`${g0(Y)}="${g0(Q)}"`);return`
684
685
  <!-- Custom Analytics -->
685
686
  <script${J.length>0?` ${J.join(" ")}`:""} src="${g0(Z.scriptUrl)}" defer></script>
686
- `}function B3($,Z){let J=j3(Z);if(!J)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}return $.replace("</head>",`${J}</head>`)}function g0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Yq={name:"analytics",hasEndTag:!1,handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};return j3(Y)}};var EZ={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function V3($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...EZ,...Z};return`
687
+ `}function F3($,Z){let J=O3(Z);if(!J)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}return $.replace("</head>",`${J}</head>`)}function g0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Fq={name:"analytics",hasEndTag:!1,handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};return O3(Y)}};var xZ={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function w3($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...xZ,...Z};return`
687
688
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
688
689
  <script>
689
690
  (function() {
@@ -1066,7 +1067,7 @@ else {
1066
1067
  };
1067
1068
  })();
1068
1069
  </script>
1069
- `}function _3($,Z){let J=V3(Z);if(!J)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}var L3={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};if(Z.length>0){let Q=bZ(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return V3(Y)}};function bZ($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of J){let[Y,Q]=X.split("="),G=Q?.replace(/["']/g,"");switch(Y){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class O3{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let J of this.sessions.values())if(J.page===$)Z.push(...J.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((X)=>X.type==="scroll"),J=new Map;for(let X of Z)if(X.depth!==void 0)J.set(X.depth,(J.get(X.depth)||0)+1);return Array.from(J.entries()).map(([X,Y])=>({depth:X,count:Y})).sort((X,Y)=>X.depth-Y.depth)}getZoneStats($){let Z=new Map,J=this.getPageData($);for(let X of J)if(X.zone){let Y=Z.get(X.zone)||{clicks:0,hovers:0};if(X.type==="click")Y.clicks++;else if(X.type==="move")Y.hovers++;Z.set(X.zone,Y)}return Z}generateGridData($,Z=20){let J=this.getPageData($),X=[];for(let Q=0;Q<Z;Q++){X[Q]=[];for(let G=0;G<Z;G++)X[Q][G]=0}for(let Q of J){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),z=Math.min(Math.floor(Q.y/100*Z),Z-1);X[z][G]+=Q.type==="click"?3:1}let Y=0;for(let Q of X)for(let G of Q)Y=Math.max(Y,G);return X.map((Q,G)=>Q.map((z,q)=>({x:q,y:G,intensity:Y>0?z/Y:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function Gq(){return new O3}var yZ;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(yZ||={});var CZ;((X)=>{X.In="in";X.Out="out";X.Both="both"})(CZ||={});var SZ;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(SZ||={});var t0={duration:300,delay:0,ease:"ease",direction:"both"};function PZ($,Z={}){let{duration:J,delay:X,ease:Y,direction:Q,custom:G}={...t0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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);"}
1070
+ `}function R3($,Z){let J=w3(Z);if(!J)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+J+$.slice(X);return $+J}var N3={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,X)=>{let Y=J.__stx_config||{};if(Z.length>0){let Q=gZ(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return w3(Y)}};function gZ($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of J){let[Y,Q]=X.split("="),G=Q?.replace(/["']/g,"");switch(Y){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class D3{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let J of this.sessions.values())if(J.page===$)Z.push(...J.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((X)=>X.type==="scroll"),J=new Map;for(let X of Z)if(X.depth!==void 0)J.set(X.depth,(J.get(X.depth)||0)+1);return Array.from(J.entries()).map(([X,Y])=>({depth:X,count:Y})).sort((X,Y)=>X.depth-Y.depth)}getZoneStats($){let Z=new Map,J=this.getPageData($);for(let X of J)if(X.zone){let Y=Z.get(X.zone)||{clicks:0,hovers:0};if(X.type==="click")Y.clicks++;else if(X.type==="move")Y.hovers++;Z.set(X.zone,Y)}return Z}generateGridData($,Z=20){let J=this.getPageData($),X=[];for(let Q=0;Q<Z;Q++){X[Q]=[];for(let G=0;G<Z;G++)X[Q][G]=0}for(let Q of J){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),z=Math.min(Math.floor(Q.y/100*Z),Z-1);X[z][G]+=Q.type==="click"?3:1}let Y=0;for(let Q of X)for(let G of Q)Y=Math.max(Y,G);return X.map((Q,G)=>Q.map((z,q)=>({x:q,y:G,intensity:Y>0?z/Y:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function Rq(){return new D3}var hZ;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(hZ||={});var uZ;((X)=>{X.In="in";X.Out="out";X.Both="both"})(uZ||={});var dZ;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(dZ||={});var t0={duration:300,delay:0,ease:"ease",direction:"both"};function mZ($,Z={}){let{duration:J,delay:X,ease:Y,direction:Q,custom:G}={...t0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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);"}
1070
1071
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1071
1072
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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);"}
1072
1073
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1076,7 +1077,7 @@ else {
1076
1077
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1077
1078
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${Q==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1078
1079
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1079
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function vZ(){return`
1080
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function lZ(){return`
1080
1081
  <script data-stx-scoped data-stx-run="once">
1081
1082
  // Motion preferences handling
1082
1083
  (function() {
@@ -1104,7 +1105,7 @@ else {
1104
1105
  });
1105
1106
  })();
1106
1107
  </script>
1107
- `}function fZ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((J)=>J.test($))}function xZ($=0.1,Z="0px"){return`
1108
+ `}function cZ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((J)=>J.test($))}function pZ($=0.1,Z="0px"){return`
1108
1109
  <script data-stx-scoped data-stx-run="always">
1109
1110
  // Intersection Observer for scroll animations
1110
1111
  (function() {
@@ -1147,7 +1148,7 @@ else {
1147
1148
  }
1148
1149
  })();
1149
1150
  </script>
1150
- `}function gZ(){return`
1151
+ `}function iZ(){return`
1151
1152
  <style id="stx-animation-base">
1152
1153
  :root {
1153
1154
  --stx-transition-duration: 300ms;
@@ -1262,7 +1263,7 @@ else {
1262
1263
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1263
1264
  }
1264
1265
  </style>
1265
- `}function hZ($,Z,J={}){let{staggerDelay:X=50,sequence:Y=!1}=J;return`
1266
+ `}function nZ($,Z,J={}){let{staggerDelay:X=50,sequence:Y=!1}=J;return`
1266
1267
  <script data-stx-scoped data-stx-run="always">
1267
1268
  // Animation Group: ${$}
1268
1269
  (function() {
@@ -1299,21 +1300,21 @@ else {
1299
1300
  }
1300
1301
  })();
1301
1302
  </script>
1302
- `}var p9={name:"transition",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||t0.duration:t0.duration,G=Z.length>2?Z[2]||t0.ease:t0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||t0.delay:t0.delay,q=Z.length>4?Z[4]||t0.direction:t0.direction,K=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=PZ(Y,{duration:Q,delay:z,ease:G,direction:q}),U="stx-transition",H="";if(Y==="fade")H="stx-fade";else if(Y==="slide")H="stx-slide";else if(Y==="scale")H="stx-scale";else if(Y==="flip")H="stx-flip";else if(Y==="rotate")H="stx-rotate";return`<div id="${K}" class="${U} ${H} ${q==="out"?"stx-out":""}"
1303
- style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},i9={name:"scrollAnimate",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",z=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,K=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(Y==="fade")U+=" stx-fade";else if(Y==="slide-up"||Y==="slide")U+=" stx-from-bottom";else if(Y==="slide-down")U+=" stx-from-top";else if(Y==="slide-left")U+=" stx-from-right";else if(Y==="slide-right")U+=" stx-from-left";else if(Y==="scale")U+=" stx-scale";else if(Y.includes("-"))U+=` stx-${Y}`;else U+=` stx-${Y}`;return`<div id="${K}" class="${U}" style="${W}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},n9={name:"animationGroup",handler:($,Z,J,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=Z[0],Q=Z.slice(1).map((K)=>K.startsWith("#")||K.startsWith(".")?K:`#${K}`),G=J.staggerDelay||50,z=J.sequence||!0,q=hZ(Y,Q,{staggerDelay:G,sequence:z});return`${$}
1304
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},s9={name:"motion",handler:($,Z,J,X)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=vZ();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function w3($,Z,J,X){let Y=$;if(X.animation?.enabled===!1)return Y;let Q=J.includes("test")&&J.includes("animation");if(!fZ(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let z=gZ();Y=Y.replace("</head>",`${z}
1305
- </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let q=xZ(),K=Y.lastIndexOf("</body>");if(K!==-1)Y=Y.slice(0,K)+q+`
1306
- `+Y.slice(K)}}return Y}var F3={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};function uZ($,Z){let J=Z.map((X)=>{let Y=X.offset!==void 0?`${X.offset*100}%`:"from",Q=Object.entries(X.properties).map(([G,z])=>`${G}: ${z}`).join("; ");return`${Y} { ${Q} }`}).join(`
1303
+ `}var n9={name:"transition",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||t0.duration:t0.duration,G=Z.length>2?Z[2]||t0.ease:t0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||t0.delay:t0.delay,q=Z.length>4?Z[4]||t0.direction:t0.direction,K=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=mZ(Y,{duration:Q,delay:z,ease:G,direction:q}),U="stx-transition",H="";if(Y==="fade")H="stx-fade";else if(Y==="slide")H="stx-slide";else if(Y==="scale")H="stx-scale";else if(Y==="flip")H="stx-flip";else if(Y==="rotate")H="stx-rotate";return`<div id="${K}" class="${U} ${H} ${q==="out"?"stx-out":""}"
1304
+ style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},s9={name:"scrollAnimate",handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",z=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,K=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(Y==="fade")U+=" stx-fade";else if(Y==="slide-up"||Y==="slide")U+=" stx-from-bottom";else if(Y==="slide-down")U+=" stx-from-top";else if(Y==="slide-left")U+=" stx-from-right";else if(Y==="slide-right")U+=" stx-from-left";else if(Y==="scale")U+=" stx-scale";else if(Y.includes("-"))U+=` stx-${Y}`;else U+=` stx-${Y}`;return`<div id="${K}" class="${U}" style="${W}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},o9={name:"animationGroup",handler:($,Z,J,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=Z[0],Q=Z.slice(1).map((K)=>K.startsWith("#")||K.startsWith(".")?K:`#${K}`),G=J.staggerDelay||50,z=J.sequence||!0,q=nZ(Y,Q,{staggerDelay:G,sequence:z});return`${$}
1305
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},r9={name:"motion",handler:($,Z,J,X)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=lZ();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function M3($,Z,J,X){let Y=$;if(X.animation?.enabled===!1)return Y;let Q=J.includes("test")&&J.includes("animation");if(!cZ(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let z=iZ();Y=Y.replace("</head>",`${z}
1306
+ </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let q=pZ(),K=Y.lastIndexOf("</body>");if(K!==-1)Y=Y.slice(0,K)+q+`
1307
+ `+Y.slice(K)}}return Y}var A3={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};function sZ($,Z){let J=Z.map((X)=>{let Y=X.offset!==void 0?`${X.offset*100}%`:"from",Q=Object.entries(X.properties).map(([G,z])=>`${G}: ${z}`).join("; ");return`${Y} { ${Q} }`}).join(`
1307
1308
  `);return`@keyframes ${$} {
1308
1309
  ${J}
1309
- }`}var dZ={name:"keyframe",hasEndTag:!0,handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let Y=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",z=Z[3]||"1",q=Z[4]?.replace(/['"`]/g,"")||"normal",K=Z[5]?.replace(/['"`]/g,"")||"forwards",W=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,U=`
1310
+ }`}var oZ={name:"keyframe",hasEndTag:!0,handler:($,Z,J,X)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let Y=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",z=Z[3]||"1",q=Z[4]?.replace(/['"`]/g,"")||"normal",K=Z[5]?.replace(/['"`]/g,"")||"forwards",W=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,U=`
1310
1311
  animation-name: ${Y};
1311
1312
  animation-duration: ${Q}ms;
1312
1313
  animation-timing-function: ${G};
1313
1314
  animation-iteration-count: ${z};
1314
1315
  animation-direction: ${q};
1315
1316
  animation-fill-mode: ${K};
1316
- `.trim().replace(/\s+/g," ");return`<div id="${W}" style="${U}">${$}</div>`},description:"Applies a keyframe animation to an element"};function mZ($,Z,J,X,Y){return`
1317
+ `.trim().replace(/\s+/g," ");return`<div id="${W}" style="${U}">${$}</div>`},description:"Applies a keyframe animation to an element"};function rZ($,Z,J,X,Y){return`
1317
1318
  <script data-stx-scoped data-stx-run="always">
1318
1319
  (function() {
1319
1320
  const container = document.getElementById('${$}');
@@ -1327,7 +1328,7 @@ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
1327
1328
  child.classList.add('${Y}');
1328
1329
  });
1329
1330
  })();
1330
- </script>`}var lZ={name:"stagger",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"> *",Q=Z[1]?Number.parseInt(Z[1],10):100,G=Z[2]?Number.parseInt(Z[2],10):0,z=Z[3]?.replace(/['"`]/g,"")||"fade",q=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,K="stx-stagger-item";if(z==="fade")K+=" stx-fade";else if(z==="slide")K+=" stx-from-bottom";else if(z==="scale")K+=" stx-scale";let W=mZ(q,Y,G,Q,K);return`${`
1331
+ </script>`}var aZ={name:"stagger",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"> *",Q=Z[1]?Number.parseInt(Z[1],10):100,G=Z[2]?Number.parseInt(Z[2],10):0,z=Z[3]?.replace(/['"`]/g,"")||"fade",q=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,K="stx-stagger-item";if(z==="fade")K+=" stx-fade";else if(z==="slide")K+=" stx-from-bottom";else if(z==="scale")K+=" stx-scale";let W=rZ(q,Y,G,Q,K);return`${`
1331
1332
  <style>
1332
1333
  #${q} .stx-stagger-item {
1333
1334
  opacity: 0;
@@ -1337,12 +1338,12 @@ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
1337
1338
  from { opacity: 0; transform: translateY(10px); }
1338
1339
  to { opacity: 1; transform: translateY(0); }
1339
1340
  }
1340
- </style>`}<div id="${q}" class="stx-stagger-container">${$}</div>${W}`},description:"Applies staggered animations to child elements"};function cZ($){let{stiffness:Z,damping:J}=$,X=J/(2*Math.sqrt(Z));if(X<0.5)return"cubic-bezier(0.175, 0.885, 0.32, 1.275)";else if(X<1)return"cubic-bezier(0.34, 1.56, 0.64, 1)";else return"cubic-bezier(0.25, 0.1, 0.25, 1)"}var pZ={name:"spring",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(F3[Y])Q=F3[Y];else Q={stiffness:Number.parseInt(Y,10)||100,damping:Z[1]?Number.parseInt(Z[1],10):10,mass:Z[2]?Number.parseFloat(Z[2]):1};let G=Z[3]?Number.parseInt(Z[3],10):500,z=`stx-spring-${Math.random().toString(36).slice(2,9)}`,q=cZ(Q),K=`
1341
+ </style>`}<div id="${q}" class="stx-stagger-container">${$}</div>${W}`},description:"Applies staggered animations to child elements"};function tZ($){let{stiffness:Z,damping:J}=$,X=J/(2*Math.sqrt(Z));if(X<0.5)return"cubic-bezier(0.175, 0.885, 0.32, 1.275)";else if(X<1)return"cubic-bezier(0.34, 1.56, 0.64, 1)";else return"cubic-bezier(0.25, 0.1, 0.25, 1)"}var eZ={name:"spring",hasEndTag:!0,handler:($,Z,J,X)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(A3[Y])Q=A3[Y];else Q={stiffness:Number.parseInt(Y,10)||100,damping:Z[1]?Number.parseInt(Z[1],10):10,mass:Z[2]?Number.parseFloat(Z[2]):1};let G=Z[3]?Number.parseInt(Z[3],10):500,z=`stx-spring-${Math.random().toString(36).slice(2,9)}`,q=tZ(Q),K=`
1341
1342
  transition: all ${G}ms ${q};
1342
1343
  --stx-spring-stiffness: ${Q.stiffness};
1343
1344
  --stx-spring-damping: ${Q.damping};
1344
1345
  --stx-spring-mass: ${Q.mass};
1345
- `.trim().replace(/\s+/g," ");return`<div id="${z}" class="stx-spring" style="${K}">${$}</div>`},description:"Applies spring physics animations to an element"};function qq($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
1346
+ `.trim().replace(/\s+/g," ");return`<div id="${z}" class="stx-spring" style="${K}">${$}</div>`},description:"Applies spring physics animations to an element"};function Dq($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
1346
1347
  <script data-stx-scoped data-stx-run="always">
1347
1348
  (function() {
1348
1349
  const timeline = ${JSON.stringify($)};
@@ -1379,7 +1380,7 @@ else {
1379
1380
  runTimeline();
1380
1381
  }
1381
1382
  })();
1382
- </script>`}function Kq($,Z,J){let X=uZ($,Z),Y=`
1383
+ </script>`}function Aq($,Z,J){let X=sZ($,Z),Y=`
1383
1384
  .${$}-animation {
1384
1385
  animation-name: ${$};
1385
1386
  animation-duration: ${J.duration}ms;
@@ -1389,7 +1390,7 @@ else {
1389
1390
  animation-direction: ${J.direction||"normal"};
1390
1391
  animation-fill-mode: ${J.fill||"forwards"};
1391
1392
  }`;return`${X}
1392
- ${Y}`}function Wq($){let Z=$.trim().split(/\s+/),J={duration:300};for(let X=0;X<Z.length;X++){let Y=Z[X];if(/^\d+(?:ms|s)?$/.test(Y)){let Q=Number.parseInt(Y,10);if(X===0)J.duration=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q;else J.delay=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q}else if(Y==="infinite"||/^\d+$/.test(Y))J.iterations=Y==="infinite"?"infinite":Number.parseInt(Y,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Y))J.direction=Y;else if(["none","forwards","backwards","both"].includes(Y))J.fill=Y;else J.easing=Y}return J}function Uq(){return`
1393
+ ${Y}`}function Mq($){let Z=$.trim().split(/\s+/),J={duration:300};for(let X=0;X<Z.length;X++){let Y=Z[X];if(/^\d+(?:ms|s)?$/.test(Y)){let Q=Number.parseInt(Y,10);if(X===0)J.duration=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q;else J.delay=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q}else if(Y==="infinite"||/^\d+$/.test(Y))J.iterations=Y==="infinite"?"infinite":Number.parseInt(Y,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Y))J.direction=Y;else if(["none","forwards","backwards","both"].includes(Y))J.fill=Y;else J.easing=Y}return J}function Iq(){return`
1393
1394
  <script data-stx-scoped data-stx-run="once">
1394
1395
  window.__stxAnimation = {
1395
1396
  // Registry of animations
@@ -1461,7 +1462,7 @@ else {
1461
1462
  );
1462
1463
  }
1463
1464
  };
1464
- </script>`}function Hq($){let Z=$.customDirectives||[];return Z.push(p9),Z.push(n9),Z.push(s9),Z.push(i9),Z.push(dZ),Z.push(lZ),Z.push(pZ),{...$,customDirectives:Z}}function R3($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function D3($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var iZ=100,nZ=599,r9="__stxResponseStatus",Q2="__stxResponseHeaders";function m2($){return typeof $==="number"&&Number.isInteger($)&&$>=iZ&&$<=nZ}function _q($){for(let Z of $.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let J=Z[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!J)continue;let X=Number(J[1]);if(m2(X))return X}return}function o9($,Z){if(!$||typeof $!=="object")return!1;let J=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!m2(J))return!1;return $[r9]=J,!0}function sZ($,Z,J){if(!$||typeof $!=="object")return;let X=String(Z??"").trim();if(!X)return;$[Q2]={...$[Q2],[X]:String(J)}}function oZ($){let Z=$?.[r9];return m2(Z)?Z:void 0}function rZ($){let Z=$?.[Q2];if(!Z||typeof Z!=="object")return;let J=Object.entries(Z).map(([X,Y])=>[X,String(Y)]);return J.length>0?Object.fromEntries(J):void 0}function Lq($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let J=oZ($);if(J!==void 0)Z[r9]=J;let X=rZ($);if(X)Z[Q2]={...Z[Q2],...X}}function N3($){return{setResponseStatus:(Z)=>{o9($,Z)},notFound:(Z=404)=>{let J=m2(Z)&&Z>=400?Z:404;o9($,J)},setResponseHeader:(Z,J)=>{sZ($,Z,J)}}}function A3($,Z,J={}){if(!$.includes("@status"))return $;let{filePath:X,buildMode:Y}=J,Q=Y==="compile",G="",z=0,q=/@status\s*\(/g,K;while((K=q.exec($))!==null){let W=aZ($,K.index+K[0].length-1);if(W<0)break;let U=$.slice(K.index+K[0].length,W).trim(),H=/^\d+$/.test(U)?Number(U):e(U,Z),j=X?` in ${X}`:"";if(Q)console.warn(`[stx] @status(${U})${j} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${U}) from <script server> instead \u2014 that runs per request.`);else if(!o9(Z,H))console.warn(`[stx] @status(${U})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(z,K.index),z=W+1+($.slice(W+1).match(/^[^\S\n]*\n?/)?.[0].length??0),q.lastIndex=z}return z===0?$:G+$.slice(z)}function aZ($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}var tZ=0,eZ=0;function M3($,Z){let J=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(J)return J[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function $J($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=J.exec($))!==null){let[Y,Q,G]=X,z=X.index,q=M3(G,"x-data");if(!q)continue;let K=`__stx_scope_${tZ++}`,W=M3(G,"x-init"),U=ZJ($,Q,z+Y.length),H=$.slice(z,U.endIndex),j=JJ(H);Z.push({id:K,selector:`[data-stx-scope="${K}"]`,stateExpr:q,initExpr:W,bindings:[],refs:j})}return Z}function ZJ($,Z,J){let X=1,Y=J,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),z=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y,z.lastIndex=Y;let q=Q.exec($),K=G.exec($),W=z.exec($);if(W&&W.index<(q?.index??1/0)){Y=W.index+W[0].length;continue}if(!K)return{endIndex:$.length};if(q&&q.index<K.index)X++,Y=q.index+q[0].length;else{if(X--,X===0)return{endIndex:K.index+K[0].length};Y=K.index+K[0].length}}return{endIndex:$.length}}function JJ($){let Z=new Map,J=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=X.exec(J))!==null){let[,Q,G]=Y,z=XJ(Q);Z.set(G,z)}return Z}function XJ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${eZ++}`}function YJ(){return`
1465
+ </script>`}function Tq($){let Z=$.customDirectives||[];return Z.push(n9),Z.push(o9),Z.push(r9),Z.push(s9),Z.push(oZ),Z.push(aZ),Z.push(eZ),{...$,customDirectives:Z}}function I3($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function T3($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var $J=100,ZJ=599,t9="__stxResponseStatus",G2="__stxResponseHeaders";function l2($){return typeof $==="number"&&Number.isInteger($)&&$>=$J&&$<=ZJ}function yq($){for(let Z of $.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let J=Z[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!J)continue;let X=Number(J[1]);if(l2(X))return X}return}function a9($,Z){if(!$||typeof $!=="object")return!1;let J=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!l2(J))return!1;return $[t9]=J,!0}function JJ($,Z,J){if(!$||typeof $!=="object")return;let X=String(Z??"").trim();if(!X)return;$[G2]={...$[G2],[X]:String(J)}}function XJ($){let Z=$?.[t9];return l2(Z)?Z:void 0}function YJ($){let Z=$?.[G2];if(!Z||typeof Z!=="object")return;let J=Object.entries(Z).map(([X,Y])=>[X,String(Y)]);return J.length>0?Object.fromEntries(J):void 0}function Cq($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let J=XJ($);if(J!==void 0)Z[t9]=J;let X=YJ($);if(X)Z[G2]={...Z[G2],...X}}function k3($){return{setResponseStatus:(Z)=>{a9($,Z)},notFound:(Z=404)=>{let J=l2(Z)&&Z>=400?Z:404;a9($,J)},setResponseHeader:(Z,J)=>{JJ($,Z,J)}}}function E3($,Z,J={}){if(!$.includes("@status"))return $;let{filePath:X,buildMode:Y}=J,Q=Y==="compile",G="",z=0,q=/@status\s*\(/g,K;while((K=q.exec($))!==null){let W=QJ($,K.index+K[0].length-1);if(W<0)break;let U=$.slice(K.index+K[0].length,W).trim(),H=/^\d+$/.test(U)?Number(U):e(U,Z),j=X?` in ${X}`:"";if(Q)console.warn(`[stx] @status(${U})${j} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${U}) from <script server> instead \u2014 that runs per request.`);else if(!a9(Z,H))console.warn(`[stx] @status(${U})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(z,K.index),z=W+1+($.slice(W+1).match(/^[^\S\n]*\n?/)?.[0].length??0),q.lastIndex=z}return z===0?$:G+$.slice(z)}function QJ($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}var GJ=0,zJ=0;function b3($,Z){let J=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(J)return J[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function qJ($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=J.exec($))!==null){let[Y,Q,G]=X,z=X.index,q=b3(G,"x-data");if(!q)continue;let K=`__stx_scope_${GJ++}`,W=b3(G,"x-init"),U=KJ($,Q,z+Y.length),H=$.slice(z,U.endIndex),j=WJ(H);Z.push({id:K,selector:`[data-stx-scope="${K}"]`,stateExpr:q,initExpr:W,bindings:[],refs:j})}return Z}function KJ($,Z,J){let X=1,Y=J,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),z=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y,z.lastIndex=Y;let q=Q.exec($),K=G.exec($),W=z.exec($);if(W&&W.index<(q?.index??1/0)){Y=W.index+W[0].length;continue}if(!K)return{endIndex:$.length};if(q&&q.index<K.index)X++,Y=q.index+q[0].length;else{if(X--,X===0)return{endIndex:K.index+K[0].length};Y=K.index+K[0].length}}return{endIndex:$.length}}function WJ($){let Z=new Map,J=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=X.exec(J))!==null){let[,Q,G]=Y,z=UJ(Q);Z.set(G,z)}return Z}function UJ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${zJ++}`}function HJ(){return`
1465
1466
  // STX Reactive Runtime - x-cloak and transition CSS
1466
1467
  (function() {
1467
1468
  var style = document.createElement('style');
@@ -1668,7 +1669,7 @@ window.__stx_reactive = (function() {
1668
1669
 
1669
1670
  return { initScope: initScope, reactive: reactive };
1670
1671
  })();
1671
- `}function I3($,Z){let J=$.replace(/\{!!([\s\S]*?)!!\}/g,(z,q)=>{try{let K=x0(q,Z,!0);if(K===void 0)return z;return String(K)}catch{return z}}),X="",Y=0,Q=null;while(Y<J.length){let z=J[Y];if(Q&&z==="\\"){X+=z+(J[Y+1]??""),Y+=2;continue}if(z==="{"&&J[Y+1]==="{"){let q=J.indexOf("}}",Y+2);if(q!==-1){let K=J.slice(Y,q+2);X+=G(J.slice(Y+2,q),K,Q),Y=q+2;continue}}if(Q){if(z===Q)Q=null}else if(z==="'"||z==='"'||z==="`")Q=z;X+=z,Y++}return X;function G(z,q,K){let W;try{W=x0(z,Z,!0)}catch{return q}if(W===void 0)return q;if(K){let U=String(W).replace(/\\/g,"\\\\").replace(new RegExp(K==="`"?"`":K,"g"),`\\${K}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return K==="`"?U.replace(/\$\{/g,"\\${"):U}if(typeof W==="string"){let U=W.trim();if(U.startsWith("{")&&U.endsWith("}")||U.startsWith("[")&&U.endsWith("]"))try{return JSON.parse(U),U}catch{}}return JSON.stringify(W)}}function QJ($,Z){if($.length===0)return"";let J=$.map((X)=>{let Y=JSON.stringify(Object.fromEntries(X.refs)),Q=I3(X.stateExpr,Z),G=X.initExpr?I3(X.initExpr,Z):null,z=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
1672
+ `}function y3($,Z){let J=$.replace(/\{!!([\s\S]*?)!!\}/g,(z,q)=>{try{let K=x0(q,Z,!0);if(K===void 0)return z;return String(K)}catch{return z}}),X="",Y=0,Q=null;while(Y<J.length){let z=J[Y];if(Q&&z==="\\"){X+=z+(J[Y+1]??""),Y+=2;continue}if(z==="{"&&J[Y+1]==="{"){let q=J.indexOf("}}",Y+2);if(q!==-1){let K=J.slice(Y,q+2);X+=G(J.slice(Y+2,q),K,Q),Y=q+2;continue}}if(Q){if(z===Q)Q=null}else if(z==="'"||z==='"'||z==="`")Q=z;X+=z,Y++}return X;function G(z,q,K){let W;try{W=x0(z,Z,!0)}catch{return q}if(W===void 0)return q;if(K){let U=String(W).replace(/\\/g,"\\\\").replace(new RegExp(K==="`"?"`":K,"g"),`\\${K}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return K==="`"?U.replace(/\$\{/g,"\\${"):U}if(typeof W==="string"){let U=W.trim();if(U.startsWith("{")&&U.endsWith("}")||U.startsWith("[")&&U.endsWith("]"))try{return JSON.parse(U),U}catch{}}return JSON.stringify(W)}}function jJ($,Z){if($.length===0)return"";let J=$.map((X)=>{let Y=JSON.stringify(Object.fromEntries(X.refs)),Q=y3(X.stateExpr,Z),G=X.initExpr?y3(X.initExpr,Z):null,z=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
1672
1673
  (function() {
1673
1674
  var scopeEl = document.querySelector('${X.selector}');
1674
1675
  if (!scopeEl) return;
@@ -1677,11 +1678,11 @@ window.__stx_reactive = (function() {
1677
1678
  })();`}).join(`
1678
1679
  `);return`
1679
1680
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
1680
- ${YJ()}
1681
+ ${HJ()}
1681
1682
  ${J}
1682
- </script>`}function T3($,Z,J){if(!zJ($))return $;let X=$J($);if(X.length===0)return $;let Y=GJ($,X),Q=QJ(X,Z),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
1683
- `+Y.slice(G);else Y+=Q;return Y}function GJ($,Z){let J=0,X=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,Q,G)=>{let z=Z[J++];if(!z)return Y;let q=/data-stx-scope="([^"]*)"/.exec(G);if(q)return z.id=q[1],z.selector=`[data-stx-scope="${z.id}"]`,Y;return`<${Q} data-stx-scope="${z.id}"${G}>`});return X=X.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),X=X.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),X=X.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),X=X.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),X}function zJ($){return/x-data\s*=\s*["']/.test($)}import tJ from"fs";import _5 from"path";import{createHighlighter as eJ}from"ts-syntax-highlighter";import t2 from"fs";import b0 from"path";import{loadConfigWithResult as pJ}from"bunfig";G2();async function qJ($,Z,J,X){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=a9();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var k3={name:"stxRouter",handler:qJ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Y1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function E3($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function b3($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let X=J[1],Y=$.slice(J[0].length),Q={};for(let G of X.split(`
1684
- `)){let z=G.trim();if(!z||z.startsWith("#"))continue;let q=z.indexOf(":");if(q===-1)continue;let K=z.slice(0,q).trim(),W=z.slice(q+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}Q[K]=W}return{data:Q,content:Y.trim()}}function z2($,Z={}){let{gfm:J=!0,breaks:X=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,H)=>{let j=Q.length,B=U?` class="language-${Y1(U)}"`:"";return Q.push(`<pre><code${B}>${Y1(H.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Y=Y.replace(/`([^`]*)`/g,(W,U)=>`<code>${Y1(U)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,U,H)=>{return`<img src="${E3(H)?Y1(H):""}" alt="${Y1(U)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,U,H)=>{return`<a href="${E3(H)?Y1(H):""}">${U}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
1683
+ </script>`}function C3($,Z,J){if(!VJ($))return $;let X=qJ($);if(X.length===0)return $;let Y=BJ($,X),Q=jJ(X,Z),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
1684
+ `+Y.slice(G);else Y+=Q;return Y}function BJ($,Z){let J=0,X=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,Q,G)=>{let z=Z[J++];if(!z)return Y;let q=/data-stx-scope="([^"]*)"/.exec(G);if(q)return z.id=q[1],z.selector=`[data-stx-scope="${z.id}"]`,Y;return`<${Q} data-stx-scope="${z.id}"${G}>`});return X=X.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),X=X.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),X=X.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),X=X.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),X}function VJ($){return/x-data\s*=\s*["']/.test($)}import WX from"fs";import O5 from"path";import{createHighlighter as UX}from"ts-syntax-highlighter";import e2 from"fs";import b0 from"path";import{loadConfigWithResult as XX}from"bunfig";z2();async function _J($,Z,J,X){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=e9();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var S3={name:"stxRouter",handler:_J,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Y1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function P3($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function v3($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let X=J[1],Y=$.slice(J[0].length),Q={};for(let G of X.split(`
1685
+ `)){let z=G.trim();if(!z||z.startsWith("#"))continue;let q=z.indexOf(":");if(q===-1)continue;let K=z.slice(0,q).trim(),W=z.slice(q+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}Q[K]=W}return{data:Q,content:Y.trim()}}function q2($,Z={}){let{gfm:J=!0,breaks:X=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,H)=>{let j=Q.length,B=U?` class="language-${Y1(U)}"`:"";return Q.push(`<pre><code${B}>${Y1(H.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Y=Y.replace(/`([^`]*)`/g,(W,U)=>`<code>${Y1(U)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,U,H)=>{return`<img src="${P3(H)?Y1(H):""}" alt="${Y1(U)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,U,H)=>{return`<a href="${P3(H)?Y1(H):""}">${U}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
1685
1686
  `),Y=Y.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Y=Y.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Y=Y.replace(/<\/ul>\n<ul>/g,""),Y=Y.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Y=Y.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Y=Y.replace(/<\/ol>\n<ol>/g,""),Y=Y.replace(/<li data-ul>/g,"<li>"),Y=Y.replace(/<li data-ol>/g,"<li>"),J)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,U,H)=>{let B=`<tr>${U.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${Y1(F)}</th>`).join("")}</tr>`,V=H.trim().split(`
1686
1687
  `).map((F)=>{return`<tr>${F.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${Y1(O)}</td>`).join("")}</tr>`}).join(`
1687
1688
  `);return`<table>
@@ -1698,9 +1699,9 @@ ${V}
1698
1699
  `:`
1699
1700
  `)}</p>`);if(Y=z.join(`
1700
1701
  `),X)Y=Y.replace(/\n/g,`<br />
1701
- `);for(let W=0;W<Q.length;W++)Y=Y.replace(`\x00CODEBLOCK${W}\x00`,Q[W]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function y3($,Z,J=""){let X=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let z=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),K=q?q[1]:"",W=z+G[0].length,U=1,H=W,j=-1;while(U>0&&H<$.length){let F=$.indexOf("@markdown",H),_=$.indexOf("@endmarkdown",H);if(_===-1)break;if(F!==-1&&F<_&&F!==z){let O=$[F+9];if(O==="("||O===`
1702
- `||O==="\r"||O===" "||O===void 0)U++;H=F+9}else{if(U--,U===0){j=_;break}H=_+12}}if(j===-1)continue;let B=$.slice(W,j),V=$.slice(z,j+12);Y.push({fullMatch:V,options:K,content:B,index:z}),Q.lastIndex=j+12}for(let{fullMatch:z,options:q,content:K,index:W}of Y)try{let U={};if(q)q.split(",").forEach((B)=>{let V=B.trim();if(V)U[V]=!0});let H={gfm:U.gfm??!0,breaks:U.breaks??!1},j=z2(K.trim(),H);X=X.split(z).join(j)}catch(U){let H=U instanceof Error?U.message:String(U),j=H0("Markdown Directive",`Error processing markdown: ${H}`,J,$,W,z);X=X.split(z).join(j)}return X}async function C3($,Z,J,X){let Y={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")Y.breaks=!0;if(G==="no-gfm")Y.gfm=!1}),z2($.trim(),Y)}var _1=[320,480,640,768,1024,1280,1536,1920,2560],S3=[1,1.5,2,3],C1=["avif","webp","jpeg"],P3={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},KJ={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function q2($,Z=_1,J={},X){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${Q1($,{...J,w:Y,fm:X})} ${Y}w`}).join(", ")}function bq($,Z=320,J=2560,X=0.08,Y={},Q){let G=WJ(Z,J,X);return q2($,G,Y,Q)}function WJ($,Z,J=0.08){let X=[],Y=$;while(Y<Z)X.push(Math.round(Y)),Y*=1+J*2;if(X[X.length-1]!==Z)X.push(Z);return X}function t9($,Z,J=S3,X={},Y){return J.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${Q1($,{...X,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function yq($,Z,J=S3,X=80,Y={},Q){let G={1:X,1.5:Math.round(X*0.9),2:Math.round(X*0.8),3:Math.round(X*0.7),4:Math.round(X*0.6),5:Math.round(X*0.5)};return J.sort((z,q)=>z-q).map((z)=>{let q=Math.round(Z*z),K=G[z]||Math.round(X*Math.max(0.5,1-z*0.1));return`${Q1($,{...Y,w:q,q:K,dpr:z,fm:Q})} ${z}x`}).join(", ")}function e9($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Y,Q])=>{let G=/^\d+$/.test(Y)?`${Y}px`:Y;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((Y,Q)=>Y.numericBp-Q.numericBp).map(({bp:Y,size:Q})=>`(max-width: ${Y}) ${Q}`);return X.push(Z),X.join(", ")}function Cq($,Z="100vw"){if(!$||$.length===0)return Z;let X=[...$].sort((Y,Q)=>(Y.maxWidth||0)-(Q.maxWidth||0)).filter((Y)=>Y.maxWidth).map((Y)=>`(max-width: ${Y.maxWidth}px) ${Y.imageWidth}`);return X.push(Z),X.join(", ")}var Sq={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"};function Q1($,Z={}){let J=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(J.length===0)return $;let X=J.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${X}`}function Pq($){let[Z,J]=$.split("?"),X={};if(J)new URLSearchParams(J).forEach((Q,G)=>{if(/^\d+$/.test(Q))X[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))X[G]=Number.parseFloat(Q);else if(Q==="true")X[G]=!0;else if(Q==="false")X[G]=!1;else X[G]=Q});return{src:Z,params:X}}function vq($){let{src:Z,widths:J,dprValues:X,fixedWidth:Y,formats:Q=C1,baseUrl:G="",params:z={}}=$,q=[];for(let K of Q){let W,U;if(Y!==void 0&&X)W=t9(Z,Y,X,z,K),U=X.map((H)=>({path:"",url:Q1(Z,{...z,w:Math.round(Y*H),fm:K}),width:Math.round(Y*H),height:0,format:K,size:0,dpr:H}));else{let H=J||_1;W=q2(Z,H,z,K),U=H.map((j)=>({path:"",url:Q1(Z,{...z,w:j,fm:K}),width:j,height:0,format:K,size:0}))}q.push({srcset:W,format:K,mimeType:P3[K],variants:U})}return q}function fq($,Z="100vw"){return $.map(({srcset:J,mimeType:X})=>`<source type="${X}" srcset="${J}" sizes="${Z}" />`).join(`
1703
- `)}function xq($,Z){if($.length===0)return;let J=[...$].sort((Y,Q)=>Y.width-Q.width),X=J.find((Y)=>Y.width>=Z);if(X)return X;return J[J.length-1]}function $5($){return P3[$]||"application/octet-stream"}function gq($){return KJ[$]||$}function hq($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var UJ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},Z5=`
1702
+ `);for(let W=0;W<Q.length;W++)Y=Y.replace(`\x00CODEBLOCK${W}\x00`,Q[W]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function f3($,Z,J=""){let X=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let z=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),K=q?q[1]:"",W=z+G[0].length,U=1,H=W,j=-1;while(U>0&&H<$.length){let F=$.indexOf("@markdown",H),_=$.indexOf("@endmarkdown",H);if(_===-1)break;if(F!==-1&&F<_&&F!==z){let O=$[F+9];if(O==="("||O===`
1703
+ `||O==="\r"||O===" "||O===void 0)U++;H=F+9}else{if(U--,U===0){j=_;break}H=_+12}}if(j===-1)continue;let B=$.slice(W,j),V=$.slice(z,j+12);Y.push({fullMatch:V,options:K,content:B,index:z}),Q.lastIndex=j+12}for(let{fullMatch:z,options:q,content:K,index:W}of Y)try{let U={};if(q)q.split(",").forEach((B)=>{let V=B.trim();if(V)U[V]=!0});let H={gfm:U.gfm??!0,breaks:U.breaks??!1},j=q2(K.trim(),H);X=X.split(z).join(j)}catch(U){let H=U instanceof Error?U.message:String(U),j=H0("Markdown Directive",`Error processing markdown: ${H}`,J,$,W,z);X=X.split(z).join(j)}return X}async function x3($,Z,J,X){let Y={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")Y.breaks=!0;if(G==="no-gfm")Y.gfm=!1}),q2($.trim(),Y)}var _1=[320,480,640,768,1024,1280,1536,1920,2560],g3=[1,1.5,2,3],C1=["avif","webp","jpeg"],h3={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},LJ={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function K2($,Z=_1,J={},X){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${Q1($,{...J,w:Y,fm:X})} ${Y}w`}).join(", ")}function pq($,Z=320,J=2560,X=0.08,Y={},Q){let G=OJ(Z,J,X);return K2($,G,Y,Q)}function OJ($,Z,J=0.08){let X=[],Y=$;while(Y<Z)X.push(Math.round(Y)),Y*=1+J*2;if(X[X.length-1]!==Z)X.push(Z);return X}function $5($,Z,J=g3,X={},Y){return J.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${Q1($,{...X,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function iq($,Z,J=g3,X=80,Y={},Q){let G={1:X,1.5:Math.round(X*0.9),2:Math.round(X*0.8),3:Math.round(X*0.7),4:Math.round(X*0.6),5:Math.round(X*0.5)};return J.sort((z,q)=>z-q).map((z)=>{let q=Math.round(Z*z),K=G[z]||Math.round(X*Math.max(0.5,1-z*0.1));return`${Q1($,{...Y,w:q,q:K,dpr:z,fm:Q})} ${z}x`}).join(", ")}function Z5($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Y,Q])=>{let G=/^\d+$/.test(Y)?`${Y}px`:Y;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((Y,Q)=>Y.numericBp-Q.numericBp).map(({bp:Y,size:Q})=>`(max-width: ${Y}) ${Q}`);return X.push(Z),X.join(", ")}function nq($,Z="100vw"){if(!$||$.length===0)return Z;let X=[...$].sort((Y,Q)=>(Y.maxWidth||0)-(Q.maxWidth||0)).filter((Y)=>Y.maxWidth).map((Y)=>`(max-width: ${Y.maxWidth}px) ${Y.imageWidth}`);return X.push(Z),X.join(", ")}var sq={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"};function Q1($,Z={}){let J=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(J.length===0)return $;let X=J.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${X}`}function oq($){let[Z,J]=$.split("?"),X={};if(J)new URLSearchParams(J).forEach((Q,G)=>{if(/^\d+$/.test(Q))X[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))X[G]=Number.parseFloat(Q);else if(Q==="true")X[G]=!0;else if(Q==="false")X[G]=!1;else X[G]=Q});return{src:Z,params:X}}function rq($){let{src:Z,widths:J,dprValues:X,fixedWidth:Y,formats:Q=C1,baseUrl:G="",params:z={}}=$,q=[];for(let K of Q){let W,U;if(Y!==void 0&&X)W=$5(Z,Y,X,z,K),U=X.map((H)=>({path:"",url:Q1(Z,{...z,w:Math.round(Y*H),fm:K}),width:Math.round(Y*H),height:0,format:K,size:0,dpr:H}));else{let H=J||_1;W=K2(Z,H,z,K),U=H.map((j)=>({path:"",url:Q1(Z,{...z,w:j,fm:K}),width:j,height:0,format:K,size:0}))}q.push({srcset:W,format:K,mimeType:h3[K],variants:U})}return q}function aq($,Z="100vw"){return $.map(({srcset:J,mimeType:X})=>`<source type="${X}" srcset="${J}" sizes="${Z}" />`).join(`
1704
+ `)}function tq($,Z){if($.length===0)return;let J=[...$].sort((Y,Q)=>Y.width-Q.width),X=J.find((Y)=>Y.width>=Z);if(X)return X;return J[J.length-1]}function J5($){return h3[$]||"application/octet-stream"}function eq($){return LJ[$]||$}function $K($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var FJ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},X5=`
1704
1705
  .stx-img-placeholder {
1705
1706
  position: relative;
1706
1707
  overflow: hidden;
@@ -1729,9 +1730,9 @@ ${V}
1729
1730
  filter: blur(0);
1730
1731
  transform: scale(1);
1731
1732
  }
1732
- `.trim();async function J5(){try{return await import("ts-images")}catch{return null}}async function v3($,Z={}){let J={...UJ,...Z},X=await J5();if(X)try{return await HJ($,J,X)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return f3($,J)}async function HJ($,Z,J){let{generatePlaceholder:X,generateThumbHash:Y}=J,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let z=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:Z.strategy,dominantColor:z.dominantColor,css:z.css}}function f3($,Z){let J=Z.width||20,X=Z.height||J,Y="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${X}" viewBox="0 0 ${J} ${X}"><rect fill="#e5e7eb" width="${J}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:J,height:X,aspectRatio:J/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function dq($){let Z=await J5();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await f3($,{strategy:"thumbhash",width:32,height:32})).dataURL}function mq($){let Z=$[0]|$[1]<<8|$[2]<<16,J=(Z&63)/63,X=(Z>>6&63)/31.5-1,Y=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,z=$[3]|$[4]<<8,q=(z>>3&63)/63,K=(z>>9&63)/63,W=z>>15!==0,U=Math.max(3,W?G?5:7:G?5:7),H=Math.max(3,W?G?5:7:G?5:7),j=32,B=32,V=Math.max(0,Math.min(255,Math.round((J+X)*255))),F=Math.max(0,Math.min(255,Math.round(J*255))),_=Math.max(0,Math.min(255,Math.round((J-X)*255))),O=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1733
+ `.trim();async function Y5(){try{return await import("ts-images")}catch{return null}}async function u3($,Z={}){let J={...FJ,...Z},X=await Y5();if(X)try{return await wJ($,J,X)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return d3($,J)}async function wJ($,Z,J){let{generatePlaceholder:X,generateThumbHash:Y}=J,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let z=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:Z.strategy,dominantColor:z.dominantColor,css:z.css}}function d3($,Z){let J=Z.width||20,X=Z.height||J,Y="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${X}" viewBox="0 0 ${J} ${X}"><rect fill="#e5e7eb" width="${J}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:J,height:X,aspectRatio:J/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function JK($){let Z=await Y5();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await d3($,{strategy:"thumbhash",width:32,height:32})).dataURL}function XK($){let Z=$[0]|$[1]<<8|$[2]<<16,J=(Z&63)/63,X=(Z>>6&63)/31.5-1,Y=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,z=$[3]|$[4]<<8,q=(z>>3&63)/63,K=(z>>9&63)/63,W=z>>15!==0,U=Math.max(3,W?G?5:7:G?5:7),H=Math.max(3,W?G?5:7:G?5:7),j=32,B=32,V=Math.max(0,Math.min(255,Math.round((J+X)*255))),F=Math.max(0,Math.min(255,Math.round(J*255))),_=Math.max(0,Math.min(255,Math.round((J-X)*255))),O=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1733
1734
  <rect fill="rgb(${V},${F},${_})" width="32" height="32"/>
1734
- </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(O)}`}async function lq($,Z=20,J=50){return v3($,{strategy:"blur",width:Z,quality:J,blurLevel:40})}async function cq($){let Z=await J5();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function pq($,Z=1,J=1){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${J}"><rect fill="${$}" width="${Z}" height="${J}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`}function x3($,Z,J={}){let X=J.transitionDuration||300,Y=J.easing||"ease-out";return`
1735
+ </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(O)}`}async function YK($,Z=20,J=50){return u3($,{strategy:"blur",width:Z,quality:J,blurLevel:40})}async function QK($){let Z=await Y5();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function GK($,Z=1,J=1){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${J}"><rect fill="${$}" width="${Z}" height="${J}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`}function m3($,Z,J={}){let X=J.transitionDuration||300,Y=J.easing||"ease-out";return`
1735
1736
  #${$} {
1736
1737
  --stx-img-transition-duration: ${X}ms;
1737
1738
  --stx-img-transition-easing: ${Y};
@@ -1748,20 +1749,20 @@ ${V}
1748
1749
  #${$}.stx-img-loaded img {
1749
1750
  opacity: 1;
1750
1751
  }
1751
- `.trim()}function iq($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var S1=new Map;async function g3($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(S1.has(J))return S1.get(J);let X=await v3($,Z);return S1.set(J,X),X}function nq(){S1.clear()}function sq(){return{size:S1.size,keys:Array.from(S1.keys())}}async function jJ(){try{return await import("./chunk-wx13qmaw.js")}catch($){if(!h3)console.warn("[stx-media] Image processor not available, some features disabled:",$),h3=!0;return null}}var h3=!1,X5=80,l2="async",c2="lazy",u3=!1;async function K2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return OJ(X,J)}if(J.processedResult?.processed)return G5($,J.processedResult,Z);if(J.responsiveVariants)return l3($,J.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:z,sizes:q,widths:K=_1,dpr:W,formats:U=C1,quality:H=X5,params:j={},placeholder:B="none",placeholderOptions:V={},lazy:F=!0,priority:_=!1,loading:O=_?"eager":c2,decoding:L=l2,fetchpriority:w,objectFit:R,objectPosition:D,crossorigin:A,referrerpolicy:T}=$,N=$.class,I=$.style,k=$.id,M=$.data||{},{isDev:y=!1,baseUrl:E=""}=Z;if(y&&!Z.optimize)return _J($);let b,C,f=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!_)try{b=await g3(Y,{strategy:B,...V}),C=x3(f,b,V)}catch{}let u=W!==void 0&&G!==void 0,P;if(u)P=VJ($,f,b,Z);else P=await BJ($,f,b,Z);let h;if(_){let S0=U.includes("webp")?"webp":U[0],y0=q2(Y,K,{...j,q:H},S0),h0=typeof q==="object"?e9(q):q||"100vw";h=`<link rel="preload" as="image" imagesrcset="${y0}" imagesizes="${h0}" />`}let m=[];if(!u3&&B!=="none")m.push(Z5),u3=!0;if(C)m.push(C);let j0=F?m3(f):void 0;return{html:P,preloadLink:h,css:m.length>0?m.join(`
1752
- `):void 0,script:j0}}async function BJ($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,sizes:q,widths:K=_1,formats:W=C1,quality:U=X5,params:H={},lazy:j=!0,priority:B=!1,loading:V=B?"eager":c2,decoding:F=l2,fetchpriority:_,objectFit:O,objectPosition:L,crossorigin:w,referrerpolicy:R}=$,D=$.class,A=$.style,T=$.data||{},N=typeof q==="object"?e9(q):q||"100vw",I=[];for(let y of W){let E=q2(Y,K,{...H,q:U},y),b=$5(y);if(j&&!B)I.push(` <source type="${b}" data-srcset="${E}" data-sizes="${N}" />`);else I.push(` <source type="${b}" srcset="${E}" sizes="${N}" />`)}let k=Y5({src:Q1(Y,{...H,q:U}),alt:Q,width:G,height:z,loading:B?void 0:V,decoding:F,fetchpriority:B?"high":_,objectFit:O,objectPosition:L,crossorigin:w,referrerpolicy:R,className:d3(D,J),style:Q5(A,O,L,J),lazy:j&&!B,data:T}),M;if(J){let y=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;M=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
1752
+ `.trim()}function zK($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var S1=new Map;async function l3($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(S1.has(J))return S1.get(J);let X=await u3($,Z);return S1.set(J,X),X}function qK(){S1.clear()}function KK(){return{size:S1.size,keys:Array.from(S1.keys())}}async function RJ(){try{return await import("./chunk-51gea48g.js")}catch($){if(!c3)console.warn("[stx-media] Image processor not available, some features disabled:",$),c3=!0;return null}}var c3=!1,Q5=80,c2="async",p2="lazy",p3=!1;async function W2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return IJ(X,J)}if(J.processedResult?.processed)return q5($,J.processedResult,Z);if(J.responsiveVariants)return s3($,J.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:z,sizes:q,widths:K=_1,dpr:W,formats:U=C1,quality:H=Q5,params:j={},placeholder:B="none",placeholderOptions:V={},lazy:F=!0,priority:_=!1,loading:O=_?"eager":p2,decoding:L=c2,fetchpriority:w,objectFit:R,objectPosition:N,crossorigin:A,referrerpolicy:T}=$,D=$.class,M=$.style,k=$.id,I=$.data||{},{isDev:y=!1,baseUrl:E=""}=Z;if(y&&!Z.optimize)return AJ($);let b,C,f=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!_)try{b=await l3(Y,{strategy:B,...V}),C=m3(f,b,V)}catch{}let u=W!==void 0&&G!==void 0,P;if(u)P=DJ($,f,b,Z);else P=await NJ($,f,b,Z);let h;if(_){let S0=U.includes("webp")?"webp":U[0],y0=K2(Y,K,{...j,q:H},S0),h0=typeof q==="object"?Z5(q):q||"100vw";h=`<link rel="preload" as="image" imagesrcset="${y0}" imagesizes="${h0}" />`}let m=[];if(!p3&&B!=="none")m.push(X5),p3=!0;if(C)m.push(C);let j0=F?n3(f):void 0;return{html:P,preloadLink:h,css:m.length>0?m.join(`
1753
+ `):void 0,script:j0}}async function NJ($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,sizes:q,widths:K=_1,formats:W=C1,quality:U=Q5,params:H={},lazy:j=!0,priority:B=!1,loading:V=B?"eager":p2,decoding:F=c2,fetchpriority:_,objectFit:O,objectPosition:L,crossorigin:w,referrerpolicy:R}=$,N=$.class,A=$.style,T=$.data||{},D=typeof q==="object"?Z5(q):q||"100vw",M=[];for(let y of W){let E=K2(Y,K,{...H,q:U},y),b=J5(y);if(j&&!B)M.push(` <source type="${b}" data-srcset="${E}" data-sizes="${D}" />`);else M.push(` <source type="${b}" srcset="${E}" sizes="${D}" />`)}let k=G5({src:Q1(Y,{...H,q:U}),alt:Q,width:G,height:z,loading:B?void 0:V,decoding:F,fetchpriority:B?"high":_,objectFit:O,objectPosition:L,crossorigin:w,referrerpolicy:R,className:i3(N,J),style:z5(A,O,L,J),lazy:j&&!B,data:T}),I;if(J){let y=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
1753
1754
  <picture>
1754
- ${I.join(`
1755
+ ${M.join(`
1755
1756
  `)}
1756
1757
  <img ${k} />
1757
1758
  </picture>
1758
- </div>`}else M=`<picture${Z?` id="${Z}"`:""}>
1759
- ${I.join(`
1759
+ </div>`}else I=`<picture${Z?` id="${Z}"`:""}>
1760
+ ${M.join(`
1760
1761
  `)}
1761
1762
  <img ${k} />
1762
- </picture>`;return M}function VJ($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,dpr:q=[1,2,3],quality:K=X5,params:W={},lazy:U=!0,priority:H=!1,loading:j=H?"eager":c2,decoding:B=l2,fetchpriority:V,objectFit:F,objectPosition:_,crossorigin:O,referrerpolicy:L}=$,w=$.class,R=$.style,D=$.data||{},A=typeof G==="number"?G:Number.parseInt(String(G),10),T=t9(Y,A,q,{...W,q:K}),N=Y5({src:Q1(Y,{...W,w:A,q:K}),alt:Q,width:G,height:z,loading:H?void 0:j,decoding:B,fetchpriority:H?"high":V,objectFit:F,objectPosition:_,crossorigin:O,referrerpolicy:L,className:d3(w,J),style:Q5(R,F,_,J),lazy:U&&!H,data:D}),I=U&&!H?`data-srcset="${T}"`:`srcset="${T}"`;if(J){let k=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
1763
- <img ${N} ${I} />
1764
- </div>`}return`<img ${Z?`id="${Z}" `:""}${N} ${I} />`}function _J($){let{src:Z,alt:J,width:X,height:Y,loading:Q=c2,decoding:G=l2,fetchpriority:z,objectFit:q,objectPosition:K,crossorigin:W,referrerpolicy:U,priority:H=!1}=$,j=$.class,B=$.style,V=$.id,F=$.data||{};return{html:`<img ${Y5({src:Z,alt:J,width:X,height:Y,loading:H?"eager":Q,decoding:G,fetchpriority:H?"high":z,objectFit:q,objectPosition:K,crossorigin:W,referrerpolicy:U,className:j,style:Q5(B,q,K),id:V,data:F})} />`}}function Y5($){let Z=[];if($.lazy)Z.push(`data-src="${p0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${p0($.src)}"`);if(Z.push(`alt="${p0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${p0($.className)}"`);if($.style)Z.push(`style="${p0($.style)}"`);if($.id)Z.push(`id="${p0($.id)}"`);if($.data)for(let[J,X]of Object.entries($.data))Z.push(`data-${J}="${p0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function d3($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function Q5($,Z,J,X){let Y=[];if(Z)Y.push(`object-fit: ${Z}`);if(J)Y.push(`object-position: ${J}`);if(X)Y.push("opacity: 0; transition: opacity 300ms ease-out");if($)Y.push($);return Y.join("; ")}function p0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function m3($){return`
1763
+ </picture>`;return I}function DJ($,Z,J,X){let{src:Y,alt:Q,width:G,height:z,dpr:q=[1,2,3],quality:K=Q5,params:W={},lazy:U=!0,priority:H=!1,loading:j=H?"eager":p2,decoding:B=c2,fetchpriority:V,objectFit:F,objectPosition:_,crossorigin:O,referrerpolicy:L}=$,w=$.class,R=$.style,N=$.data||{},A=typeof G==="number"?G:Number.parseInt(String(G),10),T=$5(Y,A,q,{...W,q:K}),D=G5({src:Q1(Y,{...W,w:A,q:K}),alt:Q,width:G,height:z,loading:H?void 0:j,decoding:B,fetchpriority:H?"high":V,objectFit:F,objectPosition:_,crossorigin:O,referrerpolicy:L,className:i3(w,J),style:z5(R,F,_,J),lazy:U&&!H,data:N}),M=U&&!H?`data-srcset="${T}"`:`srcset="${T}"`;if(J){let k=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
1764
+ <img ${D} ${M} />
1765
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${D} ${M} />`}function AJ($){let{src:Z,alt:J,width:X,height:Y,loading:Q=p2,decoding:G=c2,fetchpriority:z,objectFit:q,objectPosition:K,crossorigin:W,referrerpolicy:U,priority:H=!1}=$,j=$.class,B=$.style,V=$.id,F=$.data||{};return{html:`<img ${G5({src:Z,alt:J,width:X,height:Y,loading:H?"eager":Q,decoding:G,fetchpriority:H?"high":z,objectFit:q,objectPosition:K,crossorigin:W,referrerpolicy:U,className:j,style:z5(B,q,K),id:V,data:F})} />`}}function G5($){let Z=[];if($.lazy)Z.push(`data-src="${p0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${p0($.src)}"`);if(Z.push(`alt="${p0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${p0($.className)}"`);if($.style)Z.push(`style="${p0($.style)}"`);if($.id)Z.push(`id="${p0($.id)}"`);if($.data)for(let[J,X]of Object.entries($.data))Z.push(`data-${J}="${p0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function i3($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function z5($,Z,J,X){let Y=[];if(Z)Y.push(`object-fit: ${Z}`);if(J)Y.push(`object-position: ${J}`);if(X)Y.push("opacity: 0; transition: opacity 300ms ease-out");if($)Y.push($);return Y.join("; ")}function p0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n3($){return`
1765
1766
  (function() {
1766
1767
  const container = document.getElementById('${$}');
1767
1768
  if (!container) return;
@@ -1798,27 +1799,27 @@ ${I.join(`
1798
1799
 
1799
1800
  observer.observe(container);
1800
1801
  })();
1801
- `.trim()}function LJ($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let J=Z[1],X={},Y=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=Y.exec(J))!==null){let[,G,z,q,K,W]=Q,U=q??K??W??!0;if(G===":"&&typeof U==="string")try{X[z]=JSON.parse(U)}catch{X[z]=U}else switch(z){case"src":X.src=String(U);break;case"alt":X.alt=String(U);break;case"width":X.width=Number(U)||U;break;case"height":X.height=Number(U)||U;break;case"sizes":X.sizes=String(U);break;case"quality":X.quality=Number(U);break;case"placeholder":X.placeholder=U;break;case"lazy":X.lazy=U===!0||U==="true";break;case"priority":X.priority=U===!0||U==="true";break;case"class":X.class=String(U);break;case"style":X.style=String(U);break;case"id":X.id=String(U);break;case"loading":X.loading=U;break;case"decoding":X.decoding=U;break;case"fetchpriority":X.fetchpriority=U;break;case"objectFit":X.objectFit=U;break;case"objectPosition":X.objectPosition=String(U);break;case"crossorigin":X.crossorigin=U;break}}if(!X.src||!X.alt)return null;return X}async function tq($,Z={}){let J=/<Img\s+[^>]*?\/?>/g,X=[],Y=[],Q=[],G=$,z=[],q;while((q=J.exec($))!==null)z.push({match:q[0],index:q.index});for(let K=z.length-1;K>=0;K--){let{match:W}=z[K],U=LJ(W);if(U){let H=await K2(U,Z);if(G=G.replace(W,H.html),H.preloadLink)X.push(H.preloadLink);if(H.css)Y.push(H.css);if(H.script)Q.push(H.script)}}return{html:G,preloadLinks:X,styles:Y,scripts:Q}}async function OJ($,Z){let J=await jJ();if(!J)return K2({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await J.generateResponsiveVariants($.src,$,X);if(Q)return l3($,Q,Z)}else{let Q=await J.processImage($.src,$,X);if(Q.processed)return G5($,Q,Z)}return K2({...$,process:!1},Z)}async function G5($,Z,J){let{alt:X,width:Y,height:Q,lazy:G=!0,priority:z=!1,objectFit:q,objectPosition:K,crossorigin:W,referrerpolicy:U}=$,H=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,V=$.data||{},F=Z.variants||[],_=F.find((C)=>C.format==="jpeg")||F.find((C)=>C.format==="webp")||F[0],O=_?.url||$.src,L=F.filter((C)=>C.format===(_?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of F){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],D=["avif","webp","jpeg","png"];for(let C of D){let f=w.get(C);if(f&&f.length>0){let u=f.map((h)=>`${h.url} ${h.width}w`).join(", "),P=$5(C);if(G&&!z)R.push(` <source type="${P}" data-srcset="${u}" />`);else R.push(` <source type="${P}" srcset="${u}" />`)}}let A=[];if(G&&!z){if(A.push(`data-src="${p0(O)}"`),A.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)A.push(`data-srcset="${L}"`)}else if(A.push(`src="${p0(O)}"`),L)A.push(`srcset="${L}"`);A.push(`alt="${p0(X)}"`);let T=Y||Z.originalWidth,N=Q||Z.originalHeight;if(T)A.push(`width="${T}"`);if(N)A.push(`height="${N}"`);if(!z)A.push(`loading="${G?"lazy":"eager"}"`);if(A.push('decoding="async"'),z)A.push('fetchpriority="high"');if(W)A.push(`crossorigin="${W}"`);if(U)A.push(`referrerpolicy="${U}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(K)I.push(`object-position: ${K}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(j)I.push(j);if(I.length>0)A.push(`style="${I.join("; ")}"`);let k=[];if(H)k.push(H);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)A.push(`class="${k.join(" ")}"`);if(G&&!z)A.push("data-stx-lazy");for(let[C,f]of Object.entries(V))A.push(`data-${C}="${p0(f)}"`);let M;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;M=`<div id="${B}" class="stx-img-placeholder" style="${C}">
1802
+ `.trim()}function MJ($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let J=Z[1],X={},Y=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=Y.exec(J))!==null){let[,G,z,q,K,W]=Q,U=q??K??W??!0;if(G===":"&&typeof U==="string")try{X[z]=JSON.parse(U)}catch{X[z]=U}else switch(z){case"src":X.src=String(U);break;case"alt":X.alt=String(U);break;case"width":X.width=Number(U)||U;break;case"height":X.height=Number(U)||U;break;case"sizes":X.sizes=String(U);break;case"quality":X.quality=Number(U);break;case"placeholder":X.placeholder=U;break;case"lazy":X.lazy=U===!0||U==="true";break;case"priority":X.priority=U===!0||U==="true";break;case"class":X.class=String(U);break;case"style":X.style=String(U);break;case"id":X.id=String(U);break;case"loading":X.loading=U;break;case"decoding":X.decoding=U;break;case"fetchpriority":X.fetchpriority=U;break;case"objectFit":X.objectFit=U;break;case"objectPosition":X.objectPosition=String(U);break;case"crossorigin":X.crossorigin=U;break}}if(!X.src||!X.alt)return null;return X}async function jK($,Z={}){let J=/<Img\s+[^>]*?\/?>/g,X=[],Y=[],Q=[],G=$,z=[],q;while((q=J.exec($))!==null)z.push({match:q[0],index:q.index});for(let K=z.length-1;K>=0;K--){let{match:W}=z[K],U=MJ(W);if(U){let H=await W2(U,Z);if(G=G.replace(W,H.html),H.preloadLink)X.push(H.preloadLink);if(H.css)Y.push(H.css);if(H.script)Q.push(H.script)}}return{html:G,preloadLinks:X,styles:Y,scripts:Q}}async function IJ($,Z){let J=await RJ();if(!J)return W2({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await J.generateResponsiveVariants($.src,$,X);if(Q)return s3($,Q,Z)}else{let Q=await J.processImage($.src,$,X);if(Q.processed)return q5($,Q,Z)}return W2({...$,process:!1},Z)}async function q5($,Z,J){let{alt:X,width:Y,height:Q,lazy:G=!0,priority:z=!1,objectFit:q,objectPosition:K,crossorigin:W,referrerpolicy:U}=$,H=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,V=$.data||{},F=Z.variants||[],_=F.find((C)=>C.format==="jpeg")||F.find((C)=>C.format==="webp")||F[0],O=_?.url||$.src,L=F.filter((C)=>C.format===(_?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of F){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],N=["avif","webp","jpeg","png"];for(let C of N){let f=w.get(C);if(f&&f.length>0){let u=f.map((h)=>`${h.url} ${h.width}w`).join(", "),P=J5(C);if(G&&!z)R.push(` <source type="${P}" data-srcset="${u}" />`);else R.push(` <source type="${P}" srcset="${u}" />`)}}let A=[];if(G&&!z){if(A.push(`data-src="${p0(O)}"`),A.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)A.push(`data-srcset="${L}"`)}else if(A.push(`src="${p0(O)}"`),L)A.push(`srcset="${L}"`);A.push(`alt="${p0(X)}"`);let T=Y||Z.originalWidth,D=Q||Z.originalHeight;if(T)A.push(`width="${T}"`);if(D)A.push(`height="${D}"`);if(!z)A.push(`loading="${G?"lazy":"eager"}"`);if(A.push('decoding="async"'),z)A.push('fetchpriority="high"');if(W)A.push(`crossorigin="${W}"`);if(U)A.push(`referrerpolicy="${U}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(K)M.push(`object-position: ${K}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)A.push(`style="${M.join("; ")}"`);let k=[];if(H)k.push(H);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)A.push(`class="${k.join(" ")}"`);if(G&&!z)A.push("data-stx-lazy");for(let[C,f]of Object.entries(V))A.push(`data-${C}="${p0(f)}"`);let I;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;I=`<div id="${B}" class="stx-img-placeholder" style="${C}">
1802
1803
  <picture>
1803
1804
  ${R.join(`
1804
1805
  `)}
1805
1806
  <img ${A.join(" ")} />
1806
1807
  </picture>
1807
- </div>`}else M=`<picture${B?` id="${B}"`:""}>
1808
+ </div>`}else I=`<picture${B?` id="${B}"`:""}>
1808
1809
  ${R.join(`
1809
1810
  `)}
1810
1811
  <img ${A.join(" ")} />
1811
- </picture>`;let y=[];if(Z.placeholder)y.push(Z5);let E=G?m3(B):void 0,b;if(z&&L)b=`<link rel="preload" as="image" imagesrcset="${L}" />`;return{html:M,preloadLink:b,css:y.length>0?y.join(`
1812
- `):void 0,script:E}}async function l3($,Z,J){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Y,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return G5($,X,J)}function FJ(){return p2({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,X)=>{let{src:Y,alt:Q,options:G}=wJ($,Z,J);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:Y,alt:Q||"",widths:G.widths||_1,formats:G.formats||C1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=J.__isDev||!1,K=await K2(z,{isDev:q}),W=K.html;if(K.preloadLink)W=K.preloadLink+`
1812
+ </picture>`;let y=[];if(Z.placeholder)y.push(X5);let E=G?n3(B):void 0,b;if(z&&L)b=`<link rel="preload" as="image" imagesrcset="${L}" />`;return{html:I,preloadLink:b,css:y.length>0?y.join(`
1813
+ `):void 0,script:E}}async function s3($,Z,J){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Y,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return q5($,X,J)}function TJ(){return i2({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,X)=>{let{src:Y,alt:Q,options:G}=kJ($,Z,J);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:Y,alt:Q||"",widths:G.widths||_1,formats:G.formats||C1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=J.__isDev||!1,K=await W2(z,{isDev:q}),W=K.html;if(K.preloadLink)W=K.preloadLink+`
1813
1814
  `+W;if(K.css)W+=`
1814
1815
  <style>${K.css}</style>`;if(K.script)W+=`
1815
- <script>${K.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function wJ($,Z,J){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=RJ(X),Q=z5(Y[0],J)||"",G=z5(Y[1],J)||"",z={};if(Y[2]){let q=z5(Y[2],J);if(typeof q==="object"&&q!==null)z=q;else if(typeof Y[2]==="string")try{z=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:z}}function RJ($){let Z=[],J="",X=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let q=$[z],K=z>0?$[z-1]:"";if((q==='"'||q==="'"||q==="`")&&K!=="\\"){if(!X)X=!0,Y=q;else if(q===Y)X=!1,Y="";else J+=q;continue}if(!X){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function z5($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let X=Z[J];if(X!==void 0)return X}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var c3=FJ();async function i3(){try{return await import("./chunk-ppyz9623.js")}catch($){if(!p3)console.warn("[stx-media] Video processor not available, some features disabled:",$),p3=!0;return null}}var p3=!1,n3=!0,s3="metadata",DJ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function i2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return TJ(X,J)}if(J.processedResult?.processed)return r3($,J.processedResult,Z);let Y;if(X.generatePoster&&X.src&&!$.poster)Y=await kJ(X,J);let{src:Q,sources:G=[],poster:z,posterPlaceholder:q,controls:K=n3,autoplay:W=!1,muted:U=!1,loop:H=!1,preload:j=s3,playsinline:B=!0,lazy:V=!0,player:F="native",type:_,width:O,height:L,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:D=!1}=$,A=Y||z,T=$.class,N=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return AJ($,Z);if(_&&_!=="video")return NJ(Q||"",_,$);let k=G.length>0?G:Q?[{src:Q,type:o3(Q)}]:[],M=[`id="${I}"`];if(K)M.push("controls");if(W)M.push("autoplay");if(U)M.push("muted");if(H)M.push("loop");if(B)M.push("playsinline");if(R)M.push("disablepictureinpicture");if(D)M.push("disableremoteplayback");if(w)M.push(`crossorigin="${w}"`);if(V){if(M.push(`data-preload="${j}"`),M.push('preload="none"'),A)M.push(`data-poster="${A0(A)}"`);M.push("data-stx-lazy")}else if(M.push(`preload="${j}"`),A)M.push(`poster="${A0(A)}"`);if(O)M.push(`width="${O}"`);if(L)M.push(`height="${L}"`);if(T)M.push(`class="${A0(T)}"`);if(N)M.push(`style="${A0(N)}"`);let y=k.map((C)=>{return` <source ${V?`data-src="${A0(C.src)}"`:`src="${A0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
1816
- `),E=`<video ${M.join(" ")}>
1816
+ <script>${K.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function kJ($,Z,J){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=EJ(X),Q=K5(Y[0],J)||"",G=K5(Y[1],J)||"",z={};if(Y[2]){let q=K5(Y[2],J);if(typeof q==="object"&&q!==null)z=q;else if(typeof Y[2]==="string")try{z=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:z}}function EJ($){let Z=[],J="",X=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let q=$[z],K=z>0?$[z-1]:"";if((q==='"'||q==="'"||q==="`")&&K!=="\\"){if(!X)X=!0,Y=q;else if(q===Y)X=!1,Y="";else J+=q;continue}if(!X){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function K5($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let X=Z[J];if(X!==void 0)return X}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var o3=TJ();async function a3(){try{return await import("./chunk-85p4dmft.js")}catch($){if(!r3)console.warn("[stx-media] Video processor not available, some features disabled:",$),r3=!0;return null}}var r3=!1,t3=!0,e3="metadata",bJ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function n2($,Z={}){let J=Z,X=$;if(X.process&&!X.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return vJ(X,J)}if(J.processedResult?.processed)return Z7($,J.processedResult,Z);let Y;if(X.generatePoster&&X.src&&!$.poster)Y=await fJ(X,J);let{src:Q,sources:G=[],poster:z,posterPlaceholder:q,controls:K=t3,autoplay:W=!1,muted:U=!1,loop:H=!1,preload:j=e3,playsinline:B=!0,lazy:V=!0,player:F="native",type:_,width:O,height:L,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:N=!1}=$,A=Y||z,T=$.class,D=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return CJ($,Z);if(_&&_!=="video")return yJ(Q||"",_,$);let k=G.length>0?G:Q?[{src:Q,type:$7(Q)}]:[],I=[`id="${M}"`];if(K)I.push("controls");if(W)I.push("autoplay");if(U)I.push("muted");if(H)I.push("loop");if(B)I.push("playsinline");if(R)I.push("disablepictureinpicture");if(N)I.push("disableremoteplayback");if(w)I.push(`crossorigin="${w}"`);if(V){if(I.push(`data-preload="${j}"`),I.push('preload="none"'),A)I.push(`data-poster="${A0(A)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${j}"`),A)I.push(`poster="${A0(A)}"`);if(O)I.push(`width="${O}"`);if(L)I.push(`height="${L}"`);if(T)I.push(`class="${A0(T)}"`);if(D)I.push(`style="${A0(D)}"`);let y=k.map((C)=>{return` <source ${V?`data-src="${A0(C.src)}"`:`src="${A0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
1817
+ `),E=`<video ${I.join(" ")}>
1817
1818
  ${y}
1818
1819
  Your browser does not support the video tag.
1819
1820
  </video>`,b;if(V)b=`
1820
1821
  (function() {
1821
- var video = document.getElementById('${I}');
1822
+ var video = document.getElementById('${M}');
1822
1823
  if (!video) return;
1823
1824
 
1824
1825
  var observer = new IntersectionObserver(function(entries) {
@@ -1851,9 +1852,9 @@ ${y}
1851
1852
 
1852
1853
  observer.observe(video);
1853
1854
  })();
1854
- `.trim();return{html:E,script:b}}function NJ($,Z,J){let{width:X=640,height:Y=360}=J,Q=J.class,G=J.style,z=J.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,K=null;switch(Z){case"youtube":K=MJ($),q=K?`https://www.youtube-nocookie.com/embed/${K}`:$;break;case"vimeo":K=IJ($),q=K?`https://player.vimeo.com/video/${K}`:$;break;case"dailymotion":K=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${K}`;break;case"twitch":K=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${K}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let W=[`id="${z}"`,`src="${A0(q)}"`,`width="${X}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)W.push(`class="${A0(Q)}"`);if(G)W.push(`style="${A0(G)}"`);if(J.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1855
+ `.trim();return{html:E,script:b}}function yJ($,Z,J){let{width:X=640,height:Y=360}=J,Q=J.class,G=J.style,z=J.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,K=null;switch(Z){case"youtube":K=SJ($),q=K?`https://www.youtube-nocookie.com/embed/${K}`:$;break;case"vimeo":K=PJ($),q=K?`https://player.vimeo.com/video/${K}`:$;break;case"dailymotion":K=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${K}`;break;case"twitch":K=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${K}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let W=[`id="${z}"`,`src="${A0(q)}"`,`width="${X}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)W.push(`class="${A0(Q)}"`);if(G)W.push(`style="${A0(G)}"`);if(J.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1855
1856
  <iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1856
- </div>`}}function AJ($,Z={}){let{src:J,sources:X=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:z=!1,loop:q=!1,preload:K="metadata",playsinline:W=!0,lazy:U=!0,width:H,height:j}=$,B=$.class,V=$.style,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,_={src:X.length>0?X:J,autoplay:G,loop:q,muted:z,playsinline:W,preload:K,poster:Y,controls:Q,title:$.title},O=["position: relative",H?`width: ${typeof H==="number"?H+"px":H}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",V||""].filter(Boolean).join("; "),L=`
1857
+ </div>`}}function CJ($,Z={}){let{src:J,sources:X=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:z=!1,loop:q=!1,preload:K="metadata",playsinline:W=!0,lazy:U=!0,width:H,height:j}=$,B=$.class,V=$.style,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,_={src:X.length>0?X:J,autoplay:G,loop:q,muted:z,playsinline:W,preload:K,poster:Y,controls:Q,title:$.title},O=["position: relative",H?`width: ${typeof H==="number"?H+"px":H}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",V||""].filter(Boolean).join("; "),L=`
1857
1858
  <div
1858
1859
  id="${F}"
1859
1860
  class="ts-video-player${B?" "+A0(B):""}"
@@ -1890,7 +1891,7 @@ ${y}
1890
1891
 
1891
1892
  // Load ts-video-player from CDN
1892
1893
  var script = document.createElement('script');
1893
- script.src = '${DJ}';
1894
+ script.src = '${bJ}';
1894
1895
  script.onload = initPlayer;
1895
1896
  script.onerror = function() {
1896
1897
  console.error('[stx] Failed to load ts-video-player');
@@ -2020,12 +2021,12 @@ else {
2020
2021
  .ts-video-player__play-button svg {
2021
2022
  margin-left: 4px;
2022
2023
  }
2023
- `.trim();return{html:L,script:w,css:R}}function o3($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function MJ($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let J of Z){let X=$.match(J);if(X)return X[1]}return null}function IJ($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function A0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function YK($,Z,J){if(Z.src)return{src:String(Z.src),...Z};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=X.indexOf(",");if(Y===-1)return{src:X.replace(/^['"]|['"]$/g,"")};let Q=X.slice(0,Y).trim().replace(/^['"]|['"]$/g,""),G=X.slice(Y+1).trim();try{let z=JSON.parse(G);return{src:Q,...z}}catch{return{src:Q}}}async function TJ($,Z){let J=await i3();if(!J)return i2({...$,process:!1},Z);let X=Z.tsVideosConfig,Y=await J.processVideo($.src,$,X,$.onProcessProgress);if(Y.processed)return r3($,Y,Z);return i2({...$,process:!1},Z)}async function kJ($,Z){let J=await i3();if(!J||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,X,Y.outputDir,Y.baseUrl||"/videos"))?.url}function r3($,Z,J){let{controls:X=n3,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:z=s3,playsinline:q=!0,lazy:K=!0,width:W,height:U,crossorigin:H,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,V=$.class,F=$.style,_=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,L=o3(O);if(Z.transcoded)O=Z.transcoded.url,L="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,L="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,L="application/dash+xml"}let R=Z.poster?.url||$.poster,D=[`id="${_}"`];if(X)D.push("controls");if(Y)D.push("autoplay");if(Q)D.push("muted");if(G)D.push("loop");if(q)D.push("playsinline");if(j)D.push("disablepictureinpicture");if(B)D.push("disableremoteplayback");if(H)D.push(`crossorigin="${H}"`);if(K){if(D.push(`data-preload="${z}"`),D.push('preload="none"'),R)D.push(`data-poster="${A0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${z}"`),R)D.push(`poster="${A0(R)}"`);let A=W||Z.metadata?.width,T=U||Z.metadata?.height;if(A)D.push(`width="${A}"`);if(T)D.push(`height="${T}"`);if(V)D.push(`class="${A0(V)}"`);if(F)D.push(`style="${A0(F)}"`);let I=` <source ${K?`data-src="${A0(O)}"`:`src="${A0(O)}"`} type="${L}" />`,k=`<video ${D.join(" ")}>
2024
- ${I}
2024
+ `.trim();return{html:L,script:w,css:R}}function $7($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function SJ($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let J of Z){let X=$.match(J);if(X)return X[1]}return null}function PJ($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function A0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function FK($,Z,J){if(Z.src)return{src:String(Z.src),...Z};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=X.indexOf(",");if(Y===-1)return{src:X.replace(/^['"]|['"]$/g,"")};let Q=X.slice(0,Y).trim().replace(/^['"]|['"]$/g,""),G=X.slice(Y+1).trim();try{let z=JSON.parse(G);return{src:Q,...z}}catch{return{src:Q}}}async function vJ($,Z){let J=await a3();if(!J)return n2({...$,process:!1},Z);let X=Z.tsVideosConfig,Y=await J.processVideo($.src,$,X,$.onProcessProgress);if(Y.processed)return Z7($,Y,Z);return n2({...$,process:!1},Z)}async function fJ($,Z){let J=await a3();if(!J||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,X,Y.outputDir,Y.baseUrl||"/videos"))?.url}function Z7($,Z,J){let{controls:X=t3,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:z=e3,playsinline:q=!0,lazy:K=!0,width:W,height:U,crossorigin:H,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,V=$.class,F=$.style,_=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,L=$7(O);if(Z.transcoded)O=Z.transcoded.url,L="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,L="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,L="application/dash+xml"}let R=Z.poster?.url||$.poster,N=[`id="${_}"`];if(X)N.push("controls");if(Y)N.push("autoplay");if(Q)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(j)N.push("disablepictureinpicture");if(B)N.push("disableremoteplayback");if(H)N.push(`crossorigin="${H}"`);if(K){if(N.push(`data-preload="${z}"`),N.push('preload="none"'),R)N.push(`data-poster="${A0(R)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${z}"`),R)N.push(`poster="${A0(R)}"`);let A=W||Z.metadata?.width,T=U||Z.metadata?.height;if(A)N.push(`width="${A}"`);if(T)N.push(`height="${T}"`);if(V)N.push(`class="${A0(V)}"`);if(F)N.push(`style="${A0(F)}"`);let M=` <source ${K?`data-src="${A0(O)}"`:`src="${A0(O)}"`} type="${L}" />`,k=`<video ${N.join(" ")}>
2025
+ ${M}
2025
2026
  Your browser does not support the video tag.
2026
2027
  </video>`;if(Z.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${A0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
2027
2028
  ${k}
2028
- </div>`;let M;if(K)M=`
2029
+ </div>`;let I;if(K)I=`
2029
2030
  (function() {
2030
2031
  var video = document.getElementById('${_}');
2031
2032
  if (!video) return;
@@ -2069,57 +2070,61 @@ ${k}
2069
2070
  width: 100%;
2070
2071
  height: auto;
2071
2072
  }
2072
- `.trim();return{html:k,script:M,css:y}}function a3(){return p2({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,X)=>{let{src:Y,options:Q}=EJ($,Z,J);if(!Y)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Y,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},q={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},K=await i2(G,q),W=K.html;if(K.css)W+=`
2073
+ `.trim();return{html:k,script:I,css:y}}function J7(){return i2({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,X)=>{let{src:Y,options:Q}=xJ($,Z,J);if(!Y)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Y,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},q={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},K=await n2(G,q),W=K.html;if(K.css)W+=`
2073
2074
  <style>${K.css}</style>`;if(K.script)W+=`
2074
- <script>${K.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function EJ($,Z,J){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=bJ(X),Q=t3(Y[0],J)||"",G={};if(Y[1]){let z=t3(Y[1],J);if(typeof z==="object"&&z!==null)G=z;else if(typeof Y[1]==="string")try{G=JSON.parse(Y[1])}catch{}}return{src:Q,options:G}}function bJ($){let Z=[],J="",X=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let q=$[z],K=z>0?$[z-1]:"";if((q==='"'||q==="'"||q==="`")&&K!=="\\"){if(!X)X=!0,Y=q;else if(q===Y)X=!1,Y="";else J+=q;continue}if(!X){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function t3($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let X=Z[J];if(X!==void 0)return X}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var q5=a3();function $7($,Z,J,X){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(z,q,K)=>{if(!K&&q.includes(":")){let W=q.split(":"),U=q,H=W.length>1?W[1]:"";if(H&&Z[H])K=Z[H];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[W[1]])K=Z.openGraph[W[1]];else K="";return K?`<meta property="${n(U)}" content="${n(K)}">`:""}return K?`<meta name="${n(q)}" content="${n(K)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(Y))!==null){let z=G.index,q=z+G[0].length-1,K=1,W=q+1;while(W<Y.length&&K>0){if(Y[W]==="(")K++;else if(Y[W]===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=Y.substring(q+1,W).trim(),H=W+1,j=(()=>{try{let B=E0(U,Z);if(!B)return"";let V="<meta";if(B.name)V+=` name="${n(String(B.name))}"`;if(B.property)V+=` property="${n(String(B.property))}"`;if(B.httpEquiv)V+=` http-equiv="${n(String(B.httpEquiv))}"`;if(B.content)V+=` content="${n(String(B.content))}"`;return V+=">",V}catch(B){let V=B instanceof Error?B.message:String(B);return X0("MetaTag",V,J0.EVALUATION_ERROR)}})();Y=Y.substring(0,z)+j+Y.substring(H),Q.lastIndex=0}return Y}function Z7($,Z,J){let X=$,Y=/@structuredData\s*\(/g,Q;while((Q=Y.exec(X))!==null){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1;while(K<X.length&&q>0){if(X[K]==="(")q++;else if(X[K]===")"){if(q--,q===0)break}K++}if(q!==0)break;let W=X.substring(z+1,K).trim(),U=K+1,H=(()=>{try{let j=E0(W,Z);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let B=j instanceof Error?j.message:String(j);return X0("StructuredData",B,J0.EVALUATION_ERROR)}})();X=X.substring(0,G)+H+X.substring(U),Y.lastIndex=0}return X}function J7($,Z,J,X){let Y=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(Y))!==null){let z=Y.indexOf("{",G.index+4),q=1,K=z+1,W=null,U=!1;while(K<Y.length&&q>0){let _=Y[K];if(U){U=!1,K++;continue}if(_==="\\"&&W){U=!0,K++;continue}if(W){if(_===W)W=null;K++;continue}if(_==='"'||_==="'"||_==="`"){W=_,K++;continue}if(_==="{")q++;else if(_==="}")q--;K++}if(q!==0)break;let H=Y.substring(K).match(/^\s*\)/);if(!H)break;let j=K+H[0].length,B=Y.substring(z,K),V=Y.substring(G.index,j),F=((_)=>{try{let O=E0(_,Z);if(!O)return"";let L="";if(O.title)L+=`<title>${n(O.title)}</title>
2075
- `,L+=`<meta name="title" content="${n(O.title)}">
2076
- `;if(O.description)L+=`<meta name="description" content="${n(O.description)}">
2077
- `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;L+=`<meta name="keywords" content="${n(w)}">
2078
- `}if(O.robots)L+=`<meta name="robots" content="${n(O.robots)}">
2079
- `;if(O.canonical)L+=`<link rel="canonical" href="${n(O.canonical)}">
2080
- `;if(O.openGraph){let w=O.openGraph;if(L+=`<meta property="og:type" content="${n(w.type||"website")}">
2081
- `,w.title||O.title){let R=w.title||O.title||"";L+=`<meta property="og:title" content="${n(R)}">
2082
- `}if(w.description||O.description){let R=w.description||O.description||"";L+=`<meta property="og:description" content="${n(R)}">
2083
- `}if(w.url||O.canonical){let R=w.url||O.canonical||"";L+=`<meta property="og:url" content="${n(R)}">
2084
- `}if(w.image){if(L+=`<meta property="og:image" content="${n(w.image)}">
2085
- `,w.imageAlt)L+=`<meta property="og:image:alt" content="${n(w.imageAlt)}">
2086
- `;if(w.imageWidth)L+=`<meta property="og:image:width" content="${n(String(w.imageWidth))}">
2087
- `;if(w.imageHeight)L+=`<meta property="og:image:height" content="${n(String(w.imageHeight))}">
2088
- `}if(w.siteName)L+=`<meta property="og:site_name" content="${n(w.siteName)}">
2089
- `}if(O.twitter){let w=O.twitter;if(L+=`<meta name="twitter:card" content="${n(w.card||"summary_large_image")}">
2090
- `,w.title||O.title){let R=w.title||O.title||"";L+=`<meta name="twitter:title" content="${n(R)}">
2091
- `}if(w.description||O.description){let R=w.description||O.description||"";L+=`<meta name="twitter:description" content="${n(R)}">
2092
- `}if(w.image||O.openGraph&&O.openGraph.image){let R=w.image||(O.openGraph?O.openGraph.image:"")||"";L+=`<meta name="twitter:image" content="${n(R)}">
2093
- `}if(w.site)L+=`<meta name="twitter:site" content="${n(w.site)}">
2094
- `;if(w.creator)L+=`<meta name="twitter:creator" content="${n(w.creator)}">
2075
+ <script>${K.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function xJ($,Z,J){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=gJ(X),Q=X7(Y[0],J)||"",G={};if(Y[1]){let z=X7(Y[1],J);if(typeof z==="object"&&z!==null)G=z;else if(typeof Y[1]==="string")try{G=JSON.parse(Y[1])}catch{}}return{src:Q,options:G}}function gJ($){let Z=[],J="",X=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let q=$[z],K=z>0?$[z-1]:"";if((q==='"'||q==="'"||q==="`")&&K!=="\\"){if(!X)X=!0,Y=q;else if(q===Y)X=!1,Y="";else J+=q;continue}if(!X){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function X7($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let X=Z[J];if(X!==void 0)return X}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var W5=J7();function Q7($,Z,J,X){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(z,q,K)=>{if(!K&&q.includes(":")){let W=q.split(":"),U=q,H=W.length>1?W[1]:"";if(H&&Z[H])K=Z[H];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[W[1]])K=Z.openGraph[W[1]];else K="";return K?`<meta property="${c(U)}" content="${c(K)}">`:""}return K?`<meta name="${c(q)}" content="${c(K)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(Y))!==null){let z=G.index,q=z+G[0].length-1,K=1,W=q+1;while(W<Y.length&&K>0){if(Y[W]==="(")K++;else if(Y[W]===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=Y.substring(q+1,W).trim(),H=W+1,j=(()=>{try{let B=E0(U,Z);if(!B)return"";let V="<meta";if(B.name)V+=` name="${c(String(B.name))}"`;if(B.property)V+=` property="${c(String(B.property))}"`;if(B.httpEquiv)V+=` http-equiv="${c(String(B.httpEquiv))}"`;if(B.content)V+=` content="${c(String(B.content))}"`;return V+=">",V}catch(B){let V=B instanceof Error?B.message:String(B);return X0("MetaTag",V,J0.EVALUATION_ERROR)}})();Y=Y.substring(0,z)+j+Y.substring(H),Q.lastIndex=0}return Y}function G7($,Z,J){let X=$,Y=/@structuredData\s*\(/g,Q;while((Q=Y.exec(X))!==null){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1;while(K<X.length&&q>0){if(X[K]==="(")q++;else if(X[K]===")"){if(q--,q===0)break}K++}if(q!==0)break;let W=X.substring(z+1,K).trim(),U=K+1,H=(()=>{try{let j=E0(W,Z);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let B=j instanceof Error?j.message:String(j);return X0("StructuredData",B,J0.EVALUATION_ERROR)}})();X=X.substring(0,G)+H+X.substring(U),Y.lastIndex=0}return X}function z7($,Z,J,X){let Y=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(Y))!==null){let z=Y.indexOf("{",G.index+4),q=1,K=z+1,W=null,U=!1;while(K<Y.length&&q>0){let _=Y[K];if(U){U=!1,K++;continue}if(_==="\\"&&W){U=!0,K++;continue}if(W){if(_===W)W=null;K++;continue}if(_==='"'||_==="'"||_==="`"){W=_,K++;continue}if(_==="{")q++;else if(_==="}")q--;K++}if(q!==0)break;let H=Y.substring(K).match(/^\s*\)/);if(!H)break;let j=K+H[0].length,B=Y.substring(z,K),V=Y.substring(G.index,j),F=((_)=>{try{let O=E0(_,Z);if(!O)return"";let L="";if(O.title)L+=`<title>${c(O.title)}</title>
2076
+ `,L+=`<meta name="title" content="${c(O.title)}">
2077
+ `;if(O.description)L+=`<meta name="description" content="${c(O.description)}">
2078
+ `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;L+=`<meta name="keywords" content="${c(w)}">
2079
+ `}if(O.robots)L+=`<meta name="robots" content="${c(O.robots)}">
2080
+ `;if(O.canonical)L+=`<link rel="canonical" href="${c(O.canonical)}">
2081
+ `;if(O.openGraph){let w=O.openGraph;if(L+=`<meta property="og:type" content="${c(w.type||"website")}">
2082
+ `,w.title||O.title){let R=w.title||O.title||"";L+=`<meta property="og:title" content="${c(R)}">
2083
+ `}if(w.description||O.description){let R=w.description||O.description||"";L+=`<meta property="og:description" content="${c(R)}">
2084
+ `}if(w.url||O.canonical){let R=w.url||O.canonical||"";L+=`<meta property="og:url" content="${c(R)}">
2085
+ `}if(w.image){if(L+=`<meta property="og:image" content="${c(w.image)}">
2086
+ `,w.imageAlt)L+=`<meta property="og:image:alt" content="${c(w.imageAlt)}">
2087
+ `;if(w.imageWidth)L+=`<meta property="og:image:width" content="${c(String(w.imageWidth))}">
2088
+ `;if(w.imageHeight)L+=`<meta property="og:image:height" content="${c(String(w.imageHeight))}">
2089
+ `;if(w.imageType)L+=`<meta property="og:image:type" content="${c(w.imageType)}">
2090
+ `}if(w.siteName)L+=`<meta property="og:site_name" content="${c(w.siteName)}">
2091
+ `;if(w.locale)L+=`<meta property="og:locale" content="${c(w.locale)}">
2092
+ `;if(w.profile){let R=[["first_name",w.profile.firstName],["last_name",w.profile.lastName],["username",w.profile.username],["gender",w.profile.gender]];for(let[N,A]of R)if(A)L+=`<meta property="profile:${N}" content="${c(A)}">
2093
+ `}}if(O.twitter){let w=O.twitter;if(L+=`<meta name="twitter:card" content="${c(w.card||"summary_large_image")}">
2094
+ `,w.title||O.title){let R=w.title||O.title||"";L+=`<meta name="twitter:title" content="${c(R)}">
2095
+ `}if(w.description||O.description){let R=w.description||O.description||"";L+=`<meta name="twitter:description" content="${c(R)}">
2096
+ `}if(w.image||O.openGraph&&O.openGraph.image){let R=w.image||(O.openGraph?O.openGraph.image:"")||"";L+=`<meta name="twitter:image" content="${c(R)}">
2097
+ `;let N=w.imageAlt||(!w.image&&O.openGraph?O.openGraph.imageAlt:void 0);if(N)L+=`<meta name="twitter:image:alt" content="${c(N)}">
2098
+ `}if(w.site)L+=`<meta name="twitter:site" content="${c(w.site)}">
2099
+ `;if(w.creator)L+=`<meta name="twitter:creator" content="${c(w.creator)}">
2095
2100
  `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");L+=`<script type="application/ld+json">${w}</script>
2096
- `}return L.trim()}catch(O){let L=O instanceof Error?O.message:String(O);return X0("SEO",`Error processing @seo directive: ${L}`,J0.EVALUATION_ERROR)}})(B);Y=Y.substring(0,G.index)+F+Y.substring(j),Q.lastIndex=G.index+F.length}return Y}function X7($,Z,J){if(J.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Z.__stx_seo_staged===!0||J.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((H)=>H.property==="og:title"||H.name==="og:title"||H.name==="twitter:title"||H.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(J.seo?.defaultConfig?.title)G=J.seo.defaultConfig.title;else G=J.defaultTitle||"stx Project";let z="";if(Z.description)z=Z.description;else if(Z.meta&&Z.meta.description)z=Z.meta.description;else if(J.seo?.defaultConfig?.description)z=J.seo.defaultConfig.description;else z=J.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(J.seo?.defaultImage)q=J.seo.defaultImage;else if(J.defaultImage)q=J.defaultImage;let K=`
2097
- <!-- stx SEO Tags -->
2098
- <meta name="title" content="${n(G)}">
2099
- <meta name="description" content="${n(z)}">
2100
- <meta property="og:title" content="${n(G)}">
2101
- <meta property="og:description" content="${n(z)}">
2101
+ `}return L.trim()}catch(O){let L=O instanceof Error?O.message:String(O);return X0("SEO",`Error processing @seo directive: ${L}`,J0.EVALUATION_ERROR)}})(B);Y=Y.substring(0,G.index)+F+Y.substring(j),Q.lastIndex=G.index+F.length}return Y}function q7($,Z,J){if(J.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Z.__stx_seo_staged===!0||J.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((_)=>_.property==="og:title"||_.name==="og:title"||_.name==="twitter:title"||_.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G=hJ($),z=uJ(G),q=mJ(G),K="";if(Z.title)K=Z.title;else if(Z.meta&&Z.meta.title)K=Z.meta.title;else if(z)K=z;else if(J.seo?.defaultConfig?.title)K=J.seo.defaultConfig.title;else K=J.defaultTitle||"stx Project";let W="";if(Z.description)W=Z.description;else if(Z.meta&&Z.meta.description)W=Z.meta.description;else if(q)W=q;else if(J.seo?.defaultConfig?.description)W=J.seo.defaultConfig.description;else W=J.defaultDescription||"A website built with stx templating engine";let U="";if(Z.image)U=Z.image;else if(Z.meta&&Z.meta.image)U=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)U=Z.openGraph.image;else if(J.seo?.defaultImage)U=J.seo.defaultImage;else if(J.defaultImage)U=J.defaultImage;let H=Q?"":`
2102
+ <meta name="title" content="${c(K)}">`,j=dJ(G)?"":`
2103
+ <meta name="description" content="${c(W)}">`,B=`
2104
+ <!-- stx SEO Tags -->${H}${j}
2105
+ <meta property="og:title" content="${c(K)}">
2106
+ <meta property="og:description" content="${c(W)}">
2102
2107
  <meta property="og:type" content="website">
2103
2108
  <meta name="twitter:card" content="summary_large_image">
2104
- <meta name="twitter:title" content="${n(G)}">
2105
- <meta name="twitter:description" content="${n(z)}">
2106
- `;if(q)K+=`
2107
- <meta property="og:image" content="${n(q)}">
2108
- <meta name="twitter:image" content="${n(q)}">
2109
- `;let W=$;if(!Q)W=W.replace(/<head[^>]*>/,`$&
2110
- <title>${n(G)}</title>`);let U=Z.__stx_head_injections;if(U)return Z.__stx_seo_staged=!0,U.afterOpen.push(`
2111
- ${K}
2112
- `),W;return W.replace(/<head[^>]*>/,`$&
2113
- ${K}
2114
- `)}function n($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var yJ=["og:","article:","book:","profile:","fb:","music:","video:"];function e3($){let Z=$.trim(),J=Z[0];if((J==="'"||J==='"'||J==="`")&&Z.length>1&&Z.at(-1)===J)return{value:Z.slice(1,-1),quoted:!0};return{value:Z,quoted:!1}}var K5={name:"meta",handler:($,Z,J,X)=>{if(Z.length<1)return X0("Meta","meta directive requires at least the meta name",J0.INVALID_DIRECTIVE_SYNTAX);let Y=e3(Z[0]).value,Q;if(Z.length>1){let q=e3(Z[1]);Q=q.quoted?q.value:String(J?.[q.value]??q.value)}else{let q=Y.includes(":")?Y.slice(Y.indexOf(":")+1):Y,K=J?.openGraph;Q=String(J?.[q]??K?.[q]??"")}if(!Q)return"";let z=yJ.some((q)=>Y.startsWith(q))?{property:Y,content:Q}:{name:Y,content:Q};if(J)J.__stx_runtime_head=n2(J.__stx_runtime_head??{},{meta:[z]});return""},hasEndTag:!1},W5={name:"structuredData",handler:($,Z,J,X)=>{if($.trim()==="")return X0("StructuredData","structuredData directive requires JSON-LD content",J0.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return X0("StructuredData","structuredData requires @type property",J0.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Y)}</script>`}catch(Y){let Q=Y instanceof Error?Y.message:String(Y);return X0("StructuredData",Q,J0.EVALUATION_ERROR)}},hasEndTag:!0};function jK(){return[K5,W5]}function BK($,Z){let J=Z.replace(/\/$/,""),X=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
2109
+ <meta name="twitter:title" content="${c(K)}">
2110
+ <meta name="twitter:description" content="${c(W)}">
2111
+ `;if(U)B+=`
2112
+ <meta property="og:image" content="${c(U)}">
2113
+ <meta name="twitter:image" content="${c(U)}">
2114
+ `;let V=$;if(!Q)V=V.replace(/<head[^>]*>/,`$&
2115
+ <title>${c(K)}</title>`);let F=Z.__stx_head_injections;if(F)return Z.__stx_seo_staged=!0,F.afterOpen.push(`
2116
+ ${B}
2117
+ `),V;return V.replace(/<head[^>]*>/,`$&
2118
+ ${B}
2119
+ `)}function hJ($){let Z=$.search(/<\/head\s*>/i);return Z===-1?$:$.slice(0,Z)}function K7($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;|&apos;/g,"'").replace(/&amp;/g,"&")}function uJ($){let Z=$.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return Z?K7(Z[1].trim()):""}function W7($){return($.match(/<meta\s[^>]*>/gi)||[]).filter((Z)=>/\sname\s*=\s*["']description["']/i.test(Z))}function dJ($){return W7($).length>0}function mJ($){for(let Z of W7($)){let J=Z.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),X=(J?.[1]??J?.[2]??"").trim();if(X)return K7(X)}return""}function c($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var lJ=["og:","article:","book:","profile:","fb:","music:","video:"];function Y7($){let Z=$.trim(),J=Z[0];if((J==="'"||J==='"'||J==="`")&&Z.length>1&&Z.at(-1)===J)return{value:Z.slice(1,-1),quoted:!0};return{value:Z,quoted:!1}}var U5={name:"meta",handler:($,Z,J,X)=>{if(Z.length<1)return X0("Meta","meta directive requires at least the meta name",J0.INVALID_DIRECTIVE_SYNTAX);let Y=Y7(Z[0]).value,Q;if(Z.length>1){let q=Y7(Z[1]);Q=q.quoted?q.value:String(J?.[q.value]??q.value)}else{let q=Y.includes(":")?Y.slice(Y.indexOf(":")+1):Y,K=J?.openGraph;Q=String(J?.[q]??K?.[q]??"")}if(!Q)return"";let z=lJ.some((q)=>Y.startsWith(q))?{property:Y,content:Q}:{name:Y,content:Q};if(J)J.__stx_runtime_head=s2(J.__stx_runtime_head??{},{meta:[z]});return""},hasEndTag:!1},H5={name:"structuredData",handler:($,Z,J,X)=>{if($.trim()==="")return X0("StructuredData","structuredData directive requires JSON-LD content",J0.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return X0("StructuredData","structuredData requires @type property",J0.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Y)}</script>`}catch(Y){let Q=Y instanceof Error?Y.message:String(Y);return X0("StructuredData",Q,J0.EVALUATION_ERROR)}},hasEndTag:!0};function kK(){return[U5,H5]}function EK($,Z){let J=Z.replace(/\/$/,""),X=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
2115
2120
  <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
2116
2121
  ${$.map((Q)=>{let G=Q.startsWith("http")?Q:`${J}${Q.startsWith("/")?"":"/"}${Q}`;return` <sitemap>
2117
- <loc>${SJ(G)}</loc>
2122
+ <loc>${pJ(G)}</loc>
2118
2123
  <lastmod>${X}</lastmod>
2119
2124
  </sitemap>`}).join(`
2120
2125
  `)}
2121
- </sitemapindex>`}async function VK($,Z){let{extensions:J=[".stx",".html",".htm"],ignore:X=["_*",".*","node_modules","components","partials","layouts"]}=Z,Y=[],Q=J.length===1?`*${J[0]}`:`*{${J.join(",")}}`,G=new Bun.Glob(`**/${Q}`);for await(let z of G.scan($)){if(X.some((H)=>{if(H.startsWith("*"))return z.includes(H.slice(1));return z.startsWith(H)||z.includes(`/${H}`)}))continue;let K=z.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!K.startsWith("/"))K=`/${K}`;if(K!=="/"&&K.endsWith("/"))K=K.slice(0,-1);let W=`${$}/${z}`,U;try{let H=await Bun.file(W).stat();if(H)U=new Date(H.mtime).toISOString().split("T")[0]}catch{}Y.push({loc:K||"/",lastmod:U,priority:K==="/"?1:0.5})}return Y.sort((z,q)=>z.loc.localeCompare(q.loc)),Y}function CJ($){let Z=[];for(let J of $.rules){if(Z.push(`User-agent: ${J.userAgent}`),J.allow)for(let X of J.allow)Z.push(`Allow: ${X}`);if(J.disallow)for(let X of J.disallow)Z.push(`Disallow: ${X}`);if(J.crawlDelay!==void 0)Z.push(`Crawl-delay: ${J.crawlDelay}`);Z.push("")}if($.sitemap){let J=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let X of J)Z.push(`Sitemap: ${X}`)}if($.host)Z.push(`Host: ${$.host}`);return Z.join(`
2122
- `).trim()}function _K($){return CJ({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function SJ($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}import PJ from"fs";import d0 from"path";async function DK($,Z){if(!$.webComponents?.enabled)return[];let J=$.webComponents.components||[],X=[];if(J.length>0){if($.debug)console.log(`Building ${J.length} web components...`);for(let Y of J)try{let Q=await vJ(Y,$,Z);if(Q)X.push(Q)}catch(Q){if(console.error(`Error building web component ${Y.name}:`,Q),$.debug)throw Q}}return X}async function vJ($,Z,J){let{name:X,file:Y,tag:Q,extends:G}=$;if(!X||!Y||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let z=null;if(d0.isAbsolute(Y)&&await a(Y))z=Y;else if(Z.componentsDir){let V=d0.join(Z.componentsDir,Y);if(await a(V))z=V}if(!z)z=await s2(Y,process.cwd(),Z,J);if(!z)return console.error(`Web component source file not found: ${Y}`),null;let q=await Bun.file(z).text();J.add(z);let W=($.outputFormat||"js")==="ts",U=W?xJ({name:X,tag:Q,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):fJ({name:X,tag:Q,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),H=Z.webComponents?.outputDir||"dist/web-components";await PJ.promises.mkdir(H,{recursive:!0});let j=W?"ts":"js",B=d0.join(H,`${Q}.${j}`);if(await Bun.write(B,U),Z.debug)console.log(`Built web component ${X} -> ${B}`);return B}function fJ($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:q=[]}=$,K=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)K=K.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),K=K.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),K=K.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),K=K.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let W="";if(z)W=`<link rel="stylesheet" href="${z}">`;return`/**
2126
+ </sitemapindex>`}async function bK($,Z){let{extensions:J=[".stx",".html",".htm"],ignore:X=["_*",".*","node_modules","components","partials","layouts"]}=Z,Y=[],Q=J.length===1?`*${J[0]}`:`*{${J.join(",")}}`,G=new Bun.Glob(`**/${Q}`);for await(let z of G.scan($)){if(X.some((H)=>{if(H.startsWith("*"))return z.includes(H.slice(1));return z.startsWith(H)||z.includes(`/${H}`)}))continue;let K=z.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!K.startsWith("/"))K=`/${K}`;if(K!=="/"&&K.endsWith("/"))K=K.slice(0,-1);let W=`${$}/${z}`,U;try{let H=await Bun.file(W).stat();if(H)U=new Date(H.mtime).toISOString().split("T")[0]}catch{}Y.push({loc:K||"/",lastmod:U,priority:K==="/"?1:0.5})}return Y.sort((z,q)=>z.loc.localeCompare(q.loc)),Y}function cJ($){let Z=[];for(let J of $.rules){if(Z.push(`User-agent: ${J.userAgent}`),J.allow)for(let X of J.allow)Z.push(`Allow: ${X}`);if(J.disallow)for(let X of J.disallow)Z.push(`Disallow: ${X}`);if(J.crawlDelay!==void 0)Z.push(`Crawl-delay: ${J.crawlDelay}`);Z.push("")}if($.sitemap){let J=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let X of J)Z.push(`Sitemap: ${X}`)}if($.host)Z.push(`Host: ${$.host}`);return Z.join(`
2127
+ `).trim()}function yK($){return cJ({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function pJ($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}import iJ from"fs";import d0 from"path";async function xK($,Z){if(!$.webComponents?.enabled)return[];let J=$.webComponents.components||[],X=[];if(J.length>0){if($.debug)console.log(`Building ${J.length} web components...`);for(let Y of J)try{let Q=await nJ(Y,$,Z);if(Q)X.push(Q)}catch(Q){if(console.error(`Error building web component ${Y.name}:`,Q),$.debug)throw Q}}return X}async function nJ($,Z,J){let{name:X,file:Y,tag:Q,extends:G}=$;if(!X||!Y||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let z=null;if(d0.isAbsolute(Y)&&await a(Y))z=Y;else if(Z.componentsDir){let V=d0.join(Z.componentsDir,Y);if(await a(V))z=V}if(!z)z=await o2(Y,process.cwd(),Z,J);if(!z)return console.error(`Web component source file not found: ${Y}`),null;let q=await Bun.file(z).text();J.add(z);let W=($.outputFormat||"js")==="ts",U=W?oJ({name:X,tag:Q,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):sJ({name:X,tag:Q,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),H=Z.webComponents?.outputDir||"dist/web-components";await iJ.promises.mkdir(H,{recursive:!0});let j=W?"ts":"js",B=d0.join(H,`${Q}.${j}`);if(await Bun.write(B,U),Z.debug)console.log(`Built web component ${X} -> ${B}`);return B}function sJ($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:q=[]}=$,K=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)K=K.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),K=K.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),K=K.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),K=K.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let W="";if(z)W=`<link rel="stylesheet" href="${z}">`;return`/**
2123
2128
  * ${Z} Web Component
2124
2129
  * Auto-generated from stx component
2125
2130
  */
@@ -2211,13 +2216,13 @@ class ${Z.replace(/\W/g,"")} extends ${X} {
2211
2216
 
2212
2217
  // Register the web component
2213
2218
  customElements.define('${J}', ${Z.replace(/\W/g,"")})
2214
- `}function xJ($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:q=[],attributeTypes:K={}}=$,W=Z.replace(/\W/g,""),U=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)U=U.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),U=U.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),U=U.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),U=U.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");U=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let H=z?`<link rel="stylesheet" href="${z}">`:"",j=(R)=>{switch(K[R]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},B=(R)=>R.replace(/-([a-z])/g,(D,A)=>A.toUpperCase()),V=q.map((R)=>` private _${B(R)}: ${j(R)} | null = null;`).join(`
2215
- `),F=q.map((R)=>{let D=j(R),A=B(R);return`
2216
- get ${A}(): ${D} | null {
2219
+ `}function oJ($){let{name:Z,tag:J,baseElement:X="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:q=[],attributeTypes:K={}}=$,W=Z.replace(/\W/g,""),U=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)U=U.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),U=U.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),U=U.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),U=U.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");U=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let H=z?`<link rel="stylesheet" href="${z}">`:"",j=(R)=>{switch(K[R]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},B=(R)=>R.replace(/-([a-z])/g,(N,A)=>A.toUpperCase()),V=q.map((R)=>` private _${B(R)}: ${j(R)} | null = null;`).join(`
2220
+ `),F=q.map((R)=>{let N=j(R),A=B(R);return`
2221
+ get ${A}(): ${N} | null {
2217
2222
  return this._${A};
2218
2223
  }
2219
2224
 
2220
- set ${A}(value: ${D} | null) {
2225
+ set ${A}(value: ${N} | null) {
2221
2226
  this._${A} = value;
2222
2227
  if (value !== null) {
2223
2228
  this.setAttribute('${R}', String(value));
@@ -2230,7 +2235,7 @@ else {
2230
2235
  * Props interface for ${Z}
2231
2236
  */
2232
2237
  export interface ${W}Props {
2233
- ${q.map((R)=>{let D=j(R);return` ${B(R)}?: ${D};`}).join(`
2238
+ ${q.map((R)=>{let N=j(R);return` ${B(R)}?: ${N};`}).join(`
2234
2239
  `)}
2235
2240
  }
2236
2241
  `:"",O=q.length>0?`
@@ -2366,17 +2371,17 @@ declare global {
2366
2371
 
2367
2372
  // Register the web component
2368
2373
  customElements.define('${J}', ${W});
2369
- `}var U5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function H5($){let Z=$.split("").reduce((J,X)=>(J<<5)-J+X.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function gJ($,Z,J={}){let X={...U5,...J},Y=H5(Z);switch(X.strategy){case"shadow":return $;case"prefix":return uJ($,X.prefix||Z,X.preserveOriginal);case"attribute":return hJ($,Y,X.attributeName||"data-v",X.preserveOriginal);case"bem":return dJ($,Z,X.preserveOriginal);default:return $}}function hJ($,Z,J,X){let Y=`[${J}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,z)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${X?`${G}${Y}`:`${G}${Y}`}${z}`})}function uJ($,Z,J){return $.replace(/\.([a-z_][\w-]*)/gi,(X,Y)=>{if(Y.startsWith(Z))return X;let Q=`${Z}__${Y}`;return J?`.${Q}`:`.${Q}`})}function dJ($,Z,J){let X=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Y,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(X))return`.${X}__${Q}`;return Y}let G=`${X}__${Q}`;return J?`.${G}`:`.${G}`})}function mJ($,Z,J={}){let X={...U5,...J};if(X.strategy==="shadow")return $;if(X.strategy==="attribute"){let Y=H5(Z),G=`${X.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(z,q,K)=>{if(/^(?:script|style|!--)$/i.test(q))return z;let W=K.trimEnd().endsWith("/"),U=W?K.slice(0,-1):K;return`<${q}${U} ${G}${W?"/":""}>`})}if(X.strategy==="prefix"||X.strategy==="bem"){let Y=X.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):X.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((q)=>{if(!q)return q;if(q.startsWith(Y))return q;return`${Y}__${q}`}).join(" ")}"`})}return $}function NK($,Z={}){let J={...U5,...Z},X=H5($);return`${J.attributeName||"data-v"}-${X}`}function AK($,Z,J={}){let X="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,z,q)=>{if(/\bscoped\b/i.test(z)||J.strategy!=="shadow")X+=`${gJ(q,Z,J)}
2374
+ `}var j5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function B5($){let Z=$.split("").reduce((J,X)=>(J<<5)-J+X.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function rJ($,Z,J={}){let X={...j5,...J},Y=B5(Z);switch(X.strategy){case"shadow":return $;case"prefix":return tJ($,X.prefix||Z,X.preserveOriginal);case"attribute":return aJ($,Y,X.attributeName||"data-v",X.preserveOriginal);case"bem":return eJ($,Z,X.preserveOriginal);default:return $}}function aJ($,Z,J,X){let Y=`[${J}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,z)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${X?`${G}${Y}`:`${G}${Y}`}${z}`})}function tJ($,Z,J){return $.replace(/\.([a-z_][\w-]*)/gi,(X,Y)=>{if(Y.startsWith(Z))return X;let Q=`${Z}__${Y}`;return J?`.${Q}`:`.${Q}`})}function eJ($,Z,J){let X=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Y,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(X))return`.${X}__${Q}`;return Y}let G=`${X}__${Q}`;return J?`.${G}`:`.${G}`})}function $X($,Z,J={}){let X={...j5,...J};if(X.strategy==="shadow")return $;if(X.strategy==="attribute"){let Y=B5(Z),G=`${X.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(z,q,K)=>{if(/^(?:script|style|!--)$/i.test(q))return z;let W=K.trimEnd().endsWith("/"),U=W?K.slice(0,-1):K;return`<${q}${U} ${G}${W?"/":""}>`})}if(X.strategy==="prefix"||X.strategy==="bem"){let Y=X.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):X.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((q)=>{if(!q)return q;if(q.startsWith(Y))return q;return`${Y}__${q}`}).join(" ")}"`})}return $}function gK($,Z={}){let J={...j5,...Z},X=B5($);return`${J.attributeName||"data-v"}-${X}`}function hK($,Z,J={}){let X="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,z,q)=>{if(/\bscoped\b/i.test(z)||J.strategy!=="shadow")X+=`${rJ(q,Z,J)}
2370
2375
  `;else X+=`${q}
2371
- `;return""});return{html:mJ(Y,Z,J),css:X.trim()}}function P1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function MK($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:q={},events:K={},methods:W={},state:U={}}=$,H=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((T)=>z[T].attribute!==!1).map((T)=>z[T].attribute||P1(T)),V=j.map((T)=>{let N=z[T],I=N.default!==void 0?JSON.stringify(N.default):N.type==="string"?'""':N.type==="number"?"0":N.type==="boolean"?"false":N.type==="array"?"[]":"{}";return` this._${T} = ${I};`}).join(`
2372
- `),F=j.map((T)=>{let N=z[T],I=N.attribute!==!1?N.attribute||P1(T):null,k=N.reflect&&I?`
2376
+ `;return""});return{html:$X(Y,Z,J),css:X.trim()}}function P1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function uK($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:q={},events:K={},methods:W={},state:U={}}=$,H=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((T)=>z[T].attribute!==!1).map((T)=>z[T].attribute||P1(T)),V=j.map((T)=>{let D=z[T],M=D.default!==void 0?JSON.stringify(D.default):D.type==="string"?'""':D.type==="number"?"0":D.type==="boolean"?"false":D.type==="array"?"[]":"{}";return` this._${T} = ${M};`}).join(`
2377
+ `),F=j.map((T)=>{let D=z[T],M=D.attribute!==!1?D.attribute||P1(T):null,k=D.reflect&&M?`
2373
2378
  if (value !== null && value !== undefined) {
2374
- ${N.type==="boolean"?`if (value) { this.setAttribute('${I}', ''); }
2375
- else { this.removeAttribute('${I}'); }`:`this.setAttribute('${I}', ${N.type==="object"||N.type==="array"?"JSON.stringify(value)":"String(value)"});`}
2379
+ ${D.type==="boolean"?`if (value) { this.setAttribute('${M}', ''); }
2380
+ else { this.removeAttribute('${M}'); }`:`this.setAttribute('${M}', ${D.type==="object"||D.type==="array"?"JSON.stringify(value)":"String(value)"});`}
2376
2381
  }
2377
2382
  else {
2378
- this.removeAttribute('${I}');
2379
- }`:"",M=N.observer?`this.${N.observer}(value, oldValue);`:"",y=N.render!==!1?"this._scheduleRender();":"";return`
2383
+ this.removeAttribute('${M}');
2384
+ }`:"",I=D.observer?`this.${D.observer}(value, oldValue);`:"",y=D.render!==!1?"this._scheduleRender();":"";return`
2380
2385
  get ${T}() {
2381
2386
  return this._${T};
2382
2387
  }
@@ -2385,7 +2390,7 @@ else {
2385
2390
  const oldValue = this._${T};
2386
2391
  if (oldValue === value) return;
2387
2392
  this._${T} = value;${k}
2388
- ${M}
2393
+ ${I}
2389
2394
  ${y}
2390
2395
  this.dispatchEvent(new CustomEvent('${T}-changed', {
2391
2396
  detail: { value, oldValue },
@@ -2405,12 +2410,12 @@ else {
2405
2410
  this[propName] = this._deserializeAttribute(newValue, propDef.type);
2406
2411
  }
2407
2412
  ${q.attributeChanged||""}
2408
- }`:"",O=Object.entries(K).map(([T,N])=>{return`this._root.addEventListener('${T}', (e) => { ${N} });`}).join(`
2409
- `),L=Object.entries(W).map(([T,N])=>{return`
2413
+ }`:"",O=Object.entries(K).map(([T,D])=>{return`this._root.addEventListener('${T}', (e) => { ${D} });`}).join(`
2414
+ `),L=Object.entries(W).map(([T,D])=>{return`
2410
2415
  ${T}() {
2411
- ${N}
2416
+ ${D}
2412
2417
  }`}).join(`
2413
- `),w=JSON.stringify(Object.fromEntries(j.map((T)=>[T,z[T]]))),R=JSON.stringify(Object.fromEntries(j.filter((T)=>z[T].attribute!==!1).map((T)=>[z[T].attribute||P1(T),T]))),D=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),A=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2418
+ `),w=JSON.stringify(Object.fromEntries(j.map((T)=>[T,z[T]]))),R=JSON.stringify(Object.fromEntries(j.filter((T)=>z[T].attribute!==!1).map((T)=>[z[T].attribute||P1(T),T]))),N=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),A=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2414
2419
  * ${Z} - Reactive Web Component
2415
2420
  * Auto-generated with reactive properties and lifecycle management
2416
2421
  *
@@ -2488,7 +2493,7 @@ ${F}
2488
2493
  * Render the component template
2489
2494
  */
2490
2495
  _render() {
2491
- const template = \`${A?`<style>${A}</style>`:""}${D}\`;
2496
+ const template = \`${A?`<style>${A}</style>`:""}${N}\`;
2492
2497
 
2493
2498
  // Interpolate template with property values
2494
2499
  const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, propName) => {
@@ -2570,12 +2575,12 @@ customElements.define('${J}', ${H});
2570
2575
  // Export for module usage
2571
2576
  export { ${H} };
2572
2577
  export default ${H};
2573
- `}function IK($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:q={},events:K={},methods:W={},state:U={}}=$,H=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((N)=>z[N].attribute!==!1).map((N)=>z[N].attribute||P1(N)),V=(N)=>{switch(N){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";case"array":return"unknown[]";default:return"unknown"}},F=j.length>0?`
2578
+ `}function dK($){let{name:Z,tag:J,baseElement:X="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:q={},events:K={},methods:W={},state:U={}}=$,H=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((D)=>z[D].attribute!==!1).map((D)=>z[D].attribute||P1(D)),V=(D)=>{switch(D){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";case"array":return"unknown[]";default:return"unknown"}},F=j.length>0?`
2574
2579
  /**
2575
2580
  * Props interface for ${Z}
2576
2581
  */
2577
2582
  export interface ${H}Props {
2578
- ${j.map((N)=>` ${N}?: ${V(z[N].type)};`).join(`
2583
+ ${j.map((D)=>` ${D}?: ${V(z[D].type)};`).join(`
2579
2584
  `)}
2580
2585
  }
2581
2586
  `:"",_=Object.keys(U).length>0?`
@@ -2583,33 +2588,33 @@ ${j.map((N)=>` ${N}?: ${V(z[N].type)};`).join(`
2583
2588
  * State interface for ${Z}
2584
2589
  */
2585
2590
  export interface ${H}State {
2586
- ${Object.entries(U).map(([N,I])=>` ${N}: ${typeof I};`).join(`
2591
+ ${Object.entries(U).map(([D,M])=>` ${D}: ${typeof M};`).join(`
2587
2592
  `)}
2588
2593
  }
2589
2594
  `:`
2590
2595
  export interface ${H}State {
2591
2596
  [key: string]: unknown;
2592
2597
  }
2593
- `,O=j.map((N)=>{let I=z[N],k=V(I.type);return` private _${N}: ${k};`}).join(`
2594
- `),L=j.map((N)=>{let I=z[N],k=V(I.type),M=I.attribute!==!1?I.attribute||P1(N):null,y=I.default!==void 0?JSON.stringify(I.default):I.type==="string"?'""':I.type==="number"?"0":I.type==="boolean"?"false":I.type==="array"?"[]":"{}",E=I.reflect&&M?`
2598
+ `,O=j.map((D)=>{let M=z[D],k=V(M.type);return` private _${D}: ${k};`}).join(`
2599
+ `),L=j.map((D)=>{let M=z[D],k=V(M.type),I=M.attribute!==!1?M.attribute||P1(D):null,y=M.default!==void 0?JSON.stringify(M.default):M.type==="string"?'""':M.type==="number"?"0":M.type==="boolean"?"false":M.type==="array"?"[]":"{}",E=M.reflect&&I?`
2595
2600
  if (value !== null && value !== undefined) {
2596
- ${I.type==="boolean"?`if (value) { this.setAttribute('${M}', ''); }
2597
- else { this.removeAttribute('${M}'); }`:`this.setAttribute('${M}', ${I.type==="object"||I.type==="array"?"JSON.stringify(value)":"String(value)"});`}
2601
+ ${M.type==="boolean"?`if (value) { this.setAttribute('${I}', ''); }
2602
+ else { this.removeAttribute('${I}'); }`:`this.setAttribute('${I}', ${M.type==="object"||M.type==="array"?"JSON.stringify(value)":"String(value)"});`}
2598
2603
  }
2599
2604
  else {
2600
- this.removeAttribute('${M}');
2601
- }`:"",b=I.observer?`this.${I.observer}(value, oldValue);`:"",C=I.render!==!1?"this._scheduleRender();":"";return`
2602
- get ${N}(): ${k} {
2603
- return this._${N};
2605
+ this.removeAttribute('${I}');
2606
+ }`:"",b=M.observer?`this.${M.observer}(value, oldValue);`:"",C=M.render!==!1?"this._scheduleRender();":"";return`
2607
+ get ${D}(): ${k} {
2608
+ return this._${D};
2604
2609
  }
2605
2610
 
2606
- set ${N}(value: ${k}) {
2607
- const oldValue = this._${N};
2611
+ set ${D}(value: ${k}) {
2612
+ const oldValue = this._${D};
2608
2613
  if (oldValue === value) return;
2609
- this._${N} = value;${E}
2614
+ this._${D} = value;${E}
2610
2615
  ${b}
2611
2616
  ${C}
2612
- this.dispatchEvent(new CustomEvent('${N}-changed', {
2617
+ this.dispatchEvent(new CustomEvent('${D}-changed', {
2613
2618
  detail: { value, oldValue },
2614
2619
  bubbles: true
2615
2620
  }));
@@ -2618,7 +2623,7 @@ else {
2618
2623
  // Property default: ${y}`}).join(`
2619
2624
  `),w=B.length>0?`
2620
2625
  static get observedAttributes(): string[] {
2621
- return [${B.map((N)=>`'${N}'`).join(", ")}];
2626
+ return [${B.map((D)=>`'${D}'`).join(", ")}];
2622
2627
  }
2623
2628
 
2624
2629
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
@@ -2629,10 +2634,10 @@ else {
2629
2634
  (this as unknown as Record<string, unknown>)[propName] = this._deserializeAttribute(newValue, propDef.type);
2630
2635
  }
2631
2636
  ${q.attributeChanged||""}
2632
- }`:"",R=Object.entries(K).map(([N,I])=>{return`this._root.addEventListener('${N}', (e: Event) => { ${I} });`}).join(`
2633
- `),D=Object.entries(W).map(([N,I])=>{return`
2634
- ${N}(): void {
2635
- ${I}
2637
+ }`:"",R=Object.entries(K).map(([D,M])=>{return`this._root.addEventListener('${D}', (e: Event) => { ${M} });`}).join(`
2638
+ `),N=Object.entries(W).map(([D,M])=>{return`
2639
+ ${D}(): void {
2640
+ ${M}
2636
2641
  }`}).join(`
2637
2642
  `),A=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),T=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2638
2643
  * ${Z} - Reactive Web Component (TypeScript)
@@ -2662,7 +2667,7 @@ interface PropertyDefinition {
2662
2667
  export class ${H} extends ${X} {
2663
2668
  // Property definitions
2664
2669
  private _propertyDefs: Record<string, PropertyDefinition> = ${JSON.stringify(z)};
2665
- private _attrToProp: Record<string, string> = ${JSON.stringify(Object.fromEntries(j.filter((N)=>z[N].attribute!==!1).map((N)=>[z[N].attribute||P1(N),N])))};
2670
+ private _attrToProp: Record<string, string> = ${JSON.stringify(Object.fromEntries(j.filter((D)=>z[D].attribute!==!1).map((D)=>[z[D].attribute||P1(D),D])))};
2666
2671
 
2667
2672
  // Internal state
2668
2673
  private _state: ${H}State = ${JSON.stringify(U)};
@@ -2679,7 +2684,7 @@ ${O}
2679
2684
  this._root = ${G?"this.shadowRoot!":"this"};
2680
2685
 
2681
2686
  // Initialize properties with defaults
2682
- ${j.map((N)=>{let I=z[N],k=I.default!==void 0?JSON.stringify(I.default):I.type==="string"?'""':I.type==="number"?"0":I.type==="boolean"?"false":I.type==="array"?"[]":"{}";return` this._${N} = ${k};`}).join(`
2687
+ ${j.map((D)=>{let M=z[D],k=M.default!==void 0?JSON.stringify(M.default):M.type==="string"?'""':M.type==="number"?"0":M.type==="boolean"?"false":M.type==="array"?"[]":"{}";return` this._${D} = ${k};`}).join(`
2683
2688
  `)}
2684
2689
 
2685
2690
  // Initial render
@@ -2808,7 +2813,7 @@ ${w}
2808
2813
  // =========================================================================
2809
2814
  // Custom Methods
2810
2815
  // =========================================================================
2811
- ${D}
2816
+ ${N}
2812
2817
  }
2813
2818
 
2814
2819
  // Type augmentation for HTMLElementTagNameMap
@@ -2822,7 +2827,7 @@ declare global {
2822
2827
  customElements.define('${J}', ${H});
2823
2828
 
2824
2829
  export default ${H};
2825
- `}function TK(){return`/**
2830
+ `}function mK(){return`/**
2826
2831
  * ReactiveElement Mixin
2827
2832
  * Adds reactive properties and lifecycle management to web components
2828
2833
  */
@@ -2944,7 +2949,7 @@ else {
2944
2949
 
2945
2950
  export { ReactiveElement };
2946
2951
  export default ReactiveElement;
2947
- `}function kK(){return`/**
2952
+ `}function lK(){return`/**
2948
2953
  * stx Reactive Web Components Runtime
2949
2954
  * Provides base classes and utilities for reactive web components
2950
2955
  */
@@ -3161,7 +3166,7 @@ else {
3161
3166
  };
3162
3167
 
3163
3168
  })(typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this);
3164
- `}function lJ($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=J?J[1].trim():"",Y=Z,Q=[],G=!0;if(X){let U=X.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let H=U[1],j=H.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Y=j[1];let B=H.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let V=H.match(/shadowDOM\s*:\s*(true|false)/);if(V)G=V[1]==="true"}catch{}}let z=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=z?z[1].trim():"",K=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=K?K[1].trim():"";return{tag:Y,props:Q,template:q,styles:W,script:X,shadowDOM:G}}function cJ($){let{tag:Z,props:J,template:X,styles:Y,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),z=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),K=J.map((U)=>`'${U}'`).join(", "),W=J.map((U)=>`
3169
+ `}function ZX($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=J?J[1].trim():"",Y=Z,Q=[],G=!0;if(X){let U=X.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let H=U[1],j=H.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Y=j[1];let B=H.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let V=H.match(/shadowDOM\s*:\s*(true|false)/);if(V)G=V[1]==="true"}catch{}}let z=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=z?z[1].trim():"",K=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=K?K[1].trim():"";return{tag:Y,props:Q,template:q,styles:W,script:X,shadowDOM:G}}function JX($){let{tag:Z,props:J,template:X,styles:Y,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),z=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),K=J.map((U)=>`'${U}'`).join(", "),W=J.map((U)=>`
3165
3170
  get ${U}() {
3166
3171
  return this.getAttribute('${U}') || '';
3167
3172
  }
@@ -3212,14 +3217,14 @@ ${W}
3212
3217
  }
3213
3218
 
3214
3219
  customElements.define('${Z}', ${G});
3215
- `}async function Y7($,Z,J,X){if(Z.length<1)return X0("WebComponent","@webcomponent directive requires at least the tag name parameter",J0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=d0.isAbsolute(G)?[d0.join(G,`${Y}.stx`),d0.join(d0.dirname(X),`${Y}.stx`)]:[d0.join(d0.dirname(X),G,`${Y}.stx`),d0.join(process.cwd(),G,`${Y}.stx`),d0.join(d0.dirname(X),`${Y}.stx`)],q=null;for(let U of z)if(await a(U)){q=await Bun.file(U).text();break}if(!q)return X0("WebComponent",`Component file not found: ${Y}.stx`,J0.FILE_NOT_FOUND);let K=lJ(q,Y);return`<script type="module">
3216
- ${cJ(K)}
3217
- </script>`}var j5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:q7,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:C3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Y7,hasEndTag:!1,description:"Include a web component in the template"},G7,z7,K5,W5,p9,n9,s9,i9,k3,L3,c3,q5,...j7],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,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 iJ($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=b0.join(Y,"resources","views"),G=b0.join(Y,"resources","layouts");if(t2.existsSync(Q)&&t2.existsSync(G))return{root:"resources",pagesDir:"views"};let z=b0.join(Y,"resources","views","pages");if(t2.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var Q7=new Set,e2=["partialsDir","componentsDir","layoutsDir"],B5=new WeakMap;function nJ($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function sJ($,Z){let J=!$.root,X=iJ($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!Q7.has(Y))Q7.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!B5.has($)){let Y={};for(let Q of e2){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}B5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of e2){let G=$[Q];if(typeof G!=="string"||!G)continue;if(b0.isAbsolute(G)||nJ(G,Y))continue;$[Q]=b0.join(Y,G)}}for(let Y of e2){let Q=$[Y];if(typeof Q!=="string"||!Q||b0.isAbsolute(Q))continue;$[Y]=b0.resolve(Z,Q)}return $}function oJ($,Z){let J=B5.get($);for(let X of e2){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=b0.isAbsolute(Y)?Y:b0.join(Z,Y);if(t2.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,q=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(q?`, resolved under root "${z}".`:"."))}}function rJ($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function aJ($){if(K7($.stateDir),$.stateDir=W7(),$.cachePath=W2($.cachePath),$.build)$.build.cacheDir=W2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=W2($.media.cache.directory);if($.story)$.story.outDir=W2($.story.outDir)}var G1=null,L1=new Map,o2=new Map,U2=null;async function V5($){let Z=$?b0.resolve($):process.cwd(),J=o2.get(Z);if(J&&J.signature!==r2(J.graph)){let Q=L1.get(Z);if(L1.delete(Z),o2.delete(Z),!$)G1=null,U2=null;let{clearComponentCache:G}=await import("./chunk-a87jqtmd.js"),{partialsCache:z}=await import("./chunk-n99ajrwv.js");if(G(),z.clear(),Q&&J.configSignature===a2(J.graph)){let q=Q.then(async(K)=>{let W={...J.graph};await H7(W,Z),o2.set(Z,{graph:W,signature:r2(W),configSignature:a2(W)});let U={...K,_layerGraph:W};if(!$)G1=U;return U});return L1.set(Z,q),q}}if(!$){if(G1)return G1;if(U2)return U2}let X=L1.get(Z);if(X)return X;let Y=(async()=>{let G=(await pJ({name:"stx",alias:"ui",cwd:Z,defaultConfig:j5,verbose:!1})).config;if(G.extends!==void 0||J){let z=await U7(Z,j5);G=z.config,o2.set(Z,{graph:z.graph,signature:r2(z.graph),configSignature:a2(z.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:z}=await import("./chunk-7gqbr8nr.js");z(G.runtimeConfig,{});let{generateRuntimeConfigTypes:q}=await import("./chunk-zs95z9tf.js");await q(Z,G.runtimeConfig)}if(rJ(G),aJ(G),sJ(G,Z),oJ(G,Z),G.plugins&&G.plugins.length>0){let{pluginManager:z}=await import("./chunk-ghw5p1yk.js"),q=[],K=[];for(let W of G.plugins){let U=typeof W==="string"?W:W[0],H=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(U),B=b0.dirname(x.resolve(U))}catch{let F=b0.resolve(Z,U);j=await import(F),B=b0.dirname(F)}let V=j.default||j;if(!z.has(V.name))await z.register(V,G);if(V.components){let F=Array.isArray(V.components)?V.components:[V.components];for(let _ of F)q.push(b0.resolve(B,_))}if(V.pages){let F=b0.resolve(B,V.pages),_=H.path||"/";K.push({dir:F,prefix:_})}if(V.setup){let F={addDirective:(_)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(_)},addRoute:(_,O)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[_]=O},addMiddleware:(_)=>{G.middleware=G.middleware||[],G.middleware.push(_)},pluginDir:B,config:G};await V.setup(H,F)}console.log(`[stx] Plugin loaded: ${V.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}G._pluginComponentDirs=q,G._pluginPageDirs=K}return G})();if(L1.set(Z,Y),Y.catch(()=>{if(L1.get(Z)===Y)L1.delete(Z)}),!$)U2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var B7=new Proxy(j5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!U2)V5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function pK($){return $}function iK($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var L5=new Map;async function $X($,Z={}){try{if(!await a($))throw Error(`Markdown file not found: ${$}`);let X=(await tJ.promises.stat($)).mtime.getTime();if(Z.cache&&L5.has($)){let U=L5.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=b3(Y),z=Z.markdown||B7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},K=z2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)K=await ZX(K,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:K,data:Q||{}};if(Z.cache)L5.set($,{...W,updatedAt:X});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:H0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var $9=null;async function ZX($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!$9)try{$9=await eJ({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,q,K,W)=>{let U=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),H=K||(J?"text":"");if(!H)return z;try{if(!$9.getSupportedLanguages().includes(H))return z;return(await $9.highlight(U,H,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${K}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[q,K,W,U]=z,H=await Y(q,K,W,U);Q=Q.replace(q,H)}return Q}async function V7($,Z,J="",X={}){return await JX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,q,K)=>{try{let W=z;if(!_5.isAbsolute(z))W=_5.resolve(_5.dirname(J),z);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of O){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),D=L.substring(w+1).trim(),A=D.startsWith('"')&&D.endsWith('"'),T=D.startsWith("'")&&D.endsWith("'");if(A||T)D=D.substring(1,D.length-1);U[R]=D}}}}catch(_){if(X.debug)console.error("Error parsing context in @markdown-file directive:",_)}let{content:H,data:j}=await $X(W,X),B={...Z,...j,...U},V=H,F=/\{\{([^}]+)\}\}/g;return V=V.replace(F,(_,O)=>{let L=O.trim();return B[L]!==void 0?String(B[L]):_}),V}catch(W){let U=W instanceof Error?W.message:String(W);return H0("Markdown File",`Error including markdown file: ${U}`,J,$,K,G)}})}async function JX($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],q=Y.index,K=Y;X.push(J(...K).then((W)=>({match:z,replacement:W,index:q})))}let Q=await Promise.all(X);Q.sort((z,q)=>q.index-z.index);let G=$;for(let{match:z,replacement:q}of Q)G=G.replace(z,()=>q);return G}function z1($,Z){try{let J=$.trim();if(q0(J))return W0(J,Object.keys(Z))(...Object.values(Z));else return e(J,Z)}catch{return!1}}class Z9{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,J=this.column,X=this.source[this.pos];if(/\s/.test(X))return this.readWhitespace($,Z,J);if(X==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,J);if(X==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,J);if(X==='"'||X==="'")return this.readString(X,$,Z,J);if(X==="`")return this.readTemplateString($,Z,J);if(/\d/.test(X)||X==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,J);if(/[a-z_$]/i.test(X))return this.readIdentifier($,Z,J);if(X==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:J}}if(X==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:J}}if(X==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:J};if(X==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,J);let Y=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of Y)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:J};if(/[+\-*/%<>=!&|^~?:]/.test(X))return this.advance(),{type:"OPERATOR",value:X,start:$,end:this.pos,line:Z,column:J};if(/[()[\]{},;.]/.test(X))return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J};return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J}}readWhitespace($,Z,J){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readLineComment($,Z,J){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
3220
+ `}async function U7($,Z,J,X){if(Z.length<1)return X0("WebComponent","@webcomponent directive requires at least the tag name parameter",J0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",z=d0.isAbsolute(G)?[d0.join(G,`${Y}.stx`),d0.join(d0.dirname(X),`${Y}.stx`)]:[d0.join(d0.dirname(X),G,`${Y}.stx`),d0.join(process.cwd(),G,`${Y}.stx`),d0.join(d0.dirname(X),`${Y}.stx`)],q=null;for(let U of z)if(await a(U)){q=await Bun.file(U).text();break}if(!q)return X0("WebComponent",`Component file not found: ${Y}.stx`,J0.FILE_NOT_FOUND);let K=ZX(q,Y);return`<script type="module">
3221
+ ${JX(K)}
3222
+ </script>`}var V5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:V7,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:x3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:U7,hasEndTag:!1,description:"Include a web component in the template"},j7,B7,U5,H5,n9,o9,r9,s9,S3,N3,o3,W5,...w7],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,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 YX($,Z,J){let X=Z||"pages";if($)return{root:$,pagesDir:X};let Y=J||process.cwd(),Q=b0.join(Y,"resources","views"),G=b0.join(Y,"resources","layouts");if(e2.existsSync(Q)&&e2.existsSync(G))return{root:"resources",pagesDir:"views"};let z=b0.join(Y,"resources","views","pages");if(e2.existsSync(z))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}var H7=new Set,$9=["partialsDir","componentsDir","layoutsDir"],_5=new WeakMap;function QX($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let X=$.replace(/\\/g,"/"),Y=J.replace(/\\/g,"/");return X===Y||X.startsWith(`${Y}/`)}function GX($,Z){let J=!$.root,X=YX($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,J&&X.root!=="."){let Y=`${Z}::${X.root}`;if(!H7.has(Y))H7.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!_5.has($)){let Y={};for(let Q of $9){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}_5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of $9){let G=$[Q];if(typeof G!=="string"||!G)continue;if(b0.isAbsolute(G)||QX(G,Y))continue;$[Q]=b0.join(Y,G)}}for(let Y of $9){let Q=$[Y];if(typeof Q!=="string"||!Q||b0.isAbsolute(Q))continue;$[Y]=b0.resolve(Z,Q)}return $}function zX($,Z){let J=_5.get($);for(let X of $9){let Y=$[X];if(typeof Y!=="string"||!Y)continue;let Q=b0.isAbsolute(Y)?Y:b0.join(Z,Y);if(e2.existsSync(Q))continue;let G=J?.[X]??Y,z=$.root,q=!!z&&z!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(q?`, resolved under root "${z}".`:"."))}}function qX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function KX($){if(_7($.stateDir),$.stateDir=L7(),$.cachePath=U2($.cachePath),$.build)$.build.cacheDir=U2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=U2($.media.cache.directory);if($.story)$.story.outDir=U2($.story.outDir)}var G1=null,L1=new Map,r2=new Map,H2=null;async function L5($){let Z=$?b0.resolve($):process.cwd(),J=r2.get(Z);if(J&&J.signature!==a2(J.graph)){let Q=L1.get(Z);if(L1.delete(Z),r2.delete(Z),!$)G1=null,H2=null;let{clearComponentCache:G}=await import("./chunk-ba5t40dx.js"),{partialsCache:z}=await import("./chunk-6dmrpd71.js");if(G(),z.clear(),Q&&J.configSignature===t2(J.graph)){let q=Q.then(async(K)=>{let W={...J.graph};await F7(W,Z),r2.set(Z,{graph:W,signature:a2(W),configSignature:t2(W)});let U={...K,_layerGraph:W};if(!$)G1=U;return U});return L1.set(Z,q),q}}if(!$){if(G1)return G1;if(H2)return H2}let X=L1.get(Z);if(X)return X;let Y=(async()=>{let G=(await XX({name:"stx",alias:"ui",cwd:Z,defaultConfig:V5,verbose:!1})).config;if(G.extends!==void 0||J){let z=await O7(Z,V5);G=z.config,r2.set(Z,{graph:z.graph,signature:a2(z.graph),configSignature:t2(z.graph)})}if(G.runtimeConfig){let{resolveRuntimeConfig:z}=await import("./chunk-zr1r73p3.js");z(G.runtimeConfig,{});let{generateRuntimeConfigTypes:q}=await import("./chunk-0wwgr4wv.js");await q(Z,G.runtimeConfig)}if(qX(G),KX(G),GX(G,Z),zX(G,Z),G.plugins&&G.plugins.length>0){let{pluginManager:z}=await import("./chunk-wm86mmgq.js"),q=[],K=[];for(let W of G.plugins){let U=typeof W==="string"?W:W[0],H=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(U),B=b0.dirname(x.resolve(U))}catch{let F=b0.resolve(Z,U);j=await import(F),B=b0.dirname(F)}let V=j.default||j;if(!z.has(V.name))await z.register(V,G);if(V.components){let F=Array.isArray(V.components)?V.components:[V.components];for(let _ of F)q.push(b0.resolve(B,_))}if(V.pages){let F=b0.resolve(B,V.pages),_=H.path||"/";K.push({dir:F,prefix:_})}if(V.setup){let F={addDirective:(_)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(_)},addRoute:(_,O)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[_]=O},addMiddleware:(_)=>{G.middleware=G.middleware||[],G.middleware.push(_)},pluginDir:B,config:G};await V.setup(H,F)}console.log(`[stx] Plugin loaded: ${V.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}G._pluginComponentDirs=q,G._pluginPageDirs=K}return G})();if(L1.set(Z,Y),Y.catch(()=>{if(L1.get(Z)===Y)L1.delete(Z)}),!$)H2=Y,Y.then((Q)=>{G1=Q}).catch(()=>{});return Y}var R7=new Proxy(V5,{get($,Z){if(G1&&Z in G1)return G1[Z];if(!H2)L5().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}});function GW($){return $}function zW($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Y)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var F5=new Map;async function HX($,Z={}){try{if(!await a($))throw Error(`Markdown file not found: ${$}`);let X=(await WX.promises.stat($)).mtime.getTime();if(Z.cache&&F5.has($)){let U=F5.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=v3(Y),z=Z.markdown||R7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},K=q2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)K=await jX(K,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:K,data:Q||{}};if(Z.cache)F5.set($,{...W,updatedAt:X});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let X=J instanceof Error?J.message:String(J);return{content:H0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}var Z9=null;async function jX($,Z,J){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Z9)try{Z9=await UX({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,q,K,W)=>{let U=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),H=K||(J?"text":"");if(!H)return z;try{if(!Z9.getSupportedLanguages().includes(H))return z;return(await Z9.highlight(U,H,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${K}:`,j)}return z},Q=$,G=$.matchAll(X);for(let z of G){let[q,K,W,U]=z,H=await Y(q,K,W,U);Q=Q.replace(q,H)}return Q}async function N7($,Z,J="",X={}){return await BX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,q,K)=>{try{let W=z;if(!O5.isAbsolute(z))W=O5.resolve(O5.dirname(J),z);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of O){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),N=L.substring(w+1).trim(),A=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(A||T)N=N.substring(1,N.length-1);U[R]=N}}}}catch(_){if(X.debug)console.error("Error parsing context in @markdown-file directive:",_)}let{content:H,data:j}=await HX(W,X),B={...Z,...j,...U},V=H,F=/\{\{([^}]+)\}\}/g;return V=V.replace(F,(_,O)=>{let L=O.trim();return B[L]!==void 0?String(B[L]):_}),V}catch(W){let U=W instanceof Error?W.message:String(W);return H0("Markdown File",`Error including markdown file: ${U}`,J,$,K,G)}})}async function BX($,Z,J){let X=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],q=Y.index,K=Y;X.push(J(...K).then((W)=>({match:z,replacement:W,index:q})))}let Q=await Promise.all(X);Q.sort((z,q)=>q.index-z.index);let G=$;for(let{match:z,replacement:q}of Q)G=G.replace(z,()=>q);return G}function z1($,Z){try{let J=$.trim();if(W0(J))return K0(J,Object.keys(Z))(...Object.values(Z));else return e(J,Z)}catch{return!1}}class J9{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,J=this.column,X=this.source[this.pos];if(/\s/.test(X))return this.readWhitespace($,Z,J);if(X==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,J);if(X==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,J);if(X==='"'||X==="'")return this.readString(X,$,Z,J);if(X==="`")return this.readTemplateString($,Z,J);if(/\d/.test(X)||X==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,J);if(/[a-z_$]/i.test(X))return this.readIdentifier($,Z,J);if(X==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:J}}if(X==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:J};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:J}}if(X==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:J};if(X==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,J);let Y=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of Y)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:J};if(/[+\-*/%<>=!&|^~?:]/.test(X))return this.advance(),{type:"OPERATOR",value:X,start:$,end:this.pos,line:Z,column:J};if(/[()[\]{},;.]/.test(X))return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J};return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:J}}readWhitespace($,Z,J){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readLineComment($,Z,J){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
3218
3223
  `)this.advance();return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readBlockComment($,Z,J){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readString($,Z,J,X){this.advance();while(this.pos<this.source.length){let Y=this.source[this.pos];if(Y==="\\"){this.advance(2);continue}if(Y===$){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Z,this.pos),start:Z,end:this.pos,line:J,column:X}}readTemplateString($,Z,J){this.advance();let X=0,Y=256;while(this.pos<this.source.length){let Q=this.source[this.pos];if(Q==="\\"){this.advance(2);continue}if(Q==="$"&&this.peek(1)==="{"){if(X>=Y){this.pos=this.source.length;break}this.advance(2),X++;continue}if(Q==="{"&&X>0){X++,this.advance();continue}if(Q==="}"&&X>0){X--,this.advance();continue}if(Q==="`"&&X===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readNumber($,Z,J){if(this.source[this.pos]==="0"){let X=this.peek(1)?.toLowerCase();if(X==="x"||X==="o"||X==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readIdentifier($,Z,J){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}readDirective($,Z,J){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:J}}advance($=1){for(let Z=0;Z<$&&this.pos<this.source.length;Z++){if(this.source[this.pos]===`
3219
- `)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function L0($,Z,J,X=0){let Y=0,Q=X,G=null,z=0,q=!1;while(Q<$.length){let K=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&K==="\\"){q=!0,Q++;continue}if(q=!1,(K==='"'||K==="'"||K==="`")&&!G){G=K,Q++;continue}if(K===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&K==="$"&&$[Q+1]==="{"){z++,Q+=2;continue}if(z>0&&K==="}"){z--,Q++;continue}if(K==="`"&&G==="`"&&z===0){G=null,Q++;continue}if(G){Q++;continue}if(K===Z)Y++;else if(K===J){if(Y--,Y===0)return Q}Q++}return-1}function _7($,Z){let J=Z,X={paren:0,bracket:0,brace:0},Y=null,Q=0;while(J<$.length){let G=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((G==='"'||G==="'")&&!Y){Y=G,J++;continue}if(G===Y&&Y!=="`"){Y=null,J++;continue}if(G==="`"&&!Y){Y="`",J++;continue}if(G==="`"&&Y==="`"&&Q===0){Y=null,J++;continue}if(Y==="`"&&G==="$"&&$[J+1]==="{"){Q++,J+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;J++;continue}if(Y){J++;continue}if(X.paren===0&&X.bracket===0&&X.brace===0){if($.slice(J,J+2)==="}}"||$.slice(J,J+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")X.paren++;else if(G===")"){if(X.paren--,X.paren<0)break}else if(G==="[")X.bracket++;else if(G==="]"){if(X.bracket--,X.bracket<0)break}else if(G==="{")X.brace++;else if(G==="}"){if(X.brace--,X.brace<0)break}J++}return{expression:$.slice(Z,J),endPos:J}}function O5($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+=z+$[G+1],G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}if(z==="|"&&$[G-1]==="\\"&&!Y){J=J.slice(0,-1)+z;continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function q1($,Z){let J=XX($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function XX($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=L0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function YX($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function O1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let q=G.exec($),K=z.exec($),W=q?q.index:1/0,U=K?K.index:1/0;if(W<U)Y++,Q=W+q[0].length;else if(U<1/0){if(Y--,Y===0)return U;Q=U+K[0].length}else break}return-1}function L7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=q1($,X);if(!Y)return null;let Q=Y.endPos,G=O1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),q=[],K=0,W="if",U=Y.expression,H=0,j=0;while(K<z.length){let B=z.indexOf("@",K);if(B===-1)break;K=B;let V=z.substring(B);if(YX(z,B)){K++;continue}if(/^@if\s*\(/.test(V)){j++,K++;continue}if(/^@endif(?![a-z])/.test(V)){j--,K+=6;continue}if(j===0){let F=V.match(/^@elseif\s*/);if(F){q.push({type:W,condition:U,content:z.substring(H,K),start:Q+H,end:Q+K});let _=K+F[0].length,O=q1(z,_);if(!O){K++;continue}W="elseif",U=O.expression,K=O.endPos,H=K;continue}else if(/^@else(?![a-z])/.test(V)){q.push({type:W,condition:U,content:z.substring(H,K),start:Q+H,end:Q+K}),W="else",U=void 0,K+=5,H=K;continue}}K++}return q.push({type:W,condition:U,content:z.slice(H),start:Q+H,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function H2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=L7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function J9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,q=z+Q[0].length-1,K=L0($,"(",")",q);if(K===-1){Q=Y.exec($);continue}let W=$.slice(q+1,K),U=K+1,H=O1($,Z,J,U);if(H===-1){Q=Y.exec($);continue}let j=$.slice(U,H),B=H+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:W,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function F5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=q1($,X);if(!Y)return null;let Q=Y.endPos,G=O1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),q=[],K=0,W=null,U=0;while(K<z.length){let H=z.slice(K),j=H.match(/^@switch\s*\(/),B=H.match(/^@endswitch(?![a-z])/);if(j){if(U++,W)W.content+=j[0];K+=j[0].length;continue}if(B){if(U--,W)W.content+=B[0];K+=B[0].length;continue}if(U>0){if(W)W.content+=z[K];K++;continue}let V=H.match(/^@case\s*/),F=H.match(/^@default(?![a-z])/),_=H.match(/^@break(?![a-z])/);if(V&&H.startsWith("@case")){if(W)q.push(W);let O=K+V[0].length,L=q1(z,O);if(!L){K++;continue}W={type:"case",value:L.expression,content:""},K=L.endPos}else if(F&&H.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},K+=F[0].length}else if(_&&H.startsWith("@break"))K+=_[0].length;else{if(W)W.content+=z[K];K++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:q,start:Z,end:G+10}}function QX($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",q=Q?z==="{{{"?"}}}":"!!}":"}}",K=G+z.length,W=GX($,K,q);if(W===-1){J=G+1;continue}let U=$.slice(K,W).trim(),H=W+q.length;Z.push({fullMatch:$.slice(G,H),expression:U,start:G,end:H,isRaw:Q}),J=H}return Z}function GX($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function zX($){let Z=O5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=qX(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function qX($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=L0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=w7(G);return{name:X,args:z}}function w7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function KX($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=L0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function WX($){let Z=[],X=new Z9($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let q=z.value;if(Y++,Y>=X.length)break;let K=X[Y];if(K.type==="IDENTIFIER"){let W=K.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let U=Y<X.length?X[Y].start:$.length,H=O7(X,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:W,value:$.slice(U,H.endPos),exported:G,start:z.start,end:H.endPos})}}else if(K.type==="PUNCTUATION"&&(K.value==="{"||K.value==="[")){let W=K.start,U=K.value==="{"?"}":"]",H=L0($,K.value,U,W);if(H!==-1){let j=$.slice(W,H+1);if(Y=F7(X,H+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=O7(X,Y,$);Y=V.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(B,V.endPos)}; ${q} ${j} = ${F}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let q=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let K=X[Y];if(K.type==="IDENTIFIER"){let W=K.value;Y++;let U=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){U=X[Y].start;break}Y++}if(U!==-1){let H=L0($,"{","}",U);if(H!==-1)Z.push({type:"function",name:W,value:$.slice(q,H+1).replace(/^export\s+/,""),exported:G,start:q,end:H+1}),Y=F7(X,H+1)}}}else Y++}return Z}function O7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function F7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function UX($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=F5(X,G);if(!z)break;try{let q;if(q0(z.expression))q=W0(z.expression,Object.keys(Z))(...Object.values(Z));else q=e(z.expression,Z);let K="",W=!1;for(let U of z.cases)if(U.type==="default"){if(!W)K=U.content.trim()}else try{let H;if(U.value&&q0(U.value))H=W0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)H=e(U.value,Z);if(q===H){K=U.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+K+X.substring(z.end),Y=!0}catch(q){let K=q instanceof Error?q.message:String(q),W=X0("Switch",`Error evaluating @switch expression: ${K}`,J0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function HX($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function jX($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function e0($,Z,J){let{masked:X,scripts:Y}=HX($);return jX(BX(X,Z,J),Y)}function BX($,Z,J){let X=$;X=UX(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,q=q1(X,z+7);if(!q)break;let K=q.endPos,W=O1(X,"unless","endunless",K);if(W===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(K,W),H=q.expression,j=-1;{let V=0,F=/@(?:if|unless)\s*\(/g,_=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,L=[],w;while((w=F.exec(U))!==null)L.push({pos:w.index,type:"open"});while((w=_.exec(U))!==null)L.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)L.push({pos:w.index,type:"else"});L.sort((R,D)=>R.pos-D.pos);for(let R of L)if(R.type==="open")V++;else if(R.type==="close")V--;else if(R.type==="else"&&V===0){j=R.pos;break}}let B;if(j!==-1){let V=U.slice(0,j),F=U.slice(j+5);B=`@if (${H})${F}@else ${V}@endif`}else B=`@if (!(${H}))${U}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Q=!0}}X=R5(X,Z,J),X=D5(X,Z,J),X=w5(X,Z);let Y=()=>{let Q=H2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let K=Q.length-1;K>=0;K--){let W=Q[K];try{let U="",H=!1;for(let j of W.branches){if(H)break;if(j.type==="else")U=j.content,H=!0;else try{let B;if(j.condition&&q0(j.condition))B=W0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=e(j.condition,Z);if(B)U=j.content,H=!0}catch(B){U=X0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,J0.EVALUATION_ERROR),H=!0}}G[K]=U}catch(U){let H=U instanceof Error?U.message:String(U);G[K]=X0("If",`Error processing @if block: ${H}`,J0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),q=0;for(let K=0;K<Q.length;K++){let W=Q[K];z[K*2]=X.slice(q,W.start),z[K*2+1]=G[K],q=W.end}return z[Q.length*2]=X.slice(q),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function R7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function w5($,Z){let J=$;function X(z,q,K,W){let U=1,H=W,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${K}(?![a-z])`,"g");while(H<z.length&&U>0){j.lastIndex=H,B.lastIndex=H;let V=j.exec(z),F=B.exec(z),_=V?V.index:1/0,O=F?F.index:1/0;if(_<O)U++,H=_+V[0].length;else if(O<1/0){if(U--,U===0)return O;H=O+F[0].length}else break}return-1}function Y(z,q,K){let W=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=U.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=H.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((F,_)=>F.pos-_.pos);for(let F of B)if(F.type==="open")W++;else if(F.type==="close")W--;else if(F.type==="else"&&W===0)return F.pos;return-1}{let z=!0;while(z){z=!1;let q=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,W,U,H=J.slice(K+5),j=R7(H);if(j)W=j.value,U=K+5+j.consumed;else U=K+5;let B=X(J,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${K} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(U,B),F=Y(V,"auth","endauth"),_;if(!Z.auth)_=!1;else _=W?z1(`auth?.check && auth?.user?.[${W}]`,Z):z1("auth?.check",Z);let O;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);O=_?L:w}else O=_?V:"";J=J.substring(0,K)+O+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let q=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,W,U,H=J.slice(K+6),j=R7(H);if(j)W=j.value,U=K+6+j.consumed;else U=K+6;let B=X(J,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${K} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(U,B),F=Y(V,"guest","endguest"),_;if(!Z.auth)_=!0;else _=W?z1(`!auth?.check || !auth?.user?.[${W}]`,Z):z1("!auth?.check",Z);let O;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);O=_?L:w}else O=_?V:"";J=J.substring(0,K)+O+J.substring(B+9),z=!0}}function Q(z,q,K){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[z];if(q)W.push(q);if(K){let U=z1(K,Z);W.push(U)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(z){let q=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let z of["can","cannot"]){let q=`end${z}`,K=z==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let U=J.match(new RegExp(`@${z}\\s*\\(`));if(!U||U.index===void 0)break;let H=U.index,j=J.slice(H+`@${z}`.length),B=G(j);if(!B)break;let V=H+`@${z}`.length+B.paramsEnd,F=X(J,z,q,V);if(F===-1){console.warn(`[stx] @${z} directive at position ${H} has no matching @${q} \u2014 the block was skipped.`);break}let _=J.slice(V,F),O=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),D=new RegExp(`@${K}\\s*\\(`,"g"),A=/@else(?![a-z])/g,T=[],N;while((N=w.exec(_))!==null)T.push({pos:N.index,type:"open"});while((N=R.exec(_))!==null)T.push({pos:N.index,type:"close"});while((N=D.exec(_))!==null)T.push({pos:N.index,type:"elseDirective"});while((N=A.exec(_))!==null)T.push({pos:N.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)O.push(b)}let I=[],k=0;for(let b=0;b<O.length;b++){let C=O[b];if(I.push({content:_.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let f=_.slice(C.pos+`@${K}`.length),u=G(f);if(u){I[I.length-1]={content:_.slice(k,C.pos)},k=C.pos+`@${K}`.length+u.paramsEnd,I.push({content:"",ability:u.ability,type:u.type,id:u.id}),I.pop();let P=O[b+1],h=P?P.pos:_.length;I.push({content:_.slice(k,h),ability:u.ability,type:u.type,id:u.id}),k=h}}else k=C.pos+5}if(k<_.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:_.slice(k),isFinalElse:!0});else if(I.length===0)I.push({content:_.slice(k)})}let M=Q(B.ability,B.type,B.id),y=z==="can"?M:!M,E="";if(y)E=I[0]?.content||"";else{let b=!1;for(let C=1;C<I.length;C++){let f=I[C];if(f.isFinalElse){E=f.content,b=!0;break}if(f.ability){let u=Q(f.ability,f.type,f.id);if(z==="can"?u:!u){E=f.content,b=!0;break}}}if(!b&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)E=C.content}}J=J.substring(0,H)+E+J.substring(F+`@${q}`.length),W=!0}}return J}function R5($,Z,J){let X=$;function Y(Q,G,z,q,K){let W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\s*\\(`),H=Q.match(U);if(!H||H.index===void 0)break;let j=H.index,B=q1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,F=O1(Q,G,z,V);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let _=Q.slice(V,F),O=B.expression,L=-1,w=0,R=0;while(R<_.length){let D=_.indexOf("@",R);if(D===-1)break;let A=_.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){L=D;break}R=D+1}try{let D=q(O.trim()),A;if(L!==-1){let T=_.slice(0,L),N=_.slice(L+5);A=D?T:N}else A=D?_:"";Q=Q.substring(0,j)+A+Q.substring(F+`@${z}`.length),W=!0}catch(D){let A=D instanceof Error?D.message:String(D),T=X0(K,`Error processing @${G} directive: ${A}`,J0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(F+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function D5($,Z,J){let X=$,Y="development";function Q(G,z,q,K){let W=new RegExp(`@${z}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),H=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,V=!0;while(V){V=!1,W.lastIndex=0;let F=W.exec(B);if(!F)break;let _=F.index,O=_+F[0].length;if(z==="env"){let M=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!M)break;O+=M[0].length,K=Y===M[2]}let L=1,w=O,R=-1;while(L>0&&w<B.length){W.lastIndex=w,U.lastIndex=w;let M=W.exec(B),y=U.exec(B),E=M?M.index:1/0,b=y?y.index:1/0;if(E<b)L++,w=E+M[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${z} directive at position ${_} has no matching @${q} \u2014 the block was skipped.`);break}let D=B.substring(O,R),A=-1,T=0,N=0;while(N<D.length){let M=D.indexOf("@",N);if(M===-1)break;let y=D.substring(M);if(H.test(y)){T++,N=M+1;continue}if(j.test(y)){T--,N=M+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){A=M;break}N=M+1}let I;if(A!==-1){let M=D.slice(0,A),y=D.slice(A+5);I=K?M:y}else I=K?D:"";let k=`@${q}`.length;B=B.substring(0,_)+I+B.substring(R+k),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var N5=new WeakMap;function D7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function F1($,Z){if(!$)return Z?.nonceGenerator?.()??D7();let J=N5.get($);if(!J)J=Z?.nonceGenerator?.()??D7(),N5.set($,J);return J}function FW($){N5.delete($)}function N7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function M5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${N7($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var VX={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},A5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},_X={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},LX={"default-src":["'none'"],"frame-ancestors":["'none'"]};function wW($){return{enabled:!0,directives:{strict:VX,moderate:A5,relaxed:_X,api:LX}[$]||A5,useNonce:$==="strict",addMetaTag:!0}}function RW($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],q=[...new Set([...z,...Y])];J[Q]=q}}return J}function A7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?F1(J,Z):void 0,Y=M5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3220
- ${Y}`)}function M7($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<script nonce="${Z}"${Y}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<style nonce="${Z}"${Y}>`}),J}function I7($,Z,J,X){let Y=$,Q=X.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?F1(Z,Q):void 0;return M5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return F1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=F1(Z,Q);return Y}var OX={name:"csp",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?F1(J,Q):void 0;return M5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},FX={name:"cspNonce",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return F1(J,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function DW(){return[OX,FX]}function NW($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[J,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${J} allows insecure resources`);return Z}function wX($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function AW($,Z){if(!$.enabled)return{};let J=$.useNonce?F1(Z,$):void 0,X=N7($.directives,J);return{[wX($.reportOnly)]:X}}var MW={enabled:!1,reportOnly:!1,directives:A5,useNonce:!1,addMetaTag:!0};import RX from"crypto";var DX=40,T7="_token",I5=null;function NX($=DX){let Z=RX.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return I5=Z,Z}function AX(){if(!I5)NX();return I5}function MX($=T7){let Z=AX();return`<input type="hidden" name="${$}" value="${Z}">`}function k7($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return MX(X||T7)})}async function E7($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Y=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await IX(Y,Q,Z,J,X);else Y=await TX(Y,Q,Z,J,X)}return Y}async function IX($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,q=`@end${Q}`,K=$,W=v1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],H=W.exec(K);while(H!==null){let[j,B="",V=""]=H,F=H.index||0;try{let _=B?b7(B):[],O=V.trim(),L=await G(O,_,J,X);U.push({original:j,processed:L,startIndex:F})}catch(_){let O=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);U.push({original:j,processed:X0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${O}`,J0.EVALUATION_ERROR),startIndex:F})}H=W.exec(K)}for(let j=U.length-1;j>=0;j--){let{original:B,processed:V}=U[j];K=K.replace(B,V)}return K}async function TX($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,q=v1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),K=[],W=q.exec(z);while(W!==null){let[j,B=""]=W,V=W.index||0;try{let F=b7(B),_=await G("",F,J,X);K.push({original:j,processed:_,startIndex:V})}catch(F){let _=F instanceof Error?F.message:String(F);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,F);K.push({original:j,processed:X0("CustomDirective",`Error in @${Q}(${B}): ${_}`,J0.EVALUATION_ERROR),startIndex:V})}W=q.exec(z)}let U=v1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=U.exec(z);while(H!==null){let[j]=H,B=H.index||0;try{let V=await G("",[],J,X);K.push({original:j,processed:V,startIndex:B})}catch(V){let F=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);K.push({original:j,processed:X0("CustomDirective",`Error in @${Q}: ${F}`,J0.EVALUATION_ERROR),startIndex:B})}H=U.exec(z)}for(let j=K.length-1;j>=0;j--){let{original:B,processed:V}=K[j];z=z.replace(B,V)}return z}function b7($){if(!$.trim())return[];let Z=[],J="",X=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,Y=G;else if(G===Y)X=!1;else J+=G;else if(G===","&&!X)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var y7=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,C7=/^[A-Za-z_$][\w$]*$/,kX=new Set(["light","dark","system"]);function w1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function EX($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(w1(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(w1(J.key,"appearance.key"),w1(J.attribute,"appearance.attribute"),w1(J.default,"appearance.default"),w1(X.key,"colorMode.key"),w1(X.attribute,"colorMode.attribute"),w1(X.default,"colorMode.default"),!C7.test(J.key)||!C7.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!y7.test(J.attribute)||!y7.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!kX.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function bX($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function yX($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${bX($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}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());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,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function CX($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function S7($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=CX(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),q=e(`(${z})`,Z),K=yX(EX(q));J=J.slice(0,Y.index)+K+J.slice(G+1),X.lastIndex=Y.index+K.length}return J}import SX from"crypto";function O0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var k5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function PX($){return{...k5,...$.forms?.classes}}function X9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function m0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function f1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${O0(Z)}"`}function T5($,Z,J){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(J))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))X+=` aria-describedby="${O0(`${m0($)}-error`)}"`;return X}function vX(){return SX.randomUUID()}function fW($,Z,J,X){let Y=PX(X),Q=$;return Q=xX(Q,Z),Q=V2(Q,Z),Q=E5(Q,Z,Y),Q=b5(Q,Z,Y),Q}function V2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=vX();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${O0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${O0(Q)}">`;return X}),J}function E5($,Z,J=k5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,q,K="")=>{let W=Q||G||"POST",U=z||q||"",H=K1(K),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${O0(B)}" action="${O0(U)}"${H?` ${H}`:""}>`;if(V+=`
3221
- ${V2("@csrf",Z)}`,!["GET","POST"].includes(j))V+=`
3222
- ${V2(`@method('${j}')`,Z)}`;return V}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,q,K="")=>{let W=Q||G||"",U=z||q||"",H=K1(K),j=j2(W,Z),B=j!==void 0&&j!==null?j:U||"",V=H.match(/type=['"]([^'"]+)['"]/i),F=V?V[1]:"text",_=B2(W,Z),O=H.match(/class=['"]([^'"]+)['"]/i),L=X9(O?O[1]:"",J.input,_,J.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${O0(F)}" name="${O0(W)}"${f1(H,m0(W))} value="${O0(B)}" class="${L}"${T5(W,_,H)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let q=K1(G),K=j2(Q,Z)||z.trim(),W=B2(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),H=X9(U?U[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${O0(Q)}"${f1(q,m0(Q))} class="${H}"${T5(Q,W,q)}${j?` ${j}`:""}>${O0(K)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let q=K1(G),K=j2(Q,Z),W=B2(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),H=X9(U?U[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),B=z;if(K!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(V,F,_)=>{if((Array.isArray(K)?K.some((L)=>String(L)===_):String(K)===_)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return V});return`<select name="${O0(Q)}"${f1(q,m0(Q))} class="${H}"${T5(Q,W,q)}${j?` ${j}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let q=G===void 0?"1":G,K=G===void 0?m0(Q):`${m0(Q)}-${m0(q)}`,W=K1(z),U=j2(Q,Z),H=U!==void 0&&(Array.isArray(U)?U.some((F)=>String(F)===q):U===!0||String(U)===q),j=W.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:J.checkInput,V=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${O0(Q)}"${f1(W,K)} value="${O0(q)}" class="${B}"${H?" checked":""}${V?` ${V}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let q=K1(z),K=j2(Q,Z),W=K!==void 0&&K===G,U=q.match(/class=['"]([^'"]+)['"]/i),H=U?U[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${O0(Q)}"${f1(q,`${m0(Q)}-${m0(G)}`)} value="${O0(G)}" class="${H}"${W?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=K1(G),q=z.match(/accept=['"]([^'"]+)['"]/i),K=q?q[1]:"",W=z.includes("multiple"),U=B2(Q,Z),H=z.match(/class=['"]([^'"]+)['"]/i),j=X9(H?H[1]:"",J.input,U,J.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),V=[`<input type="file" name="${O0(Q)}"${f1(z,m0(Q))}`,`class="${j}"`];if(K)V.push(`accept="${O0(K)}"`);if(W)V.push("multiple");if(B)V.push(B);return`${V.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let q=K1(G),K=q.match(/class=['"]([^'"]+)['"]/i),W=K?K[1]:J.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${O0(m0(Q))}" class="${W}"${U?` ${U}`:""}>${z}</label>`}),X}function b5($,Z,J=k5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Y,Q)=>{try{if(B2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return P7(Y,Z);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return P7(Y,Z)}let K=q.trim();if(q0(K)){let W=e(K,Z);return W!==void 0?String(W):K}return K}catch{return q}});return`<div id="${O0(`${m0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function B2($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function P7($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function j2($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(J=Z[X],J!==void 0)return J}return Z[$]}function K1($){if(!$.trim())return"";let Z=[],J=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=X.exec(J))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var v7={required:($,Z,J)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${J} field is required.`;return null},email:($,Z,J)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${J} field must be a valid email address.`;return null},min:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${J} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${J} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${J} field must have at least ${X} items.`;return null},max:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${J} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${J} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${J} field must not have more than ${X} items.`;return null},confirmed:($,Z,J)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${J} confirmation does not match.`;return null},numeric:($,Z,J)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${J} field must be a number.`;return null},integer:($,Z,J)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${J} field must be an integer.`;return null},alpha:($,Z,J)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${J} field must only contain letters.`;return null},alphanumeric:($,Z,J)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${J} field must only contain letters and numbers.`;return null},url:($,Z,J)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${J} field must be a valid URL.`}},regex:($,Z,J)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${J} field format is invalid.`;return null}catch{return`The ${J} field has an invalid validation pattern.`}},in:($,Z,J)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${J} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,J)=>{if(!$)return null;if(Z.includes(String($)))return`The ${J} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,J)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${J} field must be a valid date.`;return null},before:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X>=Y)return`The ${J} field must be before ${Z[0]}.`;return null},after:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X<=Y)return`The ${J} field must be after ${Z[0]}.`;return null}};function xW($,Z){v7[$]=Z}function y5($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function fX($,Z,J,X={}){let Y=[],Q=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=y5(G),q=v7[z.name];if(!q){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let W=`${$}_confirmation`;z.params=[X[W]]}let K=q(Z,z.params||[],$);if(K)Y.push(z.message||K)}return{field:$,valid:Y.length===0,errors:Y}}function gW($,Z){let J={};for(let[X,Y]of Object.entries(Z)){let Q=fX(X,$[X],Y,$);if(!Q.valid)J[X]=Q.errors}return J}function xX($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(J,X,Y,Q)=>{let G=Y.split("|").map((q)=>q.trim()),z=[];for(let q of G){let K=y5(q);switch(K.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),K.name==="integer")z.push('step="1"');break;case"min":if(K.params?.[0])z.push(`minlength="${K.params[0]}"`);break;case"max":if(K.params?.[0])z.push(`maxlength="${K.params[0]}"`);break;case"regex":if(K.params?.[0])z.push(`pattern="${K.params[0]}"`);break}}return`<!-- @validate:${X}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var f7={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length>=J||`Must be at least ${J} characters`;if(typeof $==="number")return $>=J||`Must be at least ${J}`;if(Array.isArray($))return $.length>=J||`Must have at least ${J} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length<=J||`Must be no more than ${J} characters`;if(typeof $==="number")return $<=J||`Must be no more than ${J}`;if(Array.isArray($))return $.length<=J||`Must have no more than ${J} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[J,X]=Z.map(Number);if(typeof $==="string")return $.length>=J&&$.length<=X||`Must be between ${J} and ${X} characters`;if(typeof $==="number")return $>=J&&$<=X||`Must be between ${J} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,J)=>{let X=Object.keys(J);for(let Y of X)if(Y.endsWith("_confirmation")&&J[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length===J||`Must be exactly ${J} characters`;if(Array.isArray($))return $.length===J||`Must have exactly ${J} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function hW($){f7[$.name]=$}function gX($,Z,J={}){let X=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=y5(Q),z=f7[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let q=z.validate($,G.params||[],J);if(q!==!0)X.push(q)}return{valid:X.length===0,errors:X}}function uW($,Z){let J={},X=!0;for(let[Y,Q]of Object.entries(Z)){let G=gX($[Y],Q,$);if(!G.valid)X=!1,J[Y]=G.errors}return{valid:X,errors:J}}function dW($,Z){let J=JSON.stringify(Z);return`
3224
+ `)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function L0($,Z,J,X=0){let Y=0,Q=X,G=null,z=0,q=!1;while(Q<$.length){let K=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&K==="\\"){q=!0,Q++;continue}if(q=!1,(K==='"'||K==="'"||K==="`")&&!G){G=K,Q++;continue}if(K===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&K==="$"&&$[Q+1]==="{"){z++,Q+=2;continue}if(z>0&&K==="}"){z--,Q++;continue}if(K==="`"&&G==="`"&&z===0){G=null,Q++;continue}if(G){Q++;continue}if(K===Z)Y++;else if(K===J){if(Y--,Y===0)return Q}Q++}return-1}function D7($,Z){let J=Z,X={paren:0,bracket:0,brace:0},Y=null,Q=0;while(J<$.length){let G=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((G==='"'||G==="'")&&!Y){Y=G,J++;continue}if(G===Y&&Y!=="`"){Y=null,J++;continue}if(G==="`"&&!Y){Y="`",J++;continue}if(G==="`"&&Y==="`"&&Q===0){Y=null,J++;continue}if(Y==="`"&&G==="$"&&$[J+1]==="{"){Q++,J+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;J++;continue}if(Y){J++;continue}if(X.paren===0&&X.bracket===0&&X.brace===0){if($.slice(J,J+2)==="}}"||$.slice(J,J+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")X.paren++;else if(G===")"){if(X.paren--,X.paren<0)break}else if(G==="[")X.bracket++;else if(G==="]"){if(X.bracket--,X.bracket<0)break}else if(G==="{")X.brace++;else if(G==="}"){if(X.brace--,X.brace<0)break}J++}return{expression:$.slice(Z,J),endPos:J}}function w5($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+=z+$[G+1],G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}if(z==="|"&&$[G-1]==="\\"&&!Y){J=J.slice(0,-1)+z;continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function q1($,Z){let J=VX($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function VX($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let X=L0($,"(",")",J);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,X),endPos:X+1}}function _X($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function O1($,Z,J,X){let Y=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let q=G.exec($),K=z.exec($),W=q?q.index:1/0,U=K?K.index:1/0;if(W<U)Y++,Q=W+q[0].length;else if(U<1/0){if(Y--,Y===0)return U;Q=U+K[0].length}else break}return-1}function A7($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let X=Z+J[0].length,Y=q1($,X);if(!Y)return null;let Q=Y.endPos,G=O1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),q=[],K=0,W="if",U=Y.expression,H=0,j=0;while(K<z.length){let B=z.indexOf("@",K);if(B===-1)break;K=B;let V=z.substring(B);if(_X(z,B)){K++;continue}if(/^@if\s*\(/.test(V)){j++,K++;continue}if(/^@endif(?![a-z])/.test(V)){j--,K+=6;continue}if(j===0){let F=V.match(/^@elseif\s*/);if(F){q.push({type:W,condition:U,content:z.substring(H,K),start:Q+H,end:Q+K});let _=K+F[0].length,O=q1(z,_);if(!O){K++;continue}W="elseif",U=O.expression,K=O.endPos,H=K;continue}else if(/^@else(?![a-z])/.test(V)){q.push({type:W,condition:U,content:z.substring(H,K),start:Q+H,end:Q+K}),W="else",U=void 0,K+=5,H=K;continue}}K++}return q.push({type:W,condition:U,content:z.slice(H),start:Q+H,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function j2($){let Z=[],J=/@if\s*\(/g,X=J.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=J.exec($);continue}let Q=A7($,X.index);if(Q)Z.push(Q),J.lastIndex=Q.end;X=J.exec($)}return Z}function X9($,Z,J){let X=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(X.some((V)=>Q.index>V.start&&Q.index<V.end)){Q=Y.exec($);continue}let z=Q.index,q=z+Q[0].length-1,K=L0($,"(",")",q);if(K===-1){Q=Y.exec($);continue}let W=$.slice(q+1,K),U=K+1,H=O1($,Z,J,U);if(H===-1){Q=Y.exec($);continue}let j=$.slice(U,H),B=H+`@${J}`.length;X.push({fullMatch:$.slice(z,B),name:Z,params:W,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return X}function R5($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let X=Z+J[0].length,Y=q1($,X);if(!Y)return null;let Q=Y.endPos,G=O1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),q=[],K=0,W=null,U=0;while(K<z.length){let H=z.slice(K),j=H.match(/^@switch\s*\(/),B=H.match(/^@endswitch(?![a-z])/);if(j){if(U++,W)W.content+=j[0];K+=j[0].length;continue}if(B){if(U--,W)W.content+=B[0];K+=B[0].length;continue}if(U>0){if(W)W.content+=z[K];K++;continue}let V=H.match(/^@case\s*/),F=H.match(/^@default(?![a-z])/),_=H.match(/^@break(?![a-z])/);if(V&&H.startsWith("@case")){if(W)q.push(W);let O=K+V[0].length,L=q1(z,O);if(!L){K++;continue}W={type:"case",value:L.expression,content:""},K=L.endPos}else if(F&&H.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},K+=F[0].length}else if(_&&H.startsWith("@break"))K+=_[0].length;else{if(W)W.content+=z[K];K++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:q,start:Z,end:G+10}}function LX($){let Z=[],J=0;while(J<$.length){let X=$.indexOf("{{",J),Y=$.indexOf("{!!",J),Q=!1,G;if(X===-1&&Y===-1)break;else if(X===-1)G=Y,Q=!0;else if(Y===-1)G=X,Q=!1;else if(Y<X)G=Y,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",q=Q?z==="{{{"?"}}}":"!!}":"}}",K=G+z.length,W=OX($,K,q);if(W===-1){J=G+1;continue}let U=$.slice(K,W).trim(),H=W+q.length;Z.push({fullMatch:$.slice(G,H),expression:U,start:G,end:H,isRaw:Q}),J=H}return Z}function OX($,Z,J){let X=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let z=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((z==='"'||z==="'")&&!Y){Y=z,X++;continue}if(z===Y&&Y!=="`"){Y=null,X++;continue}if(z==="`"&&!Y){Y="`",X++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,X++;continue}if(Y==="`"&&z==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;X++;continue}if(Y){X++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+J.length)===J)return X}X++}return-1}function FX($){let Z=w5($);if(Z.length===0)return{baseExpression:"",filters:[]};let J=Z[0],X=[];for(let Y=1;Y<Z.length;Y++){let Q=wX(Z[Y]);if(Q)X.push(Q)}return{baseExpression:J,filters:X}}function wX($){let Z=$.trim();if(!Z)return null;let J=Z.indexOf("(");if(J===-1)return{name:Z,args:[]};let X=Z.slice(0,J).trim(),Y=J+1,Q=L0(Z,"(",")",J);if(Q===-1)return{name:X,args:[]};let G=Z.slice(Y,Q),z=T7(G);return{name:X,args:z}}function T7($){let Z=[],J="",X={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){J+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,J+=z;continue}if(z===Y&&Y!=="`"){Y=null,J+=z;continue}if(z==="`"&&!Y){Y="`",J+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,J+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,J+="${",G++;continue}if(Q>0&&z==="{"){Q++,J+=z;continue}if(Q>0&&z==="}"){Q--,J+=z;continue}if(Y){J+=z;continue}if(z==="(")X.paren++;else if(z===")")X.paren--;else if(z==="[")X.bracket++;else if(z==="]")X.bracket--;else if(z==="{")X.brace++;else if(z==="}")X.brace--;if(z===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(J.trim()),J="";continue}J+=z}if(J.trim())Z.push(J.trim());return Z}function RX($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;let X=L0($,"(",")",J);if(X===-1)return null;return{params:$.slice(J+1,X),endPos:X+1}}function NX($){let Z=[],X=new J9($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<X.length){let Q=X[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=X.length)break}let z=X[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let q=z.value;if(Y++,Y>=X.length)break;let K=X[Y];if(K.type==="IDENTIFIER"){let W=K.value;if(Y++,Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let U=Y<X.length?X[Y].start:$.length,H=M7(X,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:W,value:$.slice(U,H.endPos),exported:G,start:z.start,end:H.endPos})}}else if(K.type==="PUNCTUATION"&&(K.value==="{"||K.value==="[")){let W=K.start,U=K.value==="{"?"}":"]",H=L0($,K.value,U,W);if(H!==-1){let j=$.slice(W,H+1);if(Y=I7(X,H+1),Y<X.length&&X[Y].type==="OPERATOR"&&X[Y].value==="="){Y++;let B=Y<X.length?X[Y].start:$.length,V=M7(X,Y,$);Y=V.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(B,V.endPos)}; ${q} ${j} = ${F}`,exported:G,start:z.start,end:V.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let q=G?X[Y-1].start:z.start;if(Y++,Y>=X.length)break;let K=X[Y];if(K.type==="IDENTIFIER"){let W=K.value;Y++;let U=-1;while(Y<X.length){if(X[Y].type==="PUNCTUATION"&&X[Y].value==="{"){U=X[Y].start;break}Y++}if(U!==-1){let H=L0($,"{","}",U);if(H!==-1)Z.push({type:"function",name:W,value:$.slice(q,H+1).replace(/^export\s+/,""),exported:G,start:q,end:H+1}),Y=I7(X,H+1)}}}else Y++}return Z}function M7($,Z,J){let X=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:J.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function I7($,Z){for(let J=0;J<$.length;J++)if($[J].start>=Z)return J;return $.length}function DX($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=R5(X,G);if(!z)break;try{let q;if(W0(z.expression))q=K0(z.expression,Object.keys(Z))(...Object.values(Z));else q=e(z.expression,Z);let K="",W=!1;for(let U of z.cases)if(U.type==="default"){if(!W)K=U.content.trim()}else try{let H;if(U.value&&W0(U.value))H=K0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)H=e(U.value,Z);if(q===H){K=U.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+K+X.substring(z.end),Y=!0}catch(q){let K=q instanceof Error?q.message:String(q),W=X0("Switch",`Error evaluating @switch expression: ${K}`,J0.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(z.end);break}}return X}function AX($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function MX($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,X)=>Z[Number(X)]??J)}function e0($,Z,J){let{masked:X,scripts:Y}=AX($);return MX(IX(X,Z,J),Y)}function IX($,Z,J){let X=$;X=DX(X,Z,J);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,q=q1(X,z+7);if(!q)break;let K=q.endPos,W=O1(X,"unless","endunless",K);if(W===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(K,W),H=q.expression,j=-1;{let V=0,F=/@(?:if|unless)\s*\(/g,_=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,L=[],w;while((w=F.exec(U))!==null)L.push({pos:w.index,type:"open"});while((w=_.exec(U))!==null)L.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)L.push({pos:w.index,type:"else"});L.sort((R,N)=>R.pos-N.pos);for(let R of L)if(R.type==="open")V++;else if(R.type==="close")V--;else if(R.type==="else"&&V===0){j=R.pos;break}}let B;if(j!==-1){let V=U.slice(0,j),F=U.slice(j+5);B=`@if (${H})${F}@else ${V}@endif`}else B=`@if (!(${H}))${U}@endif`;X=X.substring(0,z)+B+X.substring(W+10),Q=!0}}X=D5(X,Z,J),X=A5(X,Z,J),X=N5(X,Z);let Y=()=>{let Q=j2(X);if(Q.length===0)return!1;let G=Array(Q.length);for(let K=Q.length-1;K>=0;K--){let W=Q[K];try{let U="",H=!1;for(let j of W.branches){if(H)break;if(j.type==="else")U=j.content,H=!0;else try{let B;if(j.condition&&W0(j.condition))B=K0(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=e(j.condition,Z);if(B)U=j.content,H=!0}catch(B){U=X0(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,J0.EVALUATION_ERROR),H=!0}}G[K]=U}catch(U){let H=U instanceof Error?U.message:String(U);G[K]=X0("If",`Error processing @if block: ${H}`,J0.EVALUATION_ERROR)}}let z=Array(Q.length*2+1),q=0;for(let K=0;K<Q.length;K++){let W=Q[K];z[K*2]=X.slice(q,W.start),z[K*2+1]=G[K],q=W.end}return z[Q.length*2]=X.slice(q),X=z.join(""),!0};while(!0){let Q=X;if(!Y())break;if(X===Q)break}return X}function k7($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let X=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Y===J){Z++;break}X.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function N5($,Z){let J=$;function X(z,q,K,W){let U=1,H=W,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${K}(?![a-z])`,"g");while(H<z.length&&U>0){j.lastIndex=H,B.lastIndex=H;let V=j.exec(z),F=B.exec(z),_=V?V.index:1/0,O=F?F.index:1/0;if(_<O)U++,H=_+V[0].length;else if(O<1/0){if(U--,U===0)return O;H=O+F[0].length}else break}return-1}function Y(z,q,K){let W=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],V;while((V=U.exec(z))!==null)B.push({pos:V.index,type:"open"});while((V=H.exec(z))!==null)B.push({pos:V.index,type:"close"});while((V=j.exec(z))!==null)B.push({pos:V.index,type:"else"});B.sort((F,_)=>F.pos-_.pos);for(let F of B)if(F.type==="open")W++;else if(F.type==="close")W--;else if(F.type==="else"&&W===0)return F.pos;return-1}{let z=!0;while(z){z=!1;let q=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,W,U,H=J.slice(K+5),j=k7(H);if(j)W=j.value,U=K+5+j.consumed;else U=K+5;let B=X(J,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${K} has no matching @endauth \u2014 the block was skipped.`);break}let V=J.slice(U,B),F=Y(V,"auth","endauth"),_;if(!Z.auth)_=!1;else _=W?z1(`auth?.check && auth?.user?.[${W}]`,Z):z1("auth?.check",Z);let O;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);O=_?L:w}else O=_?V:"";J=J.substring(0,K)+O+J.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let q=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,W,U,H=J.slice(K+6),j=k7(H);if(j)W=j.value,U=K+6+j.consumed;else U=K+6;let B=X(J,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${K} has no matching @endguest \u2014 the block was skipped.`);break}let V=J.slice(U,B),F=Y(V,"guest","endguest"),_;if(!Z.auth)_=!0;else _=W?z1(`!auth?.check || !auth?.user?.[${W}]`,Z):z1("!auth?.check",Z);let O;if(F!==-1){let L=V.slice(0,F),w=V.slice(F+5);O=_?L:w}else O=_?V:"";J=J.substring(0,K)+O+J.substring(B+9),z=!0}}function Q(z,q,K){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[z];if(q)W.push(q);if(K){let U=z1(K,Z);W.push(U)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(z){let q=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let z of["can","cannot"]){let q=`end${z}`,K=z==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let U=J.match(new RegExp(`@${z}\\s*\\(`));if(!U||U.index===void 0)break;let H=U.index,j=J.slice(H+`@${z}`.length),B=G(j);if(!B)break;let V=H+`@${z}`.length+B.paramsEnd,F=X(J,z,q,V);if(F===-1){console.warn(`[stx] @${z} directive at position ${H} has no matching @${q} \u2014 the block was skipped.`);break}let _=J.slice(V,F),O=[],L=0,w=new RegExp(`@${z}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${K}\\s*\\(`,"g"),A=/@else(?![a-z])/g,T=[],D;while((D=w.exec(_))!==null)T.push({pos:D.index,type:"open"});while((D=R.exec(_))!==null)T.push({pos:D.index,type:"close"});while((D=N.exec(_))!==null)T.push({pos:D.index,type:"elseDirective"});while((D=A.exec(_))!==null)T.push({pos:D.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)O.push(b)}let M=[],k=0;for(let b=0;b<O.length;b++){let C=O[b];if(M.push({content:_.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let f=_.slice(C.pos+`@${K}`.length),u=G(f);if(u){M[M.length-1]={content:_.slice(k,C.pos)},k=C.pos+`@${K}`.length+u.paramsEnd,M.push({content:"",ability:u.ability,type:u.type,id:u.id}),M.pop();let P=O[b+1],h=P?P.pos:_.length;M.push({content:_.slice(k,h),ability:u.ability,type:u.type,id:u.id}),k=h}}else k=C.pos+5}if(k<_.length){let b=M[M.length-1];if(O.length>0&&O[O.length-1].type==="else")M.push({content:_.slice(k),isFinalElse:!0});else if(M.length===0)M.push({content:_.slice(k)})}let I=Q(B.ability,B.type,B.id),y=z==="can"?I:!I,E="";if(y)E=M[0]?.content||"";else{let b=!1;for(let C=1;C<M.length;C++){let f=M[C];if(f.isFinalElse){E=f.content,b=!0;break}if(f.ability){let u=Q(f.ability,f.type,f.id);if(z==="can"?u:!u){E=f.content,b=!0;break}}}if(!b&&M.length>0){let C=M[M.length-1];if(C.isFinalElse)E=C.content}}J=J.substring(0,H)+E+J.substring(F+`@${q}`.length),W=!0}}return J}function D5($,Z,J){let X=$;function Y(Q,G,z,q,K){let W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\s*\\(`),H=Q.match(U);if(!H||H.index===void 0)break;let j=H.index,B=q1(Q,j+`@${G}`.length);if(!B)break;let V=B.endPos,F=O1(Q,G,z,V);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let _=Q.slice(V,F),O=B.expression,L=-1,w=0,R=0;while(R<_.length){let N=_.indexOf("@",R);if(N===-1)break;let A=_.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,R=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,R=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){L=N;break}R=N+1}try{let N=q(O.trim()),A;if(L!==-1){let T=_.slice(0,L),D=_.slice(L+5);A=N?T:D}else A=N?_:"";Q=Q.substring(0,j)+A+Q.substring(F+`@${z}`.length),W=!0}catch(N){let A=N instanceof Error?N.message:String(N),T=X0(K,`Error processing @${G} directive: ${A}`,J0.EVALUATION_ERROR);Q=Q.substring(0,j)+T+Q.substring(F+`@${z}`.length);break}}return Q}return X=Y(X,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=Y(X,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function A5($,Z,J){let X=$,Y="development";function Q(G,z,q,K){let W=new RegExp(`@${z}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),H=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,V=!0;while(V){V=!1,W.lastIndex=0;let F=W.exec(B);if(!F)break;let _=F.index,O=_+F[0].length;if(z==="env"){let I=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;O+=I[0].length,K=Y===I[2]}let L=1,w=O,R=-1;while(L>0&&w<B.length){W.lastIndex=w,U.lastIndex=w;let I=W.exec(B),y=U.exec(B),E=I?I.index:1/0,b=y?y.index:1/0;if(E<b)L++,w=E+I[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${z} directive at position ${_} has no matching @${q} \u2014 the block was skipped.`);break}let N=B.substring(O,R),A=-1,T=0,D=0;while(D<N.length){let I=N.indexOf("@",D);if(I===-1)break;let y=N.substring(I);if(H.test(y)){T++,D=I+1;continue}if(j.test(y)){T--,D=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){A=I;break}D=I+1}let M;if(A!==-1){let I=N.slice(0,A),y=N.slice(A+5);M=K?I:y}else M=K?N:"";let k=`@${q}`.length;B=B.substring(0,_)+M+B.substring(R+k),V=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",Y==="production"),X=Q(X,"development","enddevelopment",Y==="development"),X=Q(X,"staging","endstaging",Y==="staging"),X=Q(X,"testing","endtesting",Y==="testing"),X}var M5=new WeakMap;function E7($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function F1($,Z){if(!$)return Z?.nonceGenerator?.()??E7();let J=M5.get($);if(!J)J=Z?.nonceGenerator?.()??E7(),M5.set($,J);return J}function PW($){M5.delete($)}function b7($,Z){let J=[];for(let[X,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)J.push(X);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${X} ${Q.join(" ")}`)}}return J.join("; ")}function T5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${b7($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var TX={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},I5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},kX={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},EX={"default-src":["'none'"],"frame-ancestors":["'none'"]};function vW($){return{enabled:!0,directives:{strict:TX,moderate:I5,relaxed:kX,api:EX}[$]||I5,useNonce:$==="strict",addMetaTag:!0}}function fW($,Z){let J={...$};for(let[X,Y]of Object.entries(Z)){let Q=X,G=J[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")J[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],q=[...new Set([...z,...Y])];J[Q]=q}}return J}function y7($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?F1(J,Z):void 0,Y=T5(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3225
+ ${Y}`)}function C7($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<script nonce="${Z}"${Y}>`}),J=J.replace(/<style([^>]*)>/gi,(X,Y)=>{if(Y.includes("nonce="))return X;return`<style nonce="${Z}"${Y}>`}),J}function S7($,Z,J,X){let Y=$,Q=X.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?F1(Z,Q):void 0;return T5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return F1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=F1(Z,Q);return Y}var bX={name:"csp",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?F1(J,Q):void 0;return T5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},yX={name:"cspNonce",handler:($,Z,J,X)=>{let Q=J.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return F1(J,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function xW(){return[bX,yX]}function gW($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[J,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${J} allows insecure resources`);return Z}function CX($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function hW($,Z){if(!$.enabled)return{};let J=$.useNonce?F1(Z,$):void 0,X=b7($.directives,J);return{[CX($.reportOnly)]:X}}var uW={enabled:!1,reportOnly:!1,directives:I5,useNonce:!1,addMetaTag:!0};import SX from"crypto";var PX=40,P7="_token",k5=null;function vX($=PX){let Z=SX.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return k5=Z,Z}function fX(){if(!k5)vX();return k5}function xX($=P7){let Z=fX();return`<input type="hidden" name="${$}" value="${Z}">`}function v7($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,X)=>{return xX(X||P7)})}async function f7($,Z,J,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Y=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await gX(Y,Q,Z,J,X);else Y=await hX(Y,Q,Z,J,X)}return Y}async function gX($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,q=`@end${Q}`,K=$,W=v1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],H=W.exec(K);while(H!==null){let[j,B="",V=""]=H,F=H.index||0;try{let _=B?x7(B):[],O=V.trim(),L=await G(O,_,J,X);U.push({original:j,processed:L,startIndex:F})}catch(_){let O=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);U.push({original:j,processed:X0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${O}`,J0.EVALUATION_ERROR),startIndex:F})}H=W.exec(K)}for(let j=U.length-1;j>=0;j--){let{original:B,processed:V}=U[j];K=K.replace(B,V)}return K}async function hX($,Z,J,X,Y){let{name:Q,handler:G}=Z,z=$,q=v1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),K=[],W=q.exec(z);while(W!==null){let[j,B=""]=W,V=W.index||0;try{let F=x7(B),_=await G("",F,J,X);K.push({original:j,processed:_,startIndex:V})}catch(F){let _=F instanceof Error?F.message:String(F);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,F);K.push({original:j,processed:X0("CustomDirective",`Error in @${Q}(${B}): ${_}`,J0.EVALUATION_ERROR),startIndex:V})}W=q.exec(z)}let U=v1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=U.exec(z);while(H!==null){let[j]=H,B=H.index||0;try{let V=await G("",[],J,X);K.push({original:j,processed:V,startIndex:B})}catch(V){let F=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);K.push({original:j,processed:X0("CustomDirective",`Error in @${Q}: ${F}`,J0.EVALUATION_ERROR),startIndex:B})}H=U.exec(z)}for(let j=K.length-1;j>=0;j--){let{original:B,processed:V}=K[j];z=z.replace(B,V)}return z}function x7($){if(!$.trim())return[];let Z=[],J="",X=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,Y=G;else if(G===Y)X=!1;else J+=G;else if(G===","&&!X)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var g7=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,h7=/^[A-Za-z_$][\w$]*$/,uX=new Set(["light","dark","system"]);function w1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function dX($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,X=Z.colorMode;if(w1(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(w1(J.key,"appearance.key"),w1(J.attribute,"appearance.attribute"),w1(J.default,"appearance.default"),w1(X.key,"colorMode.key"),w1(X.attribute,"colorMode.attribute"),w1(X.default,"colorMode.default"),!h7.test(J.key)||!h7.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!g7.test(J.attribute)||!g7.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!uX.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function mX($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function lX($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${mX($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}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());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,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function cX($,Z){let J=1,X=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(X){if(G==="\\")Y=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function u7($,Z){let J=$,X=/@appearanceBootstrap\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index+Y[0].length-1,G=cX(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=J.slice(Q+1,G).trim(),q=e(`(${z})`,Z),K=lX(dX(q));J=J.slice(0,Y.index)+K+J.slice(G+1),X.lastIndex=Y.index+K.length}return J}import pX from"crypto";function O0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var b5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function iX($){return{...b5,...$.forms?.classes}}function Y9($,Z,J,X){let Y=$||Z;return J?`${Y} ${X}`:Y}function m0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function f1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${O0(Z)}"`}function E5($,Z,J){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(J))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))X+=` aria-describedby="${O0(`${m0($)}-error`)}"`;return X}function nX(){return pX.randomUUID()}function aW($,Z,J,X){let Y=iX(X),Q=$;return Q=oX(Q,Z),Q=_2(Q,Z),Q=y5(Q,Z,Y),Q=C5(Q,Z,Y),Q}function _2($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=nX();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${O0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${O0(Q)}">`;return X}),J}function y5($,Z,J=b5){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,q,K="")=>{let W=Q||G||"POST",U=z||q||"",H=K1(K),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",V=`<form method="${O0(B)}" action="${O0(U)}"${H?` ${H}`:""}>`;if(V+=`
3226
+ ${_2("@csrf",Z)}`,!["GET","POST"].includes(j))V+=`
3227
+ ${_2(`@method('${j}')`,Z)}`;return V}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,q,K="")=>{let W=Q||G||"",U=z||q||"",H=K1(K),j=B2(W,Z),B=j!==void 0&&j!==null?j:U||"",V=H.match(/type=['"]([^'"]+)['"]/i),F=V?V[1]:"text",_=V2(W,Z),O=H.match(/class=['"]([^'"]+)['"]/i),L=Y9(O?O[1]:"",J.input,_,J.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${O0(F)}" name="${O0(W)}"${f1(H,m0(W))} value="${O0(B)}" class="${L}"${E5(W,_,H)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let q=K1(G),K=B2(Q,Z)||z.trim(),W=V2(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),H=Y9(U?U[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${O0(Q)}"${f1(q,m0(Q))} class="${H}"${E5(Q,W,q)}${j?` ${j}`:""}>${O0(K)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let q=K1(G),K=B2(Q,Z),W=V2(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),H=Y9(U?U[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),B=z;if(K!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(V,F,_)=>{if((Array.isArray(K)?K.some((L)=>String(L)===_):String(K)===_)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return V});return`<select name="${O0(Q)}"${f1(q,m0(Q))} class="${H}"${E5(Q,W,q)}${j?` ${j}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let q=G===void 0?"1":G,K=G===void 0?m0(Q):`${m0(Q)}-${m0(q)}`,W=K1(z),U=B2(Q,Z),H=U!==void 0&&(Array.isArray(U)?U.some((F)=>String(F)===q):U===!0||String(U)===q),j=W.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:J.checkInput,V=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${O0(Q)}"${f1(W,K)} value="${O0(q)}" class="${B}"${H?" checked":""}${V?` ${V}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let q=K1(z),K=B2(Q,Z),W=K!==void 0&&K===G,U=q.match(/class=['"]([^'"]+)['"]/i),H=U?U[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${O0(Q)}"${f1(q,`${m0(Q)}-${m0(G)}`)} value="${O0(G)}" class="${H}"${W?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=K1(G),q=z.match(/accept=['"]([^'"]+)['"]/i),K=q?q[1]:"",W=z.includes("multiple"),U=V2(Q,Z),H=z.match(/class=['"]([^'"]+)['"]/i),j=Y9(H?H[1]:"",J.input,U,J.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),V=[`<input type="file" name="${O0(Q)}"${f1(z,m0(Q))}`,`class="${j}"`];if(K)V.push(`accept="${O0(K)}"`);if(W)V.push("multiple");if(B)V.push(B);return`${V.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let q=K1(G),K=q.match(/class=['"]([^'"]+)['"]/i),W=K?K[1]:J.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${O0(m0(Q))}" class="${W}"${U?` ${U}`:""}>${z}</label>`}),X}function C5($,Z,J=b5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Y,Q)=>{try{if(V2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return d7(Y,Z);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return d7(Y,Z)}let K=q.trim();if(W0(K)){let W=e(K,Z);return W!==void 0?String(W):K}return K}catch{return q}});return`<div id="${O0(`${m0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function V2($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function d7($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function B2($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(J=Z[X],J!==void 0)return J}return Z[$]}function K1($){if(!$.trim())return"";let Z=[],J=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=X.exec(J))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var m7={required:($,Z,J)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${J} field is required.`;return null},email:($,Z,J)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${J} field must be a valid email address.`;return null},min:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${J} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${J} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${J} field must have at least ${X} items.`;return null},max:($,Z,J)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${J} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${J} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${J} field must not have more than ${X} items.`;return null},confirmed:($,Z,J)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${J} confirmation does not match.`;return null},numeric:($,Z,J)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${J} field must be a number.`;return null},integer:($,Z,J)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${J} field must be an integer.`;return null},alpha:($,Z,J)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${J} field must only contain letters.`;return null},alphanumeric:($,Z,J)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${J} field must only contain letters and numbers.`;return null},url:($,Z,J)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${J} field must be a valid URL.`}},regex:($,Z,J)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${J} field format is invalid.`;return null}catch{return`The ${J} field has an invalid validation pattern.`}},in:($,Z,J)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${J} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,J)=>{if(!$)return null;if(Z.includes(String($)))return`The ${J} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,J)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${J} field must be a valid date.`;return null},before:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X>=Y)return`The ${J} field must be before ${Z[0]}.`;return null},after:($,Z,J)=>{if(!$)return null;let X=new Date($),Y=new Date(Z[0]);if(X<=Y)return`The ${J} field must be after ${Z[0]}.`;return null}};function tW($,Z){m7[$]=Z}function S5($){let[Z,...J]=$.split(":"),X=J.length>0?J.join(":").split(","):[];return{name:Z.trim(),params:X}}function sX($,Z,J,X={}){let Y=[],Q=J.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=S5(G),q=m7[z.name];if(!q){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let W=`${$}_confirmation`;z.params=[X[W]]}let K=q(Z,z.params||[],$);if(K)Y.push(z.message||K)}return{field:$,valid:Y.length===0,errors:Y}}function eW($,Z){let J={};for(let[X,Y]of Object.entries(Z)){let Q=sX(X,$[X],Y,$);if(!Q.valid)J[X]=Q.errors}return J}function oX($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(J,X,Y,Q)=>{let G=Y.split("|").map((q)=>q.trim()),z=[];for(let q of G){let K=S5(q);switch(K.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),K.name==="integer")z.push('step="1"');break;case"min":if(K.params?.[0])z.push(`minlength="${K.params[0]}"`);break;case"max":if(K.params?.[0])z.push(`maxlength="${K.params[0]}"`);break;case"regex":if(K.params?.[0])z.push(`pattern="${K.params[0]}"`);break}}return`<!-- @validate:${X}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var l7={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length>=J||`Must be at least ${J} characters`;if(typeof $==="number")return $>=J||`Must be at least ${J}`;if(Array.isArray($))return $.length>=J||`Must have at least ${J} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length<=J||`Must be no more than ${J} characters`;if(typeof $==="number")return $<=J||`Must be no more than ${J}`;if(Array.isArray($))return $.length<=J||`Must have no more than ${J} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[J,X]=Z.map(Number);if(typeof $==="string")return $.length>=J&&$.length<=X||`Must be between ${J} and ${X} characters`;if(typeof $==="number")return $>=J&&$<=X||`Must be between ${J} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,J)=>{let X=Object.keys(J);for(let Y of X)if(Y.endsWith("_confirmation")&&J[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let J=new Date(String($)),X=new Date(Z[0]);return J>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let J=Number(Z[0]);if(typeof $==="string")return $.length===J||`Must be exactly ${J} characters`;if(Array.isArray($))return $.length===J||`Must have exactly ${J} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function $U($){l7[$.name]=$}function rX($,Z,J={}){let X=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=S5(Q),z=l7[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let q=z.validate($,G.params||[],J);if(q!==!0)X.push(q)}return{valid:X.length===0,errors:X}}function ZU($,Z){let J={},X=!0;for(let[Y,Q]of Object.entries(Z)){let G=rX($[Y],Q,$);if(!G.valid)X=!1,J[Y]=G.errors}return{valid:X,errors:J}}function JU($,Z){let J=JSON.stringify(Z);return`
3223
3228
  <script>
3224
3229
  (function() {
3225
3230
  const form = document.getElementById('${$}');
@@ -3271,19 +3276,19 @@ catch { return 'Please enter a valid URL'; } },
3271
3276
  }
3272
3277
  });
3273
3278
  })();
3274
- </script>`.trim()}var _2=/<\/?template\b[^>]*>/gi,hX=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function uX($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return hX.test(Z)}function Y9($){_2.lastIndex=0;let Z;while((Z=_2.exec($))!==null){if(Z[0].startsWith("</")||uX(Z[0]))continue;let J=Z.index,X=_2.lastIndex,Y=1,Q;while((Q=_2.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:J,openEnd:X,closeStart:G,end:_2.lastIndex,content:$.slice(X,G)}}}else Y++;return null}return null}import Q0 from"path";import{existsSync as OY}from"fs";import Q9 from"fs";import U0 from"path";var x7=new Map;function g7($,Z=!0){let J=x7.get($);if(Z&&J)return J;let X=new Map,Y=[U0.join($,"src"),U0.join($,"dist"),$];function Q(G,z){if(z>6)return;let q;try{q=Q9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let K of q){let W=U0.join(G,K.name);if(K.isDirectory()){if(K.name==="node_modules"||K.name.startsWith("."))continue;Q(W,z+1)}else if(K.isFile()&&K.name.endsWith(".stx")){let U=K.name.slice(0,-4);if(!X.has(U))X.set(U,W);let H=U.toLowerCase();if(!X.has(H))X.set(H,W);let j=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(j))X.set(j,W)}}}for(let G of Y)if(Q(G,0),X.size>0)break;if(Z)x7.set($,X);return X}function h7($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let X=U0.join(J,"node_modules",$);try{if(Q9.statSync(X).isDirectory())return X}catch{}let Y=U0.dirname(J);if(Y===J)return null;J=Y}}function u7($,Z,J={}){return[U0.resolve(U0.dirname(Z),`${$}.stx`),U0.resolve(U0.dirname(Z),$),U0.resolve(J.componentsDir||"components",`${$}.stx`),U0.resolve(J.componentsDir||"components",$),$.endsWith(".stx")?$:`${$}.stx`]}function d7($){let Z=$.endsWith(".stx")?$.slice(0,-4):$,J=Z.split("-").map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join(""),X=Z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[Z,J,X]}function C5($,Z){let[J,X,Y]=d7($);for(let Q of[J,J.toLowerCase(),X,Y]){let G=Z?.__importedComponents?.get(Q);if(G!==void 0)return G}}function*S5($,Z,J={},X){let Y=d7($);if(Y[0].startsWith("./")||Y[0].startsWith("../")){yield U0.resolve(U0.dirname(Z),`${Y[0]}.stx`);return}let Q=[...new Set(Y.map((q)=>`${q}.stx`))],G=J.projectRoot||process.cwd(),z=[...X?.__originalFilePath?[U0.join(U0.dirname(X.__originalFilePath),"components")]:[],...J.componentsDir?[J.componentsDir]:[],U0.join(U0.dirname(Z),"components"),U0.resolve(G,"src/components"),U0.resolve(G,"components"),...import.meta.dir?[U0.resolve(import.meta.dir,"components")]:[]];for(let q of new Set(z)){for(let K of Q)yield U0.join(q,K);try{for(let K of Q9.readdirSync(q,{withFileTypes:!0}))if(K.isDirectory())for(let W of Q)yield U0.join(q,K.name,W)}catch{}}}function iW($,Z,J={},X){let Y=C5($,X);if(Y!==void 0)return Y;for(let Q of S5($,Z,J,X))try{if(Q9.statSync(Q,{throwIfNoEntry:!1})?.isFile())return Q}catch{}return null}class m7{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,J,X){let Y=C5($,X);if(Y!==void 0)return Y;for(let Q of S5($,Z,J,X))if(await a(Q))return Q;return null}}var x1=new m7;function N0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var R1="\x00stx-boolean-attribute";function P5($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function g1($,Z){let J=[];for(let[X,Y]of Object.entries($.static)){if(Z.has(X))continue;let Q=$.staticNames?.[X]??X;if(typeof Y==="boolean"){if(Y)J.push(N0(Q));continue}if(Y===R1){J.push(N0(Q));continue}J.push(`${N0(Q)}="${N0(P5(String(Y)))}"`)}return J}function h1($,Z){let J=[];for(let[X,Y]of Object.entries($.serverDynamic??{})){if(Z.has(X))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[X]??X;if(Y===!0){J.push(N0(Q));continue}if(typeof Y==="object")continue;J.push(`${N0(Q)}="${N0(P5(String(Y)))}"`)}return J}function L2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function dX($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var v5={name:"StxLink",aliases:["stx-link"],render($,Z,J){let X=dX($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",z=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${L2(X.value)}"`);else q.push(`href="${L2(X.value)}"`);if(Y)q.push(`class="${L2(Y)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${L2(Q)}"`),q.push(`data-stx-exact-active-class="${L2(G)}"`),z)q.push("data-stx-prefetch");let K=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...g1($,K)),q.push(...h1($,K)),`<a ${q.join(" ")}>${Z}</a>`}};import d1 from"fs";import f5 from"path";var mX=new Set([".jpg",".jpeg",".png",".webp",".avif"]),W1=new Map,u1=!1;function l7($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return W1.get(Z)}function GU(){return u1}function zU(){W1.clear(),u1=!1}function qU($,Z){W1.set($,Z),u1=!0}function lX($){let Z=0,J=0,X=0,Y=0;for(let G=0;G<$.length;G+=4)Z+=$[G],J+=$[G+1],X+=$[G+2],Y++;if(Y===0)return"#e5e7eb";let Q=(G)=>Math.round(G/Y).toString(16).padStart(2,"0");return`#${Q(Z)}${Q(J)}${Q(X)}`}function cX($,Z,J,X=4,Y=3){let Q=[];for(let G=0;G<Y;G++)for(let z=0;z<X;z++){let q=Math.floor(z*Z/X),K=Math.max(q+1,Math.floor((z+1)*Z/X)),W=Math.floor(G*J/Y),U=Math.max(W+1,Math.floor((G+1)*J/Y)),H=0,j=0,B=0,V=0;for(let _=W;_<U;_++)for(let O=q;O<K;O++){let L=(_*Z+O)*4;H+=$[L],j+=$[L+1],B+=$[L+2],V++}let F=(_)=>Math.round(_/V).toString(16).padStart(2,"0");Q.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${F(H)}${F(j)}${F(B)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${X} ${Y}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Q.join("")}</g></svg>`}function pX($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function iX($){try{return JSON.parse(d1.readFileSync($,"utf8"))}catch{return{}}}function nX($,Z){try{d1.mkdirSync(f5.dirname($),{recursive:!0}),d1.writeFileSync($,JSON.stringify(Z))}catch{}}function c7($,Z,J=[]){let X;try{X=d1.readdirSync($,{withFileTypes:!0})}catch{return J}for(let Y of X){let Q=f5.join($,Y.name);if(Y.isDirectory()){c7(Q,`${Z}/${Y.name}`,J);continue}if(!mX.has(f5.extname(Y.name).toLowerCase()))continue;J.push([`${Z}/${Y.name}`,Q])}return J}async function KU($,Z={}){let{cachePath:J,maxBytes:X=33554432,limit:Y=2000}=Z;if(!$||!d1.existsSync($))return u1=!0,W1.size;let Q;try{Q=await import("ts-images")}catch{return u1=!0,W1.size}let G=J?iX(J):{},z=!1,q=c7($,"").slice(0,Y),K=8,W=async([U,H])=>{let j;try{j=d1.statSync(H)}catch{return}if(j.size>X)return;let B=G[U];if(B&&B.mtimeMs===j.mtimeMs&&B.size===j.size){W1.set(U,{dataUrl:B.dataUrl,color:B.color});return}try{let{hash:V}=await Q.generateThumbHash(H);if(!V)return;let{rgba:F,w:_,h:O}=Q.thumbHashToRGBA(V),L={dataUrl:pX(cX(F,_,O)),color:lX(F)};W1.set(U,L),G[U]={mtimeMs:j.mtimeMs,size:j.size,...L},z=!0}catch{}};for(let U=0;U<q.length;U+=K)await Promise.all(q.slice(U,U+K).map(W));if(J&&z)nX(J,G);return u1=!0,W1.size}var sX={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},x5=[320,640,768,1024,1280,1536,1920];function F0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function I0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function G9($,Z,J=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return J}function oX($){let Z=(X)=>$.variants.filter((Y)=>Y.format===X).reduce((Y,Q)=>Y+Q.bytes,0),J=Z($.fallback.format);return["avif","webp"].map((X)=>({format:X,srcset:$.sources[X]||"",bytes:Z(X)})).filter((X)=>X.srcset&&X.bytes>0&&X.bytes<J).sort((X,Y)=>X.bytes-Y.bytes).map(({format:X,srcset:Y})=>({format:X,srcset:Y}))}function g5($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let X of Z)if(X.includes(":")){let[Y,Q]=X.split(":"),G=sX[Y];if(G)J.push(`(max-width: ${G}px) ${Q}`);else{let z=Number.parseInt(Y);if(!Number.isNaN(z))J.push(`(max-width: ${z}px) ${Q}`)}}else J.push(X);return J.join(", ")}function h5($,Z,J,X){return Z.map((Y)=>`${O2($,Y,void 0,J,X)} ${Y}w`).join(", ")}function rX($,Z,J,X,Y){return Z.map((Q)=>{let G=J?J*Q:void 0;return`${O2($,G,void 0,X,Y)} ${Q}x`}).join(", ")}function O2($,Z,J,X,Y){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(J)Q.push(`h_${J}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(J)Q.set("h",String(J));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(J)Q.set("height",String(J));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function aX($,Z,J="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var u5={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,J){let X=I0($,"src")||"",Y=p7(X),Q=I0($,"alt")||"",G=I0($,"width")||(Y?String(Y.source.width):void 0),z=I0($,"height")||(Y?String(Y.source.height):void 0),q=I0($,"sizes"),K=I0($,"srcset"),W=I0($,"densities"),U=I0($,"format"),H=I0($,"placeholder")||(Y?"thumbhash":void 0),j=I0($,"placeholderColor")||"#e5e7eb",B=I0($,"provider"),V=I0($,"class")||I0($,"className")||"",F=I0($,"style")||"",_=I0($,"quality"),O=G9($,"lazy",!0),L=G9($,"preload",!1),w=G9($,"priority",!1),R=I0($,"loading"),D=I0($,"decoding")||"async",A=!!Y||G9($,"picture",!1)||!!U,T=G?Number.parseInt(G):void 0,N=z?Number.parseInt(z):void 0,I=K||"",k="";if(Y)I=Y.sources[Y.fallback.format]||"",k=q?g5(q):"100vw";else if(!I&&q&&B&&B!=="local"&&B!=="static")I=h5(X,x5,B,U),k=g5(q);else if(!I&&W){let P=W.split(/\s+/).map((h)=>Number.parseFloat(h.replace("x","")));I=rX(X,P,T,B,U)}else if(q)k=g5(q);let M=[];if(F)M.push(F);if(T&&N)M.push(`aspect-ratio:${T}/${N}`);if(H==="blur"||H==="color"||H==="thumbhash"){let P=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:j}:l7(X);if(P&&H==="color")M.push(`background-color:${P.color}`);else if(P)M.push(`background-color:${P.color}`),M.push(`background-image:url(${P.dataUrl})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");else{let h=aX(T||16,N||9,j);M.push(`background-image:url(${h})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}}else if(H&&H!=="empty"&&H!=="none")M.push(`background-image:url(${F0(H)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let y=Y?.fallback.url||O2(X,T,N,B,U),E=[];if(E.push(`src="${F0(y)}"`),E.push(`alt="${F0(Q)}"`),G)E.push(`width="${F0(G)}"`);if(z)E.push(`height="${F0(z)}"`);let b=R||(w||L?"eager":O?"lazy":"");if(b)E.push(`loading="${F0(b)}"`);if(w)E.push('fetchpriority="high"');if(E.push(`decoding="${F0(D)}"`),V)E.push(`class="${F0(V)}"`);if(M.length>0)E.push(`style="${F0(M.join(";"))}"`);if(I)E.push(`srcset="${F0(I)}"`);if(k)E.push(`sizes="${F0(k)}"`);let C=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);E.push(...g1($,C)),E.push(...h1($,C));let f=`<img ${E.join(" ")} />`,u="";if(L){let h=U==="webp"?"image/webp":U==="avif"?"image/avif":"";u=`<link rel="preload" as="image" href="${F0(y)}"${h?` type="${h}"`:""}${I?` imagesrcset="${F0(I)}"`:""}${k?` imagesizes="${F0(k)}"`:""} />
3275
- `}if(A){let P=[];if(Y)for(let h of oX(Y))P.push(`<source type="image/${h.format}" srcset="${F0(h.srcset)}"${k?` sizes="${F0(k)}"`:""} />`);if(!Y&&(U==="avif"||U==="auto")){let h=O2(X,T,N,B,"avif"),m=I?h5(X,x5,B,"avif"):`${h}`;P.push(`<source type="image/avif" srcset="${F0(m)}"${k?` sizes="${F0(k)}"`:""} />`)}if(!Y&&(U==="webp"||U==="auto")){let h=O2(X,T,N,B,"webp"),m=I?h5(X,x5,B,"webp"):`${h}`;P.push(`<source type="image/webp" srcset="${F0(m)}"${k?` sizes="${F0(k)}"`:""} />`)}return`${u}<picture>
3279
+ </script>`.trim()}var L2=/<\/?template\b[^>]*>/gi,aX=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function tX($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return aX.test(Z)}function Q9($){L2.lastIndex=0;let Z;while((Z=L2.exec($))!==null){if(Z[0].startsWith("</")||tX(Z[0]))continue;let J=Z.index,X=L2.lastIndex,Y=1,Q;while((Q=L2.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:J,openEnd:X,closeStart:G,end:L2.lastIndex,content:$.slice(X,G)}}}else Y++;return null}return null}import Q0 from"path";import{existsSync as bY}from"fs";import G9 from"fs";import U0 from"path";var c7=new Map;function p7($,Z=!0){let J=c7.get($);if(Z&&J)return J;let X=new Map,Y=[U0.join($,"src"),U0.join($,"dist"),$];function Q(G,z){if(z>6)return;let q;try{q=G9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let K of q){let W=U0.join(G,K.name);if(K.isDirectory()){if(K.name==="node_modules"||K.name.startsWith("."))continue;Q(W,z+1)}else if(K.isFile()&&K.name.endsWith(".stx")){let U=K.name.slice(0,-4);if(!X.has(U))X.set(U,W);let H=U.toLowerCase();if(!X.has(H))X.set(H,W);let j=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(j))X.set(j,W)}}}for(let G of Y)if(Q(G,0),X.size>0)break;if(Z)c7.set($,X);return X}function i7($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let X=U0.join(J,"node_modules",$);try{if(G9.statSync(X).isDirectory())return X}catch{}let Y=U0.dirname(J);if(Y===J)return null;J=Y}}function n7($,Z,J={}){return[U0.resolve(U0.dirname(Z),`${$}.stx`),U0.resolve(U0.dirname(Z),$),U0.resolve(J.componentsDir||"components",`${$}.stx`),U0.resolve(J.componentsDir||"components",$),$.endsWith(".stx")?$:`${$}.stx`]}function s7($){let Z=$.endsWith(".stx")?$.slice(0,-4):$,J=Z.split("-").map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join(""),X=Z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return[Z,J,X]}function P5($,Z){let[J,X,Y]=s7($);for(let Q of[J,J.toLowerCase(),X,Y]){let G=Z?.__importedComponents?.get(Q);if(G!==void 0)return G}}function*v5($,Z,J={},X){let Y=s7($);if(Y[0].startsWith("./")||Y[0].startsWith("../")){yield U0.resolve(U0.dirname(Z),`${Y[0]}.stx`);return}let Q=[...new Set(Y.map((q)=>`${q}.stx`))],G=J.projectRoot||process.cwd(),z=[...X?.__originalFilePath?[U0.join(U0.dirname(X.__originalFilePath),"components")]:[],...J.componentsDir?[J.componentsDir]:[],U0.join(U0.dirname(Z),"components"),U0.resolve(G,"src/components"),U0.resolve(G,"components"),...import.meta.dir?[U0.resolve(import.meta.dir,"components")]:[]];for(let q of new Set(z)){for(let K of Q)yield U0.join(q,K);try{for(let K of G9.readdirSync(q,{withFileTypes:!0}))if(K.isDirectory())for(let W of Q)yield U0.join(q,K.name,W)}catch{}}}function zU($,Z,J={},X){let Y=P5($,X);if(Y!==void 0)return Y;for(let Q of v5($,Z,J,X))try{if(G9.statSync(Q,{throwIfNoEntry:!1})?.isFile())return Q}catch{}return null}class o7{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,J,X){let Y=P5($,X);if(Y!==void 0)return Y;for(let Q of v5($,Z,J,X))if(await a(Q))return Q;return null}}var x1=new o7;function D0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var R1="\x00stx-boolean-attribute";function f5($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function g1($,Z){let J=[];for(let[X,Y]of Object.entries($.static)){if(Z.has(X))continue;let Q=$.staticNames?.[X]??X;if(typeof Y==="boolean"){if(Y)J.push(D0(Q));continue}if(Y===R1){J.push(D0(Q));continue}J.push(`${D0(Q)}="${D0(f5(String(Y)))}"`)}return J}function h1($,Z){let J=[];for(let[X,Y]of Object.entries($.serverDynamic??{})){if(Z.has(X))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[X]??X;if(Y===!0){J.push(D0(Q));continue}if(typeof Y==="object")continue;J.push(`${D0(Q)}="${D0(f5(String(Y)))}"`)}return J}function O2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function eX($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var x5={name:"StxLink",aliases:["stx-link"],render($,Z,J){let X=eX($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",z=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${O2(X.value)}"`);else q.push(`href="${O2(X.value)}"`);if(Y)q.push(`class="${O2(Y)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${O2(Q)}"`),q.push(`data-stx-exact-active-class="${O2(G)}"`),z)q.push("data-stx-prefetch");let K=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...g1($,K)),q.push(...h1($,K)),`<a ${q.join(" ")}>${Z}</a>`}};import d1 from"fs";import g5 from"path";var $Y=new Set([".jpg",".jpeg",".png",".webp",".avif"]),W1=new Map,u1=!1;function r7($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return W1.get(Z)}function RU(){return u1}function NU(){W1.clear(),u1=!1}function DU($,Z){W1.set($,Z),u1=!0}function ZY($){let Z=0,J=0,X=0,Y=0;for(let G=0;G<$.length;G+=4)Z+=$[G],J+=$[G+1],X+=$[G+2],Y++;if(Y===0)return"#e5e7eb";let Q=(G)=>Math.round(G/Y).toString(16).padStart(2,"0");return`#${Q(Z)}${Q(J)}${Q(X)}`}function JY($,Z,J,X=4,Y=3){let Q=[];for(let G=0;G<Y;G++)for(let z=0;z<X;z++){let q=Math.floor(z*Z/X),K=Math.max(q+1,Math.floor((z+1)*Z/X)),W=Math.floor(G*J/Y),U=Math.max(W+1,Math.floor((G+1)*J/Y)),H=0,j=0,B=0,V=0;for(let _=W;_<U;_++)for(let O=q;O<K;O++){let L=(_*Z+O)*4;H+=$[L],j+=$[L+1],B+=$[L+2],V++}let F=(_)=>Math.round(_/V).toString(16).padStart(2,"0");Q.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${F(H)}${F(j)}${F(B)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${X} ${Y}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Q.join("")}</g></svg>`}function XY($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function YY($){try{return JSON.parse(d1.readFileSync($,"utf8"))}catch{return{}}}function QY($,Z){try{d1.mkdirSync(g5.dirname($),{recursive:!0}),d1.writeFileSync($,JSON.stringify(Z))}catch{}}function a7($,Z,J=[]){let X;try{X=d1.readdirSync($,{withFileTypes:!0})}catch{return J}for(let Y of X){let Q=g5.join($,Y.name);if(Y.isDirectory()){a7(Q,`${Z}/${Y.name}`,J);continue}if(!$Y.has(g5.extname(Y.name).toLowerCase()))continue;J.push([`${Z}/${Y.name}`,Q])}return J}async function AU($,Z={}){let{cachePath:J,maxBytes:X=33554432,limit:Y=2000}=Z;if(!$||!d1.existsSync($))return u1=!0,W1.size;let Q;try{Q=await import("ts-images")}catch{return u1=!0,W1.size}let G=J?YY(J):{},z=!1,q=a7($,"").slice(0,Y),K=8,W=async([U,H])=>{let j;try{j=d1.statSync(H)}catch{return}if(j.size>X)return;let B=G[U];if(B&&B.mtimeMs===j.mtimeMs&&B.size===j.size){W1.set(U,{dataUrl:B.dataUrl,color:B.color});return}try{let{hash:V}=await Q.generateThumbHash(H);if(!V)return;let{rgba:F,w:_,h:O}=Q.thumbHashToRGBA(V),L={dataUrl:XY(JY(F,_,O)),color:ZY(F)};W1.set(U,L),G[U]={mtimeMs:j.mtimeMs,size:j.size,...L},z=!0}catch{}};for(let U=0;U<q.length;U+=K)await Promise.all(q.slice(U,U+K).map(W));if(J&&z)QY(J,G);return u1=!0,W1.size}var GY={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},h5=[320,640,768,1024,1280,1536,1920];function F0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function I0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function z9($,Z,J=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return J}function zY($){let Z=(X)=>$.variants.filter((Y)=>Y.format===X).reduce((Y,Q)=>Y+Q.bytes,0),J=Z($.fallback.format);return["avif","webp"].map((X)=>({format:X,srcset:$.sources[X]||"",bytes:Z(X)})).filter((X)=>X.srcset&&X.bytes>0&&X.bytes<J).sort((X,Y)=>X.bytes-Y.bytes).map(({format:X,srcset:Y})=>({format:X,srcset:Y}))}function u5($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let X of Z)if(X.includes(":")){let[Y,Q]=X.split(":"),G=GY[Y];if(G)J.push(`(max-width: ${G}px) ${Q}`);else{let z=Number.parseInt(Y);if(!Number.isNaN(z))J.push(`(max-width: ${z}px) ${Q}`)}}else J.push(X);return J.join(", ")}function d5($,Z,J,X){return Z.map((Y)=>`${F2($,Y,void 0,J,X)} ${Y}w`).join(", ")}function qY($,Z,J,X,Y){return Z.map((Q)=>{let G=J?J*Q:void 0;return`${F2($,G,void 0,X,Y)} ${Q}x`}).join(", ")}function F2($,Z,J,X,Y){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(J)Q.push(`h_${J}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(J)Q.set("h",String(J));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(J)Q.set("height",String(J));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function KY($,Z,J="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var m5={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,J){let X=I0($,"src")||"",Y=t7(X),Q=I0($,"alt")||"",G=I0($,"width")||(Y?String(Y.source.width):void 0),z=I0($,"height")||(Y?String(Y.source.height):void 0),q=I0($,"sizes"),K=I0($,"srcset"),W=I0($,"densities"),U=I0($,"format"),H=I0($,"placeholder")||(Y?"thumbhash":void 0),j=I0($,"placeholderColor")||"#e5e7eb",B=I0($,"provider"),V=I0($,"class")||I0($,"className")||"",F=I0($,"style")||"",_=I0($,"quality"),O=z9($,"lazy",!0),L=z9($,"preload",!1),w=z9($,"priority",!1),R=I0($,"loading"),N=I0($,"decoding")||"async",A=!!Y||z9($,"picture",!1)||!!U,T=G?Number.parseInt(G):void 0,D=z?Number.parseInt(z):void 0,M=K||"",k="";if(Y)M=Y.sources[Y.fallback.format]||"",k=q?u5(q):"100vw";else if(!M&&q&&B&&B!=="local"&&B!=="static")M=d5(X,h5,B,U),k=u5(q);else if(!M&&W){let P=W.split(/\s+/).map((h)=>Number.parseFloat(h.replace("x","")));M=qY(X,P,T,B,U)}else if(q)k=u5(q);let I=[];if(F)I.push(F);if(T&&D)I.push(`aspect-ratio:${T}/${D}`);if(H==="blur"||H==="color"||H==="thumbhash"){let P=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:j}:r7(X);if(P&&H==="color")I.push(`background-color:${P.color}`);else if(P)I.push(`background-color:${P.color}`),I.push(`background-image:url(${P.dataUrl})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");else{let h=KY(T||16,D||9,j);I.push(`background-image:url(${h})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat")}}else if(H&&H!=="empty"&&H!=="none")I.push(`background-image:url(${F0(H)})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");let y=Y?.fallback.url||F2(X,T,D,B,U),E=[];if(E.push(`src="${F0(y)}"`),E.push(`alt="${F0(Q)}"`),G)E.push(`width="${F0(G)}"`);if(z)E.push(`height="${F0(z)}"`);let b=R||(w||L?"eager":O?"lazy":"");if(b)E.push(`loading="${F0(b)}"`);if(w)E.push('fetchpriority="high"');if(E.push(`decoding="${F0(N)}"`),V)E.push(`class="${F0(V)}"`);if(I.length>0)E.push(`style="${F0(I.join(";"))}"`);if(M)E.push(`srcset="${F0(M)}"`);if(k)E.push(`sizes="${F0(k)}"`);let C=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);E.push(...g1($,C)),E.push(...h1($,C));let f=`<img ${E.join(" ")} />`,u="";if(L){let h=U==="webp"?"image/webp":U==="avif"?"image/avif":"";u=`<link rel="preload" as="image" href="${F0(y)}"${h?` type="${h}"`:""}${M?` imagesrcset="${F0(M)}"`:""}${k?` imagesizes="${F0(k)}"`:""} />
3280
+ `}if(A){let P=[];if(Y)for(let h of zY(Y))P.push(`<source type="image/${h.format}" srcset="${F0(h.srcset)}"${k?` sizes="${F0(k)}"`:""} />`);if(!Y&&(U==="avif"||U==="auto")){let h=F2(X,T,D,B,"avif"),m=M?d5(X,h5,B,"avif"):`${h}`;P.push(`<source type="image/avif" srcset="${F0(m)}"${k?` sizes="${F0(k)}"`:""} />`)}if(!Y&&(U==="webp"||U==="auto")){let h=F2(X,T,D,B,"webp"),m=M?d5(X,h5,B,"webp"):`${h}`;P.push(`<source type="image/webp" srcset="${F0(m)}"${k?` sizes="${F0(k)}"`:""} />`)}return`${u}<picture>
3276
3281
  ${P.join(`
3277
3282
  `)}
3278
3283
  ${f}
3279
- </picture>`}return`${u}${f}`}};var i7="/images/safe-image-default.svg";function F2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function m1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var tX=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${i7}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,d5={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,J){let X=m1($,"src")||"",Y=m1($,"alt")||"",Q=m1($,"fallback")||i7,G=m1($,"class")||m1($,"className")||"",z=m1($,"fallbackClassName")||"",q=[];if(q.push(`src="${F2(X)}"`),q.push(`alt="${F2(Y)}"`),G)q.push(`class="${F2(G)}"`);if(q.push(`data-fallback="${F2(Q)}"`),z)q.push(`data-fallback-class="${F2(z)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let K=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...g1($,K)),q.push(...h1($,K));let W=`<img ${q.join(" ")} />`,U=J.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${tX}${W}`;return W}};function m5($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function w2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function z9($,Z,J){let X=w2($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var l5={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let X=m5(w2($,"color")||"#6366f1"),Y=m5(w2($,"initialColor")||w2($,"initial-color")||""),Q=m5(w2($,"height")||"3px"),G=z9($,"duration",2000),z=z9($,"throttle",200),q=z9($,"zIndex",999999)||z9($,"z-index",999999),K=Y?`linear-gradient(to right, ${Y}, ${X})`:X;return`
3284
+ </picture>`}return`${u}${f}`}};var e7="/images/safe-image-default.svg";function w2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function m1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var WY=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${e7}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,l5={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,J){let X=m1($,"src")||"",Y=m1($,"alt")||"",Q=m1($,"fallback")||e7,G=m1($,"class")||m1($,"className")||"",z=m1($,"fallbackClassName")||"",q=[];if(q.push(`src="${w2(X)}"`),q.push(`alt="${w2(Y)}"`),G)q.push(`class="${w2(G)}"`);if(q.push(`data-fallback="${w2(Q)}"`),z)q.push(`data-fallback-class="${w2(z)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let K=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...g1($,K)),q.push(...h1($,K));let W=`<img ${q.join(" ")} />`,U=J.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${WY}${W}`;return W}};function c5($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function R2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function q9($,Z,J){let X=R2($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var p5={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,J){let X=c5(R2($,"color")||"#6366f1"),Y=c5(R2($,"initialColor")||R2($,"initial-color")||""),Q=c5(R2($,"height")||"3px"),G=q9($,"duration",2000),z=q9($,"throttle",200),q=q9($,"zIndex",999999)||q9($,"z-index",999999),K=Y?`linear-gradient(to right, ${Y}, ${X})`:X;return`
3280
3285
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${K};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
3281
3286
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
3282
3287
  </div>
3283
3288
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
3284
3289
  <script>
3285
3290
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${z})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
3286
- </script>`}};function s7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function eX($,Z,J){let X=s7($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var n7={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},c5={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let X=N0(s7($,"position")||"top-right"),Y=eX($,"max",5),Q=n7[X]||n7["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Y}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3291
+ </script>`}};function Z4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function UY($,Z,J){let X=Z4($,Z);if(X!==void 0){let Y=Number.parseInt(X,10);if(!Number.isNaN(Y))return Y}return J}var $4={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},i5={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let X=D0(Z4($,"position")||"top-right"),Y=UY($,"max",5),Q=$4[X]||$4["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Y}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3287
3292
  <style>
3288
3293
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
3289
3294
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -3291,7 +3296,7 @@ ${f}
3291
3296
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
3292
3297
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
3293
3298
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
3294
- </style>`}};function q9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var o7={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},p5={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let X=q9($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=N0(X),Q=q9($,"size")||"md",G=q9($,"closeOnBackdrop")!=="false",z=q9($,"closeOnEscape")!=="false",q=o7[Q]||o7.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${G}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
3299
+ </style>`}};function K9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var J4={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},n5={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let X=K9($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=D0(X),Q=K9($,"size")||"md",G=K9($,"closeOnBackdrop")!=="false",z=K9($,"closeOnEscape")!=="false",q=J4[Q]||J4.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${G}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
3295
3300
  <div class="stx-modal-panel" style="${q};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
3296
3301
  <div style="padding:1.5rem">${Z}</div>
3297
3302
  </div>
@@ -3300,7 +3305,7 @@ ${f}
3300
3305
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
3301
3306
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
3302
3307
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
3303
- </style>`}};function l1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var r7={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},i5={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let X=l1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=N0(X),Q=l1($,"side")||"right",G=l1($,"size")||"md",z=l1($,"closeOnBackdrop")!=="false",q=l1($,"closeOnEscape")!=="false",K=l1($,"overlay")!=="false",W=r7[G]||r7.md,U=Q==="left",H=U?"left:0":"right:0",j=U?"translateX(-100%)":"translateX(100%)",B=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${z}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${K?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
3308
+ </style>`}};function l1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var X4={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},s5={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let X=l1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=D0(X),Q=l1($,"side")||"right",G=l1($,"size")||"md",z=l1($,"closeOnBackdrop")!=="false",q=l1($,"closeOnEscape")!=="false",K=l1($,"overlay")!=="false",W=X4[G]||X4.md,U=Q==="left",H=U?"left:0":"right:0",j=U?"translateX(-100%)":"translateX(100%)",B=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${z}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${K?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
3304
3309
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${H};width:${W};max-width:100vw;transform:${j};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
3305
3310
  <div style="padding:1.5rem">${Z}</div>
3306
3311
  </div>
@@ -3309,7 +3314,7 @@ ${f}
3309
3314
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
3310
3315
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3311
3316
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3312
- </style>`}};import{existsSync as $Y,readFileSync as ZY}from"fs";var D1=new Map,a7=new Set;function t7($){if(a7.has($))return;a7.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function e7($){let Z=process.cwd();for(let J of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if($Y(J))return J;for(let J of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return x.resolve(J)}catch{}return null}function JY($){if(D1.has($))return D1.get($);let Z=e7($);if(!Z)return t7($),null;try{let J=JSON.parse(ZY(Z,"utf8"));return D1.set($,J.icons),J.icons}catch{return null}}async function XY($,Z=!1){if(D1.has($))return D1.get($);let J=e7($);if(!J){if(!Z)t7($);return null}try{let X=await Bun.file(J).json();return D1.set($,X.icons),X.icons}catch{return null}}function c1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var n5={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let X=c1($,"name")??c1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=X;if(X.includes(":")){let O=X.split(":");Y=O[0],Q=O[1]}let G=N0(c1($,"size")||"24"),z=N0(c1($,"color")||"currentColor"),q=N0(c1($,"class")||""),K=N0(c1($,"style")||""),W=D1.get(Y)??JY(Y);if(!W)return`<!-- Icon: collection "${Y}" not loaded -->`;let U=W[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let H=U.width||24,j=U.height||24,B=`0 0 ${H} ${j}`,V=U.body;if(z!=="currentColor")V=V.replace(/currentColor/g,z);let F=q?` class="${q}"`:"",_=K?` style="${K}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${_}>${V}</svg>`}};async function YY($="lucide",Z={}){await XY($,Z.speculative??!0)}function s5(){return`
3317
+ </style>`}};import{existsSync as HY,readFileSync as jY}from"fs";var N1=new Map,Y4=new Set;function Q4($){if(Y4.has($))return;Y4.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function G4($){let Z=process.cwd();for(let J of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(HY(J))return J;for(let J of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return x.resolve(J)}catch{}return null}function BY($){if(N1.has($))return N1.get($);let Z=G4($);if(!Z)return Q4($),null;try{let J=JSON.parse(jY(Z,"utf8"));return N1.set($,J.icons),J.icons}catch{return null}}async function VY($,Z=!1){if(N1.has($))return N1.get($);let J=G4($);if(!J){if(!Z)Q4($);return null}try{let X=await Bun.file(J).json();return N1.set($,X.icons),X.icons}catch{return null}}function c1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var o5={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let X=c1($,"name")??c1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=X;if(X.includes(":")){let O=X.split(":");Y=O[0],Q=O[1]}let G=D0(c1($,"size")||"24"),z=D0(c1($,"color")||"currentColor"),q=D0(c1($,"class")||""),K=D0(c1($,"style")||""),W=N1.get(Y)??BY(Y);if(!W)return`<!-- Icon: collection "${Y}" not loaded -->`;let U=W[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let H=U.width||24,j=U.height||24,B=`0 0 ${H} ${j}`,V=U.body;if(z!=="currentColor")V=V.replace(/currentColor/g,z);let F=q?` class="${q}"`:"",_=K?` style="${K}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${_}>${V}</svg>`}};async function _Y($="lucide",Z={}){await VY($,Z.speculative??!0)}function r5(){return`
3313
3318
  (function(){
3314
3319
  var tip=null,hideTimer=null,currentEl=null;
3315
3320
 
@@ -3412,9 +3417,9 @@ document.addEventListener("focusout",function(e){
3412
3417
  if(el) hideTip();
3413
3418
  });
3414
3419
  })();
3415
- `}function $4($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}function Z4($,Z){let J=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(J);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var o5={name:"Suspense",aliases:["suspense"],render($,Z,J){let X=Z4(Z,"fallback"),Y=X.rest,Q=Z4(Y,"error"),G=Q.rest,z=X.region??$4($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??$4($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function K9($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}var r5={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let X=(K9($,"name")||"v").replace(/["'<>]/g,""),Y=(K9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=K9($,"class"),G=K9($,"id"),z=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${z}>${Z}</${Y}>`}};function J4($=x1){$.registerBuiltin(v5),$.registerBuiltin(u5),$.registerBuiltin(d5),$.registerBuiltin(l5),$.registerBuiltin(c5),$.registerBuiltin(p5),$.registerBuiltin(i5),$.registerBuiltin(n5),$.registerBuiltin(o5),$.registerBuiltin(r5)}function W9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var X4=new Map;function QY($){let Z=X4.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),X4.set($.source,Z);return Z}var Y4=new WeakMap;function Q4($){let Z=Y4.get($);if(!Z)Z=new Set([...$].map((X)=>X.toLowerCase())),Y4.set($,Z);let J=Z;return(X)=>!/[a-z]/.test(X)&&J.has(X.toLowerCase())}function G4($,Z,J){let X=[],Y=0,Q=typeof J==="function"?J:J?(G)=>J.has(G.toLowerCase()):void 0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;let z=QY(Z);z.lastIndex=G+1;let q=z.exec($);if(!q){Y=G+1;continue}let K=q[1];if(Q&&Q(K)){let F=G+1+K.length;while(F<$.length&&$[F]!==">")F++;Y=F+1;continue}let W=G+1+K.length,U=null,H=W,j=-1,B=!1;while(W<$.length){let F=$[W];if(U){if(F==="\\"&&W+1<$.length){W+=2;continue}if(F===U)U=null;W++;continue}if(F==='"'||F==="'"){U=F,W++;continue}if(F==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,B=!0;break}if(F===">"){j=W+1;break}W++}if(j===-1){Y=G+1;continue}let V=$.slice(H,B?j-2:j-1).trim();if(B)X.push({fullMatch:$.slice(G,j),tagName:K,attributes:V,content:"",startIndex:G,endIndex:j,isSelfClosing:!0}),Y=j;else{let F=`<${K}`,_=`</${K}>`,O=1,L=j,w=-1;while(O>0&&L<$.length){let A=$.indexOf(F,L),T=$.indexOf(_,L);if(T===-1)break;if(A!==-1&&A<T){let N=$[A+F.length];if(N===" "||N===">"||N==="/"||N===`
3416
- `||N==="\t")O++;L=A+F.length}else{if(O--,O===0){w=T;break}L=T+_.length}}if(w===-1){Y=j;continue}let R=$.slice(j,w),D=w+_.length;X.push({fullMatch:$.slice(G,D),tagName:K,attributes:V,content:R,startIndex:G,endIndex:D,isSelfClosing:!1}),Y=D}}return X}function z4($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function q4($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}function a5($,Z){let J=0,X="",Y=Z;while(Y<$.length){let Q=$[Y];if(X){if(Q==="\\")Y++;else if(Q===X)X=""}else if(Q==='"'||Q==="'"||Q==="`")X=Q;else if(Q==="{")J++;else if(Q==="}"){if(J--,J===0)return $.slice(Z,Y+1)}Y++}return $.slice(Z)}function K4($){let Z=$.trim();if(!Z.startsWith("{")||!Z.endsWith("}"))return null;if(a5(Z,0).length!==Z.length)return null;return Z.slice(1,-1).trim()}var GY=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),zY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function t5($){let Z=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,X;while((X=J.exec($))!==null){let Y=X[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=X.index,G=Q+X[0].length,z=X[1].toLowerCase();if(X[0].endsWith("/>")||zY.has(z)){Z.push([Q,G]);continue}let q=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`<\\/?${q}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");K.lastIndex=G;let W=1,U=G,H;while((H=K.exec($))!==null)if(H[0].startsWith("</")){if(W--,W===0){U=H.index+H[0].length;break}}else if(!H[0].endsWith("/>"))W++;Z.push([Q,U])}return Z}function U4($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>U4(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function H4($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=X.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...t5($));function G(U){return Y.some(([H,j])=>U>=H&&U<j)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,q=[],K=new Map,W=256;while((Q=z.exec(J))!==null){if(G(Q.index))continue;let U=Q[0],H=Q[2];if(!H||!H.includes(":"))continue;let j=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,V=H,F=!1;while((B=j.exec(H))!==null){let _=B[1],O=B[2];if(W4(_))continue;if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let L=Object.keys(Z),w=Object.values(Z),R=O.match(/^([a-zA-Z_$][\w$]*)/);if(R&&!L.includes(R[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(R[1]))continue;let D=JSON.stringify([L,O]),A=K.get(D);if(!A){if(A=Function(...L,`return (${O})`),K.size>=W)K.clear();K.set(D,A)}let T=A(...w);if(_==="class"){let N=U4(T);if(N){let I=V.match(/\sclass="([^"]*)"/);if(I)V=V.replace(I[0],` class="${I[1]} ${N}"`);else V=V.replace(B[0],` class="${N}"`)}else V=V.replace(B[0],"");F=!0;continue}if(GY.has(_)){if(T)V=V.replace(B[0],` ${_}`);else V=V.replace(B[0],"");F=!0;continue}if(T===null||T===void 0||T===!1)V=V.replace(B[0],"");else{let N=String(T).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");V=V.replace(B[0],` ${_}="${N}"`)}F=!0}catch{continue}}if(F){let _=U.endsWith("/>")?" /":"",L=`<${Q[1]}${V}${_}>`;q.push({start:Q.index,end:Q.index+U.length,replacement:L})}}if(q.length>0){let U=Array(q.length*2+1),H=0;for(let j=0;j<q.length;j++){let{start:B,end:V,replacement:F}=q[j];U[j*2]=J.slice(H,B),U[j*2+1]=F,H=V}U[q.length*2]=J.slice(H),J=U.join("")}return J}import j4 from"fs";import B4 from"path";var R2=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 e5($){if($.includes("-")||$==="component")return!1;if(/^[A-Z]/.test($))return!/[a-z]/.test($)&&[...R2].some((Z)=>Z.toLowerCase()===$.toLowerCase());return R2.has($)||/[A-Z]/.test($)}var V4=!1;function qY($,Z,J,X=!1){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Q=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(W)=>{if(Q.size===0)return!1;let U=u0(W),H=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(H&&Q.has(H))return!0;for(let j of Q){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(U))return!0}return!1},z=new Set(O4),q=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(U,H)=>H.toUpperCase())},K=(W,U)=>{let H=q(W);if(Y.static[H]=U,H!==W)Y.staticNames[H]=W};for(let[W,U]of Object.entries($)){let H=W.startsWith("x-")&&!z.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(H.startsWith("@")){Y.events[H]=U;continue}if(H.startsWith("__stx_")){let j=q(H.slice(6));Y.serverDynamic[j]=q4(U,J);continue}if(H.startsWith(":")){let j=q(H.slice(1)),B=U===R1?j:U;if(j==="if"||j==="for"||j==="show"){Y.clientReactive[j]=B;continue}if(X){Y.clientReactive[j]=B;continue}if(G(B)){Y.clientReactive[j]=B;continue}try{if(!q0(B)){if(J.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let V=Object.keys(Z),_=W0(B,V)(...Object.values(Z));if(_===void 0){let O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H9(B).some((w)=>!O.has(w)&&!V.includes(w))){Y.clientReactive[j]=B;continue}}if(Y.serverDynamic[j]=_,j!==H.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[j]=H.slice(1)}catch{Y.clientReactive[j]=B}continue}if(typeof U==="string"&&U.includes("{{")&&U.includes("}}")){let j=U.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(q0(B)){let F=W0(B,Object.keys(Z))(...Object.values(Z));K(H,F!=null?String(F):"")}else{if(J.debug)console.error(`Unsafe expression in ${H}: ${B}`);K(H,U)}}catch(B){if(J.debug)console.error(`Error evaluating expression for ${H}:`,B);K(H,U)}else{let B=U,V=/\{\{\s*([\s\S]+?)\s*\}\}/g,F;while((F=V.exec(U))!==null)try{let _=F[1];if(!q0(_)){if(J.debug)console.error(`Unsafe expression in ${H}: ${_}`);continue}let L=W0(_,Object.keys(Z))(...Object.values(Z));B=B.replace(F[0],String(L??""))}catch(_){if(J.debug)console.error(`Error evaluating expression in ${H}:`,_)}K(H,B)}continue}K(H,U===R1?"true":z4(U))}return Y}var KY=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function WY($,Z,J){if(!$.includes("@"))return $;if(!KY.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return e0($,Z,J)}catch{return $}}function UY($){let Z={},J=0,X=$.length;while(J<X){while(J<X&&/\s/.test($[J]))J++;if(J>=X)break;let Y="";while(J<X&&!/[\s=]/.test($[J]))Y+=$[J],J++;if(!Y)break;while(J<X&&/\s/.test($[J]))J++;if(J<X&&$[J]==="="){J++;while(J<X&&/\s/.test($[J]))J++;let Q="";if(J<X&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<X){let z=$[J];if(z==="\\"&&J+1<X){J++,Q+=$[J],J++;continue}if(z===G){J++;break}Q+=z,J++}}else if($[J]==="{"){Q=a5($,J),J+=Q.length;let G=K4(Q);if(G!==null){Z[`:${Y}`]=G;continue}}else while(J<X&&!/\s/.test($[J]))Q+=$[J],J++;Z[Y]=Q}else Z[Y]=R1}return Z}function _4($){return Object.entries($).map(([Z,J])=>J===R1?Z:`${Z}="${HY(J)}"`).join(" ")}function HY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function jY($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=J.exec($))!==null){let Y=X[1];if(x1.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}async function BY($,Z,J,X,Y){if(!/import\s/.test($))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=B4.dirname(J),z=[],q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let U of $.matchAll(q)){let[H,j,B]=U,V=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,F=B,_,O=[];while((_=V.exec(B))!==null){let[L,w,R,D]=_,A=null,T=null;if(D.startsWith(".")||D.startsWith("/")){let k=B4.resolve(G,D);if(k.endsWith(".stx"))T=k;else{let M=`${k}.stx`;try{if(j4.statSync(M).isFile())T=M}catch{try{if(j4.statSync(k).isDirectory())A=k}catch{}}}}else A=h7(D,G);if(!A&&!T)continue;let N=!1,I=(k,M)=>{Q.set(k,M),Q.set(k.toLowerCase(),M);let y=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(y,M),Y.add(M)};if(R&&T)I(R,T),N=!0;else if(w){let k=w.slice(1,-1).split(",").map((y)=>y.trim()).filter(Boolean).map((y)=>{let E=y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:y,local:y}}),M=A?g7(A):null;for(let{source:y,local:E}of k){let b=null;if(T)b=T;else if(M)b=M.get(y)??M.get(y.toLowerCase())??M.get(y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(b)I(E,b),N=!0}}if(N)O.push({start:_.index,end:_.index+L.length})}if(O.length===0)continue;for(let L=O.length-1;L>=0;L--)F=F.slice(0,O[L].start)+F.slice(O[L].end);z.push({start:U.index,end:U.index+H.length,value:`<script${j}>${F}</script>`})}if(z.length===0)return $;let K=[],W=0;for(let U of z)K.push($.slice(W,U.start),U.value),W=U.end;return K.push($.slice(W)),K.join("")}async function VY($,Z,J,X,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=z.exec(Q))!==null){let[K,W]=q,U=W.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of U){let j=H.split("/"),V=j[j.length-1].replace(/\.stx$/,""),F=V.includes("-")?V.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):V.charAt(0).toUpperCase()+V.slice(1),_=null,O=u7(H,J,X);for(let L of O)try{if(await Bun.file(L).exists()){_=L;break}}catch{}if(_){G.set(F,_),G.set(V,_),G.set(V.toLowerCase(),_);let L=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,_),Y.add(_),X.debug)console.log(`Imported component: ${F} -> ${_}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(K,""),z.lastIndex=0}return Q}async function _Y($,Z,J,X,Y){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,q=/@component\s*\(/g,K;while((K=q.exec(Q))!==null){let W=K.index,U=W+K[0].length-1,H=1,j=U+1;while(j<Q.length&&H>0){if(Q[j]==="(")H++;else if(Q[j]===")"){if(H--,H===0)break}j++}if(H!==0)break;let B=Q.substring(U+1,j),V=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){q.lastIndex=0;continue}let _=F[1],O,L=B.slice(F[0].length),w=L.match(/^\s*,\s*/);if(w)O=L.slice(w[0].length).trim();let R={};if(O)try{R=E0(O,Z)}catch(k){let M=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(W,V),`[Error parsing component props: ${M}]`);continue}let D="",A=V,N=Q.substring(V).match(/^([\s\S]*?)@endcomponent/);if(N)D=N[1].trim(),A=V+N[0].length;let I=await N1(_,R,D,G,Z,J,X,z,Y);Q=Q.substring(0,W)+I+Q.substring(A),q.lastIndex=0}return Q}async function LY($,Z,J,X,Y){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,q=n0(Q);Q=q.output;let K=t5(Q);return Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0,Q4(R2)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,R2),Q=q.restore(Q),Q;async function j(B,V,F,_){if(!B)return B;let O=B,L=G4(O,V,_),w=new Map;for(let A=L.length-1;A>=0;A--){let T=L[A],N=F?W9(T.tagName):T.tagName,I=UY(WY(T.attributes,Z,J)),k=K.some(([u,P])=>T.startIndex>=u&&T.startIndex<P),M=qY(I,Z,X,k),y=x1.getBuiltin(T.tagName),E=y?await U9(N,G,Z,J,X):!1;if(y&&!E){let u={context:Z,filePath:J,options:X,dependencies:Y},P=y.render(M,T.content,u);if(Object.keys(M.events).length>0){let h=_4(M.events);P=P.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${h}`)}if(Object.keys(M.clientReactive).length>0)P=L4(P,M.clientReactive);w.set(A,P);continue}if(!F&&T.tagName.includes("-")&&!await U9(N,G,Z,J,X))continue;let b={};for(let[u,P]of Object.entries(M.static))b[u]=P;for(let[u,P]of Object.entries(M.serverDynamic))b[u]=P;let f=await N1(N,b,q.restore(T.content),G,Z,J,X,z,Y);if(Object.keys(M.events).length>0){let u=F4(f);if(u){let P=_4(M.events),h=Object.keys(M.events).map((m)=>m.replace(/^@/,"").split(".")[0]).join(" ");f=f.substring(0,u.insertPos)+` data-stx-parent-events="${h}" ${P}`+f.substring(u.insertPos)}}if(Object.keys(M.clientReactive).length>0)f=L4(f,M.clientReactive);w.set(A,f)}if(w.size===0)return O;let R="",D=0;for(let A=0;A<L.length;A++){let T=w.get(A);if(T===void 0)continue;R+=O.slice(D,L[A].startIndex),R+=T,D=L[A].endIndex}return R+=O.slice(D),R}}function L4($,Z){let J=new Set(["if","for"]),X=new Set(["show"]),Y=Object.entries(Z).filter(([W])=>!J.has(W)),Q=Y.filter(([W])=>!X.has(W)).map(([W])=>W9(W)).join(" "),G=$,z=Y.length>0?F4(G):null;if(z){let W=Y.map(([H,j])=>`:${W9(H)}="${j.replace(/"/g,"&quot;")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${U} ${W}`+G.substring(z.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let K=Z.for;if(K)G=`<template :for="${K.replace(/"/g,"&quot;")}">${G}</template>`;return G}function F4($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let J=0;while(J<$.length){let X=$.slice(J),Y=X.match(/^\s+/);if(Y){J+=Y[0].length;continue}if(X.startsWith("<!--")){let z=$.indexOf("-->",J+4);if(z===-1)return null;J=z+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let z=`</${Q[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(z,J+Q[0].length);if(q===-1)return null;J=q+z.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function $$($,Z,J,X,Y){if(!V4)J4(x1),V4=!0;let Q=await BY($,Z,J,X,Y);Q=await VY(Q,Z,J,X,Y),Q=await _Y(Q,Z,J,X,Y);let G=[];for(let z=0;z<3;z++){let q=G.length,K=B1(Q,j9,(U,H)=>`\x00STX_COMPONENT_COMMENT_${q+H}\x00`,`STX_COMPONENT_COMMENT:${q}`);G.push(...K.tokens);let W=Q;if(Q=await LY(K.output,Z,J,X,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,q)=>G[Number(q)]??"");if(X.debug){let z=jY(Q);if(z.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}function Z$($,Z){let J=0;for(let X=Z;X<$.length;X++){let Y=$[X];if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;else if(Y===","&&J===0)return X}return-1}function FY($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(X);while(Q){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1;while(K<X.length&&q>0){if(X[K]==="(")q++;else if(X[K]===")")q--;K++}if(q!==0)break;let W=X.substring(z+1,K-1),U=`${J}(${W})`;X=X.substring(0,G)+U+X.substring(K),Y.lastIndex=G+U.length,Q=Y.exec(X)}return X}function wY($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function N4($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},q=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},K=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3417
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(Y!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!X.has(B))J.push(B),X.add(B);return}let H=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))J.push(B),X.add(B);return}let j=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))J.push(B),X.add(B)}};while(Q<G){if(K())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]);continue}if(Z[Q]==="`"){q();continue}if(Z[Q]==="{"){Y++,Q++;continue}if(Z[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))W();Q++}return J.join(", ")}function RY($,Z=""){let J=N4($).split(",").map((X)=>X.trim()).filter(Boolean);return`
3420
+ `}function z4($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}function q4($,Z){let J=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(J);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var a5={name:"Suspense",aliases:["suspense"],render($,Z,J){let X=q4(Z,"fallback"),Y=X.rest,Q=q4(Y,"error"),G=Q.rest,z=X.region??z4($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??z4($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function W9($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let X=$.static[J];if(typeof X==="string")return X}return}var t5={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let X=(W9($,"name")||"v").replace(/["'<>]/g,""),Y=(W9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=W9($,"class"),G=W9($,"id"),z=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${z}>${Z}</${Y}>`}};function K4($=x1){$.registerBuiltin(x5),$.registerBuiltin(m5),$.registerBuiltin(l5),$.registerBuiltin(p5),$.registerBuiltin(i5),$.registerBuiltin(n5),$.registerBuiltin(s5),$.registerBuiltin(o5),$.registerBuiltin(a5),$.registerBuiltin(t5)}function U9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var W4=new Map;function LY($){let Z=W4.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),W4.set($.source,Z);return Z}var U4=new WeakMap;function H4($){let Z=U4.get($);if(!Z)Z=new Set([...$].map((X)=>X.toLowerCase())),U4.set($,Z);let J=Z;return(X)=>!/[a-z]/.test(X)&&J.has(X.toLowerCase())}function j4($,Z,J){let X=[],Y=0,Q=typeof J==="function"?J:J?(G)=>J.has(G.toLowerCase()):void 0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;let z=LY(Z);z.lastIndex=G+1;let q=z.exec($);if(!q){Y=G+1;continue}let K=q[1];if(Q&&Q(K)){let F=G+1+K.length;while(F<$.length&&$[F]!==">")F++;Y=F+1;continue}let W=G+1+K.length,U=null,H=W,j=-1,B=!1;while(W<$.length){let F=$[W];if(U){if(F==="\\"&&W+1<$.length){W+=2;continue}if(F===U)U=null;W++;continue}if(F==='"'||F==="'"){U=F,W++;continue}if(F==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,B=!0;break}if(F===">"){j=W+1;break}W++}if(j===-1){Y=G+1;continue}let V=$.slice(H,B?j-2:j-1).trim();if(B)X.push({fullMatch:$.slice(G,j),tagName:K,attributes:V,content:"",startIndex:G,endIndex:j,isSelfClosing:!0}),Y=j;else{let F=`<${K}`,_=`</${K}>`,O=1,L=j,w=-1;while(O>0&&L<$.length){let A=$.indexOf(F,L),T=$.indexOf(_,L);if(T===-1)break;if(A!==-1&&A<T){let D=$[A+F.length];if(D===" "||D===">"||D==="/"||D===`
3421
+ `||D==="\t")O++;L=A+F.length}else{if(O--,O===0){w=T;break}L=T+_.length}}if(w===-1){Y=j;continue}let R=$.slice(j,w),N=w+_.length;X.push({fullMatch:$.slice(G,N),tagName:K,attributes:V,content:R,startIndex:G,endIndex:N,isSelfClosing:!1}),Y=N}}return X}function B4($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function V4($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}function e5($,Z){let J=0,X="",Y=Z;while(Y<$.length){let Q=$[Y];if(X){if(Q==="\\")Y++;else if(Q===X)X=""}else if(Q==='"'||Q==="'"||Q==="`")X=Q;else if(Q==="{")J++;else if(Q==="}"){if(J--,J===0)return $.slice(Z,Y+1)}Y++}return $.slice(Z)}function _4($){let Z=$.trim();if(!Z.startsWith("{")||!Z.endsWith("}"))return null;if(e5(Z,0).length!==Z.length)return null;return Z.slice(1,-1).trim()}var OY=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),FY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function $$($){let Z=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,X;while((X=J.exec($))!==null){let Y=X[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=X.index,G=Q+X[0].length,z=X[1].toLowerCase();if(X[0].endsWith("/>")||FY.has(z)){Z.push([Q,G]);continue}let q=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`<\\/?${q}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");K.lastIndex=G;let W=1,U=G,H;while((H=K.exec($))!==null)if(H[0].startsWith("</")){if(W--,W===0){U=H.index+H[0].length;break}}else if(!H[0].endsWith("/>"))W++;Z.push([Q,U])}return Z}function O4($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>O4(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function F4($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=X.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...$$($));function G(U){return Y.some(([H,j])=>U>=H&&U<j)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,q=[],K=new Map,W=256;while((Q=z.exec(J))!==null){if(G(Q.index))continue;let U=Q[0],H=Q[2];if(!H||!H.includes(":"))continue;let j=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,V=H,F=!1;while((B=j.exec(H))!==null){let _=B[1],O=B[2];if(L4(_))continue;if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let L=Object.keys(Z),w=Object.values(Z),R=O.match(/^([a-zA-Z_$][\w$]*)/);if(R&&!L.includes(R[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(R[1]))continue;let N=JSON.stringify([L,O]),A=K.get(N);if(!A){if(A=Function(...L,`return (${O})`),K.size>=W)K.clear();K.set(N,A)}let T=A(...w);if(_==="class"){let D=O4(T);if(D){let M=V.match(/\sclass="([^"]*)"/);if(M)V=V.replace(M[0],` class="${M[1]} ${D}"`);else V=V.replace(B[0],` class="${D}"`)}else V=V.replace(B[0],"");F=!0;continue}if(OY.has(_)){if(T)V=V.replace(B[0],` ${_}`);else V=V.replace(B[0],"");F=!0;continue}if(T===null||T===void 0||T===!1)V=V.replace(B[0],"");else{let D=String(T).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");V=V.replace(B[0],` ${_}="${D}"`)}F=!0}catch{continue}}if(F){let _=U.endsWith("/>")?" /":"",L=`<${Q[1]}${V}${_}>`;q.push({start:Q.index,end:Q.index+U.length,replacement:L})}}if(q.length>0){let U=Array(q.length*2+1),H=0;for(let j=0;j<q.length;j++){let{start:B,end:V,replacement:F}=q[j];U[j*2]=J.slice(H,B),U[j*2+1]=F,H=V}U[q.length*2]=J.slice(H),J=U.join("")}return J}import w4 from"fs";import R4 from"path";var N2=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 Z$($){if($.includes("-")||$==="component")return!1;if(/^[A-Z]/.test($))return!/[a-z]/.test($)&&[...N2].some((Z)=>Z.toLowerCase()===$.toLowerCase());return N2.has($)||/[A-Z]/.test($)}var N4=!1;function wY($,Z,J,X=!1){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Q=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(W)=>{if(Q.size===0)return!1;let U=u0(W),H=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(H&&Q.has(H))return!0;for(let j of Q){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(U))return!0}return!1},z=new Set(M4),q=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(U,H)=>H.toUpperCase())},K=(W,U)=>{let H=q(W);if(Y.static[H]=U,H!==W)Y.staticNames[H]=W};for(let[W,U]of Object.entries($)){let H=W.startsWith("x-")&&!z.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(H.startsWith("@")){Y.events[H]=U;continue}if(H.startsWith("__stx_")){let j=q(H.slice(6));Y.serverDynamic[j]=V4(U,J);continue}if(H.startsWith(":")){let j=q(H.slice(1)),B=U===R1?j:U;if(j==="if"||j==="for"||j==="show"){Y.clientReactive[j]=B;continue}if(X){Y.clientReactive[j]=B;continue}if(G(B)){Y.clientReactive[j]=B;continue}try{if(!W0(B)){if(J.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let V=Object.keys(Z),_=K0(B,V)(...Object.values(Z));if(_===void 0){let O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j9(B).some((w)=>!O.has(w)&&!V.includes(w))){Y.clientReactive[j]=B;continue}}if(Y.serverDynamic[j]=_,j!==H.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[j]=H.slice(1)}catch{Y.clientReactive[j]=B}continue}if(typeof U==="string"&&U.includes("{{")&&U.includes("}}")){let j=U.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(W0(B)){let F=K0(B,Object.keys(Z))(...Object.values(Z));K(H,F!=null?String(F):"")}else{if(J.debug)console.error(`Unsafe expression in ${H}: ${B}`);K(H,U)}}catch(B){if(J.debug)console.error(`Error evaluating expression for ${H}:`,B);K(H,U)}else{let B=U,V=/\{\{\s*([\s\S]+?)\s*\}\}/g,F;while((F=V.exec(U))!==null)try{let _=F[1];if(!W0(_)){if(J.debug)console.error(`Unsafe expression in ${H}: ${_}`);continue}let L=K0(_,Object.keys(Z))(...Object.values(Z));B=B.replace(F[0],String(L??""))}catch(_){if(J.debug)console.error(`Error evaluating expression in ${H}:`,_)}K(H,B)}continue}K(H,U===R1?"true":B4(U))}return Y}var RY=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function NY($,Z,J){if(!$.includes("@"))return $;if(!RY.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return e0($,Z,J)}catch{return $}}function DY($){let Z={},J=0,X=$.length;while(J<X){while(J<X&&/\s/.test($[J]))J++;if(J>=X)break;let Y="";while(J<X&&!/[\s=]/.test($[J]))Y+=$[J],J++;if(!Y)break;while(J<X&&/\s/.test($[J]))J++;if(J<X&&$[J]==="="){J++;while(J<X&&/\s/.test($[J]))J++;let Q="";if(J<X&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<X){let z=$[J];if(z==="\\"&&J+1<X){J++,Q+=$[J],J++;continue}if(z===G){J++;break}Q+=z,J++}}else if($[J]==="{"){Q=e5($,J),J+=Q.length;let G=_4(Q);if(G!==null){Z[`:${Y}`]=G;continue}}else while(J<X&&!/\s/.test($[J]))Q+=$[J],J++;Z[Y]=Q}else Z[Y]=R1}return Z}function D4($){return Object.entries($).map(([Z,J])=>J===R1?Z:`${Z}="${AY(J)}"`).join(" ")}function AY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function MY($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=J.exec($))!==null){let Y=X[1];if(x1.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}async function IY($,Z,J,X,Y){if(!/import\s/.test($))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=R4.dirname(J),z=[],q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let U of $.matchAll(q)){let[H,j,B]=U,V=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,F=B,_,O=[];while((_=V.exec(B))!==null){let[L,w,R,N]=_,A=null,T=null;if(N.startsWith(".")||N.startsWith("/")){let k=R4.resolve(G,N);if(k.endsWith(".stx"))T=k;else{let I=`${k}.stx`;try{if(w4.statSync(I).isFile())T=I}catch{try{if(w4.statSync(k).isDirectory())A=k}catch{}}}}else A=i7(N,G);if(!A&&!T)continue;let D=!1,M=(k,I)=>{Q.set(k,I),Q.set(k.toLowerCase(),I);let y=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(y,I),Y.add(I)};if(R&&T)M(R,T),D=!0;else if(w){let k=w.slice(1,-1).split(",").map((y)=>y.trim()).filter(Boolean).map((y)=>{let E=y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:y,local:y}}),I=A?p7(A):null;for(let{source:y,local:E}of k){let b=null;if(T)b=T;else if(I)b=I.get(y)??I.get(y.toLowerCase())??I.get(y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(b)M(E,b),D=!0}}if(D)O.push({start:_.index,end:_.index+L.length})}if(O.length===0)continue;for(let L=O.length-1;L>=0;L--)F=F.slice(0,O[L].start)+F.slice(O[L].end);z.push({start:U.index,end:U.index+H.length,value:`<script${j}>${F}</script>`})}if(z.length===0)return $;let K=[],W=0;for(let U of z)K.push($.slice(W,U.start),U.value),W=U.end;return K.push($.slice(W)),K.join("")}async function TY($,Z,J,X,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=z.exec(Q))!==null){let[K,W]=q,U=W.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of U){let j=H.split("/"),V=j[j.length-1].replace(/\.stx$/,""),F=V.includes("-")?V.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):V.charAt(0).toUpperCase()+V.slice(1),_=null,O=n7(H,J,X);for(let L of O)try{if(await Bun.file(L).exists()){_=L;break}}catch{}if(_){G.set(F,_),G.set(V,_),G.set(V.toLowerCase(),_);let L=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,_),Y.add(_),X.debug)console.log(`Imported component: ${F} -> ${_}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(K,""),z.lastIndex=0}return Q}async function kY($,Z,J,X,Y){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,q=/@component\s*\(/g,K;while((K=q.exec(Q))!==null){let W=K.index,U=W+K[0].length-1,H=1,j=U+1;while(j<Q.length&&H>0){if(Q[j]==="(")H++;else if(Q[j]===")"){if(H--,H===0)break}j++}if(H!==0)break;let B=Q.substring(U+1,j),V=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){q.lastIndex=0;continue}let _=F[1],O,L=B.slice(F[0].length),w=L.match(/^\s*,\s*/);if(w)O=L.slice(w[0].length).trim();let R={};if(O)try{R=E0(O,Z)}catch(k){let I=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(W,V),`[Error parsing component props: ${I}]`);continue}let N="",A=V,D=Q.substring(V).match(/^([\s\S]*?)@endcomponent/);if(D)N=D[1].trim(),A=V+D[0].length;let M=await D1(_,R,N,G,Z,J,X,z,Y);Q=Q.substring(0,W)+M+Q.substring(A),q.lastIndex=0}return Q}async function EY($,Z,J,X,Y){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,q=n0(Q);Q=q.output;let K=$$(Q);return Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0,H4(N2)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,N2),Q=q.restore(Q),Q;async function j(B,V,F,_){if(!B)return B;let O=B,L=j4(O,V,_),w=new Map;for(let A=L.length-1;A>=0;A--){let T=L[A],D=F?U9(T.tagName):T.tagName,M=DY(NY(T.attributes,Z,J)),k=K.some(([u,P])=>T.startIndex>=u&&T.startIndex<P),I=wY(M,Z,X,k),y=x1.getBuiltin(T.tagName),E=y?await H9(D,G,Z,J,X):!1;if(y&&!E){let u={context:Z,filePath:J,options:X,dependencies:Y},P=y.render(I,T.content,u);if(Object.keys(I.events).length>0){let h=D4(I.events);P=P.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${h}`)}if(Object.keys(I.clientReactive).length>0)P=A4(P,I.clientReactive);w.set(A,P);continue}if(!F&&T.tagName.includes("-")&&!await H9(D,G,Z,J,X))continue;let b={};for(let[u,P]of Object.entries(I.static))b[u]=P;for(let[u,P]of Object.entries(I.serverDynamic))b[u]=P;let f=await D1(D,b,q.restore(T.content),G,Z,J,X,z,Y);if(Object.keys(I.events).length>0){let u=I4(f);if(u){let P=D4(I.events),h=Object.keys(I.events).map((m)=>m.replace(/^@/,"").split(".")[0]).join(" ");f=f.substring(0,u.insertPos)+` data-stx-parent-events="${h}" ${P}`+f.substring(u.insertPos)}}if(Object.keys(I.clientReactive).length>0)f=A4(f,I.clientReactive);w.set(A,f)}if(w.size===0)return O;let R="",N=0;for(let A=0;A<L.length;A++){let T=w.get(A);if(T===void 0)continue;R+=O.slice(N,L[A].startIndex),R+=T,N=L[A].endIndex}return R+=O.slice(N),R}}function A4($,Z){let J=new Set(["if","for"]),X=new Set(["show"]),Y=Object.entries(Z).filter(([W])=>!J.has(W)),Q=Y.filter(([W])=>!X.has(W)).map(([W])=>U9(W)).join(" "),G=$,z=Y.length>0?I4(G):null;if(z){let W=Y.map(([H,j])=>`:${U9(H)}="${j.replace(/"/g,"&quot;")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${U} ${W}`+G.substring(z.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let K=Z.for;if(K)G=`<template :for="${K.replace(/"/g,"&quot;")}">${G}</template>`;return G}function I4($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let J=0;while(J<$.length){let X=$.slice(J),Y=X.match(/^\s+/);if(Y){J+=Y[0].length;continue}if(X.startsWith("<!--")){let z=$.indexOf("-->",J+4);if(z===-1)return null;J=z+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let z=`</${Q[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(z,J+Q[0].length);if(q===-1)return null;J=q+z.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function J$($,Z,J,X,Y){if(!N4)K4(x1),N4=!0;let Q=await IY($,Z,J,X,Y);Q=await TY(Q,Z,J,X,Y),Q=await kY(Q,Z,J,X,Y);let G=[];for(let z=0;z<3;z++){let q=G.length,K=B1(Q,B9,(U,H)=>`\x00STX_COMPONENT_COMMENT_${q+H}\x00`,`STX_COMPONENT_COMMENT:${q}`);G.push(...K.tokens);let W=Q;if(Q=await EY(K.output,Z,J,X,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,q)=>G[Number(q)]??"");if(X.debug){let z=MY(Q);if(z.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}function X$($,Z){let J=0;for(let X=Z;X<$.length;X++){let Y=$[X];if(Y==="("||Y==="["||Y==="{")J++;else if(Y===")"||Y==="]"||Y==="}")J--;else if(Y===","&&J===0)return X}return-1}function yY($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(X);while(Q){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1;while(K<X.length&&q>0){if(X[K]==="(")q++;else if(X[K]===")")q--;K++}if(q!==0)break;let W=X.substring(z+1,K-1),U=`${J}(${W})`;X=X.substring(0,G)+U+X.substring(K),Y.lastIndex=G+U.length,Q=Y.exec(X)}return X}function CY($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function b4($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},q=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},K=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3422
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(Y!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!X.has(B))J.push(B),X.add(B);return}let H=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))J.push(B),X.add(B);return}let j=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))J.push(B),X.add(B)}};while(Q<G){if(K())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]);continue}if(Z[Q]==="`"){q();continue}if(Z[Q]==="{"){Y++,Q++;continue}if(Z[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))W();Q++}return J.join(", ")}function SY($,Z=""){let J=b4($).split(",").map((X)=>X.trim()).filter(Boolean);return`
3418
3423
  (function() {
3419
3424
  ${p1("var",J)}
3420
3425
  var __destroyHooks = [];
@@ -3423,7 +3428,7 @@ document.addEventListener("focusout",function(e){
3423
3428
 
3424
3429
  ${$}
3425
3430
  ${Z}})();
3426
- `}function DY($,Z){let Y=N4($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
3431
+ `}function PY($,Z){let Y=b4($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
3427
3432
  `);return`
3428
3433
  // Register scope variables for STX runtime
3429
3434
  if (!window.stx._scopes) window.stx._scopes = {};
@@ -3435,7 +3440,7 @@ ${Y}
3435
3440
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
3436
3441
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
3437
3442
  window.stx._scopes['${Z}'] = __scopeRegistration;
3438
- `}function NY($,Z){return $.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(J,X)=>X===Z?J:'<script data-stx-scoped data-stx-run="always"')}function w4($,Z){let J=DY($,Z);return AY(RY($,J),Z)}function AY($,Z){let J=`
3443
+ `}function vY($,Z){return $.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(J,X)=>X===Z?J:'<script data-stx-scoped data-stx-run="always"')}function T4($,Z){let J=PY($,Z);return fY(SY($,J),Z)}function fY($,Z){let J=`
3439
3444
  (function() {
3440
3445
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
3441
3446
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -3452,25 +3457,25 @@ ${Y}
3452
3457
  } finally {
3453
3458
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3454
3459
  }
3455
- })();`}function MY($,Z){if(s0($)){let Y=s0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:y1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],q=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${q}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var R4=0;function D4($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var hH=new i1(500),A4=new Set;function uH(){A4.clear()}function IY($){if($.__onceStore instanceof Set)return $.__onceStore;return A4}async function J$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||Q0.join(Q0.dirname(J),"partials");if(G&&!Q0.isAbsolute(G))G=Q0.resolve(process.cwd(),G);let z=FY($,"@partial","@include"),q=IY(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,_)=>{let O=F.trim(),L=`${J}:${O}`;if(q.has(L))return"";return q.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let R=z.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){V.lastIndex=w;continue}let A=D[1],T=K(A,G,J),N="";if(T&&await Bun.file(T).exists())Y.add(T),N=`@include(${R})`;z=z.substring(0,_)+N+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let _=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=_.exec(z))!==null){let L=O.index,w=L+O[0].length-1,R=1,D=w+1;while(D<z.length&&R>0){if(z[D]==="(")R++;else if(z[D]===")")R--;D++}if(R!==0)break;let A=z.substring(w+1,D-1),T=Z$(A,0);if(T===-1){_.lastIndex=D;continue}let N=A.substring(0,T).trim(),I=A.substring(T+1).trim(),k=I.match(/^\s*['"]([^'"]+)['"]/);if(!k){_.lastIndex=D;continue}let M=k[1],y=I.substring(k[0].length),E,b=Z$(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${N})`,f;if(q0(C)){let h=W0(C,Object.keys(Z));f=Boolean(h(...Object.values(Z)))}else f=Boolean(e(C,Z));let u=F?!f:f,P="";if(u){let h=K(M,G,J);if(h&&await Bun.file(h).exists())Y.add(h);P=`@include('${M}'${E?`, ${E}`:""})`}z=z.substring(0,L)+P+z.substring(D),_.lastIndex=0}catch(C){let f=C instanceof Error?C.message:String(C),u=H0("Include",`Error evaluating ${V} condition: ${f}`,J,$,L);z=z.substring(0,L)+u+z.substring(D),_.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(O+1,w),D=z.substring(_,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){V.lastIndex=0,z=z.replace(D,"");continue}let[,T,N,I,k]=A;try{let M,y=N.trim();if(q0(y))M=W0(y,Object.keys(Z))(...Object.values(Z));else M=e(y,Z);let E="";if(Array.isArray(M)&&M.length>0)for(let b of M){let C={...Z,[I]:b},f=await H(T,C,$,_);E+=f}else if(k)E=await H(k,{},$,_);z=z.substring(0,_)+E+z.substring(w+1),V.lastIndex=0}catch(M){let y=M instanceof Error?M.message:String(M);z=z.substring(0,_)+H0("Each",`Error in @each: ${y}`,J,$,_)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(O+1,w),D=z.substring(_,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){V.lastIndex=0,z=z.replace(D,"");continue}let T=A[1],N=R.slice(A[0].length),I,k=N.match(/^\s*,\s*\{/);if(k){N=N.slice(k[0].length-1);let E=1,b=1;while(b<N.length&&E>0){if(N[b]==="{")E++;else if(N[b]==="}"){if(E--,E===0)break}b++}I=N.substring(0,b+1),N=N.slice(b+1)}let M,y=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)M=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(I)try{b=E0(I,Z)}catch(f){let u=f instanceof Error?f.message:String(f);if(X.debug){let P=H0("Include",`Error parsing includeFirst variables: ${u}`,J,$,_,D);z=z.replace(D,()=>P)}else z=z.replace(D,()=>M||"");continue}let C=!1;for(let f of E){let u=K(f,G,J);if(!u)continue;if(await a(u)){let P=await H(f,b,$,_);z=z.replace(D,()=>P),C=!0;break}}if(!C)if(M!==void 0)z=z.replace(D,()=>M);else if(X.debug){let f=H0("Include",`None of the includeFirst paths exist: ${T}`,J,$,_,D);z=z.replace(D,()=>f)}else z=z.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=H0("Include",`Error processing @includeFirst: ${b}`,J,$,_,D);z=z.replace(D,()=>C)}V.lastIndex=0}}function K(V,F,_){try{let O=V;if(!V.endsWith(".stx"))O=`${V}.stx`;let L=Q0.resolve(F),w=Q0.resolve(Q0.dirname(_)),R;if(!O.startsWith("./")&&!O.startsWith("../")){for(let k of X._layerPartialDirs??[]){let M=Q0.resolve(k,O);if(M.startsWith(`${Q0.resolve(k)}${Q0.sep}`)&&OY(M))return M}R=Q0.resolve(F,O)}else R=Q0.resolve(w,O);let D=Q0.normalize(R),A=D.startsWith(L+Q0.sep)||D===L,T=D.startsWith(w+Q0.sep)||D===w,N=!1,I=Q0.dirname(w);if(D.startsWith(I+Q0.sep)){if(!Q0.relative(I,D).split(Q0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))N=!0}if(!A&&!T&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${V}: ${O}`),null}}let W=Q0.resolve(J);Q.add(W);function U(V,F,_,O){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),H0("Include",F,J,_,O)}async function H(V,F={},_,O){let L=K(V,G,J);if(!L)return U(V,`Could not resolve path for include: ${V}`,_,O);let w=Q0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>Q0.basename(D)).join(" -> ");return U(V,`Circular include detected: ${R}`,_,O)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(P){let h=P instanceof Error?P.message:String(P);return U(V,`Error loading include file ${V}: ${h}`,_,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:P}=await import("./chunk-bezqaxqt.js");R=P(R,Z)}if(R&&(X.debug||!B9()&&!V9()))try{let{warnUnbalancedTags:P}=await import("./chunk-8z0n5mtg.js");P(R,L)}catch{}let D=R;try{let{processESImports:P}=await import("./chunk-yd7jyyr7.js");await P(R,Z,L,X,Y)}catch(P){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,P instanceof Error?P.message:P)}let A=Y9(D);if(A)D=A.content.trim();let N=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(N)I=`<style${N[1]}>${N[2]}</style>`;let k=[];D=D.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(P,h,m)=>{if(!D4(h))return"";return k.push({attrs:h,body:m}),`__STX_DATA_BLOCK_${k.length-1}__`}),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let M={...Z};M.__stx_signals_gate=X1(R,L);for(let[P,h]of Object.entries(F))M[P]=h;let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...R.matchAll(y)],b="",C=null;for(let P of E){let h=P[1]||"",m=P[2]||"";if(D4(h))continue;let j0=h.includes("server"),S0=A1(h);if(!j0&&m.trim()){let{interpolateScriptExpressions:Y0}=await import("./chunk-wjdfhfj6.js");m=Y0(m,M)}let y0="";try{let{extractAndStripCssImports:Y0,renderVendorStyleTags:B0}=await import("./chunk-tc6gqeha.js"),M0=Y0(m,{filePath:L,projectRoot:process.cwd()});m=M0.code,y0=B0(M0.styles)}catch(Y0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,Y0 instanceof Error?Y0.message:Y0)}if(S0&&m.trim())m=M1(m);if(!j0){try{let{injectBrowserCoreAutoImports:B0}=await import("./chunk-tc6gqeha.js");m=B0(m).code;let{hasUserImports:M0,bundleClientScript:P0}=await import("./chunk-sen2cxqm.js");if(M0(m))m=await P0(m,L,{projectRoot:process.cwd()})}catch(B0){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,B0 instanceof Error?B0.message:B0)}let{stripStxRuntimeImports:Y0}=await import("./chunk-r2k2sewg.js");m=Y0(m)}let h0=wY(m);if(h0&&!j0){C=`stx_scope_${Q0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++R4}`;let Y0=$1(m),B0=w4(Y0,C);b+=`${y0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}">${B0}</script>
3456
- `;continue}if(j0)try{let{extractVariables:Y0}=await import("./chunk-qpzxgkc5.js");await Y0(m,M,L)}catch(Y0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,Y0)}if(!j0&&!h0){let Y0=h.replace(/\bclient\b/i,"").trim();C=`stx_scope_${Q0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++R4}`;let B0=$1(m),M0=w4(B0,C);b+=`${y0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}"${Y0?` ${Y0}`:""}>${M0}</script>
3457
- `}}if(k.length>0){let{interpolateScriptExpressions:P}=await import("./chunk-wjdfhfj6.js");D=D.replace(/__STX_DATA_BLOCK_(\d+)__/g,(h,m)=>{let j0=k[Number(m)];return`<script${j0.attrs}>${P(j0.body,M)}</script>`})}if(C){let P=MY(D,C);if(D=P.html,P.mergedIntoExisting){let m=C,j0=P.mergedIntoExisting;b=b.split(`'${m}'`).join(`'${j0}'`).split(`"${m}"`).join(`"${j0}"`),C=j0}else if(!P.stamped)console.warn(`[stx] ${Q0.relative(process.cwd(),L)} 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.`);let h=P.stamped&&P.root!==null&&e5(P.root);b=NY(b,h?C:null)}if(D.includes("@include")||D.includes("@partial"))D=await J$(D,M,L,X,Y,Q);let{processLoops:f}=await import("./chunk-044mychj.js"),u=f(D,M,L);if(u=e0(u,M,L),u=V1(u,M,L),I)u+=`
3458
- `+I;if(b)u+=`
3459
- `+b;return u}catch(R){let D=R instanceof Error?R.message:String(R);return U(V,`Error processing include ${V}: ${D}`,_,O)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,F=V+B[0].length-1,_=1,O=F+1;while(O<z.length&&_>0){if(z[O]==="(")_++;else if(z[O]===")")_--;O++}if(_!==0)break;let L=z.substring(V,O),w=z.substring(F+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=O;continue}let D=R[1],A,T=w.substring(R[0].length),N=Z$(T,0);if(N!==-1)A=T.substring(N+1).trim();let I={};if(A)try{I=E0(A,Z)}catch(M){let y=M instanceof Error?M.message:String(M);z=z.replace(L,H0("Include",`Error parsing include variables for ${D}: ${y}`,J,$,V)),j.lastIndex=0;continue}let k=await H(D,I,$,V);z=z.substring(0,V)+k+z.substring(O),j.lastIndex=0}return z}function X$($,Z){let J=$;function X(Y,Q,G,z){let q=Y,K=!0;while(K){K=!1;let W=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=q.match(W);if(!U||U.index===void 0)break;let H=U.index,j=U[1],B=H+U[0].length,V=new RegExp(`@${Q}\\(`),F=new RegExp(`@${G}(?![a-z])`),_=1,O=B,L=-1;while(_>0&&O<q.length){let R=q.slice(O),D=R.match(V),A=R.match(F),T=D?O+D.index:1/0,N=A?O+A.index:1/0;if(T<N)_++,O=T+(D[0].length||1);else if(N<1/0){if(_--,_===0){L=N;break}O=N+G.length+1}else break}if(L===-1)break;let w=q.slice(B,L);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);q=q.substring(0,H)+q.substring(L+`@${G}`.length),K=!0}return q}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function Y$($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
3460
- `)})}import*as Q$ from"path";async function M4($,Z,J=""){if(Q$.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return T4($,Z,J,"@js","@endjs")}async function I4($,Z,J=""){if(Q$.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return T4($,Z,J,"@ts","@endts")}async function T4($,Z,J,X,Y){let Q=$,G=v1(`${X}([\\s\\S]*?)${Y}`,"g"),z=[],q;while((q=G.exec($))!==null)z.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:K,content:W,index:U}of z)try{let H={...Z,global:Z},j=Object.keys(H),B=Object.values(H),V=W.trim();if(X==="@ts")V=V.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 _=(V.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=_.length>0?`return { ${_.join(", ")} };`:"return {};",L=`
3460
+ })();`}function xY($,Z){if(s0($)){let Y=s0($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0,root:"body"};return{html:y1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=J[2]+J[3],Y=J[2].slice(1),Q=X.match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1],stamped:!0,root:Y};let G=J[1],z=J[2],q=J[3];return{html:`${G}${z} data-stx-scope="${Z}"${q}${$.slice(J[0].length)}`,mergedIntoExisting:null,stamped:!0,root:Y}}return{html:$,mergedIntoExisting:null,stamped:!1,root:null}}var k4=0;function E4($){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test($)}var $j=new i1(500),y4=new Set;function Zj(){y4.clear()}function gY($){if($.__onceStore instanceof Set)return $.__onceStore;return y4}async function Y$($,Z,J,X,Y,Q=new Set){let G=X.partialsDir||Q0.join(Q0.dirname(J),"partials");if(G&&!Q0.isAbsolute(G))G=Q0.resolve(process.cwd(),G);let z=yY($,"@partial","@include"),q=gY(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(V,F,_)=>{let O=F.trim(),L=`${J}:${O}`;if(q.has(L))return"";return q.add(L),F});{let V=/@includeIf\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")")L--;w++}if(L!==0)break;let R=z.substring(O+1,w-1),N=R.match(/^\s*['"]([^'"]+)['"]/);if(!N){V.lastIndex=w;continue}let A=N[1],T=K(A,G,J),D="";if(T&&await Bun.file(T).exists())Y.add(T),D=`@include(${R})`;z=z.substring(0,_)+D+z.substring(w),V.lastIndex=0}}for(let[V,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let _=new RegExp(`${V.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=_.exec(z))!==null){let L=O.index,w=L+O[0].length-1,R=1,N=w+1;while(N<z.length&&R>0){if(z[N]==="(")R++;else if(z[N]===")")R--;N++}if(R!==0)break;let A=z.substring(w+1,N-1),T=X$(A,0);if(T===-1){_.lastIndex=N;continue}let D=A.substring(0,T).trim(),M=A.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){_.lastIndex=N;continue}let I=k[1],y=M.substring(k[0].length),E,b=X$(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${D})`,f;if(W0(C)){let h=K0(C,Object.keys(Z));f=Boolean(h(...Object.values(Z)))}else f=Boolean(e(C,Z));let u=F?!f:f,P="";if(u){let h=K(I,G,J);if(h&&await Bun.file(h).exists())Y.add(h);P=`@include('${I}'${E?`, ${E}`:""})`}z=z.substring(0,L)+P+z.substring(N),_.lastIndex=0}catch(C){let f=C instanceof Error?C.message:String(C),u=H0("Include",`Error evaluating ${V} condition: ${f}`,J,$,L);z=z.substring(0,L)+u+z.substring(N),_.lastIndex=0}}}{let V=/@each\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(O+1,w),N=z.substring(_,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){V.lastIndex=0,z=z.replace(N,"");continue}let[,T,D,M,k]=A;try{let I,y=D.trim();if(W0(y))I=K0(y,Object.keys(Z))(...Object.values(Z));else I=e(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},f=await H(T,C,$,_);E+=f}else if(k)E=await H(k,{},$,_);z=z.substring(0,_)+E+z.substring(w+1),V.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);z=z.substring(0,_)+H0("Each",`Error in @each: ${y}`,J,$,_)+z.substring(w+1),V.lastIndex=0}}}{let V=/@includeFirst\s*\(/g,F;while((F=V.exec(z))!==null){let _=F.index,O=_+F[0].length-1,L=1,w=O+1;while(w<z.length&&L>0){if(z[w]==="(")L++;else if(z[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=z.substring(O+1,w),N=z.substring(_,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){V.lastIndex=0,z=z.replace(N,"");continue}let T=A[1],D=R.slice(A[0].length),M,k=D.match(/^\s*,\s*\{/);if(k){D=D.slice(k[0].length-1);let E=1,b=1;while(b<D.length&&E>0){if(D[b]==="{")E++;else if(D[b]==="}"){if(E--,E===0)break}b++}M=D.substring(0,b+1),D=D.slice(b+1)}let I,y=D.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=E0(M,Z)}catch(f){let u=f instanceof Error?f.message:String(f);if(X.debug){let P=H0("Include",`Error parsing includeFirst variables: ${u}`,J,$,_,N);z=z.replace(N,()=>P)}else z=z.replace(N,()=>I||"");continue}let C=!1;for(let f of E){let u=K(f,G,J);if(!u)continue;if(await a(u)){let P=await H(f,b,$,_);z=z.replace(N,()=>P),C=!0;break}}if(!C)if(I!==void 0)z=z.replace(N,()=>I);else if(X.debug){let f=H0("Include",`None of the includeFirst paths exist: ${T}`,J,$,_,N);z=z.replace(N,()=>f)}else z=z.replace(N,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=H0("Include",`Error processing @includeFirst: ${b}`,J,$,_,N);z=z.replace(N,()=>C)}V.lastIndex=0}}function K(V,F,_){try{let O=V;if(!V.endsWith(".stx"))O=`${V}.stx`;let L=Q0.resolve(F),w=Q0.resolve(Q0.dirname(_)),R;if(!O.startsWith("./")&&!O.startsWith("../")){for(let k of X._layerPartialDirs??[]){let I=Q0.resolve(k,O);if(I.startsWith(`${Q0.resolve(k)}${Q0.sep}`)&&bY(I))return I}R=Q0.resolve(F,O)}else R=Q0.resolve(w,O);let N=Q0.normalize(R),A=N.startsWith(L+Q0.sep)||N===L,T=N.startsWith(w+Q0.sep)||N===w,D=!1,M=Q0.dirname(w);if(N.startsWith(M+Q0.sep)){if(!Q0.relative(M,N).split(Q0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))D=!0}if(!A&&!T&&!D)return console.error(`Security: Path traversal attempt blocked for include path: ${V}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return N}catch(O){return console.error(`Error resolving path ${V}: ${O}`),null}}let W=Q0.resolve(J);Q.add(W);function U(V,F,_,O){return X.onIncludeError?.({includePath:V,templatePath:J,message:F,partialsDir:G}),H0("Include",F,J,_,O)}async function H(V,F={},_,O){let L=K(V,G,J);if(!L)return U(V,`Could not resolve path for include: ${V}`,_,O);let w=Q0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((N)=>Q0.basename(N)).join(" -> ");return U(V,`Circular include detected: ${R}`,_,O)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(P){let h=P instanceof Error?P.message:String(P);return U(V,`Error loading include file ${V}: ${h}`,_,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:P}=await import("./chunk-80rmf67y.js");R=P(R,Z)}if(R&&(X.debug||!V9()&&!_9()))try{let{warnUnbalancedTags:P}=await import("./chunk-h78pksyp.js");P(R,L)}catch{}let N=R;try{let{processESImports:P}=await import("./chunk-8tkn0yxq.js");await P(R,Z,L,X,Y)}catch(P){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,P instanceof Error?P.message:P)}let A=Q9(N);if(A)N=A.content.trim();let D=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(D)M=`<style${D[1]}>${D[2]}</style>`;let k=[];N=N.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(P,h,m)=>{if(!E4(h))return"";return k.push({attrs:h,body:m}),`__STX_DATA_BLOCK_${k.length-1}__`}),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};I.__stx_signals_gate=X1(R,L);for(let[P,h]of Object.entries(F))I[P]=h;let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...R.matchAll(y)],b="",C=null;for(let P of E){let h=P[1]||"",m=P[2]||"";if(E4(h))continue;let j0=h.includes("server"),S0=A1(h);if(!j0&&m.trim()){let{interpolateScriptExpressions:Y0}=await import("./chunk-hg7ptfd4.js");m=Y0(m,I)}let y0="";try{let{extractAndStripCssImports:Y0,renderVendorStyleTags:B0}=await import("./chunk-czje8k8c.js"),M0=Y0(m,{filePath:L,projectRoot:process.cwd()});m=M0.code,y0=B0(M0.styles)}catch(Y0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,Y0 instanceof Error?Y0.message:Y0)}if(S0&&m.trim())m=M1(m);if(!j0){try{let{injectBrowserCoreAutoImports:B0}=await import("./chunk-czje8k8c.js");m=B0(m).code;let{hasUserImports:M0,bundleClientScript:P0}=await import("./chunk-4z3yyryn.js");if(M0(m))m=await P0(m,L,{projectRoot:process.cwd()})}catch(B0){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,B0 instanceof Error?B0.message:B0)}let{stripStxRuntimeImports:Y0}=await import("./chunk-v0ne90ft.js");m=Y0(m)}let h0=CY(m);if(h0&&!j0){C=`stx_scope_${Q0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++k4}`;let Y0=$1(m),B0=T4(Y0,C);b+=`${y0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}">${B0}</script>
3461
+ `;continue}if(j0)try{let{extractVariables:Y0}=await import("./chunk-75vxhxn1.js");await Y0(m,I,L)}catch(Y0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,Y0)}if(!j0&&!h0){let Y0=h.replace(/\bclient\b/i,"").trim();C=`stx_scope_${Q0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++k4}`;let B0=$1(m),M0=T4(B0,C);b+=`${y0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${C}"${Y0?` ${Y0}`:""}>${M0}</script>
3462
+ `}}if(k.length>0){let{interpolateScriptExpressions:P}=await import("./chunk-hg7ptfd4.js");N=N.replace(/__STX_DATA_BLOCK_(\d+)__/g,(h,m)=>{let j0=k[Number(m)];return`<script${j0.attrs}>${P(j0.body,I)}</script>`})}if(C){let P=xY(N,C);if(N=P.html,P.mergedIntoExisting){let m=C,j0=P.mergedIntoExisting;b=b.split(`'${m}'`).join(`'${j0}'`).split(`"${m}"`).join(`"${j0}"`),C=j0}else if(!P.stamped)console.warn(`[stx] ${Q0.relative(process.cwd(),L)} 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.`);let h=P.stamped&&P.root!==null&&Z$(P.root);b=vY(b,h?C:null)}if(N.includes("@include")||N.includes("@partial"))N=await Y$(N,I,L,X,Y,Q);let{processLoops:f}=await import("./chunk-7n6fq2t7.js"),u=f(N,I,L);if(u=e0(u,I,L),u=V1(u,I,L),M)u+=`
3463
+ `+M;if(b)u+=`
3464
+ `+b;return u}catch(R){let N=R instanceof Error?R.message:String(R);return U(V,`Error processing include ${V}: ${N}`,_,O)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let V=B.index,F=V+B[0].length-1,_=1,O=F+1;while(O<z.length&&_>0){if(z[O]==="(")_++;else if(z[O]===")")_--;O++}if(_!==0)break;let L=z.substring(V,O),w=z.substring(F+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=O;continue}let N=R[1],A,T=w.substring(R[0].length),D=X$(T,0);if(D!==-1)A=T.substring(D+1).trim();let M={};if(A)try{M=E0(A,Z)}catch(I){let y=I instanceof Error?I.message:String(I);z=z.replace(L,H0("Include",`Error parsing include variables for ${N}: ${y}`,J,$,V)),j.lastIndex=0;continue}let k=await H(N,M,$,V);z=z.substring(0,V)+k+z.substring(O),j.lastIndex=0}return z}function Q$($,Z){let J=$;function X(Y,Q,G,z){let q=Y,K=!0;while(K){K=!1;let W=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=q.match(W);if(!U||U.index===void 0)break;let H=U.index,j=U[1],B=H+U[0].length,V=new RegExp(`@${Q}\\(`),F=new RegExp(`@${G}(?![a-z])`),_=1,O=B,L=-1;while(_>0&&O<q.length){let R=q.slice(O),N=R.match(V),A=R.match(F),T=N?O+N.index:1/0,D=A?O+A.index:1/0;if(T<D)_++,O=T+(N[0].length||1);else if(D<1/0){if(_--,_===0){L=D;break}O=D+G.length+1}else break}if(L===-1)break;let w=q.slice(B,L);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);q=q.substring(0,H)+q.substring(L+`@${G}`.length),K=!0}return q}return J=X(J,"push","endpush",!1),J=X(J,"prepend","endprepend",!0),J}function G$($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
3465
+ `)})}import*as z$ from"path";async function C4($,Z,J=""){if(z$.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return P4($,Z,J,"@js","@endjs")}async function S4($,Z,J=""){if(z$.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return P4($,Z,J,"@ts","@endts")}async function P4($,Z,J,X,Y){let Q=$,G=v1(`${X}([\\s\\S]*?)${Y}`,"g"),z=[],q;while((q=G.exec($))!==null)z.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:K,content:W,index:U}of z)try{let H={...Z,global:Z},j=Object.keys(H),B=Object.values(H),V=W.trim();if(X==="@ts")V=V.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 _=(V.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=_.length>0?`return { ${_.join(", ")} };`:"return {};",L=`
3461
3466
  ${V}
3462
3467
  ${O}
3463
- `,R=Function(...j,L)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(K,"")}catch(H){console.error(`Error executing ${X} code block in ${J}:`,H);let j=H instanceof Error?H.message:String(H),B=H0(`${X} Directive`,`Error executing code: ${j}`,J,$,U,K);console.error(B),Q=Q.replace(K,"")}return Q}var TY=1000,kY=!1;function EY($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index+Q[0].length,z=Q.index+Q[0].indexOf("("),q=L0($,"(",")",z);if(q===-1)continue;let K=$.slice(G,q).trim();if(!K)continue;if(!Object.keys(Z).some((H)=>new RegExp(`(?:^|[^\\w$.])${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(K)))continue;let U;try{let H=E0(K,Z);if(!H||typeof H!=="object")continue;U=JSON.stringify(H)}catch{continue}X+=$.slice(Y,G)+U,Y=q,J.lastIndex=q}return Y===0?$:X+$.slice(Y)}function bY($,Z){let J=/@component\s*\(/g,X=$,Y,Q=[];while((Y=J.exec(X))!==null){let G=Y.index,z=G+Y[0].length-1,q=1,K=z+1;while(K<X.length&&q>0){if(X[K]==="(")q++;else if(X[K]===")"){if(q--,q===0)break}K++}if(q!==0)continue;let W=X.substring(z+1,K),U=K+1,H=W.match(/^\s*['"]([^'"]+)['"]/);if(!H)continue;let j=H[1],B=W.slice(H[0].length),V=B.match(/^\s*,\s*/);if(!V)continue;let F=B.slice(V[0].length).trim();if(!F)continue;try{let _=E0(F,Z),O=JSON.stringify(_),L=`@component('${j}', ${O})`;Q.push({start:G,end:U,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Q[G];X=X.substring(0,z)+K+X.substring(q)}return X}function L9($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=Y.exec(X))!==null){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1,W=null,U=!1;while(K<X.length&&q>0){let B=X[K];if(U){U=!1,K++;continue}if(B==="\\"&&W){U=!0,K++;continue}if(W){if(B===W)W=null;K++;continue}if(B==='"'||B==="'"||B==="`"){W=B,K++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}K++}if(q!==0)break;let H=X.substring(z+1,K),j=J(H);X=X.substring(0,G)+j+X.substring(K+1)}return X}function yY($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Y)=>{if(Y in Z)return`:${Y}="${Y}"`;return X}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Y,Q)=>{try{let G=Object.keys(Z),z=Object.values(Z);y4(Q);let K=W0(Q,G)(...z),W=JSON.stringify(K);if(W===void 0){if(!H9(Q).some((j)=>!(j in Z)))return"";return X}let U=Buffer.from(W,"utf8").toString("base64");return`__stx_${Y}="${U}"`}catch(G){return X}}),J}var O9="<!--__STX_BREAK__-->",F9="<!--__STX_CONTINUE__-->";function CY($,Z){let J=$;return J=L9(J,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(q0(Q)){let z=W0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?O9:""}catch{return""}}),J=L9(J,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(q0(Q)){let z=W0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?F9:""}catch{return""}}),J}function SY($){let Z=$;return Z=Z.replace(/@break(?!\()/g,O9),Z=Z.replace(/@continue(?!\()/g,F9),Z}function k4($){let Z=$.includes(O9),J=Z?$.substring(0,$.indexOf(O9)):$;return{hasBreak:Z,content:J}}function E4($){let Z=$.includes(F9),J=Z?$.substring(0,$.indexOf(F9)):$;return{hasContinue:Z,content:J}}function C4($){let Z=$;return Z=L9(Z,"@break",(J)=>{let X=J.trim();if(!_9(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=L9(Z,"@continue",(J)=>{let X=J.trim();if(!_9(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function PY($){let Z=/@forelse\s*\(/g,J,X=[],Y=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=Y.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((W,U)=>W.pos-U.pos);let z=[],q=0;for(let W of X)q+=W.delta,z.push({pos:W.pos,depth:q});function K(W){let U=0,H=z.length-1,j=0;while(U<=H){let B=U+H>>1;if(z[B].pos<=W)j=z[B].depth,U=B+1;else H=B-1}return j}while((J=Z.exec($))!==null){if(K(J.index)>0)continue;let W=J.index,U=J.index+J[0].length-1,H=1,j=U+1,B=-1;while(j<$.length&&H>0){if($[j]==="(")H++;else if($[j]===")"){if(H--,H===0){B=j;break}}j++}if(B===-1)continue;let V=$.substring(U+1,B),F=S4(V);if(!F)continue;let{arrayExpr:_,itemVar:O}=F,L=B+1,w=1,R=L,D=/@forelse\s*\(/g,A=/@endforelse/g,T=-1;while(w>0&&R<$.length){D.lastIndex=R,A.lastIndex=R;let E=D.exec($),b=A.exec($);if(!b)break;if(E&&E.index<b.index)w++,R=E.index+E[0].length;else{if(w--,w===0){T=b.index;break}R=b.index+11}}if(T===-1)continue;let N=$.substring(L,T),I=T+11,k=-1,M=0,y=0;while(y<N.length){let E=N.indexOf("@",y);if(E===-1)break;let b=N.substring(E);if(/^@forelse\s*\(/.test(b))M++,y=E+1;else if(b.startsWith("@endforelse"))M--,y=E+11;else if(M===0&&b.startsWith("@empty")){if(N.length<=E+6||!/[a-z]/i.test(N[E+6])){k=E;break}y=E+1}else y=E+1}if(k===-1)continue;return{start:W,end:I,arrayExpr:_,itemVar:O,foreachContent:N.substring(0,k),emptyContent:N.substring(k+6)}}return null}function b4($,Z){let J=$;while(!0){let X=PY(J);if(!X)break;let{start:Y,end:Q,arrayExpr:G,itemVar:z,foreachContent:q,emptyContent:K}=X;try{let W;if(q0(G))W=W0(G,Object.keys(Z))(...Object.values(Z));else W=e(G,Z);let U;if(!Array.isArray(W)||W.length===0)U=K;else U=`@foreach (${G} as ${z})${q}@endforeach`;J=J.substring(0,Y)+U+J.substring(Q)}catch(W){let U=W instanceof Error?W.message:String(W),H=X0("Forelse",`Error in @forelse(${G} as ${z}): ${U}`,J0.EVALUATION_ERROR);J=J.substring(0,Y)+H+J.substring(Q)}}return J}function S4($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let J=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!J)return null;let X=J[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=J[2].trim();return X&&Y?{arrayExpr:Y,itemVar:X}:null}function P4($,Z,J,X){let Y=$;Y=b4(Y,Z);function Q(q){let K=/@foreach\s*\(/g,W;while((W=K.exec(q))!==null){let U=W.index,H=W.index+W[0].length-1,j=1,B=H+1,V=-1;while(B<q.length&&j>0){if(q[B]==="(")j++;else if(q[B]===")"){if(j--,j===0){V=B;break}}B++}if(V===-1)continue;let F=q.substring(H+1,V),_=S4(F);if(!_)continue;let O=U,{arrayExpr:L,itemVar:w}=_,R=V+1,D=1,A=R,T=/@foreach\s*\(/g,N=/@endforeach/g;while(D>0&&A<q.length){T.lastIndex=A,N.lastIndex=A;let I=T.exec(q),k=N.exec(q);if(!k)break;if(I&&I.index<k.index)D++,A=I.index+I[0].length;else{if(D--,D===0){let M=q.substring(R,k.index),y=k.index+11;return{start:O,end:y,arrayExpr:L,itemVar:w,content:M}}A=k.index+11}}}return null}function G(q,K){let W=q;while(!0){let U=Q(W);if(!U)break;let{start:H,end:j,arrayExpr:B,itemVar:V,content:F}=U;try{let _=B.trim(),O;if(q0(_))O=W0(_,Object.keys(K))(...Object.values(K));else O=e(_,K);let L=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),L=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),L=!0;else{console.warn(`[stx] @foreach(${_}) in ${J}: ${_} 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.");let k=X0("Foreach",`Error in @foreach: ${_} is not iterable`,J0.TYPE_ERROR);W=W.substring(0,H)+k+W.substring(j);continue}let w=X?.loops?.useAltLoopVariable??kY,R=V.trim(),D=null,A,T=!1;if(R.includes("=>")){let k=R.split("=>").map((M)=>M.trim());if(k.length===2&&k[0]&&k[1])D=k[0],A=k[1];else A=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((M)=>M.trim());if(k.length===2&&k[0]&&k[1])A=k[0],D=k[1],T=!0;else A=R}else A=R;let N="",I=O;for(let k=0;k<I.length;k++){let M=I[k],y={index:k,iteration:k+1,first:k===0,last:k===I.length-1,count:I.length},E={...K,loop:y,$loop:y};if(A.startsWith("[")&&A.endsWith("]")){let u=A.slice(1,-1).split(",").map((P)=>P.trim());if(Array.isArray(M))u.forEach((P,h)=>{if(P)E[P]=M[h]});else E[A]=M}else E[A]=M;if(D)if(!T&&L&&Array.isArray(M)&&M.length===2)E[D]=M[0],E[A]=M[1];else E[D]=k;let b=CY(F,E),C=E4(b);if(C.hasContinue){N+=C.content;continue}let f=k4(b);if(f.hasBreak){N+=f.content;break}if(b=b4(b,E),b=G(b,E),b=e0(b,E,J),b=SY(b),f=k4(b),f.hasBreak){N+=f.content;break}if(C=E4(b),C.hasContinue){N+=C.content;continue}b=V1(b,E,J),b=yY(b,E),b=bY(b,E),b=EY(b,E),N+=b}W=W.substring(0,H)+N+W.substring(j)}catch(_){let O=X0("Foreach",`Error in @foreach(${B.trim()} as ${V.trim()}): ${_ instanceof Error?_.message:String(_)}`,J0.EVALUATION_ERROR);W=W.substring(0,H)+O+W.substring(j)}}return W}Y=G(Y,Z),Y=f4(Y,Z,J,X);let z=X?.loops?.maxWhileIterations??TY;return Y=xY(Y,Z,z),Y}function v4($){return _9($)}function f4($,Z,J,X){let Y=$,Q=!0;while(Q){Q=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let z=G.index,q=z+G[0].length-1,K=L0(Y,"(",")",q);if(K===-1)break;let W=Y.slice(q+1,K),U=K+1,H=J9(Y.slice(z),"for","endfor");if(H.length===0)break;let j=H[0].content,B=z+H[0].end;if(!v4(W)){let V=X0("For",`Unsafe expression in @for: ${W}`,J0.UNSAFE_EXPRESSION);Y=Y.substring(0,z)+V+Y.substring(B),Q=!0;continue}try{let V=vY(W),F=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(V.length>0&&F){let D=fY({forExpr:W,content:j,iterVarNames:V,context:Z,filePath:J,options:X});Y=Y.substring(0,z)+D+Y.substring(B),Q=!0;continue}let _=Object.keys(Z),O=Object.values(Z),L=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(D,A)=>{return`\${${A}}`});L=C4(L);let R=Function(..._,`
3468
+ `,R=Function(...j,L)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(K,"")}catch(H){console.error(`Error executing ${X} code block in ${J}:`,H);let j=H instanceof Error?H.message:String(H),B=H0(`${X} Directive`,`Error executing code: ${j}`,J,$,U,K);console.error(B),Q=Q.replace(K,"")}return Q}var hY=1000,uY=!1;function dY($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index+Q[0].length,z=Q.index+Q[0].indexOf("("),q=L0($,"(",")",z);if(q===-1)continue;let K=$.slice(G,q).trim();if(!K)continue;if(!Object.keys(Z).some((H)=>new RegExp(`(?:^|[^\\w$.])${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(K)))continue;let U;try{let H=E0(K,Z);if(!H||typeof H!=="object")continue;U=JSON.stringify(H)}catch{continue}X+=$.slice(Y,G)+U,Y=q,J.lastIndex=q}return Y===0?$:X+$.slice(Y)}function mY($,Z){let J=/@component\s*\(/g,X=$,Y,Q=[];while((Y=J.exec(X))!==null){let G=Y.index,z=G+Y[0].length-1,q=1,K=z+1;while(K<X.length&&q>0){if(X[K]==="(")q++;else if(X[K]===")"){if(q--,q===0)break}K++}if(q!==0)continue;let W=X.substring(z+1,K),U=K+1,H=W.match(/^\s*['"]([^'"]+)['"]/);if(!H)continue;let j=H[1],B=W.slice(H[0].length),V=B.match(/^\s*,\s*/);if(!V)continue;let F=B.slice(V[0].length).trim();if(!F)continue;try{let _=E0(F,Z),O=JSON.stringify(_),L=`@component('${j}', ${O})`;Q.push({start:G,end:U,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Q[G];X=X.substring(0,z)+K+X.substring(q)}return X}function O9($,Z,J){let X=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=Y.exec(X))!==null){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1,W=null,U=!1;while(K<X.length&&q>0){let B=X[K];if(U){U=!1,K++;continue}if(B==="\\"&&W){U=!0,K++;continue}if(W){if(B===W)W=null;K++;continue}if(B==='"'||B==="'"||B==="`"){W=B,K++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}K++}if(q!==0)break;let H=X.substring(z+1,K),j=J(H);X=X.substring(0,G)+j+X.substring(K+1)}return X}function lY($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Y)=>{if(Y in Z)return`:${Y}="${Y}"`;return X}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Y,Q)=>{try{let G=Object.keys(Z),z=Object.values(Z);g4(Q);let K=K0(Q,G)(...z),W=JSON.stringify(K);if(W===void 0){if(!j9(Q).some((j)=>!(j in Z)))return"";return X}let U=Buffer.from(W,"utf8").toString("base64");return`__stx_${Y}="${U}"`}catch(G){return X}}),J}var F9="<!--__STX_BREAK__-->",w9="<!--__STX_CONTINUE__-->";function cY($,Z){let J=$;return J=O9(J,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(W0(Q)){let z=K0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?F9:""}catch{return""}}),J=O9(J,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(W0(Q)){let z=K0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?w9:""}catch{return""}}),J}function pY($){let Z=$;return Z=Z.replace(/@break(?!\()/g,F9),Z=Z.replace(/@continue(?!\()/g,w9),Z}function v4($){let Z=$.includes(F9),J=Z?$.substring(0,$.indexOf(F9)):$;return{hasBreak:Z,content:J}}function f4($){let Z=$.includes(w9),J=Z?$.substring(0,$.indexOf(w9)):$;return{hasContinue:Z,content:J}}function h4($){let Z=$;return Z=O9(Z,"@break",(J)=>{let X=J.trim();if(!L9(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=O9(Z,"@continue",(J)=>{let X=J.trim();if(!L9(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function iY($){let Z=/@forelse\s*\(/g,J,X=[],Y=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=Y.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((W,U)=>W.pos-U.pos);let z=[],q=0;for(let W of X)q+=W.delta,z.push({pos:W.pos,depth:q});function K(W){let U=0,H=z.length-1,j=0;while(U<=H){let B=U+H>>1;if(z[B].pos<=W)j=z[B].depth,U=B+1;else H=B-1}return j}while((J=Z.exec($))!==null){if(K(J.index)>0)continue;let W=J.index,U=J.index+J[0].length-1,H=1,j=U+1,B=-1;while(j<$.length&&H>0){if($[j]==="(")H++;else if($[j]===")"){if(H--,H===0){B=j;break}}j++}if(B===-1)continue;let V=$.substring(U+1,B),F=u4(V);if(!F)continue;let{arrayExpr:_,itemVar:O}=F,L=B+1,w=1,R=L,N=/@forelse\s*\(/g,A=/@endforelse/g,T=-1;while(w>0&&R<$.length){N.lastIndex=R,A.lastIndex=R;let E=N.exec($),b=A.exec($);if(!b)break;if(E&&E.index<b.index)w++,R=E.index+E[0].length;else{if(w--,w===0){T=b.index;break}R=b.index+11}}if(T===-1)continue;let D=$.substring(L,T),M=T+11,k=-1,I=0,y=0;while(y<D.length){let E=D.indexOf("@",y);if(E===-1)break;let b=D.substring(E);if(/^@forelse\s*\(/.test(b))I++,y=E+1;else if(b.startsWith("@endforelse"))I--,y=E+11;else if(I===0&&b.startsWith("@empty")){if(D.length<=E+6||!/[a-z]/i.test(D[E+6])){k=E;break}y=E+1}else y=E+1}if(k===-1)continue;return{start:W,end:M,arrayExpr:_,itemVar:O,foreachContent:D.substring(0,k),emptyContent:D.substring(k+6)}}return null}function x4($,Z){let J=$;while(!0){let X=iY(J);if(!X)break;let{start:Y,end:Q,arrayExpr:G,itemVar:z,foreachContent:q,emptyContent:K}=X;try{let W;if(W0(G))W=K0(G,Object.keys(Z))(...Object.values(Z));else W=e(G,Z);let U;if(!Array.isArray(W)||W.length===0)U=K;else U=`@foreach (${G} as ${z})${q}@endforeach`;J=J.substring(0,Y)+U+J.substring(Q)}catch(W){let U=W instanceof Error?W.message:String(W),H=X0("Forelse",`Error in @forelse(${G} as ${z}): ${U}`,J0.EVALUATION_ERROR);J=J.substring(0,Y)+H+J.substring(Q)}}return J}function u4($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let J=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!J)return null;let X=J[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=J[2].trim();return X&&Y?{arrayExpr:Y,itemVar:X}:null}function d4($,Z,J,X){let Y=$;Y=x4(Y,Z);function Q(q){let K=/@foreach\s*\(/g,W;while((W=K.exec(q))!==null){let U=W.index,H=W.index+W[0].length-1,j=1,B=H+1,V=-1;while(B<q.length&&j>0){if(q[B]==="(")j++;else if(q[B]===")"){if(j--,j===0){V=B;break}}B++}if(V===-1)continue;let F=q.substring(H+1,V),_=u4(F);if(!_)continue;let O=U,{arrayExpr:L,itemVar:w}=_,R=V+1,N=1,A=R,T=/@foreach\s*\(/g,D=/@endforeach/g;while(N>0&&A<q.length){T.lastIndex=A,D.lastIndex=A;let M=T.exec(q),k=D.exec(q);if(!k)break;if(M&&M.index<k.index)N++,A=M.index+M[0].length;else{if(N--,N===0){let I=q.substring(R,k.index),y=k.index+11;return{start:O,end:y,arrayExpr:L,itemVar:w,content:I}}A=k.index+11}}}return null}function G(q,K){let W=q;while(!0){let U=Q(W);if(!U)break;let{start:H,end:j,arrayExpr:B,itemVar:V,content:F}=U;try{let _=B.trim(),O;if(W0(_))O=K0(_,Object.keys(K))(...Object.values(K));else O=e(_,K);let L=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),L=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),L=!0;else{console.warn(`[stx] @foreach(${_}) in ${J}: ${_} 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.");let k=X0("Foreach",`Error in @foreach: ${_} is not iterable`,J0.TYPE_ERROR);W=W.substring(0,H)+k+W.substring(j);continue}let w=X?.loops?.useAltLoopVariable??uY,R=V.trim(),N=null,A,T=!1;if(R.includes("=>")){let k=R.split("=>").map((I)=>I.trim());if(k.length===2&&k[0]&&k[1])N=k[0],A=k[1];else A=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((I)=>I.trim());if(k.length===2&&k[0]&&k[1])A=k[0],N=k[1],T=!0;else A=R}else A=R;let D="",M=O;for(let k=0;k<M.length;k++){let I=M[k],y={index:k,iteration:k+1,first:k===0,last:k===M.length-1,count:M.length},E={...K,loop:y,$loop:y};if(A.startsWith("[")&&A.endsWith("]")){let u=A.slice(1,-1).split(",").map((P)=>P.trim());if(Array.isArray(I))u.forEach((P,h)=>{if(P)E[P]=I[h]});else E[A]=I}else E[A]=I;if(N)if(!T&&L&&Array.isArray(I)&&I.length===2)E[N]=I[0],E[A]=I[1];else E[N]=k;let b=cY(F,E),C=f4(b);if(C.hasContinue){D+=C.content;continue}let f=v4(b);if(f.hasBreak){D+=f.content;break}if(b=x4(b,E),b=G(b,E),b=e0(b,E,J),b=pY(b),f=v4(b),f.hasBreak){D+=f.content;break}if(C=f4(b),C.hasContinue){D+=C.content;continue}b=V1(b,E,J),b=lY(b,E),b=mY(b,E),b=dY(b,E),D+=b}W=W.substring(0,H)+D+W.substring(j)}catch(_){let O=X0("Foreach",`Error in @foreach(${B.trim()} as ${V.trim()}): ${_ instanceof Error?_.message:String(_)}`,J0.EVALUATION_ERROR);W=W.substring(0,H)+O+W.substring(j)}}return W}Y=G(Y,Z),Y=l4(Y,Z,J,X);let z=X?.loops?.maxWhileIterations??hY;return Y=oY(Y,Z,z),Y}function m4($){return L9($)}function l4($,Z,J,X){let Y=$,Q=!0;while(Q){Q=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let z=G.index,q=z+G[0].length-1,K=L0(Y,"(",")",q);if(K===-1)break;let W=Y.slice(q+1,K),U=K+1,H=X9(Y.slice(z),"for","endfor");if(H.length===0)break;let j=H[0].content,B=z+H[0].end;if(!m4(W)){let V=X0("For",`Unsafe expression in @for: ${W}`,J0.UNSAFE_EXPRESSION);Y=Y.substring(0,z)+V+Y.substring(B),Q=!0;continue}try{let V=nY(W),F=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(V.length>0&&F){let N=sY({forExpr:W,content:j,iterVarNames:V,context:Z,filePath:J,options:X});Y=Y.substring(0,z)+N+Y.substring(B),Q=!0;continue}let _=Object.keys(Z),O=Object.values(Z),L=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,A)=>{return`\${${A}}`});L=h4(L);let R=Function(..._,`
3464
3469
  let result = '';
3465
3470
  for (${W}) {
3466
3471
  result += \`${L}\`;
3467
3472
  }
3468
3473
  return result;
3469
- `)(...O);Y=Y.substring(0,z)+R+Y.substring(B),Q=!0}catch(V){let F=X0("For",`Error in @for(${W}): ${V instanceof Error?V.message:String(V)}`,J0.EVALUATION_ERROR);Y=Y.substring(0,z)+F+Y.substring(B),Q=!0}}return Y}function vY($){let Z=$.trim(),J=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(J){let Q=J[1];return Q.slice(1,-1).split(",").map((z)=>{let q=z.trim();if(!q)return"";let K=q.indexOf(":");if(K>=0&&Q.startsWith("{")){let H=q.slice(K+1).trim(),j=H.indexOf("=");return(j>=0?H.slice(0,j):H).trim()}let W=q.indexOf("="),U=(W>=0?q.slice(0,W):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function fY($){let{forExpr:Z,content:J,iterVarNames:X,context:Y,filePath:Q,options:G}=$,z=Object.keys(Y),q=Object.values(Y),K=Function(...z,"__pushIter",`
3474
+ `)(...O);Y=Y.substring(0,z)+R+Y.substring(B),Q=!0}catch(V){let F=X0("For",`Error in @for(${W}): ${V instanceof Error?V.message:String(V)}`,J0.EVALUATION_ERROR);Y=Y.substring(0,z)+F+Y.substring(B),Q=!0}}return Y}function nY($){let Z=$.trim(),J=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(J){let Q=J[1];return Q.slice(1,-1).split(",").map((z)=>{let q=z.trim();if(!q)return"";let K=q.indexOf(":");if(K>=0&&Q.startsWith("{")){let H=q.slice(K+1).trim(),j=H.indexOf("=");return(j>=0?H.slice(0,j):H).trim()}let W=q.indexOf("="),U=(W>=0?q.slice(0,W):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function sY($){let{forExpr:Z,content:J,iterVarNames:X,context:Y,filePath:Q,options:G}=$,z=Object.keys(Y),q=Object.values(Y),K=Function(...z,"__pushIter",`
3470
3475
  for (${Z}) {
3471
3476
  __pushIter([${X.join(", ")}])
3472
3477
  }
3473
- `),W=[];K(...q,(j)=>{W.push(j)});let U=Q??"inline.stx",H="";for(let j of W){let B={...Y};X.forEach((F,_)=>{B[F]=j[_]});let V=f4(J,B,Q,G);V=e0(V,B,U),V=V1(V,B,U),H+=V}return H}function xY($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=G+Q[0].length-1,q=L0(X,"(",")",z);if(q===-1)break;let K=X.slice(z+1,q),W=J9(X.slice(G),"while","endwhile");if(W.length===0)break;let U=W[0].content,H=G+W[0].end;if(!v4(K)){let j=X0("While",`Unsafe expression in @while: ${K}`,J0.UNSAFE_EXPRESSION);X=X.substring(0,G)+j+X.substring(H),Y=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),V=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,L)=>{return`\${${L}}`});V=C4(V);let _=Function(...j,`
3478
+ `),W=[];K(...q,(j)=>{W.push(j)});let U=Q??"inline.stx",H="";for(let j of W){let B={...Y};X.forEach((F,_)=>{B[F]=j[_]});let V=l4(J,B,Q,G);V=e0(V,B,U),V=V1(V,B,U),H+=V}return H}function oY($,Z,J){let X=$,Y=!0;while(Y){Y=!1;let Q=X.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=G+Q[0].length-1,q=L0(X,"(",")",z);if(q===-1)break;let K=X.slice(z+1,q),W=X9(X.slice(G),"while","endwhile");if(W.length===0)break;let U=W[0].content,H=G+W[0].end;if(!m4(K)){let j=X0("While",`Unsafe expression in @while: ${K}`,J0.UNSAFE_EXPRESSION);X=X.substring(0,G)+j+X.substring(H),Y=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),V=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,L)=>{return`\${${L}}`});V=h4(V);let _=Function(...j,`
3474
3479
  let result = '';
3475
3480
  let maxIterations = ${J}; // Configurable safety limit
3476
3481
  let counter = 0;
@@ -3482,52 +3487,52 @@ ${Y}
3482
3487
  result += '<!-- [While Error [1104]]: Maximum iterations (${J}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3483
3488
  }
3484
3489
  return result;
3485
- `)(...B);X=X.substring(0,G)+_+X.substring(H),Y=!0}catch(j){let B=X0("While",`Error in @while(${K}): ${j instanceof Error?j.message:String(j)}`,J0.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(H),Y=!0}}return X}function gY($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function x4($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,X,Y,Q)=>{return gY(X,Q||"_method")})}async function g4($,Z,J,X,Y){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((z)=>z.timing===Y);if(G.length===0)return Q;for(let z of G){if(!z.name||typeof z.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",z);continue}try{let q=await z.handler(Q,Z,J,X);if(typeof q==="string")Q=q;else if(X.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${z.name}:`,q);if(X.debug){let K=H0("Middleware",`Error in middleware '${z.name}': ${q instanceof Error?q.message:String(q)}`,J,$);Q=Q.replace(/<body[^>]*>/,`$&
3486
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${d9(K)}</div>
3487
- `)}}}return Q}async function h4($,Z,J,X){return g4($,Z,J,X,"before")}async function u4($,Z,J,X){return g4($,Z,J,X,"after")}G2();G2();function d4($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,X,Y,Q)=>{try{let G=Y?E0(Y,{}):{};return G$(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var i0={patterns:[],exact:{}};function Kj($,Z){if(!i0.exact[$])i0.exact[$]=[];i0.exact[$].push(Z)}function Wj($,Z){let J=typeof $==="string"?new RegExp($):$;i0.patterns.push({pattern:J,callback:Z})}async function m4($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(i0.exact[$])for(let X of i0.exact[$])await Promise.resolve(X(Z,$));if(i0.exact[J])for(let X of i0.exact[J])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Y}of i0.patterns)if(X.test($)||X.test(J))await Promise.resolve(Y(Z,$))}function Uj(){i0.patterns=[],i0.exact={}}var hY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),uY=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function T1($,Z){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=Z;let X=J.exec($);if(!X)return null;let Y=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&hY.has(X[1]),Q=Y?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Q,selfClosing:Y,start:X.index,end:X.index+X[0].length}}function dY($,Z,J){let X=1,Y=J,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y;let z=Q.exec($),q=G.exec($);if(!q)return-1;if(z&&z.index<q.index)X++,Y=z.index+z[0].length;else{if(X--,X===0)return q.index+q[0].length;Y=q.index+q[0].length}}return-1}function I1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=dY($,Z.tag,Z.end);if(J===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:J,innerHTML:$.slice(Z.end,J-`</${Z.tag}>`.length)}}function l4($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function D2($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return X?X[1]:null}function U1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function n1($,Z,J){let X=Z.selfClosing?" /":"",Y=`<${Z.tag}${J}${X}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function mY($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function lY($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=D2(X.attrs,"v-for");if(Y===null){J=X.end;continue}let Q=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){J=X.end;continue}let G=Q[1].trim(),z=Q[2].trim(),q;if(G.includes(",")){let F=G.split(",").map((L)=>L.trim()),_=F[0],O=F[1];q=`${z} as ${O} => ${_}`}else q=`${z} as ${G}`;let K=U1(X.attrs,"v-for"),W=U1(K,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=I1(Z,X),H=Z.slice(U.outerStart,U.outerEnd),j=n1(H,{...X,start:0,end:X.end-X.start},W),B=`@foreach(${q})
3490
+ `)(...B);X=X.substring(0,G)+_+X.substring(H),Y=!0}catch(j){let B=X0("While",`Error in @while(${K}): ${j instanceof Error?j.message:String(j)}`,J0.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(H),Y=!0}}return X}function rY($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function c4($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,X,Y,Q)=>{return rY(X,Q||"_method")})}async function p4($,Z,J,X,Y){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((z)=>z.timing===Y);if(G.length===0)return Q;for(let z of G){if(!z.name||typeof z.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",z);continue}try{let q=await z.handler(Q,Z,J,X);if(typeof q==="string")Q=q;else if(X.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${z.name}:`,q);if(X.debug){let K=H0("Middleware",`Error in middleware '${z.name}': ${q instanceof Error?q.message:String(q)}`,J,$);Q=Q.replace(/<body[^>]*>/,`$&
3491
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${l9(K)}</div>
3492
+ `)}}}return Q}async function i4($,Z,J,X){return p4($,Z,J,X,"before")}async function n4($,Z,J,X){return p4($,Z,J,X,"after")}z2();z2();function s4($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,X,Y,Q)=>{try{let G=Y?E0(Y,{}):{};return q$(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var i0={patterns:[],exact:{}};function Aj($,Z){if(!i0.exact[$])i0.exact[$]=[];i0.exact[$].push(Z)}function Mj($,Z){let J=typeof $==="string"?new RegExp($):$;i0.patterns.push({pattern:J,callback:Z})}async function o4($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(i0.exact[$])for(let X of i0.exact[$])await Promise.resolve(X(Z,$));if(i0.exact[J])for(let X of i0.exact[J])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Y}of i0.patterns)if(X.test($)||X.test(J))await Promise.resolve(Y(Z,$))}function Ij(){i0.patterns=[],i0.exact={}}var aY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),tY=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function T1($,Z){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=Z;let X=J.exec($);if(!X)return null;let Y=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&aY.has(X[1]),Q=Y?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Q,selfClosing:Y,start:X.index,end:X.index+X[0].length}}function eY($,Z,J){let X=1,Y=J,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y;let z=Q.exec($),q=G.exec($);if(!q)return-1;if(z&&z.index<q.index)X++,Y=z.index+z[0].length;else{if(X--,X===0)return q.index+q[0].length;Y=q.index+q[0].length}}return-1}function I1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=eY($,Z.tag,Z.end);if(J===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:J,innerHTML:$.slice(Z.end,J-`</${Z.tag}>`.length)}}function r4($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function D2($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return X?X[1]:null}function U1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function n1($,Z,J){let X=Z.selfClosing?" /":"",Y=`<${Z.tag}${J}${X}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function $Q($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function ZQ($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=D2(X.attrs,"v-for");if(Y===null){J=X.end;continue}let Q=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){J=X.end;continue}let G=Q[1].trim(),z=Q[2].trim(),q;if(G.includes(",")){let F=G.split(",").map((L)=>L.trim()),_=F[0],O=F[1];q=`${z} as ${O} => ${_}`}else q=`${z} as ${G}`;let K=U1(X.attrs,"v-for"),W=U1(K,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=I1(Z,X),H=Z.slice(U.outerStart,U.outerEnd),j=n1(H,{...X,start:0,end:X.end-X.start},W),B=`@foreach(${q})
3488
3493
  `,V=`${B}${j}
3489
- @endforeach`;Z=Z.slice(0,U.outerStart)+V+Z.slice(U.outerEnd),J=U.outerStart+B.length}return Z}function cY($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=D2(X.attrs,"v-if");if(Y===null){J=X.end;continue}let Q=[],G=I1(Z,X),z=U1(X.attrs,"v-if"),q=n1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},z);Q.push({type:"if",expr:Y,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let K=G.outerEnd,W=!0;while(W){let V=Z.slice(K).match(/^\s*/),F=V?V[0].length:0,_=T1(Z,K+F);if(!_){W=!1;break}let O=D2(_.attrs,"v-else-if"),L=l4(_.attrs,"v-else");if(O!==null){let w=I1(Z,_),R=U1(_.attrs,"v-else-if"),D=n1(Z.slice(w.outerStart,w.outerEnd),{..._,start:0,end:_.end-_.start},R);Q.push({type:"else-if",expr:O,outerStart:K,outerEnd:w.outerEnd,element:D,parsedTag:_}),K=w.outerEnd}else if(L){let w=I1(Z,_),R=U1(_.attrs,"v-else"),D=n1(Z.slice(w.outerStart,w.outerEnd),{..._,start:0,end:_.end-_.start},R);Q.push({type:"else",outerStart:K,outerEnd:w.outerEnd,element:D,parsedTag:_}),W=!1}else W=!1}let U=[];for(let V of Q)if(V.type==="if")U.push(`@if(${V.expr})
3494
+ @endforeach`;Z=Z.slice(0,U.outerStart)+V+Z.slice(U.outerEnd),J=U.outerStart+B.length}return Z}function JQ($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=D2(X.attrs,"v-if");if(Y===null){J=X.end;continue}let Q=[],G=I1(Z,X),z=U1(X.attrs,"v-if"),q=n1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},z);Q.push({type:"if",expr:Y,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let K=G.outerEnd,W=!0;while(W){let V=Z.slice(K).match(/^\s*/),F=V?V[0].length:0,_=T1(Z,K+F);if(!_){W=!1;break}let O=D2(_.attrs,"v-else-if"),L=r4(_.attrs,"v-else");if(O!==null){let w=I1(Z,_),R=U1(_.attrs,"v-else-if"),N=n1(Z.slice(w.outerStart,w.outerEnd),{..._,start:0,end:_.end-_.start},R);Q.push({type:"else-if",expr:O,outerStart:K,outerEnd:w.outerEnd,element:N,parsedTag:_}),K=w.outerEnd}else if(L){let w=I1(Z,_),R=U1(_.attrs,"v-else"),N=n1(Z.slice(w.outerStart,w.outerEnd),{..._,start:0,end:_.end-_.start},R);Q.push({type:"else",outerStart:K,outerEnd:w.outerEnd,element:N,parsedTag:_}),W=!1}else W=!1}let U=[];for(let V of Q)if(V.type==="if")U.push(`@if(${V.expr})
3490
3495
  ${V.element}`);else if(V.type==="else-if")U.push(`@elseif(${V.expr})
3491
3496
  ${V.element}`);else U.push(`@else
3492
3497
  ${V.element}`);U.push("@endif");let H=U.join(`
3493
- `),j=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,j)+H+Z.slice(B),J=j+H.length}return Z}function pY($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function iY($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=uY.has(X.tag),Q=X.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,q,K)=>{let W=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(q);if(!W||!K||!/^["']/.test(K))return z;let U=W[1]||"modelValue",H=W[2];if(Y&&!W[1])return`@model${H}=${K}`;let j=K[0],B=K.slice(1,-1),V=`:${U}=${K} @update:${U}=${j}${B} = $event${j}`;if(H){let F=W[1]?`${U}Modifiers`:"modelModifiers",_=H.slice(1).split(".").map((O)=>`${O}: true`).join(", ");V+=` :${F}="{ ${_} }"`}return V});if(Q===X.attrs){J=X.end;continue}let G=n1(X.full,{...X,start:0,end:X.full.length},Q);Z=Z.slice(0,X.start)+G+Z.slice(X.end),J=X.start+G.length}return Z}function nY($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function sY($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function oY($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=D2(X.attrs,"v-html");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=I1(Z,X),G=U1(X.attrs,"v-html"),z=X.selfClosing?" /":"",q=`<${X.tag}${G}${z}>{!! ${Y} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),J=Q.outerStart+q.length}return Z}function rY($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=D2(X.attrs,"v-text");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=I1(Z,X),G=U1(X.attrs,"v-text"),z=X.selfClosing?" /":"",q=`<${X.tag}${G}${z}>{{ ${Y} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),J=Q.outerStart+q.length}return Z}function aY($){return $.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 tY($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;if(!l4(X.attrs,"v-once")){J=X.end;continue}let Y=U1(X.attrs,"v-once"),Q=I1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
3498
+ `),j=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,j)+H+Z.slice(B),J=j+H.length}return Z}function XQ($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function YQ($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=tY.has(X.tag),Q=X.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(z,q,K)=>{let W=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(q);if(!W||!K||!/^["']/.test(K))return z;let U=W[1]||"modelValue",H=W[2];if(Y&&!W[1])return`@model${H}=${K}`;let j=K[0],B=K.slice(1,-1),V=`:${U}=${K} @update:${U}=${j}${B} = $event${j}`;if(H){let F=W[1]?`${U}Modifiers`:"modelModifiers",_=H.slice(1).split(".").map((O)=>`${O}: true`).join(", ");V+=` :${F}="{ ${_} }"`}return V});if(Q===X.attrs){J=X.end;continue}let G=n1(X.full,{...X,start:0,end:X.full.length},Q);Z=Z.slice(0,X.start)+G+Z.slice(X.end),J=X.start+G.length}return Z}function QQ($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function GQ($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function zQ($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=D2(X.attrs,"v-html");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=I1(Z,X),G=U1(X.attrs,"v-html"),z=X.selfClosing?" /":"",q=`<${X.tag}${G}${z}>{!! ${Y} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),J=Q.outerStart+q.length}return Z}function qQ($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;let Y=D2(X.attrs,"v-text");if(Y===null){J=X.end;continue}if(X.selfClosing){J=X.end;continue}let Q=I1(Z,X),G=U1(X.attrs,"v-text"),z=X.selfClosing?" /":"",q=`<${X.tag}${G}${z}>{{ ${Y} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),J=Q.outerStart+q.length}return Z}function KQ($){return $.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 WQ($){let Z=$,J=0;while(J<Z.length){let X=T1(Z,J);if(!X)break;if(!r4(X.attrs,"v-once")){J=X.end;continue}let Y=U1(X.attrs,"v-once"),Q=I1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
3494
3499
  ${n1(G,{...X,start:0,end:X.end-X.start},Y)}
3495
- @endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),J=Q.outerStart+q.length}return Z}function eY($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function $Q($){return $.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 c4($){if(!mY($))return $;let Z=$;return Z=lY(Z),Z=cY(Z),Z=tY(Z),Z=nY(Z),Z=sY(Z),Z=iY(Z),Z=pY(Z),Z=$Q(Z),Z=oY(Z),Z=rY(Z),Z=aY(Z),Z=eY(Z),Z}function w9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var z$=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"]),ZQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function p4($,Z){let J=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),X=J?J[1]:$,Y=e(X,Z);if(Y&&typeof Y==="string")return Y;let Q=X.trim();return z$.has(Q)?Q:null}function i4($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function n4($,Z,J){let X=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=X?`<${$} ${X}>`:`<${$}>`;if(ZQ.has($))return X?`<${$} ${X}>`:`<${$}>`;return`${Y}${J}</${$}>`}async function s4($,Z,J,X,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],q;while((q=G.exec(Q))!==null)z.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let K=z.length-1;K>=0;K--){let W=z[K];try{let U=p4(W.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${w9(i4(W.expr))}" -->`;Q=Q.slice(0,W.index)+O+Q.slice(W.index+W.full.length);continue}if(z$.has(U)){let O=n4(U,W.attrs,W.slotContent);Q=Q.slice(0,W.index)+O+Q.slice(W.index+W.full.length);continue}let H=W.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,V;while((V=B.exec(H))!==null){let O=V[1]||V[2],L=V[3];if(V[1])try{j[O]=e(L,Z)}catch{j[O]=L}else j[O]=L}let F=X.componentsDir||"components",_=await N1(U,j,W.slotContent,F,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length)}catch(U){let H=U instanceof Error?U.message:String(U),j=`<!-- dynamic component error: ${w9(H)} -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}}return Q=await JQ(Q,Z,J,X,Y),Q}async function JQ($,Z,J,X,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],q;while((q=G.exec(Q))!==null)z.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let K=z.length-1;K>=0;K--){let W=z[K];try{let U=p4(W.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${w9(i4(W.expr))}" -->`;Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length);continue}if(z$.has(U)){let B=n4(U,W.attrs,"");Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length);continue}let H=X.componentsDir||"components",j=await N1(U,{},"",H,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}catch(U){let H=U instanceof Error?U.message:String(U),j=`<!-- dynamic component error: ${w9(H)} -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}}return Q}function q$(){return{afterOpen:[],beforeClose:[]}}function XQ($){return $.afterOpen.length>0||$.beforeClose.length>0}function r4($,Z){if(!XQ(Z))return $;let J=Z.afterOpen.join(""),X=Z.beforeClose.join(""),Y=$.lastIndexOf("</head>"),Q=J?N2($):null,G=X&&Y!==-1?Y:null;if(Q===null&&G===null)return $;if(Q!==null&&G!==null)return`${$.slice(0,Q)}${J}${$.slice(Q,G)}${X}${$.slice(G)}`;if(Q!==null)return`${$.slice(0,Q)}${J}${$.slice(Q)}`;return`${$.slice(0,G)}${X}${$.slice(G)}`}var o4=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function N2($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let J=Z.index+Z[0].length;o4.lastIndex=J;let X=o4.exec($);return X?J+X[0].length:J}var W$="data-stx-color-mode-boot",YQ="__STX_COLOR_MODE__",QQ=new Set(["light","dark","auto","system"]),GQ=new Set(["auto","system"]),zQ=/^[a-z][\w:-]*$/i,qQ=/^[\w-]+$/;function KQ($){let Z=$.storageKey??"stx-color-mode",J=$.initialMode??"auto",X=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!QQ.has(J))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(J)}`);if(X!==null&&(typeof X!=="string"||!qQ.test(X)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(X)}`);if(Y!==null&&(typeof Y!=="string"||!zQ.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!GQ.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(X===null&&Y===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:J==="system"?"auto":J,darkClass:X,attribute:Y,autoValue:Q}}function WQ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function U$($={}){let Z=KQ($),X=`(function(){"use strict";var c=${WQ(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.${YQ}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`;return`<script ${W$}>${X}</script>`}function e4($,Z={}){if($.includes(W$))return $;let J=K$($);if(J===null)return $;let X=U$(Z);return`${$.slice(0,J)}
3496
- ${X}${$.slice(J)}`}var K$=N2,UQ=new RegExp(`<script\\b[^>]*\\b${W$}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),a4=/<meta\b[^>]*\bcharset\b[^>]*>/gi,t4=/<\/head>/gi;function HQ($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length;t4.lastIndex=J;let X=t4.exec($),Y=X?X.index:$.length;a4.lastIndex=J;let Q=a4.exec($);if(!Q||Q.index>=Y)return $;if($.slice(J,Q.index).trim()==="")return $;let G=Q.index+Q[0].length;return`${$.slice(0,J)}
3497
- ${Q[0]}${$.slice(J,Q.index)}${$.slice(G,Y)}${$.slice(Y)}`}function $6($){return jQ(HQ($))}function jQ($){let Z=UQ.exec($);if(!Z)return $;let J=K$($);if(J===null)return $;if(Z.index<=J||$.slice(J,Z.index).trim()==="")return $;let X=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),Y=K$(X);if(Y===null)return $;return`${X.slice(0,Y)}
3498
- ${Z[0]}${X.slice(Y)}`}var Rj="stx-build",Dj="X-STX-Build",R9=null;function Z6(){if(R9===null)R9=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return R9}function Nj($){R9=$}function Aj($,Z=Z6()){let J=H$($,Z);if(J===null)return $;let X=/<head\b[^>]*>/i.exec($),Y=X.index+X[0].length;return`${$.slice(0,Y)}${J}${$.slice(Y)}`}function H$($,Z=Z6()){if($.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test($))return null;return`
3499
- <meta name="stx-build" content="${Z}">`}import{AsyncLocalStorage as BQ}from"async_hooks";var J6=new BQ;function j$($){return $.__stx_server_data??={pending:new Map,values:new Map}}function X6($,Z){return J6.run(j$($),Z)}async function Y6($,Z){let J=J6.getStore();if(!J)throw Error("useServerData must run inside a <script server> render");if(typeof $!=="string"||!$.trim())throw TypeError("useServerData requires a non-empty string key");let X=J.pending.get($);if(X)return X;let Y=Promise.resolve().then(Z).then((Q)=>{let G=JSON.stringify(Q,(q,K)=>{if(K===void 0||typeof K==="function"||typeof K==="symbol"||typeof K==="bigint"||typeof K==="number"&&!Number.isFinite(K))throw TypeError(`useServerData(${JSON.stringify($)}) requires JSON-serializable data`);if(K&&typeof K==="object"&&!Array.isArray(K)&&Object.getPrototypeOf(K)!==Object.prototype&&Object.getPrototypeOf(K)!==null)throw TypeError(`useServerData(${JSON.stringify($)}) requires JSON-serializable data`);return K}),z=JSON.parse(G);return J.values.set($,z),z}).catch((Q)=>{throw J.pending.delete($),Q});return J.pending.set($,Y),Y}function Q6($){let Z=$.__stx_server_data;if(!Z?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(Z.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var q6="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",D9="data-stx-html-attrs",N9="data-stx-html-class",K6=/^[A-Za-z_:][\w:.-]*$/;function Z1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function VQ($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function o1($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function s1($,Z){return Object.entries($).filter(([J])=>!Z?.(J)).map(([J,X])=>`${J}="${Z1(String(X))}"`).join(" ")}function _Q($={},Z="en"){let J=[],X=[],Y="",Q=Z;for(let[z,q]of Object.entries($||{})){if(q==null)continue;let K=z.trim();if(!K6.test(K))continue;let W=K.toLowerCase();if(W==="lang"){Q=String(q);continue}if(W==="class"){Y=String(q).trim();continue}J.push(` ${K}="${Z1(String(q))}"`),X.push(K)}let G=` lang="${Z1(Q)}"`;if(Y)G+=` class="${Z1(Y)}"`;if(G+=J.join(""),Y)G+=` ${N9}="${Z1(Y)}"`;if(X.length)G+=` ${D9}="${Z1(X.join(" "))}"`;return G}function W6($={},Z={}){let J={...$,...Z};if($.class&&Z.class){let X=$.class.split(/\s+/).filter(Boolean);for(let Y of Z.class.split(/\s+/).filter(Boolean))if(!X.includes(Y))X.push(Y);J.class=X.join(" ")}return J}function U6($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let J=$.match(/<html\b([^>]*)>/i);if(!J)return $;let X={},Y=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(J[1]))!==null){let W=G[1];if(!(W in X))Y.push(W);X[W]=G[2]??G[3]??G[4]??""}let z=[],q=[];for(let[W,U]of Object.entries(Z)){if(U==null)continue;let H=W.trim();if(!K6.test(H))continue;let j=H.toLowerCase();if(j==="class"){let B=(X.class||"").split(/\s+/).filter(Boolean);for(let V of String(U).split(/\s+/).filter(Boolean))if(!B.includes(V))B.push(V),z.push(V);if(!("class"in X))Y.push("class");X.class=B.join(" ");continue}if(!(H in X))Y.push(H);if(X[H]=String(U),j!=="lang")q.push(H)}if(z.length){if(!(N9 in X))Y.push(N9);X[N9]=z.join(" ")}if(q.length){if(!(D9 in X))Y.push(D9);X[D9]=q.join(" ")}let K=Y.map((W)=>` ${W}="${Z1(X[W])}"`).join("");return $.replace(J[0],()=>`<html${K}>`)}function Ej($){let Z=_$($);if(Z===null)return $;let J=$.lastIndexOf("</head>");return`${$.slice(0,J)}${Z}${$.slice(J)}`}function _$($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${q6}
3500
- `}function LQ($){let Z=[],J=0;while(J<$.length){let Q=$.slice(J),G=Q.match(/^\s+/);if(G){J+=G[0].length;continue}if(Q.startsWith("<!--")){let U=$.indexOf("-->",J);if(U===-1)break;J=U+3;continue}let z=Q.match(/^<script\b[^>]*>/i);if(z){let U=$.toLowerCase().indexOf("</script>",J+z[0].length);if(U===-1)break;J=U+9;continue}let q=Q.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),J+=q[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K){Z.push(K[0]),J+=K[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W){Z.push(W[0]),J+=W[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",Y=0;while(Y<$.length&&Y<J){let Q=$.slice(Y),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Y+=G[0].length;continue}let z=Q.match(/^<meta\b[^>]*>/i);if(z&&Z.includes(z[0])){Y+=z[0].length;continue}let q=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Y+=q[0].length;continue}X+=$[Y],Y++}return X+=$.slice(J),{body:X,hoisted:Z}}function OQ($,Z={},J={}){let{title:X="stx App",lang:Y="en",meta:Q=[],link:G=[],script:z=[],headRaw:q="",htmlAttrs:K={},bodyClass:W="",bodyAttrs:U={}}=Z,H=J.title||X,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map(o1).filter(Boolean)),F=[...j.filter((I)=>!B.has(o1(I))),...Q].map((I)=>{return` <meta ${s1(I)}>`}).join(`
3501
- `),_=G.map((I)=>{return` <link ${s1(I)}>`}).join(`
3502
- `),O=z.map((I)=>{if(I.src)return` <script ${s1(I,(k)=>k==="content")}></script>`;if(I.content)return` <script>${I.content}</script>`;return""}).filter(Boolean).join(`
3503
- `),L=_Q(K,Y),w=Object.entries(U).map(([I,k])=>` ${I}="${Z1(String(k))}"`).join(""),R=W?` class="${Z1(W)}"`:"",{body:D,hoisted:A}=LQ($),T=[F,J.colorMode?` ${U$(J.colorMode)}`:"",` <title>${J.titleIsHtml?H:VQ(H)}</title>`,` ${q6}`,_,O,q?` ${q}`:"",...(J.styles||[]).map((I)=>` ${I}`),...A.map((I)=>` ${I}`),...(J.headScripts||[]).map((I)=>` ${I}`),J.headStack||""].filter(Boolean),N=[D,...(J.bodyScripts||[]).map((I)=>I),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3500
+ @endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),J=Q.outerStart+q.length}return Z}function UQ($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function HQ($){return $.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 a4($){if(!$Q($))return $;let Z=$;return Z=ZQ(Z),Z=JQ(Z),Z=WQ(Z),Z=QQ(Z),Z=GQ(Z),Z=YQ(Z),Z=XQ(Z),Z=HQ(Z),Z=zQ(Z),Z=qQ(Z),Z=KQ(Z),Z=UQ(Z),Z}function R9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var K$=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"]),jQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function t4($,Z){let J=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),X=J?J[1]:$,Y=e(X,Z);if(Y&&typeof Y==="string")return Y;let Q=X.trim();return K$.has(Q)?Q:null}function e4($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function $6($,Z,J){let X=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=X?`<${$} ${X}>`:`<${$}>`;if(jQ.has($))return X?`<${$} ${X}>`:`<${$}>`;return`${Y}${J}</${$}>`}async function Z6($,Z,J,X,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],q;while((q=G.exec(Q))!==null)z.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let K=z.length-1;K>=0;K--){let W=z[K];try{let U=t4(W.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${R9(e4(W.expr))}" -->`;Q=Q.slice(0,W.index)+O+Q.slice(W.index+W.full.length);continue}if(K$.has(U)){let O=$6(U,W.attrs,W.slotContent);Q=Q.slice(0,W.index)+O+Q.slice(W.index+W.full.length);continue}let H=W.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,V;while((V=B.exec(H))!==null){let O=V[1]||V[2],L=V[3];if(V[1])try{j[O]=e(L,Z)}catch{j[O]=L}else j[O]=L}let F=X.componentsDir||"components",_=await D1(U,j,W.slotContent,F,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length)}catch(U){let H=U instanceof Error?U.message:String(U),j=`<!-- dynamic component error: ${R9(H)} -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}}return Q=await BQ(Q,Z,J,X,Y),Q}async function BQ($,Z,J,X,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],q;while((q=G.exec(Q))!==null)z.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let K=z.length-1;K>=0;K--){let W=z[K];try{let U=t4(W.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${R9(e4(W.expr))}" -->`;Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length);continue}if(K$.has(U)){let B=$6(U,W.attrs,"");Q=Q.slice(0,W.index)+B+Q.slice(W.index+W.full.length);continue}let H=X.componentsDir||"components",j=await D1(U,{},"",H,Z,J,X,new Set,Y??new Set);Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}catch(U){let H=U instanceof Error?U.message:String(U),j=`<!-- dynamic component error: ${R9(H)} -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length)}}return Q}function W$(){return{afterOpen:[],beforeClose:[]}}function VQ($){return $.afterOpen.length>0||$.beforeClose.length>0}function X6($,Z){if(!VQ(Z))return $;let J=Z.afterOpen.join(""),X=Z.beforeClose.join(""),Y=$.lastIndexOf("</head>"),Q=J?A2($):null,G=X&&Y!==-1?Y:null;if(Q===null&&G===null)return $;if(Q!==null&&G!==null)return`${$.slice(0,Q)}${J}${$.slice(Q,G)}${X}${$.slice(G)}`;if(Q!==null)return`${$.slice(0,Q)}${J}${$.slice(Q)}`;return`${$.slice(0,G)}${X}${$.slice(G)}`}var J6=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function A2($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let J=Z.index+Z[0].length;J6.lastIndex=J;let X=J6.exec($);return X?J+X[0].length:J}var H$="data-stx-color-mode-boot",_Q="__STX_COLOR_MODE__",LQ=new Set(["light","dark","auto","system"]),OQ=new Set(["auto","system"]),FQ=/^[a-z][\w:-]*$/i,wQ=/^[\w-]+$/;function RQ($){let Z=$.storageKey??"stx-color-mode",J=$.initialMode??"auto",X=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!LQ.has(J))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(J)}`);if(X!==null&&(typeof X!=="string"||!wQ.test(X)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(X)}`);if(Y!==null&&(typeof Y!=="string"||!FQ.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!OQ.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(X===null&&Y===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:J==="system"?"auto":J,darkClass:X,attribute:Y,autoValue:Q}}function NQ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function j$($={}){let Z=RQ($),X=`(function(){"use strict";var c=${NQ(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.${_Q}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`;return`<script ${H$}>${X}</script>`}function G6($,Z={}){if($.includes(H$))return $;let J=U$($);if(J===null)return $;let X=j$(Z);return`${$.slice(0,J)}
3501
+ ${X}${$.slice(J)}`}var U$=A2,DQ=new RegExp(`<script\\b[^>]*\\b${H$}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),Y6=/<meta\b[^>]*\bcharset\b[^>]*>/gi,Q6=/<\/head>/gi;function AQ($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length;Q6.lastIndex=J;let X=Q6.exec($),Y=X?X.index:$.length;Y6.lastIndex=J;let Q=Y6.exec($);if(!Q||Q.index>=Y)return $;if($.slice(J,Q.index).trim()==="")return $;let G=Q.index+Q[0].length;return`${$.slice(0,J)}
3502
+ ${Q[0]}${$.slice(J,Q.index)}${$.slice(G,Y)}${$.slice(Y)}`}function z6($){return MQ(AQ($))}function MQ($){let Z=DQ.exec($);if(!Z)return $;let J=U$($);if(J===null)return $;if(Z.index<=J||$.slice(J,Z.index).trim()==="")return $;let X=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),Y=U$(X);if(Y===null)return $;return`${X.slice(0,Y)}
3503
+ ${Z[0]}${X.slice(Y)}`}var fj="stx-build",xj="X-STX-Build",N9=null;function q6(){if(N9===null)N9=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return N9}function gj($){N9=$}function hj($,Z=q6()){let J=B$($,Z);if(J===null)return $;let X=/<head\b[^>]*>/i.exec($),Y=X.index+X[0].length;return`${$.slice(0,Y)}${J}${$.slice(Y)}`}function B$($,Z=q6()){if($.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test($))return null;return`
3504
+ <meta name="stx-build" content="${Z}">`}import{AsyncLocalStorage as IQ}from"async_hooks";var K6=new IQ;function V$($){return $.__stx_server_data??={pending:new Map,values:new Map}}function W6($,Z){return K6.run(V$($),Z)}async function U6($,Z){let J=K6.getStore();if(!J)throw Error("useServerData must run inside a <script server> render");if(typeof $!=="string"||!$.trim())throw TypeError("useServerData requires a non-empty string key");let X=J.pending.get($);if(X)return X;let Y=Promise.resolve().then(Z).then((Q)=>{let G=JSON.stringify(Q,(q,K)=>{if(K===void 0||typeof K==="function"||typeof K==="symbol"||typeof K==="bigint"||typeof K==="number"&&!Number.isFinite(K))throw TypeError(`useServerData(${JSON.stringify($)}) requires JSON-serializable data`);if(K&&typeof K==="object"&&!Array.isArray(K)&&Object.getPrototypeOf(K)!==Object.prototype&&Object.getPrototypeOf(K)!==null)throw TypeError(`useServerData(${JSON.stringify($)}) requires JSON-serializable data`);return K}),z=JSON.parse(G);return J.values.set($,z),z}).catch((Q)=>{throw J.pending.delete($),Q});return J.pending.set($,Y),Y}function H6($){let Z=$.__stx_server_data;if(!Z?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(Z.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var V6="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",D9="data-stx-html-attrs",A9="data-stx-html-class",_6=/^[A-Za-z_:][\w:.-]*$/;function Z1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function TQ($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function o1($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function s1($,Z){return Object.entries($).filter(([J])=>!Z?.(J)).map(([J,X])=>`${J}="${Z1(String(X))}"`).join(" ")}function kQ($={},Z="en"){let J=[],X=[],Y="",Q=Z;for(let[z,q]of Object.entries($||{})){if(q==null)continue;let K=z.trim();if(!_6.test(K))continue;let W=K.toLowerCase();if(W==="lang"){Q=String(q);continue}if(W==="class"){Y=String(q).trim();continue}J.push(` ${K}="${Z1(String(q))}"`),X.push(K)}let G=` lang="${Z1(Q)}"`;if(Y)G+=` class="${Z1(Y)}"`;if(G+=J.join(""),Y)G+=` ${A9}="${Z1(Y)}"`;if(X.length)G+=` ${D9}="${Z1(X.join(" "))}"`;return G}function L6($={},Z={}){let J={...$,...Z};if($.class&&Z.class){let X=$.class.split(/\s+/).filter(Boolean);for(let Y of Z.class.split(/\s+/).filter(Boolean))if(!X.includes(Y))X.push(Y);J.class=X.join(" ")}return J}function O6($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let J=$.match(/<html\b([^>]*)>/i);if(!J)return $;let X={},Y=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(J[1]))!==null){let W=G[1];if(!(W in X))Y.push(W);X[W]=G[2]??G[3]??G[4]??""}let z=[],q=[];for(let[W,U]of Object.entries(Z)){if(U==null)continue;let H=W.trim();if(!_6.test(H))continue;let j=H.toLowerCase();if(j==="class"){let B=(X.class||"").split(/\s+/).filter(Boolean);for(let V of String(U).split(/\s+/).filter(Boolean))if(!B.includes(V))B.push(V),z.push(V);if(!("class"in X))Y.push("class");X.class=B.join(" ");continue}if(!(H in X))Y.push(H);if(X[H]=String(U),j!=="lang")q.push(H)}if(z.length){if(!(A9 in X))Y.push(A9);X[A9]=z.join(" ")}if(q.length){if(!(D9 in X))Y.push(D9);X[D9]=q.join(" ")}let K=Y.map((W)=>` ${W}="${Z1(X[W])}"`).join("");return $.replace(J[0],()=>`<html${K}>`)}function cj($){let Z=O$($);if(Z===null)return $;let J=$.lastIndexOf("</head>");return`${$.slice(0,J)}${Z}${$.slice(J)}`}function O$($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${V6}
3505
+ `}function EQ($){let Z=[],J=0;while(J<$.length){let Q=$.slice(J),G=Q.match(/^\s+/);if(G){J+=G[0].length;continue}if(Q.startsWith("<!--")){let U=$.indexOf("-->",J);if(U===-1)break;J=U+3;continue}let z=Q.match(/^<script\b[^>]*>/i);if(z){let U=$.toLowerCase().indexOf("</script>",J+z[0].length);if(U===-1)break;J=U+9;continue}let q=Q.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),J+=q[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K){Z.push(K[0]),J+=K[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W){Z.push(W[0]),J+=W[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",Y=0;while(Y<$.length&&Y<J){let Q=$.slice(Y),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Y+=G[0].length;continue}let z=Q.match(/^<meta\b[^>]*>/i);if(z&&Z.includes(z[0])){Y+=z[0].length;continue}let q=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Y+=q[0].length;continue}X+=$[Y],Y++}return X+=$.slice(J),{body:X,hoisted:Z}}function bQ($,Z={},J={}){let{title:X="stx App",lang:Y="en",meta:Q=[],link:G=[],script:z=[],headRaw:q="",htmlAttrs:K={},bodyClass:W="",bodyAttrs:U={}}=Z,H=J.title||X,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map(o1).filter(Boolean)),F=[...j.filter((M)=>!B.has(o1(M))),...Q].map((M)=>{return` <meta ${s1(M)}>`}).join(`
3506
+ `),_=G.map((M)=>{return` <link ${s1(M)}>`}).join(`
3507
+ `),O=z.map((M)=>{if(M.src)return` <script ${s1(M,(k)=>k==="content")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
3508
+ `),L=kQ(K,Y),w=Object.entries(U).map(([M,k])=>` ${M}="${Z1(String(k))}"`).join(""),R=W?` class="${Z1(W)}"`:"",{body:N,hoisted:A}=EQ($),T=[F,J.colorMode?` ${j$(J.colorMode)}`:"",` <title>${J.titleIsHtml?H:TQ(H)}</title>`,` ${V6}`,_,O,q?` ${q}`:"",...(J.styles||[]).map((M)=>` ${M}`),...A.map((M)=>` ${M}`),...(J.headScripts||[]).map((M)=>` ${M}`),J.headStack||""].filter(Boolean),D=[N,...(J.bodyScripts||[]).map((M)=>M),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3504
3509
  <html${L}>
3505
3510
  <head>
3506
3511
  ${T.join(`
3507
3512
  `)}
3508
3513
  </head>
3509
3514
  <body${R}${w}>
3510
- ${N.join(`
3515
+ ${D.join(`
3511
3516
  `)}
3512
3517
  </body>
3513
- </html>`}var B$=/\s+/y,V$=/<(script|style)\b[^>]*>/iy,FQ=/<\/script>/gi,wQ=/<\/style>/gi,G6=/<!DOCTYPE\b/iy,z6=/<html[\s>]/iy;function L$($){let Z=0;while(Z<$.length){if(B$.lastIndex=Z,B$.exec($)){Z=B$.lastIndex;continue}if($.startsWith("<!--",Z)){let Y=$.indexOf("-->",Z);if(Y===-1)return!1;Z=Y+3;continue}V$.lastIndex=Z;let X=V$.exec($);if(X){let Y=X[1].toLowerCase()==="script"?FQ:wQ;Y.lastIndex=V$.lastIndex;let Q=Y.exec($);if(Q===null)return!1;Z=Q.index+Q[0].length;continue}if(G6.lastIndex=Z,G6.test($))return!0;return z6.lastIndex=Z,z6.test($)}return!1}function O$($){return L$($)}function H6($,Z={}){let J=$.lastIndexOf("</head>");if(J===-1)return $;let{meta:X=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,z=$.slice(0,J),q=[];for(let K of X){let W=o1(K);if(W&&z.includes(W))continue;q.push(` <meta ${s1(K)}>`)}for(let K of Y){if(K.href&&z.includes(`href="${K.href}"`))continue;q.push(` <link ${s1(K)}>`)}for(let K of Q)if(K.src){if(z.includes(`src="${K.src}"`))continue;q.push(` <script ${s1(K,(W)=>W==="content")}></script>`)}else if(K.content){if(z.includes(K.content))continue;q.push(` <script>${K.content}</script>`)}if(G&&!z.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,J)}${q.join(`
3518
+ </html>`}var _$=/\s+/y,L$=/<(script|style)\b[^>]*>/iy,yQ=/<\/script>/gi,CQ=/<\/style>/gi,j6=/<!DOCTYPE\b/iy,B6=/<html[\s>]/iy;function F$($){let Z=0;while(Z<$.length){if(_$.lastIndex=Z,_$.exec($)){Z=_$.lastIndex;continue}if($.startsWith("<!--",Z)){let Y=$.indexOf("-->",Z);if(Y===-1)return!1;Z=Y+3;continue}L$.lastIndex=Z;let X=L$.exec($);if(X){let Y=X[1].toLowerCase()==="script"?yQ:CQ;Y.lastIndex=L$.lastIndex;let Q=Y.exec($);if(Q===null)return!1;Z=Q.index+Q[0].length;continue}if(j6.lastIndex=Z,j6.test($))return!0;return B6.lastIndex=Z,B6.test($)}return!1}function w$($){return F$($)}function F6($,Z={}){let J=$.lastIndexOf("</head>");if(J===-1)return $;let{meta:X=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,z=$.slice(0,J),q=[];for(let K of X){let W=o1(K);if(W&&z.includes(W))continue;q.push(` <meta ${s1(K)}>`)}for(let K of Y){if(K.href&&z.includes(`href="${K.href}"`))continue;q.push(` <link ${s1(K)}>`)}for(let K of Q)if(K.src){if(z.includes(`src="${K.src}"`))continue;q.push(` <script ${s1(K,(W)=>W==="content")}></script>`)}else if(K.content){if(z.includes(K.content))continue;q.push(` <script>${K.content}</script>`)}if(G&&!z.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,J)}${q.join(`
3514
3519
  `)}
3515
- ${$.slice(J)}`}function j6($,Z={},J={},X){if(X??O$($))return $;return OQ($,Z,J)}var RQ=/<\/(script)/gi;function r1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(RQ,"<\\/$1")}var A2=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useObjectUrl","useTimeoutFn"];G2();G2();function V6($,Z={}){return new B6($,Z).routes}function gj($,Z){let J=F$($,Z);return J?J.params:null}var _6=new Map;async function L6($){let Z=$;if(!Z)try{Z=(await V5())?.pagesDir||"pages"}catch{Z="pages"}let J=Z,X=_6.get(J);if(X)return X;let Y=[];try{Y=V6(".",{pagesDir:J}).map((Q)=>Q.regex.source).filter(Boolean)}catch{Y=[]}return _6.set(J,Y),Y}function DQ($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function O6($){return DQ(JSON.stringify($))}function F6($){return $.includes("data-stx-runtime")}function w6($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let J=Z.exec($);J!==null;J=Z.exec($)){let X=$.slice(Math.max(0,J.index-80),J.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(X))continue;return!0}return!1}function w$($,Z){let J=$.indexOf("<script"),X=$.search(/<!doctype\b/i);if(J!==-1&&(X===-1||J>X))return $.slice(0,J)+Z+`
3516
- `+$.slice(J);let Y=N2($);if(Y!==null)return`${$.slice(0,Y)}
3520
+ ${$.slice(J)}`}function w6($,Z={},J={},X){if(X??w$($))return $;return bQ($,Z,J)}var SQ=/<\/(script)/gi;function r1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(SQ,"<\\/$1")}var M2=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useObjectUrl","useTimeoutFn"];z2();z2();function N6($,Z={}){return new R6($,Z).routes}function ej($,Z){let J=R$($,Z);return J?J.params:null}var D6=new Map;async function A6($){let Z=$;if(!Z)try{Z=(await L5())?.pagesDir||"pages"}catch{Z="pages"}let J=Z,X=D6.get(J);if(X)return X;let Y=[];try{Y=N6(".",{pagesDir:J}).map((Q)=>Q.regex.source).filter(Boolean)}catch{Y=[]}return D6.set(J,Y),Y}function PQ($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function M6($){return PQ(JSON.stringify($))}function I6($){return $.includes("data-stx-runtime")}function T6($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let J=Z.exec($);J!==null;J=Z.exec($)){let X=$.slice(Math.max(0,J.index-80),J.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(X))continue;return!0}return!1}function N$($,Z){let J=$.indexOf("<script"),X=$.search(/<!doctype\b/i);if(J!==-1&&(X===-1||J>X))return $.slice(0,J)+Z+`
3521
+ `+$.slice(J);let Y=A2($);if(Y!==null)return`${$.slice(0,Y)}
3517
3522
  ${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3518
3523
  `+$.slice(G)}if(s0($))return y1($,(G)=>`${G}
3519
3524
  ${Z}`);return`${Z}
3520
- ${$}`}async function A9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-r808fpme.js"),{url:Q}=await Y("runtime",Z.debug===!0);return w$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return w$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-r808fpme.js"),X=await J(Z.debug);return w$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function NQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function R6($){if($.includes("data-stx-tooltip-runtime")||!NQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${s5()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
3525
+ ${$}`}async function M9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let{getServeClientAsset:Y}=await import("./chunk-f7e286pa.js"),{url:Q}=await Y("runtime",Z.debug===!0);return N$($,`<script data-stx-runtime src="${Q}"></script>`)}if(Z.buildMode==="compile")return N$($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:J}=await import("./chunk-f7e286pa.js"),X=await J(Z.debug);return N$($,`<script data-stx-scoped data-stx-runtime>${X}</script>`)}function vQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function k6($){if($.includes("data-stx-tooltip-runtime")||!vQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${r5()}</script>`,J=$.lastIndexOf("</body>");if(J===-1)return`${$}
3521
3526
  ${Z}`;return`${$.slice(0,J)}${Z}
3522
- ${$.slice(J)}`}var AQ=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function MQ($){return AQ.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function IQ($,Z){if(!$.includes("</body>"))return $;if(MQ($))return $;let J=Z?.router,X="";{let q={};if(J){if(J.container)q.container=J.container;if(J.interceptAllLinks!==void 0)q.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)q.progress=J.progress;if(J.viewTransitions!==void 0)q.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)q.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)q.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)q.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)q.prefetch=J.prefetch;if(J.cache!==void 0)q.cache=J.cache;if(J.progressColor!==void 0)q.progressColor=J.progressColor;if(J.progressHeight!==void 0)q.progressHeight=J.progressHeight}try{let K=await L6(Z?.pagesDir);if(K.length>0)q.ownedRoutes=K}catch{}if(Object.keys(q).length>0)X=`<script>window.__stxRouterConfig=${O6(q)};</script>
3523
- `}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-r808fpme.js"),G=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?`<script data-stx-router src="${(await Q("router")).url}"></script>`:`<script data-stx-router>${await Y()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
3524
- </body>`+$.slice(z+7)}var D6=Symbol.for("stx.lazy-module-promises");function TQ(){let $=globalThis;return $[D6]??=new Map,$[D6]}function o($,Z){let J=TQ(),X=`${import.meta.url}\x00${$}`,Y=J.get(X);if(Y)return Y;let Q=Z();return J.set(X,Q),Q.catch(()=>{if(J.get(X)===Q)J.delete(X)}),Q}var R$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,y6=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,kQ=65536,EQ=4,I9=new Map;function WB(){I9.clear()}function bQ($){let Z=[];for(let J of M2($,X2)){let X=J.token.match(/^<script\b([^>]*)>/i),Y=J.token.match(/<\/script\s*>$/i);if(!X||!Y)continue;let Q=X[0].length,G=J.token.length-Y[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Q,G),start:J.start,end:J.end}))}return Z}function yQ($,Z={}){let J=$.length>=kQ,X=J?I9.get($):void 0;if(X===void 0){if(X=bQ($),J)b6(I9,EQ),I9.set($,X)}let Y=Z.skipAttrs;if(!Y)return X.slice();let Q=[];for(let G of X)if(Y.lastIndex=0,!Y.test(G.attrs))Q.push(G);return Q}function C6($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:z}=N6(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:z}=N6(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function N6($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function A$($,Z){return E6($,Z)}function CQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Y=X[1];if(Y.startsWith("if"))J++;else if(Y==="endif")J--;else if(J===0)return!0}return!1}function SQ($){let Z=new Set,J=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function PQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${R$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=M2($,(Q,G)=>{Z.lastIndex=G;let z=Z.exec(Q);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of X){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let z=G[2].match(J),q=C6(z?.[1]??z?.[2]??""),K=[q.itemVar,q.indexVar].filter(Boolean);if(K.length===0)continue;let W=G[1],H=/\/\s*>$/.test(Q.token)||T9.has(W.toLowerCase())?Q.end:P6($,Q.start,W,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(K)})}return Y}var A6=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 vQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function M6($,Z,J,X){if(!$)return!1;let Y=vQ($),Q=!1,G=!1,z=!1,q=/([a-zA-Z_$][\w$]*)/g,K;while((K=q.exec(Y))!==null){let j=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(A6.has(j))continue;if(Z.has(j)||X?.has(j))Q=!0;else if(J&&j in J)G=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(Y))!==null){let j=U[1];if(Y.slice(0,U.index).trimEnd().endsWith("."))continue;if(A6.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function M9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(y6);if(Q&&fQ(Q[3],Q[1])){let[,G,z,q]=Q;return`<${G}${z}${X}>${q}</${G}>`}return`<template${X}>${Y}</template>`}function fQ($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Y;while((Y=J.exec($))!==null)if(Y[1]){if(X--,X<0)return!1}else X++;return!0}function S6($,Z){let J=SQ($);function X(Y){let Q=Y,G=PQ(Y),z=(U)=>{let H=new Set;for(let j of G)if(U>j.start&&U<j.end)for(let B of j.vars)H.add(B);return H},q=/@if\s*\(/g,K,W=[];while((K=q.exec(Q))!==null){let U=K.index,H=U+K[0].length,j=1,B=H;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let V=Q.substring(H,B-1).trim(),F=B,_=1,O=F,L=/@(if\s*\(|endif)/g;L.lastIndex=F;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))_++;else if(w[1]==="endif"){if(_--,_===0){O=w.index+w[0].length;break}}if(_!==0)continue;let R=Q.substring(F,O-6).trim(),D;if(CQ(R)){let A=H2(Q.substring(U,O));if(A.length===0)continue;let T=A[0].branches.filter((M)=>M.type!=="else"),N=z(U);if(!(T.length>0&&T.every((M)=>M6(M.condition,J,Z,N))))continue;D=A[0].branches.map((M)=>{let y=X(M.content);if(M.type==="elseif")return M9(y,"@else-if",M.condition??"");if(M.type==="else")return M9(y,"@else");return M9(y,"@if",M.condition??"")}).join(`
3525
- `)}else{if(!M6(V,J,Z,z(U)))continue;D=M9(X(R),"@if",V)}W.push({start:U,end:O,replacement:D}),q.lastIndex=O}for(let U=W.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=W[U];Q=Q.substring(0,H)+B+Q.substring(j)}return Q}return X($)}function xQ($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var T9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),I6=/<(script|style)\b/iy,gQ=/<\/script/gi,hQ=/<\/style/gi;function P6($,Z,J,X){if(T9.has(J.toLowerCase()))return X;let Y=J.toLowerCase(),Q=$.length,G=1,z=X;while(z<Q){let q=$.indexOf("<",z);if(q===-1)return-1;if(z=q,$.startsWith("<!--",z)){let H=$.indexOf("-->",z+4);if(H===-1)return-1;z=H+3;continue}I6.lastIndex=z;let K=I6.exec($);if(K){let H=$.indexOf(">",z);if(H===-1)return-1;if($[H-1]==="/"){z=H+1;continue}let j=K[1].toLowerCase()==="script"?gQ:hQ;j.lastIndex=z;let B=j.exec($);if(B===null)return-1;let V=$.indexOf(">",B.index);if(V===-1)return-1;z=V+1;continue}if($[z+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(z,z+64));if(!H){z++;continue}if(H[1].toLowerCase()===Y){if(G--,z+=H[0].length,G===0)return z;continue}z+=H[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!W){z++;continue}let U=$.indexOf(">",z);if(U===-1)return-1;if(W[1].toLowerCase()===Y){let H=$.slice(z,U+1);if(!(/\/\s*>$/.test(H)||T9.has(Y)))G++}z=U+1}return-1}var uQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function dQ($,Z){let J=Z,X=$.length;for(;;){while(J<X&&$[J]!=="<")J++;if(J>=X)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let Y=$.indexOf(">",J);if(Y===-1)return!1;let Q=$.slice(J,Y+1);return uQ.test(Q)}function v6($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=J.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Y=(U)=>Z.some(([H,j])=>U>=H&&U<j),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],z;while((z=Q.exec($))!==null){if(Y(z.index))continue;let[U,H,j,B,V,F,_]=z,O=xQ(V);if(O===void 0)continue;let L=z.index,w=L+U.length,A=!!_||/\/\s*>$/.test(U)||T9.has(H.toLowerCase())?w:P6($,L,H,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&dQ($,A)){Q.lastIndex=w;continue}if(O===!0){let N=`<${H}${j}${F}${_}>`;G.push({start:L,end:w,replacement:N});continue}G.push({start:L,end:A,replacement:""}),Q.lastIndex=A}if(G.length===0)return $;G.sort((U,H)=>U.start-H.start);let q=[],K=-1;for(let U of G){if(U.start<K)continue;q.push(U),K=U.end}let W=$;for(let U=q.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=q[U];W=W.substring(0,H)+B+W.substring(j)}return W}function M$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=X.exec(J))!==null){let z=Y[1],q=Y.index,K=q+Y[0].length,W=1,U=K;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")")W--;U++}if(W!==0)continue;let H=J.substring(K,U-1).trim(),j=U,B=C6(H),V=z==="for"?"@endfor":"@endforeach",F=1,_=j,O=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");O.lastIndex=j;let L;while((L=O.exec(J))!==null)if(L[1].startsWith(z))F++;else if(F--,F===0){_=L.index+L[0].length;break}if(F!==0)continue;let w=()=>{let I=[B.itemVar,B.indexVar].filter(Boolean);if(I.length)G.push({start:q,end:_,vars:I})};if(B.iterable){let I=B.iterable.trim();if(I.startsWith("[")||I.startsWith("{")||I.startsWith("'")||I.startsWith('"')||I.startsWith("`")||/^-?\d/.test(I)){w();continue}let k=I.split(/[.[(]/)[0].trim(),M=Z?k in Z:!1,y=G.some((E)=>q>E.start&&q<E.end&&E.vars.includes(k));if(k&&(M||y)){w();continue}}if(B.style==="as")H=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=J.substring(j,_-V.length).trim(),D=Z?{...Z}:{};if(B.itemVar)delete D[B.itemVar];if(B.indexVar)delete D[B.indexVar];let A=M$(R,D),T=A.match(y6),N;if(T){let[,I,k,M]=T;N=`<${I}${k} @for="${H}">${M}</${I}>`}else N=`<template @for="${H}">${A}</template>`;Q.push({start:q,end:_,replacement:N}),X.lastIndex=_}for(let z=Q.length-1;z>=0;z--){let{start:q,end:K,replacement:W}=Q[z];J=J.substring(0,q)+W+J.substring(K)}return J}function mQ($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(W)=>{let U=X+1;while(U<Q){let H=$[U];if(H==="\\"){U+=2;continue}if(H===W)return U+1;U++}return Q},z=()=>{let W=X+2;while(W<Q&&$[W]!==`
3527
+ ${$.slice(J)}`}var fQ=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function xQ($){return fQ.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function gQ($,Z){if(!$.includes("</body>"))return $;if(xQ($))return $;let J=Z?.router,X="";{let q={};if(J){if(J.container)q.container=J.container;if(J.interceptAllLinks!==void 0)q.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)q.progress=J.progress;if(J.viewTransitions!==void 0)q.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)q.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)q.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)q.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)q.prefetch=J.prefetch;if(J.cache!==void 0)q.cache=J.cache;if(J.progressColor!==void 0)q.progressColor=J.progressColor;if(J.progressHeight!==void 0)q.progressHeight=J.progressHeight}try{let K=await A6(Z?.pagesDir);if(K.length>0)q.ownedRoutes=K}catch{}if(Object.keys(q).length>0)X=`<script>window.__stxRouterConfig=${M6(q)};</script>
3528
+ `}let{getCachedRouterScript:Y,getServeClientAsset:Q}=await import("./chunk-f7e286pa.js"),G=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?`<script data-stx-router src="${(await Q("router")).url}"></script>`:`<script data-stx-router>${await Y()}</script>`,z=$.lastIndexOf("</body>");return $.slice(0,z)+X+G+`
3529
+ </body>`+$.slice(z+7)}var E6=Symbol.for("stx.lazy-module-promises");function hQ(){let $=globalThis;return $[E6]??=new Map,$[E6]}function o($,Z){let J=hQ(),X=`${import.meta.url}\x00${$}`,Y=J.get(X);if(Y)return Y;let Q=Z();return J.set(X,Q),Q.catch(()=>{if(J.get(X)===Q)J.delete(X)}),Q}var D$=`(?:"[^"]*"|'[^']*'|[^>"'])*`,g6=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,uQ=65536,dQ=4,T9=new Map;function MB(){T9.clear()}function mQ($){let Z=[];for(let J of I2($,Y2)){let X=J.token.match(/^<script\b([^>]*)>/i),Y=J.token.match(/<\/script\s*>$/i);if(!X||!Y)continue;let Q=X[0].length,G=J.token.length-Y[0].length;Z.push(Object.freeze({fullMatch:J.token,attrs:X[1],body:J.token.slice(Q,G),start:J.start,end:J.end}))}return Z}function lQ($,Z={}){let J=$.length>=uQ,X=J?T9.get($):void 0;if(X===void 0){if(X=mQ($),J)x6(T9,dQ),T9.set($,X)}let Y=Z.skipAttrs;if(!Y)return X.slice();let Q=[];for(let G of X)if(Y.lastIndex=0,!Y.test(G.attrs))Q.push(G);return Q}function h6($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:z}=b6(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:z}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:z}=b6(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function b6($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function I$($,Z){return f6($,Z)}function cQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,X;while((X=Z.exec($))!==null){let Y=X[1];if(Y.startsWith("if"))J++;else if(Y==="endif")J--;else if(J===0)return!0}return!1}function pQ($){let Z=new Set,J=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function iQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${D$})>`,"iy"),J=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,X=I2($,(Q,G)=>{Z.lastIndex=G;let z=Z.exec(Q);if(!z||z.index!==G||!J.test(z[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of X){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let z=G[2].match(J),q=h6(z?.[1]??z?.[2]??""),K=[q.itemVar,q.indexVar].filter(Boolean);if(K.length===0)continue;let W=G[1],H=/\/\s*>$/.test(Q.token)||k9.has(W.toLowerCase())?Q.end:d6($,Q.start,W,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(K)})}return Y}var y6=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 nQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function C6($,Z,J,X){if(!$)return!1;let Y=nQ($),Q=!1,G=!1,z=!1,q=/([a-zA-Z_$][\w$]*)/g,K;while((K=q.exec(Y))!==null){let j=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(y6.has(j))continue;if(Z.has(j)||X?.has(j))Q=!0;else if(J&&j in J)G=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(Y))!==null){let j=U[1];if(Y.slice(0,U.index).trimEnd().endsWith("."))continue;if(y6.has(j)||J&&j in J)continue;z=!0}return(Q||z)&&!G}function I9($,Z,J){let X=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(g6);if(Q&&sQ(Q[3],Q[1])){let[,G,z,q]=Q;return`<${G}${z}${X}>${q}</${G}>`}return`<template${X}>${Y}</template>`}function sQ($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Y;while((Y=J.exec($))!==null)if(Y[1]){if(X--,X<0)return!1}else X++;return!0}function u6($,Z){let J=pQ($);function X(Y){let Q=Y,G=iQ(Y),z=(U)=>{let H=new Set;for(let j of G)if(U>j.start&&U<j.end)for(let B of j.vars)H.add(B);return H},q=/@if\s*\(/g,K,W=[];while((K=q.exec(Q))!==null){let U=K.index,H=U+K[0].length,j=1,B=H;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let V=Q.substring(H,B-1).trim(),F=B,_=1,O=F,L=/@(if\s*\(|endif)/g;L.lastIndex=F;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))_++;else if(w[1]==="endif"){if(_--,_===0){O=w.index+w[0].length;break}}if(_!==0)continue;let R=Q.substring(F,O-6).trim(),N;if(cQ(R)){let A=j2(Q.substring(U,O));if(A.length===0)continue;let T=A[0].branches.filter((I)=>I.type!=="else"),D=z(U);if(!(T.length>0&&T.every((I)=>C6(I.condition,J,Z,D))))continue;N=A[0].branches.map((I)=>{let y=X(I.content);if(I.type==="elseif")return I9(y,"@else-if",I.condition??"");if(I.type==="else")return I9(y,"@else");return I9(y,"@if",I.condition??"")}).join(`
3530
+ `)}else{if(!C6(V,J,Z,z(U)))continue;N=I9(X(R),"@if",V)}W.push({start:U,end:O,replacement:N}),q.lastIndex=O}for(let U=W.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=W[U];Q=Q.substring(0,H)+B+Q.substring(j)}return Q}return X($)}function oQ($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}var k9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),S6=/<(script|style)\b/iy,rQ=/<\/script/gi,aQ=/<\/style/gi;function d6($,Z,J,X){if(k9.has(J.toLowerCase()))return X;let Y=J.toLowerCase(),Q=$.length,G=1,z=X;while(z<Q){let q=$.indexOf("<",z);if(q===-1)return-1;if(z=q,$.startsWith("<!--",z)){let H=$.indexOf("-->",z+4);if(H===-1)return-1;z=H+3;continue}S6.lastIndex=z;let K=S6.exec($);if(K){let H=$.indexOf(">",z);if(H===-1)return-1;if($[H-1]==="/"){z=H+1;continue}let j=K[1].toLowerCase()==="script"?rQ:aQ;j.lastIndex=z;let B=j.exec($);if(B===null)return-1;let V=$.indexOf(">",B.index);if(V===-1)return-1;z=V+1;continue}if($[z+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(z,z+64));if(!H){z++;continue}if(H[1].toLowerCase()===Y){if(G--,z+=H[0].length,G===0)return z;continue}z+=H[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(z,z+64));if(!W){z++;continue}let U=$.indexOf(">",z);if(U===-1)return-1;if(W[1].toLowerCase()===Y){let H=$.slice(z,U+1);if(!(/\/\s*>$/.test(H)||k9.has(Y)))G++}z=U+1}return-1}var tQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function eQ($,Z){let J=Z,X=$.length;for(;;){while(J<X&&$[J]!=="<")J++;if(J>=X)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let Y=$.indexOf(">",J);if(Y===-1)return!1;let Q=$.slice(J,Y+1);return tQ.test(Q)}function m6($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=J.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Y=(U)=>Z.some(([H,j])=>U>=H&&U<j),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],z;while((z=Q.exec($))!==null){if(Y(z.index))continue;let[U,H,j,B,V,F,_]=z,O=oQ(V);if(O===void 0)continue;let L=z.index,w=L+U.length,A=!!_||/\/\s*>$/.test(U)||k9.has(H.toLowerCase())?w:d6($,L,H,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&eQ($,A)){Q.lastIndex=w;continue}if(O===!0){let D=`<${H}${j}${F}${_}>`;G.push({start:L,end:w,replacement:D});continue}G.push({start:L,end:A,replacement:""}),Q.lastIndex=A}if(G.length===0)return $;G.sort((U,H)=>U.start-H.start);let q=[],K=-1;for(let U of G){if(U.start<K)continue;q.push(U),K=U.end}let W=$;for(let U=q.length-1;U>=0;U--){let{start:H,end:j,replacement:B}=q[U];W=W.substring(0,H)+B+W.substring(j)}return W}function T$($,Z){let J=$,X=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=X.exec(J))!==null){let z=Y[1],q=Y.index,K=q+Y[0].length,W=1,U=K;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")")W--;U++}if(W!==0)continue;let H=J.substring(K,U-1).trim(),j=U,B=h6(H),V=z==="for"?"@endfor":"@endforeach",F=1,_=j,O=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");O.lastIndex=j;let L;while((L=O.exec(J))!==null)if(L[1].startsWith(z))F++;else if(F--,F===0){_=L.index+L[0].length;break}if(F!==0)continue;let w=()=>{let M=[B.itemVar,B.indexVar].filter(Boolean);if(M.length)G.push({start:q,end:_,vars:M})};if(B.iterable){let M=B.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){w();continue}let k=M.split(/[.[(]/)[0].trim(),I=Z?k in Z:!1,y=G.some((E)=>q>E.start&&q<E.end&&E.vars.includes(k));if(k&&(I||y)){w();continue}}if(B.style==="as")H=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=J.substring(j,_-V.length).trim(),N=Z?{...Z}:{};if(B.itemVar)delete N[B.itemVar];if(B.indexVar)delete N[B.indexVar];let A=T$(R,N),T=A.match(g6),D;if(T){let[,M,k,I]=T;D=`<${M}${k} @for="${H}">${I}</${M}>`}else D=`<template @for="${H}">${A}</template>`;Q.push({start:q,end:_,replacement:D}),X.lastIndex=_}for(let z=Q.length-1;z>=0;z--){let{start:q,end:K,replacement:W}=Q[z];J=J.substring(0,q)+W+J.substring(K)}return J}function $G($){let Z=new Set,J=[],X=0,Y=0,Q=$.length,G=(W)=>{let U=X+1;while(U<Q){let H=$[U];if(H==="\\"){U+=2;continue}if(H===W)return U+1;U++}return Q},z=()=>{let W=X+2;while(W<Q&&$[W]!==`
3526
3531
  `)W++;return W},q=()=>{let W=X+2;while(W<Q-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return Q},K=(W)=>{let U=W,H=0;while(U<Q){let j=$[U];if(j==="/"&&$[U+1]==="/"){let B=U+2;while(B<Q&&$[B]!==`
3527
- `)B++;U=B;continue}if(j==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}U=B;continue}if(j==="("||j==="["||j==="{"){H++,U++;continue}if(j===")"||j==="]"||j==="}"){H--,U++;continue}if(j===";"&&H===0)return U+1;U++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let U=z();J.push($.slice(X,U)),X=U;continue}if(W==="/"&&$[X+1]==="*"){let U=q();J.push($.slice(X,U)),X=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);J.push($.slice(X,U)),X=U;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=K(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(W),X++}return J.join("")}var lQ=new Set(["script","style","html","head","meta","link","title","!doctype"]);function D$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function cQ($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!D$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function pQ($,Z){if(cQ($,"<body",Z)){let Y=new RegExp(`<body(${R$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!D$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${R$})>`,"gi"),X;while((X=J.exec($))!==null){if(D$(X.index,X.index+X[0].length,Z))continue;if(lQ.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function iQ($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,q=(K)=>{if(J!==null&&!z&&J>=G&&J<=K)Y.push($.slice(G,J),Q,$.slice(J,K)),z=!0;else Y.push($.slice(G,K))};for(let K of Z){if(K.start<G)continue;q(K.start),G=K.end}return q($.length),Y.join("")}async function nQ($,Z,J){let X=yQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|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*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await o("stx/client-script-bundler",()=>import("./chunk-sen2cxqm.js"));for(let O of X){let L=O.body;if(A1(O.attrs))L=M1(L);if(Y.test(L)){Q.push({content:L,start:O.start,end:O.end});continue}if(!G(L))continue;try{let w=await z(a1(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:O.start,end:O.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let q=`${Z??""}\x00${Q.map((O)=>O.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(q).toString(36).slice(0,10)}`,W=[];for(let O=0;O<Q.length;O++){let L=Q[O].bundled??a1(Q[O].content).code;if(!Q[O].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=aQ(L);let w=$1(L);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
3532
+ `)B++;U=B;continue}if(j==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}U=B;continue}if(j==="("||j==="["||j==="{"){H++,U++;continue}if(j===")"||j==="]"||j==="}"){H--,U++;continue}if(j===";"&&H===0)return U+1;U++}return Q};while(X<Q){let W=$[X];if(W==="/"&&$[X+1]==="/"){let U=z();J.push($.slice(X,U)),X=U;continue}if(W==="/"&&$[X+1]==="*"){let U=q();J.push($.slice(X,U)),X=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);J.push($.slice(X,U)),X=U;continue}if(W==="{"){Y++,J.push(W),X++;continue}if(W==="}"){Y--,J.push(W),X++;continue}if(Y===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],V=K(X+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),X=V;continue}Z.add(B),J.push($.slice(X,V)),X=V;continue}}}J.push(W),X++}return J.join("")}var ZG=new Set(["script","style","html","head","meta","link","title","!doctype"]);function A$($,Z,J){for(let X of J){if(X.start>=Z)return!1;if(X.end>$)return!0}return!1}function JG($,Z,J){let X=0;while(X<$.length){let Y=$.indexOf(Z,X);if(Y===-1)return!1;if(!A$(Y,Y+Z.length,J))return!0;X=Y+Z.length}return!1}function XG($,Z){if(JG($,"<body",Z)){let Y=new RegExp(`<body(${D$})>`,"g"),Q;while((Q=Y.exec($))!==null)if(!A$(Q.index,Q.index+Q[0].length,Z))return Q.index+Q[0].length-1;return null}let J=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${D$})>`,"gi"),X;while((X=J.exec($))!==null){if(A$(X.index,X.index+X[0].length,Z))continue;if(ZG.has(X[1].toLowerCase()))continue;return X.index+X[0].length-1}return null}function YG($,Z,J,X){let Y=[],Q=` data-stx="${X}"`,G=0,z=!1,q=(K)=>{if(J!==null&&!z&&J>=G&&J<=K)Y.push($.slice(G,J),Q,$.slice(J,K)),z=!0;else Y.push($.slice(G,K))};for(let K of Z){if(K.start<G)continue;q(K.start),G=K.end}return q($.length),Y.join("")}async function QG($,Z,J){let X=lQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|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*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await o("stx/client-script-bundler",()=>import("./chunk-4z3yyryn.js"));for(let O of X){let L=O.body;if(A1(O.attrs))L=M1(L);if(Y.test(L)){Q.push({content:L,start:O.start,end:O.end});continue}if(!G(L))continue;try{let w=await z(a1(L).code,Z||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(Y.test(w))Q.push({content:L,start:O.start,end:O.end})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let q=`${Z??""}\x00${Q.map((O)=>O.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(q).toString(36).slice(0,10)}`,W=[];for(let O=0;O<Q.length;O++){let L=Q[O].bundled??a1(Q[O].content).code;if(!Q[O].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=KG(L);let w=$1(L);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
3528
3533
  ${w}`)}let U=W.join(`
3529
3534
 
3530
- `);U=mQ(U);let H=sQ(U),j=H.split(",").map((O)=>O.trim()).filter(Boolean),B=N$(U,J),V=`
3535
+ `);U=$G(U);let H=GG(U),j=H.split(",").map((O)=>O.trim()).filter(Boolean),B=M$(U,J),V=`
3531
3536
  <script data-stx-scoped>
3532
3537
  function ${K}() {
3533
3538
  ${p1("const",j)}
@@ -3536,95 +3541,95 @@ ${r1(`${B}${U}`)}
3536
3541
  }
3537
3542
  window.__stx_latestSetup=${K};
3538
3543
  if(window.stx)window.stx._latestSetup=${K};
3539
- </script>`,F=pQ($,Q);return{output:iQ($,Q,F,K),setupCode:V}}function sQ($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z="",q=()=>{Q++;let B=!1;while(Q<G){let V=Z[Q];if(V==="\\"){Q+=2;continue}if(V==="["&&!B){B=!0,Q++;continue}if(V==="]"&&B){B=!1,Q++;continue}if(V==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(V===`
3544
+ </script>`,F=XG($,Q);return{output:YG($,Q,F,K),setupCode:V}}function GG($){let Z=$,J=[],X=new Set,Y=0,Q=0,G=Z.length,z="",q=()=>{Q++;let B=!1;while(Q<G){let V=Z[Q];if(V==="\\"){Q+=2;continue}if(V==="["&&!B){B=!0,Q++;continue}if(V==="]"&&B){B=!1,Q++;continue}if(V==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(V===`
3540
3545
  `)return;Q++}},K=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},W=(B)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===B){Q++;return}Q++}},U=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let B=1;while(Q<G&&B>0)if(Z[Q]==="{")B++,Q++;else if(Z[Q]==="}")B--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')W(Z[Q]);else if(Z[Q]==="`")U();else Q++;continue}Q++}},H=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3541
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},j=()=>{if(Y!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let L=B[2];if(!X.has(L))J.push(L),X.add(L);return}let V=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(V){V[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let R=w.indexOf(":"),A=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(A&&!X.has(A))J.push(A),X.add(A)});return}let F=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(F){F[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!X.has(R))J.push(R),X.add(R)});return}let _=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let L=_[1];if(!X.has(L))J.push(L),X.add(L);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!X.has(L))J.push(L),X.add(L)}};while(Q<G){if(H())continue;if(Z[Q]==="'"||Z[Q]==='"'){W(Z[Q]),z=Z[Q-1];continue}if(Z[Q]==="`"){U(),z="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&K()){q(),z="/";continue}if(Z[Q]==="{"){Y++,z="{",Q++;continue}if(Z[Q]==="}"){Y--,z="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))j();if(!/\s/.test(Z[Q]))z=Z[Q];Q++}return J.join(", ")}async function f6($,Z,J,X){if(!A$($,J))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await nQ(Y,J,X);if(Y=Q,!G){let z=s0(Y);if(z&&!/data-stx/.test(z.attrs)&&!/data-stx-auto/.test(z.attrs)){let q=z.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");Y=Y.slice(0,z.index)+q+Y.slice(z.index+z.tag.length)}}if(Y=await A9(Y,Z),G){let z=T6(Y,/<\/head>/i),q=z===-1?T6(Y,/<body[^>]*>/i):-1;if(z!==-1)Y=`${Y.slice(0,z)}${G}
3546
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},j=()=>{if(Y!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let L=B[2];if(!X.has(L))J.push(L),X.add(L);return}let V=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(V){V[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let R=w.indexOf(":"),A=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(A&&!X.has(A))J.push(A),X.add(A)});return}let F=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(F){F[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!X.has(R))J.push(R),X.add(R)});return}let _=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let L=_[1];if(!X.has(L))J.push(L),X.add(L);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!X.has(L))J.push(L),X.add(L)}};while(Q<G){if(H())continue;if(Z[Q]==="'"||Z[Q]==='"'){W(Z[Q]),z=Z[Q-1];continue}if(Z[Q]==="`"){U(),z="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&K()){q(),z="/";continue}if(Z[Q]==="{"){Y++,z="{",Q++;continue}if(Z[Q]==="}"){Y--,z="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))j();if(!/\s/.test(Z[Q]))z=Z[Q];Q++}return J.join(", ")}async function l6($,Z,J,X){if(!I$($,J))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await QG(Y,J,X);if(Y=Q,!G){let z=s0(Y);if(z&&!/data-stx/.test(z.attrs)&&!/data-stx-auto/.test(z.attrs)){let q=z.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");Y=Y.slice(0,z.index)+q+Y.slice(z.index+z.tag.length)}}if(Y=await M9(Y,Z),G){let z=P6(Y,/<\/head>/i),q=z===-1?P6(Y,/<body[^>]*>/i):-1;if(z!==-1)Y=`${Y.slice(0,z)}${G}
3542
3547
  ${Y.slice(z)}`;else if(q!==-1){let K=/<body[^>]*>/i.exec(Y.slice(q))[0],W=q+K.length;Y=`${Y.slice(0,W)}
3543
3548
  ${G}${Y.slice(W)}`}else Y=`${Y}
3544
- ${G}`}return Y}function T6($,Z){let J=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Y;while((Y=J.exec($))!==null)X.push([Y.index,Y.index+Y[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let z=Q.exec($.slice(G));if(!z)return-1;let q=G+z.index;if(!X.some(([W,U])=>q>=W&&q<U))return q;G=q+Math.max(z[0].length,1)}return-1}var k6="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function oQ($){let Z=[];for(let J of $.split(",")){let X=J.trim();if(!X||X.startsWith("type "))continue;let Y=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])Z.push(`${Y[2]} = ${Y[1]}`)}if(Z.length===0)return k6;return`var ${Z.join(", ")}; ${k6}`}var rQ=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function aQ($){return $.replace(rQ,(Z,J)=>oQ(J))}import e1 from"path";import x6 from"process";function t1($="STX_PUBLIC_"){let Z={},J={};for(let[X,Y]of Object.entries(x6.env)){if(!X.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Y),J[X]=Y}return Z["import.meta.env"]=JSON.stringify(J),Z}function jB($="STX_PUBLIC_"){let Z={};for(let[J,X]of Object.entries(x6.env))if(J.startsWith($)&&X!==void 0)Z[J]=X;return Z}function g6($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function h6($,Z,J){try{let X;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=e1.join(Y,$);if(await Bun.file(G).exists())return G;Y=e1.dirname(Y)}X=e1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=e1.resolve(Z,$);else X=e1.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}var u6=Symbol.for("stx.inline-assets.import-meta");function tQ($,Z){if(!$.includes("import.meta"))return;let J=Error(`[stx] ${Z} 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.
3545
- `+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw J[u6]=!0,J}async function d6($,Z,J){let X=$,Y=e1.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[K,W,U,H]=G;if(g6(U))continue;let j=await h6(U,Y,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),U.endsWith(".ts")||U.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!0,define:t1()});if(F.outputs.length>0)B=await F.outputs[0].text(),tQ(B,U)}let V=`<script>
3549
+ ${G}`}return Y}function P6($,Z){let J=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Y;while((Y=J.exec($))!==null)X.push([Y.index,Y.index+Y[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let z=Q.exec($.slice(G));if(!z)return-1;let q=G+z.index;if(!X.some(([W,U])=>q>=W&&q<U))return q;G=q+Math.max(z[0].length,1)}return-1}var v6="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function zG($){let Z=[];for(let J of $.split(",")){let X=J.trim();if(!X||X.startsWith("type "))continue;let Y=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])Z.push(`${Y[2]} = ${Y[1]}`)}if(Z.length===0)return v6;return`var ${Z.join(", ")}; ${v6}`}var qG=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function KG($){return $.replace(qG,(Z,J)=>zG(J))}import e1 from"path";import c6 from"process";function t1($="STX_PUBLIC_"){let Z={},J={};for(let[X,Y]of Object.entries(c6.env)){if(!X.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Y),J[X]=Y}return Z["import.meta.env"]=JSON.stringify(J),Z}function kB($="STX_PUBLIC_"){let Z={};for(let[J,X]of Object.entries(c6.env))if(J.startsWith($)&&X!==void 0)Z[J]=X;return Z}function p6($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function i6($,Z,J){try{let X;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=e1.join(Y,$);if(await Bun.file(G).exists())return G;Y=e1.dirname(Y)}X=e1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=e1.resolve(Z,$);else X=e1.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}var n6=Symbol.for("stx.inline-assets.import-meta");function WG($,Z){if(!$.includes("import.meta"))return;let J=Error(`[stx] ${Z} 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.
3550
+ `+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw J[n6]=!0,J}async function s6($,Z,J){let X=$,Y=e1.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[K,W,U,H]=G;if(p6(U))continue;let j=await i6(U,Y,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),U.endsWith(".ts")||U.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!0,define:t1()});if(F.outputs.length>0)B=await F.outputs[0].text(),WG(B,U)}let V=`<script>
3546
3551
  // Source: ${U}
3547
3552
  ${B}
3548
- </script>`;X=X.replace(K,V),Q.lastIndex=0}catch(B){if(B?.[u6])throw B}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=z.exec(X))!==null){let[K,W,U,H]=q,j=W+H;if(g6(U))continue;if(/rel=["']stylesheet["']/.test(j)||U.endsWith(".css")){let V=await h6(U,Y,Z);if(V)try{let F=await Bun.file(V).text();J.add(V);let _=`<style>
3553
+ </script>`;X=X.replace(K,V),Q.lastIndex=0}catch(B){if(B?.[n6])throw B}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=z.exec(X))!==null){let[K,W,U,H]=q,j=W+H;if(p6(U))continue;if(/rel=["']stylesheet["']/.test(j)||U.endsWith(".css")){let V=await i6(U,Y,Z);if(V)try{let F=await Bun.file(V).text();J.add(V);let _=`<style>
3549
3554
  /* Source: ${U} */
3550
3555
  ${F}
3551
- </style>`;X=X.replace(K,_),z.lastIndex=0}catch(F){}}}return X}function I$($,Z){let J=$,X=/@json\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index,G=Q+Y[0].length-1,z=1,q=G+1,K=null,W=!1;while(q<J.length&&z>0){let L=J[q];if(W){W=!1,q++;continue}if(L==="\\"&&K){W=!0,q++;continue}if(K){if(L===K)K=null;q++;continue}if(L==='"'||L==="'"||L==="`"){K=L,q++;continue}if(L==="(")z++;else if(L===")"){if(z--,z===0)break}q++}if(z!==0)break;let U=J.substring(G+1,q).trim(),H=J.substring(Q,q+1),j=-1,B=0,V=null,F=!1;for(let L=0;L<U.length;L++){let w=U[L];if(F){F=!1;continue}if(w==="\\"&&V){F=!0;continue}if(V){if(w===V)V=null;continue}if(w==='"'||w==="'"||w==="`"){V=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){j=L;break}}let _=j>=0?U.substring(0,j).trim():U,O=j>=0?U.substring(j+1).trim():void 0;try{let L=_.trim(),w;if(q0(L))w=W0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(O==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let D=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,Q)+D+J.substring(q+1),X.lastIndex=Q+D.length}catch(L){o0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),X.lastIndex=Q+H.length}}return J}function T$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function c6($){let Z=$,J=/@memo\s*\(/g,X,Y=[];while((X=J.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,z=1,q=G;while(q<Z.length&&z>0){if(Z[q]==="(")z++;else if(Z[q]===")")z--;q++}if(z!==0)continue;let K=Z.slice(G,q-1).trim(),W=q,U=Z.slice(W),H=U.indexOf("@endmemo");if(H===-1)continue;let j=U.slice(0,H),B=W+H+8,V=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),F=V?V[0].length:0,_=j.slice(F),O=j.match(/(\s*)$/),L=O?O[0].length:0,w=_.slice(0,_.length-L),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),D;if(R){let[A,T,N="",I]=R,k=`<${T}${N} data-stx-memo="${K}"${I}>`;D=j.slice(0,F)+k+w.slice(A.length)+j.slice(F+w.length)}else D=`${j.slice(0,F)}<div data-stx-memo="${K}">${w}</div>${j.slice(F+w.length)}`;Y.push({start:Q,end:B,replacement:D}),J.lastIndex=B}for(let Q=Y.length-1;Q>=0;Q--){let G=Y[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function k$($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function p6($,Z){if(!/\bref\s*=/.test($))return $;let J=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,X=M2($,(q,K)=>{J.lastIndex=K;let W=J.exec(q);if(!W||/^(?:script|style)$/i.test(W[1]))return-1;return J.lastIndex}),Y=[],Q=0,G=0,z=[];for(let{start:q,end:K,token:W}of X){let U=/^<\/?([\w-]+)/.exec(W)[1].toLowerCase();if(W.startsWith("</")){let j;while(j=Y.pop()){if(j.scoped)Q--;if(j.name===U)break}continue}let H=/\sdata-stx-scope\s*=/.test(W);if(!Q&&!H&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(W)&&!/\sdata-stx-ref-caller\s*=/.test(W))z.push($.slice(G,q),W.replace(/\s*\/?>$/,(j)=>` data-stx-ref-caller="${Z}"${j}`)),G=K;if(!i6.has(U)&&!/\/>$/.test(W)){if(Y.push({name:U,scoped:H}),H)Q++}}return z.push($.slice(G)),z.join("")}var i6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),n6=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,m6=/<\/?\s*([a-z][\w-]*)/iy,eQ=/\s/;function $G($,Z){let J=Z-1;while(J>=0&&eQ.test($[J]))J--;return J>=0&&$[J]==="/"}function ZG($,Z){let J=!1,X=!1;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(J){if(Q==="'")J=!1}else if(X){if(Q==='"')X=!1}else if(Q==="'")J=!0;else if(Q==='"')X=!0;else if(Q===">")return Y}return-1}function JG($,Z){if($.indexOf("{",Z)===-1||$.indexOf("}",Z)===-1)return!1;let J=0,X=Z,Y=!1,Q=!1,G=!1;while(X<$.length){let z=$.indexOf("<",X),q=z===-1?$.length:z;if(q>X){if(J===0)while(X<q){let U=$.indexOf(Q?"}":"{",X);if(U===-1||U>=q){if(Q)G=!1;else Y=!1;break}if(U>X)if(Q)G=!1;else Y=!1;if(Q){if(G)return!0;G=!0}else if(Y)Q=!0,G=!1;else Y=!0;X=U+1}X=q;continue}if($.startsWith("<!--",X)){let U=$.indexOf("-->",X);X=U===-1?$.length:U+3;continue}let K=ZG($,X);if(K===-1)break;m6.lastIndex=X;let W=m6.exec($)?.[1]?.toLowerCase()??"";if($[X+1]==="/"){if(J===0)break;J--}else if(!$G($,K)&&!i6.has(W))J++;X=K+1}return!1}function s6($){if($.length>=32768&&!l6($))return $;let J=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"),X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index,z=G+Q[0].length,q=!1,K=!1,W=-1;while(z<$.length){let H=$[z];if(q){if(H==="'")q=!1}else if(K){if(H==='"')K=!1}else if(H==="'")q=!0;else if(H==='"')K=!0;else if(H===">"){W=z;break}z++}if(W===-1)continue;let U=$.slice(G,W+1);if(n6.test(U))continue;if(U.includes("x-cloak"))continue;if(JG($,W+1))X+=$.slice(Y,W)+" x-cloak>",Y=W+1}return X+=$.slice(Y),X}var XG=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,YG=/<\/script>/gi,QG=/<\/style>/gi;function o6($){let Z=/<[a-z][\w-]*/gi,J="",X=0,Y;while((Y=Z.exec($))!==null){let Q=Y.index,G=Y[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=G==="script"?YG:QG;B.lastIndex=Q;let V=B.exec($);if(V!==null)Z.lastIndex=V.index+V[0].length;continue}let z=Q+Y[0].length,q=!1,K=!1,W=-1;while(z<$.length){let B=$[z];if(q){if(B==="'")q=!1}else if(K){if(B==='"')K=!1}else if(B==="'")q=!0;else if(B==='"')K=!0;else if(B===">"){W=z;break}z++}if(W===-1)continue;let U=$.slice(Q+Y[0].length,W);if(n6.test(U))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!XG.test(U))continue;let H=$[W-1]==="/",j=H?W-1:W;J+=`${$.slice(X,j)} x-cloak${H?" ":""}`,X=j}return J+=$.slice(X),J}var E$=k1(256),GG=[{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 @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{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"}];function b$($,Z,J,X){let Y=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1};if(!Y.enabled)return;let Q=H1($,Z,X,JSON.stringify(Y)),G=E$.get(Q);if(G!==void 0){if(G&&Y.failOnViolation)throw Error(G);return}let z=Y.allowPatterns??[],q=[],K=u0($.replace(/\{\{--[\s\S]*?--\}\}/g,(j)=>j.replace(/[^\n]/g," ")));for(let{pattern:j,message:B,suggestion:V}of GG){if(z.some((_)=>/\w/.test(_)&&B.includes(_)))continue;j.lastIndex=0;let F=K.match(j);if(F&&F.length>0){let _=K.split(`
3556
+ </style>`;X=X.replace(K,_),z.lastIndex=0}catch(F){}}}return X}function k$($,Z){let J=$,X=/@json\s*\(/g,Y;while((Y=X.exec(J))!==null){let Q=Y.index,G=Q+Y[0].length-1,z=1,q=G+1,K=null,W=!1;while(q<J.length&&z>0){let L=J[q];if(W){W=!1,q++;continue}if(L==="\\"&&K){W=!0,q++;continue}if(K){if(L===K)K=null;q++;continue}if(L==='"'||L==="'"||L==="`"){K=L,q++;continue}if(L==="(")z++;else if(L===")"){if(z--,z===0)break}q++}if(z!==0)break;let U=J.substring(G+1,q).trim(),H=J.substring(Q,q+1),j=-1,B=0,V=null,F=!1;for(let L=0;L<U.length;L++){let w=U[L];if(F){F=!1;continue}if(w==="\\"&&V){F=!0;continue}if(V){if(w===V)V=null;continue}if(w==='"'||w==="'"||w==="`"){V=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){j=L;break}}let _=j>=0?U.substring(0,j).trim():U,O=j>=0?U.substring(j+1).trim():void 0;try{let L=_.trim(),w;if(W0(L))w=K0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(O==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let N=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,Q)+N+J.substring(q+1),X.lastIndex=Q+N.length}catch(L){o0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),X.lastIndex=Q+H.length}}return J}function E$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function a6($){let Z=$,J=/@memo\s*\(/g,X,Y=[];while((X=J.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,z=1,q=G;while(q<Z.length&&z>0){if(Z[q]==="(")z++;else if(Z[q]===")")z--;q++}if(z!==0)continue;let K=Z.slice(G,q-1).trim(),W=q,U=Z.slice(W),H=U.indexOf("@endmemo");if(H===-1)continue;let j=U.slice(0,H),B=W+H+8,V=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),F=V?V[0].length:0,_=j.slice(F),O=j.match(/(\s*)$/),L=O?O[0].length:0,w=_.slice(0,_.length-L),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(R){let[A,T,D="",M]=R,k=`<${T}${D} data-stx-memo="${K}"${M}>`;N=j.slice(0,F)+k+w.slice(A.length)+j.slice(F+w.length)}else N=`${j.slice(0,F)}<div data-stx-memo="${K}">${w}</div>${j.slice(F+w.length)}`;Y.push({start:Q,end:B,replacement:N}),J.lastIndex=B}for(let Q=Y.length-1;Q>=0;Q--){let G=Y[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function b$($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function t6($,Z){if(!/\bref\s*=/.test($))return $;let J=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,X=I2($,(q,K)=>{J.lastIndex=K;let W=J.exec(q);if(!W||/^(?:script|style)$/i.test(W[1]))return-1;return J.lastIndex}),Y=[],Q=0,G=0,z=[];for(let{start:q,end:K,token:W}of X){let U=/^<\/?([\w-]+)/.exec(W)[1].toLowerCase();if(W.startsWith("</")){let j;while(j=Y.pop()){if(j.scoped)Q--;if(j.name===U)break}continue}let H=/\sdata-stx-scope\s*=/.test(W);if(!Q&&!H&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(W)&&!/\sdata-stx-ref-caller\s*=/.test(W))z.push($.slice(G,q),W.replace(/\s*\/?>$/,(j)=>` data-stx-ref-caller="${Z}"${j}`)),G=K;if(!e6.has(U)&&!/\/>$/.test(W)){if(Y.push({name:U,scoped:H}),H)Q++}}return z.push($.slice(G)),z.join("")}var e6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),$8=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,o6=/<\/?\s*([a-z][\w-]*)/iy,UG=/\s/;function HG($,Z){let J=Z-1;while(J>=0&&UG.test($[J]))J--;return J>=0&&$[J]==="/"}function jG($,Z){let J=!1,X=!1;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(J){if(Q==="'")J=!1}else if(X){if(Q==='"')X=!1}else if(Q==="'")J=!0;else if(Q==='"')X=!0;else if(Q===">")return Y}return-1}function BG($,Z){if($.indexOf("{",Z)===-1||$.indexOf("}",Z)===-1)return!1;let J=0,X=Z,Y=!1,Q=!1,G=!1;while(X<$.length){let z=$.indexOf("<",X),q=z===-1?$.length:z;if(q>X){if(J===0)while(X<q){let U=$.indexOf(Q?"}":"{",X);if(U===-1||U>=q){if(Q)G=!1;else Y=!1;break}if(U>X)if(Q)G=!1;else Y=!1;if(Q){if(G)return!0;G=!0}else if(Y)Q=!0,G=!1;else Y=!0;X=U+1}X=q;continue}if($.startsWith("<!--",X)){let U=$.indexOf("-->",X);X=U===-1?$.length:U+3;continue}let K=jG($,X);if(K===-1)break;o6.lastIndex=X;let W=o6.exec($)?.[1]?.toLowerCase()??"";if($[X+1]==="/"){if(J===0)break;J--}else if(!HG($,K)&&!e6.has(W))J++;X=K+1}return!1}function Z8($){if($.length>=32768&&!r6($))return $;let J=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"),X="",Y=0,Q;while((Q=J.exec($))!==null){let G=Q.index,z=G+Q[0].length,q=!1,K=!1,W=-1;while(z<$.length){let H=$[z];if(q){if(H==="'")q=!1}else if(K){if(H==='"')K=!1}else if(H==="'")q=!0;else if(H==='"')K=!0;else if(H===">"){W=z;break}z++}if(W===-1)continue;let U=$.slice(G,W+1);if($8.test(U))continue;if(U.includes("x-cloak"))continue;if(BG($,W+1))X+=$.slice(Y,W)+" x-cloak>",Y=W+1}return X+=$.slice(Y),X}var VG=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,_G=/<\/script>/gi,LG=/<\/style>/gi;function J8($){let Z=/<[a-z][\w-]*/gi,J="",X=0,Y;while((Y=Z.exec($))!==null){let Q=Y.index,G=Y[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=G==="script"?_G:LG;B.lastIndex=Q;let V=B.exec($);if(V!==null)Z.lastIndex=V.index+V[0].length;continue}let z=Q+Y[0].length,q=!1,K=!1,W=-1;while(z<$.length){let B=$[z];if(q){if(B==="'")q=!1}else if(K){if(B==='"')K=!1}else if(B==="'")q=!0;else if(B==='"')K=!0;else if(B===">"){W=z;break}z++}if(W===-1)continue;let U=$.slice(Q+Y[0].length,W);if($8.test(U))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!VG.test(U))continue;let H=$[W-1]==="/",j=H?W-1:W;J+=`${$.slice(X,j)} x-cloak${H?" ":""}`,X=j}return J+=$.slice(X),J}var y$=k1(256),OG=[{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 @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{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"}];function C$($,Z,J,X){let Y=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1};if(!Y.enabled)return;let Q=H1($,Z,X,JSON.stringify(Y)),G=y$.get(Q);if(G!==void 0){if(G&&Y.failOnViolation)throw Error(G);return}let z=Y.allowPatterns??[],q=[],K=u0($.replace(/\{\{--[\s\S]*?--\}\}/g,(j)=>j.replace(/[^\n]/g," ")));for(let{pattern:j,message:B,suggestion:V}of OG){if(z.some((_)=>/\w/.test(_)&&B.includes(_)))continue;j.lastIndex=0;let F=K.match(j);if(F&&F.length>0){let _=K.split(`
3552
3557
  `),O=$.split(`
3553
3558
  `),L=[];_.forEach((A,T)=>{if(j.lastIndex=0,j.test(A))L.push(T+1)});let w=L.length>0?` (script line${L.length>1?"s":""} ${L.join(", ")})`:"",R=L.slice(0,3).map((A)=>` ${A} | ${(O[A-1]??"").trim().slice(0,100)}`).join(`
3554
- `),D=R?`
3559
+ `),N=R?`
3555
3560
  ${R}`:"";q.push(` \u2717 ${B}${w}
3556
- \u2192 ${V}${D}`)}}if(q.length===0){E$.set(Q,"");return}let W=(j)=>{let B=`${process.cwd()}/`;return j.startsWith(B)?j.slice(B.length):j},H=`[STX] DOM API violation in ${X&&X!==Z?`${W(X)} (composed into ${W(Z)})`:W(Z)}:
3561
+ \u2192 ${V}${N}`)}}if(q.length===0){y$.set(Q,"");return}let W=(j)=>{let B=`${process.cwd()}/`;return j.startsWith(B)?j.slice(B.length):j},H=`[STX] DOM API violation in ${X&&X!==Z?`${W(X)} (composed into ${W(Z)})`:W(Z)}:
3557
3562
  ${q.join(`
3558
3563
  `)}
3559
- Tip: prefer useRef(), navigate(), and composables for component code`;if(E$.set(Q,H),Y.failOnViolation)throw Error(H);else console.warn(H)}WG();import y$ from"path";var zG=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,qG=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function KG($,Z){if(!Z||!$.includes("/"))return $;let J=y$.dirname(Z);return $.replace(zG,(X,Y,Q,G)=>{let z=y$.resolve(J,G);return`${Y}${Q}${z.split(y$.sep).join("/")}${Q}`})}function r6($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(qG,(J,X,Y,Q)=>`${X}${KG(Y,Z)}${Q}`)}var E1="<!--PARENT_CONTENT_PLACEHOLDER-->";function a6($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function HG($,Z){let J=$.length,X=Z,Y=!0,Q=[],G=(z)=>z+9<=J&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(X<J){let z=$[X];if(G(X))return X;if(z==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
3564
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(y$.set(Q,H),Y.failOnViolation)throw Error(H);else console.warn(H)}NG();import S$ from"path";var FG=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,wG=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function RG($,Z){if(!Z||!$.includes("/"))return $;let J=S$.dirname(Z);return $.replace(FG,(X,Y,Q,G)=>{let z=S$.resolve(J,G);return`${Y}${Q}${z.split(S$.sep).join("/")}${Q}`})}function X8($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(wG,(J,X,Y,Q)=>`${X}${RG(Y,Z)}${Q}`)}var E1="<!--PARENT_CONTENT_PLACEHOLDER-->";function Y8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function AG($,Z){let J=$.length,X=Z,Y=!0,Q=[],G=(z)=>z+9<=J&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(X<J){let z=$[X];if(G(X))return X;if(z==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
3560
3565
  `,X+2),X===-1)return-1;X+=1,Y=!0;continue}if(z==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,Y=!0;continue}if(z==="/"&&Y){let q=X+1,K=!1;while(q<J){let W=$[q];if(W==="\\"){q+=2;continue}if(W==="[")K=!0;else if(W==="]")K=!1;else if(W==="/"&&!K){q++;break}else if(W===`
3561
3566
  `){q=-1;break}q++}if(q===-1){X++,Y=!1;continue}while(q<J&&/[a-z]/.test($[q]))q++;X=q,Y=!1;continue}if(z==="'"||z==='"'){let q=z;X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
3562
- `)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function _8($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}var t6=/<style\b[^>]*>/iy,e6=/<\/style>/gi,$8=/<script\b[^>]*>/iy;function Z8($){let Z=0;while(Z<$.length){let J=$.indexOf("<",Z);if(J===-1)return-1;if($.startsWith("<!--",J)){let Y=$.indexOf("-->",J+4);Z=Y===-1?$.length:Y+3;continue}t6.lastIndex=J;let X=t6.exec($);if(X){e6.lastIndex=J+X[0].length;let Y=e6.exec($);Z=Y===null?$.length:Y.index+8;continue}if($8.lastIndex=J,$8.test($))return J;Z=J+1}return-1}async function J8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await o("stx/client-module-registry",()=>import("./chunk-f325jzsk.js")),Y=await X(J(...$),{minify:Z.buildMode==="compile"});if(!Y)return null;return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${Y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function jG($,Z=""){let J=_8($,"data-stx-runtime");if(!J)return $;let X=Z8($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
3563
- `+$.slice(X,J.start)+$.slice(J.end);let Y=$.slice(J.start,J.end),Q=$.slice(0,J.start)+$.slice(J.end),G=Z8(Q);if(G===-1)return Y+Z+`
3567
+ `)break;X++}Y=!1;continue}if(z==="`"){X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),X++;while(X<J){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Y=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,Y=!0;break}X++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;X++}return-1}function D8($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${J}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Y=X.index+X[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}var Q8=/<style\b[^>]*>/iy,G8=/<\/style>/gi,z8=/<script\b[^>]*>/iy;function q8($){let Z=0;while(Z<$.length){let J=$.indexOf("<",Z);if(J===-1)return-1;if($.startsWith("<!--",J)){let Y=$.indexOf("-->",J+4);Z=Y===-1?$.length:Y+3;continue}Q8.lastIndex=J;let X=Q8.exec($);if(X){G8.lastIndex=J+X[0].length;let Y=G8.exec($);Z=Y===null?$.length:Y.index+8;continue}if(z8.lastIndex=J,z8.test($))return J;Z=J+1}return-1}async function K8($,Z){try{let{registeredModuleIdsIn:J,buildModuleRegistryScript:X}=await o("stx/client-module-registry",()=>import("./chunk-f91yrkcz.js")),Y=await X(J(...$),{minify:Z.buildMode==="compile"});if(!Y)return null;return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${Y.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function MG($,Z=""){let J=D8($,"data-stx-runtime");if(!J)return $;let X=q8($);if(X===-1||X===J.start){if(!Z)return $;return $.slice(0,J.end)+Z+$.slice(J.end)}if(X<J.start)return $.slice(0,X)+$.slice(J.start,J.end)+Z+`
3568
+ `+$.slice(X,J.start)+$.slice(J.end);let Y=$.slice(J.start,J.end),Q=$.slice(0,J.start)+$.slice(J.end),G=q8(Q);if(G===-1)return Y+Z+`
3564
3569
  `+Q;return Q.slice(0,G)+Y+Z+`
3565
- `+Q.slice(G)}async function C$($,Z,J,X,Y){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=X1($,J);let Q=!Z.__stxProcessingDepth;j$(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await y9(Z,J,X.runtimeConfig);if(Q)r$(Z),Z.__stx_head_injections=q$(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!B9()&&!V9())&&J&&J.endsWith(".stx"))V8($,J);try{return await U8.timeAsync("template-processing",async()=>{let G=await BG($,Z,J,X,Y);if(Q)G=k$(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},K=(Z.__stx_runtime_head||null)??B8(),W=(Z.__stx_head_raw||"").trim(),U,H=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)U=H[1].trim(),W=W.replace(H[0],"").trim();let j=Z.__sections?.title,B=K.title||U||j,V=!K.title&&(!!U||!!j),F=K.meta||[],_=new Set(F.map((A)=>o1(A)).filter(Boolean)),O={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((A)=>!_.has(o1(A))),...F],link:[...z.link||[],...K.link||[]],script:[...z.script||[],...K.script||[]],headRaw:[z.headRaw,W].filter(Boolean).join(`
3566
- `),...K.htmlAttrs&&{htmlAttrs:W6(z.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...K.bodyAttrs}}},L=O$(G);if(G=j6(G,O,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},L),L)G=H6(G,z),G=U6(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let A=w[1],T=K8(A);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
3567
- <meta name="stx-layout" content="${a6(A)}">
3568
- <meta name="stx-layout-group" content="${a6(T)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?s0(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=y1(G,(T,N)=>`<body${N} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Q){let z=Z.__stx_head_injections??q$(),q=_$(G);if(q!==null)z.beforeClose.push(q);let K=H$(G);if(K!==null)z.afterOpen.push(K);G=r4(G,z);let W=X.app?.colorMode;if(W)G=e4(G,W)}if(Q)if(_8(G,"data-stx-runtime")){let q=null,K=null,W=null,U=null;try{let{getStoreScript:j}=await o("stx/store-loader",()=>import("./chunk-92zzryxw.js")),B=X.storesDir,V=await j(B);if(V)K=`<script data-stx-stores>${V}</script>`}catch{}q=await J8([G,K],X);try{let{getFrameworkComposableScript:j}=await o("stx/framework-composables",()=>import("./chunk-bk95q0bw.js"));U=await j(G)}catch{}try{let{getComposableScript:j}=await o("stx/composable-loader",()=>import("./chunk-hftqr8ej.js")),B=X.composablesDir,V=[q,K,U].filter((_)=>_!==null),F=await j(X._layerComposableDirs??B,G,V);if(F)W=`<script data-stx-composables>${F}</script>`}catch{}let H=[q,K,W,U].filter((j)=>j!==null).map((j)=>`
3569
- ${j}`).join("");G=jG(G,H)}else{let q=await J8([G],X);if(q){let K=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(K!==-1)G=G.slice(0,K)+q+`
3570
- `+G.slice(K)}}if(Q)G=$6(G);if(Q&&Z.__stx_inject_css!==!1)G=await j8(G,void 0,X.buildMode==="serve",!0);else if(Q)G=H8(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q&&Z.__stx_runtime_config)G=W8(G,Z.__stx_runtime_config);if(Q&&!Z.__stx_defer_server_data){let z=Q6(Z);if(z){let q=/<head\b[^>]*>/i.exec(G),K=q?q.index+q[0].length:0;G=G.slice(0,K)+z+G.slice(K)}}return G})}catch(G){if(G instanceof Y8)throw G;let z=G instanceof Error?G.message:String(G),q=new I2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(o0.log(q,{filePath:J,context:Z}),G8.logDetailedError(q,{filePath:J,template:$.substring(0,500)}),X.debug)throw q;return Q8.createFallbackContent("Template Processing",q)}}async function BG($,Z,J,X,Y){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!T0.isAbsolute(X.partialsDir)?T0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!T0.isAbsolute(X.componentsDir)?T0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!T0.isAbsolute(X.layoutsDir)?T0.resolve(Q,X.layoutsDir):X.layoutsDir},z=G,q=$;await LG(J,Z),_G(Z,z),q=await T2(()=>h4(q,Z,J,z),q,(L)=>{o0.log(L,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${L.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=B1(q,j9,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);q=K.output;let W=K.tokens,U=(L)=>W.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>W[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,H),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),q=c4(q),q=await d6(q,J,Y);let j={};q=X$(q,j);let B={...Z.__sections||{}},V="",F=D3(R3($)),_=/@nolayout\b/.test(q)||F===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let O=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)V=O[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(V=F,!/@section\s*\(/.test(q))q=`@section('content')
3570
+ `+Q.slice(G)}async function P$($,Z,J,X,Y){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=X1($,J);let Q=!Z.__stxProcessingDepth;V$(Z);for(let G of X._layerGraph?.configDependencies??[])Y.add(G);if(Q&&X.runtimeConfig)await C9(Z,J,X.runtimeConfig);if(Q)t$(Z),Z.__stx_head_injections=W$(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!V9()&&!_9())&&J&&J.endsWith(".stx"))N8($,J);try{return await O8.timeAsync("template-processing",async()=>{let G=await IG($,Z,J,X,Y);if(Q)G=b$(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let z=X.app?.head||{},K=(Z.__stx_runtime_head||null)??R8(),W=(Z.__stx_head_raw||"").trim(),U,H=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)U=H[1].trim(),W=W.replace(H[0],"").trim();let j=Z.__sections?.title,B=K.title||U||j,V=!K.title&&(!!U||!!j),F=K.meta||[],_=new Set(F.map((A)=>o1(A)).filter(Boolean)),O={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((A)=>!_.has(o1(A))),...F],link:[...z.link||[],...K.link||[]],script:[...z.script||[],...K.script||[]],headRaw:[z.headRaw,W].filter(Boolean).join(`
3571
+ `),...K.htmlAttrs&&{htmlAttrs:L6(z.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...K.bodyAttrs}}},L=w$(G);if(G=w6(G,O,{...V&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}},L),L)G=F6(G,z),G=O6(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let A=w[1],T=_8(A);G=G.replace(/<head\b[^>]*>/i,(D)=>`${D}
3572
+ <meta name="stx-layout" content="${Y8(A)}">
3573
+ <meta name="stx-layout-group" content="${Y8(T)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),N=R?s0(G):null;if(R&&N&&!/\bdata-stx=/.test(N.tag)){G=y1(G,(T,D)=>`<body${D} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Q){let z=Z.__stx_head_injections??W$(),q=O$(G);if(q!==null)z.beforeClose.push(q);let K=B$(G);if(K!==null)z.afterOpen.push(K);G=X6(G,z);let W=X.app?.colorMode;if(W)G=G6(G,W)}if(Q)if(D8(G,"data-stx-runtime")){let q=null,K=null,W=null,U=null;try{let{getStoreScript:j}=await o("stx/store-loader",()=>import("./chunk-wbt9kz3j.js")),B=X.storesDir,V=await j(B);if(V)K=`<script data-stx-stores>${V}</script>`}catch{}q=await K8([G,K],X);try{let{getFrameworkComposableScript:j}=await o("stx/framework-composables",()=>import("./chunk-58xpr98x.js"));U=await j(G)}catch{}try{let{getComposableScript:j}=await o("stx/composable-loader",()=>import("./chunk-k48jp969.js")),B=X.composablesDir,V=[q,K,U].filter((_)=>_!==null),F=await j(X._layerComposableDirs??B,G,V);if(F)W=`<script data-stx-composables>${F}</script>`}catch{}let H=[q,K,W,U].filter((j)=>j!==null).map((j)=>`
3574
+ ${j}`).join("");G=MG(G,H)}else{let q=await K8([G],X);if(q){let K=G.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(K!==-1)G=G.slice(0,K)+q+`
3575
+ `+G.slice(K)}}if(Q)G=z6(G);if(Q&&Z.__stx_inject_css!==!1)G=await w8(G,void 0,X.buildMode==="serve",!0);else if(Q)G=F8(G);if(G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q&&Z.__stx_runtime_config)G=L8(G,Z.__stx_runtime_config);if(Q&&!Z.__stx_defer_server_data){let z=H6(Z);if(z){let q=/<head\b[^>]*>/i.exec(G),K=q?q.index+q[0].length:0;G=G.slice(0,K)+z+G.slice(K)}}return G})}catch(G){if(G instanceof U8)throw G;let z=G instanceof Error?G.message:String(G),q=new T2(`Template processing failed: ${z}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(o0.log(q,{filePath:J,context:Z}),j8.logDetailedError(q,{filePath:J,template:$.substring(0,500)}),X.debug)throw q;return H8.createFallbackContent("Template Processing",q)}}async function IG($,Z,J,X,Y){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!T0.isAbsolute(X.partialsDir)?T0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!T0.isAbsolute(X.componentsDir)?T0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!T0.isAbsolute(X.layoutsDir)?T0.resolve(Q,X.layoutsDir):X.layoutsDir},z=G,q=$;await EG(J,Z),kG(Z,z),q=await k2(()=>i4(q,Z,J,z),q,(L)=>{o0.log(L,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${L.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=B1(q,B9,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);q=K.output;let W=K.tokens,U=(L)=>W.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>W[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,H),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),q=a4(q),q=await s6(q,J,Y);let j={};q=Q$(q,j);let B={...Z.__sections||{}},V="",F=T3(I3($)),_=/@nolayout\b/.test(q)||F===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let O=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)V=O[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(V=F,!/@section\s*\(/.test(q))q=`@section('content')
3571
3576
  ${q.trim()}
3572
- @endsection`}if(!V&&!_&&z.defaultLayout){let L=L$(q),w=/@section\s*\(/.test(q);if(!L||w){let R="",D=T0.dirname(J),A=z.layoutsDir?T0.dirname(z.layoutsDir):process.cwd();for(let T=0;T<20;T++){let N=T0.join(D,"_layout.stx");if(await a(N)){R=N;break}let I=T0.dirname(D);if(I===D||I.length<A.length)break;D=I}if(R)V=R;else if(z.layoutsDir){let T=T0.isAbsolute(z.layoutsDir)?z.layoutsDir:T0.resolve(process.cwd(),z.layoutsDir),N=T0.join(T,`${z.defaultLayout}.stx`);if(await a(N))V=N}if(V&&!w)q=`@section('content')
3577
+ @endsection`}if(!V&&!_&&z.defaultLayout){let L=F$(q),w=/@section\s*\(/.test(q);if(!L||w){let R="",N=T0.dirname(J),A=z.layoutsDir?T0.dirname(z.layoutsDir):process.cwd();for(let T=0;T<20;T++){let D=T0.join(N,"_layout.stx");if(await a(D)){R=D;break}let M=T0.dirname(N);if(M===N||M.length<A.length)break;N=M}if(R)V=R;else if(z.layoutsDir){let T=T0.isAbsolute(z.layoutsDir)?z.layoutsDir:T0.resolve(process.cwd(),z.layoutsDir),D=T0.join(T,`${z.defaultLayout}.stx`);if(await a(D))V=D}if(V&&!w)q=`@section('content')
3573
3578
  ${q.trim()}
3574
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return B[w]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=e(R.trim(),Z);if(D===void 0)return L;return B[w]=String(D??""),""}catch{return L}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",E1);else B[w]=R.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=Y$(q,j),V){let L=[],w=n0(q),R=B1(w.output,u2,(D,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,A,T)=>{let N=A==="SCRIPT"?w.scripts[Number(T)]:R.tokens[Number(T)];if(N)L.push(N);return""}),L.length>0){let D=L.join(`
3579
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return B[w]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let N=e(R.trim(),Z);if(N===void 0)return L;return B[w]=String(N??""),""}catch{return L}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",E1);else B[w]=R.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=G$(q,j),V){let L=[],w=n0(q),R=B1(w.output,d2,(N,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(N,A,T)=>{let D=A==="SCRIPT"?w.scripts[Number(T)]:R.tokens[Number(T)];if(D)L.push(D);return""}),L.length>0){let N=L.join(`
3575
3580
  `);B.content=B.content?`${B.content}
3576
- ${D}`:D,Z.__sections=B}}if(V)try{let L;if(T0.isAbsolute(V))L=V,Y.add(V);else L=await T2(()=>s2(V,J,G,Y),null,()=>{throw new I2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let N=(M)=>{if(!M)return[];try{let y=T0.isAbsolute(M)?M:T0.resolve(process.cwd(),M);return UG.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},I=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((M,y,E)=>E.indexOf(M)===y).sort(),k=`Layout not found: ${V} (referenced from ${J})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(o0.log(Error(k),{layoutPath:V,filePath:J,available:I},"error"),console.error(`[stx] ${k}`),G.debug)throw new I2(k,J);return q}let w=await T2(()=>Bun.file(L).text(),"",()=>{throw new I2(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")});w=r6(w,L);let R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${L}`);let N={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return N[E]=b.trim(),""});for(let[y,E]of Object.entries(N))if(B[y]&&B[y].includes(E1)){let b=B[y].indexOf(E1);B[y]=B[y].slice(0,b)+E+B[y].slice(b+E1.length)}else if(!B[y])B[y]=E;let k={...Z,__sections:B},M=`@layout('${R[1]}')${I}`;return await C$(M,k,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=X$(D,j),T={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,I,k)=>{return T[I]=k.trim(),`@slot('${I}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,I,k)=>{if(B[I]){let M=B[I];if(M.includes(E1)){let y=T[I]||"",E=M.indexOf(E1);M=M.slice(0,E)+y+M.slice(E+E1.length)}return M}return k||""}),A=VG(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=Y$(A,j),Z.__originalFilePath=J,q=await X8(A,Z,L,G,Y),q=`<!-- stx-layout: ${V} -->
3577
- ${q}`,U(q)}catch(L){return o0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return U(await X8(q,Z,J,G,Y))}function VG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function _G($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function LG($,Z){await T2(()=>m4($,Z),void 0,(J)=>{o0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}async function OG($,Z,J){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=X.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:q}=await o("stx/variable-extractor",()=>import("./chunk-qpzxgkc5.js"));await q(G,Z,J,{preserveExisting:!0})}catch(q){let K=q instanceof Error?q:Error(String(q));o0.log(K,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${K.message}`)}}}async function FG($,Z,J){try{let{interpolateScriptsInTemplate:X}=await o("stx/expressions",()=>import("./chunk-wjdfhfj6.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return o0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function X8($,Z,J,X,Y){let Q=$,G=X;if(await OG(Q,Z,J),Q=await FG(Q,Z,J),Q=await M4(Q,Z,J),Q=await I4(Q,Z,J),Q=await E7(Q,Z,J,G),X1(Q))Q=S6(Q,Z),Q=M$(Q,Z);Q=v6(Q);let{processStreamDirectives:z}=await o("stx/streaming",()=>import("./chunk-bezqaxqt.js"));Q=z(Q,Z),Q=P4(Q,Z,J,G),Q=await s4(Q,Z,J,G,Y),Q=await $$(Q,Z,J,G,Y),Q=w3(Q,Z,J,G);let{processDeferDirectives:q}=await o("stx/defer",()=>import("./chunk-xzgvcrnz.js"));Q=q(Q,Z,J);let{processTeleportDirectives:K}=await o("stx/teleport",()=>import("./chunk-yyyxt326.js"));Q=K(Q,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:U}=await o("stx/transitions",()=>import("./chunk-qeyw5za9.js"));Q=W(Q,Z,J),Q=U(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-g912mb7x.js"));Q=H(Q,Z,J);let{processSuspenseDirectives:j}=await o("stx/suspense",()=>import("./chunk-8ee62a9q.js"));Q=j(Q,Z,J);let{processAsyncDirectives:B}=await o("stx/async-components",()=>import("./chunk-zs5y7xnt.js"));Q=B(Q,Z,J);let{processKeepAliveDirectives:V}=await o("stx/keep-alive",()=>import("./chunk-d57gb0v2.js"));Q=V(Q,Z,J);let{processVirtualListDirectives:F,processVirtualGridDirectives:_,processInfiniteListDirectives:O}=await o("stx/virtual-scrolling",()=>import("./chunk-d5cqnwdd.js"));Q=F(Q,Z,J),Q=_(Q,Z,J),Q=O(Q,Z,J);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-mbmqpaq1.js"));Q=L(Q,Z,J),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await o("stx/computed",()=>import("./chunk-jsg1rthc.js"));Q=R(Q,Z,J),Q=D(Q,Z,J);let{processFormValidationDirectives:A}=await o("stx/forms-validation",()=>import("./chunk-xsfwcj6x.js"));Q=A(Q,Z,J);let{processHeadDirective:T,processTitleDirective:N,processMetaDirective:I,resetHead:k}=await o("stx/head",()=>import("./chunk-jfzfrmzy.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let M=T(Q);if(Q=M.content,M.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${M.headContent}
3578
- `;if(Q=N(Q,Z),Q=I(Q,Z),Q=d4(Q),Q=w5(Q,Z),Q=k7(Q),Q=x4(Q),Q=await J$(Q,Z,J,G,Y),Q=await $$(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=a$(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=k$(Q),Q=e0(Q,Z,J),Q=A3(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=R5(Q,Z),Q=D5(Q,Z),Q=V2(Q,Z),Q=E5(Q,Z),Q=b5(Q,Z),Q=await V7(Q,Z,J,G),Q=await y3(Q,Z,J),Q=await z8(Q,Z,J,G),Q=q8(Q,Z,J,G),Q=$7(Q,Z,J,G),Q=Z7(Q,Z,J),Q=J7(Q,Z,J,G),Q=I7(Q,Z,J,G),Q=I$(Q,Z),Q=T$(Q),Q=c6(Q),!G.skipEventDirectives)Q=s$(Q,Z,J);if(Q=T3(Q,Z,J),G.debug){let s=/\bx-data\s*=/.test(Q),c=A$($);if(s&&c)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3581
+ ${N}`:N,Z.__sections=B}}if(V)try{let L;if(T0.isAbsolute(V))L=V,Y.add(V);else L=await k2(()=>o2(V,J,G,Y),null,()=>{throw new T2(`Failed to resolve layout path: ${V}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let D=(I)=>{if(!I)return[];try{let y=T0.isAbsolute(I)?I:T0.resolve(process.cwd(),I);return DG.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...D(G.layoutsDir),...D(G.fallbackLayoutsDir)].filter((I,y,E)=>E.indexOf(I)===y).sort(),k=`Layout not found: ${V} (referenced from ${J})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(o0.log(Error(k),{layoutPath:V,filePath:J,available:M},"error"),console.error(`[stx] ${k}`),G.debug)throw new T2(k,J);return q}let w=await k2(()=>Bun.file(L).text(),"",()=>{throw new T2(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")});w=X8(w,L);let R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${L}`);let D={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return D[E]=b.trim(),""});for(let[y,E]of Object.entries(D))if(B[y]&&B[y].includes(E1)){let b=B[y].indexOf(E1);B[y]=B[y].slice(0,b)+E+B[y].slice(b+E1.length)}else if(!B[y])B[y]=E;let k={...Z,__sections:B},I=`@layout('${R[1]}')${M}`;return await P$(I,k,L,G,Y)}let N=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=Q$(N,j),T={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,M,k)=>{return T[M]=k.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(D,M,k)=>{if(B[M]){let I=B[M];if(I.includes(E1)){let y=T[M]||"",E=I.indexOf(E1);I=I.slice(0,E)+y+I.slice(E+E1.length)}return I}return k||""}),A=TG(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=G$(A,j),Z.__originalFilePath=J,q=await W8(A,Z,L,G,Y),q=`<!-- stx-layout: ${V} -->
3582
+ ${q}`,U(q)}catch(L){return o0.log(L instanceof Error?L:Error(String(L)),{layoutPath:V,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return U(await W8(q,Z,J,G,Y))}function TG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,X,Y)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function kG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(J)&&Q!==void 0)X[Y]=Q;$.$env=X}async function EG($,Z){await k2(()=>o4($,Z),void 0,(J)=>{o0.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}async function bG($,Z,J){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=X.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:q}=await o("stx/variable-extractor",()=>import("./chunk-75vxhxn1.js"));await q(G,Z,J,{preserveExisting:!0})}catch(q){let K=q instanceof Error?q:Error(String(q));o0.log(K,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${K.message}`)}}}async function yG($,Z,J){try{let{interpolateScriptsInTemplate:X}=await o("stx/expressions",()=>import("./chunk-hg7ptfd4.js"));return X($,Z,{skipServer:!0})}catch(X){let Y=X instanceof Error?X:Error(String(X));return o0.log(Y,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${Y.message}`),$}}async function W8($,Z,J,X,Y){let Q=$,G=X;if(await bG(Q,Z,J),Q=await yG(Q,Z,J),Q=await C4(Q,Z,J),Q=await S4(Q,Z,J),Q=await f7(Q,Z,J,G),X1(Q))Q=u6(Q,Z),Q=T$(Q,Z);Q=m6(Q);let{processStreamDirectives:z}=await o("stx/streaming",()=>import("./chunk-80rmf67y.js"));Q=z(Q,Z),Q=d4(Q,Z,J,G),Q=await Z6(Q,Z,J,G,Y),Q=await J$(Q,Z,J,G,Y),Q=M3(Q,Z,J,G);let{processDeferDirectives:q}=await o("stx/defer",()=>import("./chunk-v33qvj8y.js"));Q=q(Q,Z,J);let{processTeleportDirectives:K}=await o("stx/teleport",()=>import("./chunk-7yzyn9k7.js"));Q=K(Q,Z,J);let{processTransitionDirectives:W,processTransitionAttributes:U}=await o("stx/transitions",()=>import("./chunk-ksqba0cq.js"));Q=W(Q,Z,J),Q=U(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-nnv8wytm.js"));Q=H(Q,Z,J);let{processSuspenseDirectives:j}=await o("stx/suspense",()=>import("./chunk-8q8gj45z.js"));Q=j(Q,Z,J);let{processAsyncDirectives:B}=await o("stx/async-components",()=>import("./chunk-t5kwx6fa.js"));Q=B(Q,Z,J);let{processKeepAliveDirectives:V}=await o("stx/keep-alive",()=>import("./chunk-wwghzbbg.js"));Q=V(Q,Z,J);let{processVirtualListDirectives:F,processVirtualGridDirectives:_,processInfiniteListDirectives:O}=await o("stx/virtual-scrolling",()=>import("./chunk-kexk6z9s.js"));Q=F(Q,Z,J),Q=_(Q,Z,J),Q=O(Q,Z,J);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-bnq0p4r4.js"));Q=L(Q,Z,J),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:N}=await o("stx/computed",()=>import("./chunk-jd9nv63q.js"));Q=R(Q,Z,J),Q=N(Q,Z,J);let{processFormValidationDirectives:A}=await o("stx/forms-validation",()=>import("./chunk-604qr43v.js"));Q=A(Q,Z,J);let{processHeadDirective:T,processTitleDirective:D,processMetaDirective:M,resetHead:k}=await o("stx/head",()=>import("./chunk-ajhrz96a.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let I=T(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
3583
+ `;if(Q=D(Q,Z),Q=M(Q,Z),Q=s4(Q),Q=N5(Q,Z),Q=v7(Q),Q=c4(Q),Q=await Y$(Q,Z,J,G,Y),Q=await J$(Q,Z,J,G,Y),Z.__stxProcessingDepth===1)Q=e$(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=b$(Q),Q=e0(Q,Z,J),Q=E3(Q,Z,{filePath:J,buildMode:G.buildMode}),Q=D5(Q,Z),Q=A5(Q,Z),Q=_2(Q,Z),Q=y5(Q,Z),Q=C5(Q,Z),Q=await N7(Q,Z,J,G),Q=await f3(Q,Z,J),Q=await B8(Q,Z,J,G),Q=V8(Q,Z,J,G),Q=Q7(Q,Z,J,G),Q=G7(Q,Z,J),Q=z7(Q,Z,J,G),Q=S7(Q,Z,J,G),Q=k$(Q,Z),Q=E$(Q),Q=a6(Q),!G.skipEventDirectives)Q=r$(Q,Z,J);if(Q=C3(Q,Z,J),G.debug){let s=/\bx-data\s*=/.test(Q),p=I$($);if(s&&p)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3579
3584
  Both work on the same page, but they manage separate scopes.
3580
- Prefer signals (state/derived/effect) for new components.`)}Q=H4(Q,Z),Q=await V1(Q,Z,J),Q=s6(Q),Q=o6(Q),Q=H3(Q);let{processXElementDirectives:y}=await o("stx/x-element",()=>import("./chunk-hrcxfvh1.js"));Q=y(Q);let E=Z.__originalFilePath||J,b=k9(Z);if(Q=await f6(Q,G,E,b),Q=S7(Q,Z),Q=await u4(Q,Z,J,G),G.media?.image?.autoSiblings){let s=G.publicDir||"public",{rewriteImagesWithSiblings:c}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-4jgr954p.js"));Q=await c(Q,{publicDir:s})}if(G.seo?.enabled)Q=X7(Q,Z,G);let C=(s,c,K0=!0)=>{if(!c)return s;let Z0=c.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),V0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Z0&&V0){if(K0)s=s.replace(V0[0],Z0[0]);if(c=c.replace(Z0[0],"").trim(),!c)return s}if(/<\/head>/i.test(s))return s.replace(/<\/head>/i,`${c}
3585
+ Prefer signals (state/derived/effect) for new components.`)}Q=F4(Q,Z),Q=await V1(Q,Z,J),Q=Z8(Q),Q=J8(Q),Q=L3(Q);let{processXElementDirectives:y}=await o("stx/x-element",()=>import("./chunk-y4dd2n2n.js"));Q=y(Q);let E=Z.__originalFilePath||J,b=E9(Z);if(Q=await l6(Q,G,E,b),Q=u7(Q,Z),Q=await n4(Q,Z,J,G),G.media?.image?.autoSiblings){let s=G.publicDir||"public",{rewriteImagesWithSiblings:p}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-vpbw6g2t.js"));Q=await p(Q,{publicDir:s})}if(G.seo?.enabled)Q=q7(Q,Z,G);let C=(s,p,q0=!0)=>{if(!p)return s;let Z0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),V0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Z0&&V0){if(q0)s=s.replace(V0[0],Z0[0]);if(p=p.replace(Z0[0],"").trim(),!p)return s}if(/<\/head>/i.test(s))return s.replace(/<\/head>/i,`${p}
3581
3586
  </head>`);if(/<head\b[^>]*>/i.test(s))return s.replace(/(<head\b[^>]*>)/i,`$1
3582
- ${c}`);if(/<html\b[^>]*>/i.test(s))return s.replace(/(<html\b[^>]*>)/i,`$1
3587
+ ${p}`);if(/<html\b[^>]*>/i.test(s))return s.replace(/(<html\b[^>]*>)/i,`$1
3583
3588
  <head>
3584
- ${c}
3585
- </head>`);return s},{renderHead:f,getHead:u}=await o("stx/head",()=>import("./chunk-jfzfrmzy.js")),h=Z.__stx_runtime_head??u();if(h.title||h.meta?.length||h.link?.length){let s=f(h);if(s)Q=C(Q,s)}if(M.headContent)Q=C(Q,M.headContent,!h.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=A7(Q,G.csp,Z);if(G.analytics?.enabled)Q=B3(Q,G);if(G.heatmap?.enabled)Q=_3(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:s}=await o("stx/pwa/inject",()=>import("./chunk-02hm88m5.js"));Q=s(Q,G)}let m=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),j0=/\bSTX\.\w+/.test(Q),S0=/window\.STX\s*=/.test(Q);if(m&&j0&&!S0){let c=`<script data-stx-scoped data-stx-run="once">
3586
- ${K3()}
3587
- </script>`;if(Q.includes("</head>")){let K0=Q.indexOf("</head>"),V0=Q.slice(0,K0).indexOf("<script");if(V0!==-1){let k0=Q.slice(0,V0),j1=Q.slice(V0);Q=k0+c+`
3588
- `+j1}else Q=Q.replace("</head>",`${c}
3589
+ ${p}
3590
+ </head>`);return s},{renderHead:f,getHead:u}=await o("stx/head",()=>import("./chunk-ajhrz96a.js")),h=Z.__stx_runtime_head??u();if(h.title||h.meta?.length||h.link?.length){let s=f(h);if(s)Q=C(Q,s)}if(I.headContent)Q=C(Q,I.headContent,!h.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=y7(Q,G.csp,Z);if(G.analytics?.enabled)Q=F3(Q,G);if(G.heatmap?.enabled)Q=R3(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:s}=await o("stx/pwa/inject",()=>import("./chunk-bzmxbz48.js"));Q=s(Q,G)}let m=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),j0=/\bSTX\.\w+/.test(Q),S0=/window\.STX\s*=/.test(Q);if(m&&j0&&!S0){let p=`<script data-stx-scoped data-stx-run="once">
3591
+ ${B3()}
3592
+ </script>`;if(Q.includes("</head>")){let q0=Q.indexOf("</head>"),V0=Q.slice(0,q0).indexOf("<script");if(V0!==-1){let k0=Q.slice(0,V0),j1=Q.slice(V0);Q=k0+p+`
3593
+ `+j1}else Q=Q.replace("</head>",`${p}
3589
3594
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
3590
- ${c}`);else Q=c+`
3591
- `+Q}{let{scanScriptTags:s}=await o("stx/signal-processing",()=>import("./chunk-r2k2sewg.js")),c=[];for(let K0 of s(Q)){if(!/\bserver\b/i.test(K0.attrs))continue;let Z0=K0.start+K0.fullMatch.indexOf(">")+1,V0=HG(Q,Z0);if(V0===-1)continue;let k0=V0+9;while(k0<Q.length&&/\s/.test(Q[k0]))k0++;c.push({start:K0.start,end:k0})}if(c.length>0){let K0=Array(c.length+1),Z0=0;for(let V0=0;V0<c.length;V0++){let{start:k0,end:j1}=c[V0];K0[V0]=Q.slice(Z0,k0),Z0=j1}K0[c.length]=Q.slice(Z0),Q=K0.join("")}}let y0=b9(Q,J);if(y0.hasScoped)Q=y0.html;let h0=Z.__stx_event_bindings||[],Y0=!1,B0=[],M0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:P0}=await o("stx/signal-processing",()=>import("./chunk-r2k2sewg.js"));for(let s of P0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))B0.push({match:s.fullMatch,attrs:s.attrs,content:s.body});for(let{match:s,attrs:c,content:K0}of B0){Y0=!0;let Z0=K0;b$(K0,J,X.strict,Z.__originalFilePath);let V0=await E9(K0,{eventBindings:h0,attrs:c,hasColonDirectives:M0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(s,()=>V0)}if(Y0)Z.__stx_event_bindings=[];if(!Y0&&Z.__stxProcessingDepth===1){let s=Z.__stx_event_bindings||[];if(s.length>0){let c=g9(s);if(c){let K0=Q.lastIndexOf("</body>");Q=K0===-1?Q+c:Q.slice(0,K0)+c+`
3592
- `+Q.slice(K0)}Z.__stx_event_bindings=[]}}if(!F6(Q)&&w6(Q))Q=await A9(Q,G);if(Q=R6(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=M7(Q,Z.cspNonce);return Q}var wG=[{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"}],RG=[{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')"}],DG=[{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 NG($){let Z=[],J=[];return AG($,Z),MG($,Z,J),IG($,J),TG($,Z),{valid:Z.length===0,errors:Z,warnings:J}}function AG($,Z){let J=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(J!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${J} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function MG($,Z,J){for(let X of wG){let Y=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(Y)||[]).length,z=($.match(Q)||[]).length;if(X.altClose){let q=new RegExp(X.altClose,"g");z+=($.match(q)||[]).length}if(G>z)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${z} closing`,suggestion:`Add ${G-z} missing ${X.close} tag(s)`});else if(z>G)J.push({type:"directive",message:`Extra ${X.close} found: ${z-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function IG($,Z){for(let J of RG)if(J.pattern.test($))Z.push({type:"syntax",message:J.message,suggestion:J.suggestion})}function TG($,Z){for(let J of DG)if(J.pattern.test($))Z.push({type:"expression",message:`Security warning: ${J.message}`,suggestion:"Remove dangerous code from template expressions"})}function kG($,Z){let J=$.slice(0,Z).split(`
3593
- `);return{line:J.length,column:J[J.length-1].length+1}}function EG($,Z,J){let X=[];switch($){case"if":case"elseif":case"unless":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(J.length===0||!J[0].includes(" as "))X.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(J.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(J.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(J.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function bG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function yG($){let Z=$.matchAll(/@([a-z]+)/gi),J=new Set;for(let X of Z){let Y=X[1].toLowerCase();if(!Y.startsWith("end"))J.add(Y)}return Array.from(J)}import r0 from"path";import $2 from"process";var y8=["module","exports","require","props","$props","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"],L8=new Set(y8),CG=new Set(["props","$props","defineProps"]),SG=new Set(["stx","@stacksjs/stx"]),O8=k1(128),F8=k1(64);function PG($){let Z=[],J=0,X=$.split(`
3594
- `);for(let Y of X){let Q=J,G=null,z=!1;for(let q=0;q<Y.length;q++){let K=Y[q];if(z){z=!1;continue}if(K==="\\"){z=!0;continue}if(G){if(K===G)G=null;continue}if(K==="'"||K==='"'||K==="`"){G=K;continue}if(K==="/"&&q+1<Y.length&&Y[q+1]==="/")break;if(K==="{")J++;else if(K==="}")J--}if(Q===0){let q=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let K=Y.match(/(?:const|let|var)\s+(\w+)/);if(K)Z.push(K[1])}else{let K=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let U=K[1].slice(1,-1).split(",").map((H)=>{let j=H.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...U)}}}}return[...new Set(Z)]}function vG($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function J(X){if(!X.includes(":"))return X;let Y=[],Q="",G=0,z=0,q=null;for(let K=0;K<X.length;K++){let W=X[K];if(q){if(Q+=W,W===q)q=null;continue}if(W==='"'||W==="'"||W==="`"){q=W,Q+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")z++;else if(W===")")z--;if(W===","&&G===0&&z===0){Y.push(Q),Q="";continue}Q+=W}if(Q)Y.push(Q);return Y.map((K)=>{let W=K.trim(),U=W.startsWith("..."),H=U?W.slice(3):W,j=-1,B=0;for(let R=0;R<H.length;R++)if(H[R]==="<")B++;else if(H[R]===">")B--;else if(H[R]===":"&&B===0){j=R;break}if(j===-1)return K;let F=H.substring(0,j).trim().replace(/\?$/,""),_=H.substring(j+1),O=-1,L=0;for(let R=0;R<_.length;R++)if(_[R]==="<")L++;else if(_[R]===">")L--;else if(_[R]==="="&&L===0){O=R;break}let w=U?"...":"";if(O!==-1)return`${w}${F} = ${_.substring(O+1).trim()}`;return`${w}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Y,Q)=>{if(!Q.includes(":"))return X;return`${Y}(${J(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=X.exec(Z))!==null){let G=Y.index+Y[0].length-1,z=1,q=G+1,K=0,W=null;while(q<Z.length&&z>0){let j=Z[q];if(W){if(j===W)W=null;q++;continue}if(j==='"'||j==="'"||j==="`"){W=j,q++;continue}if(j==="<")K++;else if(j===">"&&K>0)K--;else if(K===0){if(j==="(")z++;else if(j===")")z--}if(z>0)q++}if(z!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let H=J(U);Q.push({start:G+1,end:q,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Q[G];Z=Z.substring(0,z)+K+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Y)=>{if(!Y.includes(":"))return X;if(Y.includes("{")||Y.includes("}"))return X;return`(${Y.split(",").map((G)=>{let[z,...q]=G.split("="),K=z.split(":")[0].trim();if(q.length>0)return`${K} = ${q.join("=").trim()}`;return K}).join(", ")}) =>`}),Z=Z.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"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
3595
-
3596
- `),Z}function fG($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function xG($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function gG($,Z,J,X={}){if(!$.trim())return;let Y=t1(),Q=H1($,JSON.stringify(Y)),G=O8.get(Q);if(G===void 0){try{let S=P$({loader:"ts",target:"browser",define:Y}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),G=S.transformSync(v)}catch{G=vG($)}O8.set(Q,G)}let z={exports:{}},q=z.exports,K=$2.cwd(),W={},U=[...G.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S)),H=new Map;for(let S of U)try{if(S.startsWith(".")){W[S]=await import(r0.resolve(r0.dirname(J),S));continue}let v=r0.resolve(K,"node_modules",S),p=r0.join(v,"package.json"),$0=JSON.parse(x("fs").readFileSync(p,"utf8")),z0=$0.main||"index.js";if($0.exports){let w0=typeof $0.exports==="string"?$0.exports:$0.exports["."];if(typeof w0==="string")z0=w0;else if(w0?.bun)z0=w0.bun;else if(w0?.import)z0=w0.import;else if(w0?.default)z0=w0.default}W[S]=await import(r0.resolve(v,z0))}catch(v){if(S.startsWith("."))H.set(S,v instanceof Error?v.message:String(v))}let j=(S)=>{if(W[S])return W[S];let v=H.get(S);if(v!==void 0)throw Error(`Cannot require '${S}' from ${J}: ${v}`);return x(S)},B=Z.props||{},V=(S)=>{if(!S)return B;let v={};for(let[p,$0]of Object.entries(S)){let z0=B[p];if(z0!==void 0)v[p]=z0;else if(typeof $0==="function")v[p]=$0();else v[p]=$0}return v};for(let[S,v]of Object.entries(B))Object.defineProperty(V,S,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(B,S))continue;try{Object.defineProperty(V,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let F=(S)=>{if(!S)return B;let v={...B};for(let[p,$0]of Object.entries(S)){let z0=$0&&typeof $0==="object"&&!Array.isArray($0)?$0:{type:$0};if(v[p]===void 0&&z0.default!==void 0)v[p]=typeof z0.default==="function"?z0.default():z0.default}return v},_=()=>Z.slots||{},O=(S,v)=>{let p={...S};for(let[$0,z0]of Object.entries(v))if(p[$0]===void 0)if(typeof z0==="function")p[$0]=z0();else p[$0]=z0;return p},L=(S)=>{let v=()=>S;return v.set=(p)=>{},v.update=(p)=>{},v},w=(S)=>{let v,p=!1;return()=>{if(!p)try{v=S(),p=!0}catch{v=void 0}return v}},R=(S)=>{},D=(S)=>S(),A=(S)=>{},T=(S)=>{},N=N3(Z);function I(S){let v=S||{};if(v.title!==void 0||v.description!==void 0)b({title:v.title,description:v.description})}function k(S){if(!S||typeof S!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,S),Z.__stxClientPayload=v}let M=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",p=S?.path??"",$0=Object.fromEntries(new URLSearchParams(v)),z0=Z.query,w0=Object.keys($0).length>0?$0:z0??{},l0=v||(Object.keys(w0).length>0?`?${new URLSearchParams(w0).toString()}`:"");return{params:Z.params??{},query:w0,path:p,name:"",fullPath:p+l0,hash:"",matched:[]}},y=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),E=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=n2(v,S||{})},b=(S)=>{E(b8(S||{}))},C=(S)=>({value:S}),f=(S)=>S,u=(S)=>({value:typeof S==="function"?S():S}),P=(S,v)=>{},h=(S)=>{},m=(S)=>{},j0=(S)=>S?S():Promise.resolve(),S0=(S)=>(v,...p)=>{},y0=(S)=>{},h0=(S,v)=>{},Y0=(S,v)=>v,B0=()=>({value:"light"}),M0=()=>L(!1),P0=(S)=>L(!1),s=()=>L(!1),c=()=>P0("(prefers-color-scheme: dark)"),K0=()=>P0("(prefers-color-scheme: light)"),Z0=()=>P0("(prefers-reduced-motion: reduce)"),V0=()=>P0("(prefers-contrast: more)"),k0={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:{}},j1=new Proxy(k0,{get(S,v){if(v in S)return S[v];return},set(S,v,p){return S[v]=p,!0}}),J2={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},b2=console;try{let S=C8(G,J),v=new Set(Object.keys(B)),p=Object.keys(Z).filter((r)=>!v.has(r)&&!CG.has(r)&&Z2(r)),$0=p.map((r)=>Z[r]);if(!p.includes("__stxServeContext"))p.push("__stxServeContext"),$0.push(void 0);let z0=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),w0=[],l0=[];for(let[r,a0]of Object.entries(B)){if(!Z2(r))continue;if(z0.has(r))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${r}\\b`).test(S))continue;w0.push(r),l0.push(a0)}let d=PG(S).map((r)=>`module.exports.${r} = typeof ${r} !== 'undefined' ? ${r} : module.exports.${r};`).join(`
3597
- `),l=Z.params??{},G0=[],i=[];for(let r=0;r<p.length;r++){if(p[r]==="params")continue;G0.push(p[r]),i.push($0[r])}let _0=[...y8,...w0,...G0],R0=`return (async () => {
3595
+ ${p}`);else Q=p+`
3596
+ `+Q}{let{scanScriptTags:s}=await o("stx/signal-processing",()=>import("./chunk-v0ne90ft.js")),p=[];for(let q0 of s(Q)){if(!/\bserver\b/i.test(q0.attrs))continue;let Z0=q0.start+q0.fullMatch.indexOf(">")+1,V0=AG(Q,Z0);if(V0===-1)continue;let k0=V0+9;while(k0<Q.length&&/\s/.test(Q[k0]))k0++;p.push({start:q0.start,end:k0})}if(p.length>0){let q0=Array(p.length+1),Z0=0;for(let V0=0;V0<p.length;V0++){let{start:k0,end:j1}=p[V0];q0[V0]=Q.slice(Z0,k0),Z0=j1}q0[p.length]=Q.slice(Z0),Q=q0.join("")}}let y0=y9(Q,J);if(y0.hasScoped)Q=y0.html;let h0=Z.__stx_event_bindings||[],Y0=!1,B0=[],M0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:P0}=await o("stx/signal-processing",()=>import("./chunk-v0ne90ft.js"));for(let s of P0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))B0.push({match:s.fullMatch,attrs:s.attrs,content:s.body});for(let{match:s,attrs:p,content:q0}of B0){Y0=!0;let Z0=q0;C$(q0,J,X.strict,Z.__originalFilePath);let V0=await b9(q0,{eventBindings:h0,attrs:p,hasColonDirectives:M0,templateContent:$,filePath:J,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(s,()=>V0)}if(Y0)Z.__stx_event_bindings=[];if(!Y0&&Z.__stxProcessingDepth===1){let s=Z.__stx_event_bindings||[];if(s.length>0){let p=h9(s);if(p){let q0=Q.lastIndexOf("</body>");Q=q0===-1?Q+p:Q.slice(0,q0)+p+`
3597
+ `+Q.slice(q0)}Z.__stx_event_bindings=[]}}if(!I6(Q)&&T6(Q))Q=await M9(Q,G);if(Q=k6(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=C7(Q,Z.cspNonce);return Q}var CG=[{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"}],SG=[{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')"}],PG=[{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 vG($){let Z=[],J=[];return fG($,Z),xG($,Z,J),gG($,J),hG($,Z),{valid:Z.length===0,errors:Z,warnings:J}}function fG($,Z){let J=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(J!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${J} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function xG($,Z,J){for(let X of CG){let Y=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(Y)||[]).length,z=($.match(Q)||[]).length;if(X.altClose){let q=new RegExp(X.altClose,"g");z+=($.match(q)||[]).length}if(G>z)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${z} closing`,suggestion:`Add ${G-z} missing ${X.close} tag(s)`});else if(z>G)J.push({type:"directive",message:`Extra ${X.close} found: ${z-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function gG($,Z){for(let J of SG)if(J.pattern.test($))Z.push({type:"syntax",message:J.message,suggestion:J.suggestion})}function hG($,Z){for(let J of PG)if(J.pattern.test($))Z.push({type:"expression",message:`Security warning: ${J.message}`,suggestion:"Remove dangerous code from template expressions"})}function uG($,Z){let J=$.slice(0,Z).split(`
3598
+ `);return{line:J.length,column:J[J.length-1].length+1}}function dG($,Z,J){let X=[];switch($){case"if":case"elseif":case"unless":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(J.length===0||!J[0].includes(" as "))X.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(J.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(J.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(J.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(J.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function mG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function lG($){let Z=$.matchAll(/@([a-z]+)/gi),J=new Set;for(let X of Z){let Y=X[1].toLowerCase();if(!Y.startsWith("end"))J.add(Y)}return Array.from(J)}import r0 from"path";import $2 from"process";var g8=["module","exports","require","props","$props","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"],A8=new Set(g8),cG=new Set(["props","$props","defineProps"]),pG=new Set(["stx","@stacksjs/stx"]),M8=k1(128),I8=k1(64);function iG($){let Z=[],J=0,X=$.split(`
3599
+ `);for(let Y of X){let Q=J,G=null,z=!1;for(let q=0;q<Y.length;q++){let K=Y[q];if(z){z=!1;continue}if(K==="\\"){z=!0;continue}if(G){if(K===G)G=null;continue}if(K==="'"||K==='"'||K==="`"){G=K;continue}if(K==="/"&&q+1<Y.length&&Y[q+1]==="/")break;if(K==="{")J++;else if(K==="}")J--}if(Q===0){let q=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let K=Y.match(/(?:const|let|var)\s+(\w+)/);if(K)Z.push(K[1])}else{let K=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let U=K[1].slice(1,-1).split(",").map((H)=>{let j=H.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...U)}}}}return[...new Set(Z)]}function nG($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function J(X){if(!X.includes(":"))return X;let Y=[],Q="",G=0,z=0,q=null;for(let K=0;K<X.length;K++){let W=X[K];if(q){if(Q+=W,W===q)q=null;continue}if(W==='"'||W==="'"||W==="`"){q=W,Q+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")z++;else if(W===")")z--;if(W===","&&G===0&&z===0){Y.push(Q),Q="";continue}Q+=W}if(Q)Y.push(Q);return Y.map((K)=>{let W=K.trim(),U=W.startsWith("..."),H=U?W.slice(3):W,j=-1,B=0;for(let R=0;R<H.length;R++)if(H[R]==="<")B++;else if(H[R]===">")B--;else if(H[R]===":"&&B===0){j=R;break}if(j===-1)return K;let F=H.substring(0,j).trim().replace(/\?$/,""),_=H.substring(j+1),O=-1,L=0;for(let R=0;R<_.length;R++)if(_[R]==="<")L++;else if(_[R]===">")L--;else if(_[R]==="="&&L===0){O=R;break}let w=U?"...":"";if(O!==-1)return`${w}${F} = ${_.substring(O+1).trim()}`;return`${w}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Y,Q)=>{if(!Q.includes(":"))return X;return`${Y}(${J(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=X.exec(Z))!==null){let G=Y.index+Y[0].length-1,z=1,q=G+1,K=0,W=null;while(q<Z.length&&z>0){let j=Z[q];if(W){if(j===W)W=null;q++;continue}if(j==='"'||j==="'"||j==="`"){W=j,q++;continue}if(j==="<")K++;else if(j===">"&&K>0)K--;else if(K===0){if(j==="(")z++;else if(j===")")z--}if(z>0)q++}if(z!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let H=J(U);Q.push({start:G+1,end:q,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Q[G];Z=Z.substring(0,z)+K+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Y)=>{if(!Y.includes(":"))return X;if(Y.includes("{")||Y.includes("}"))return X;return`(${Y.split(",").map((G)=>{let[z,...q]=G.split("="),K=z.split(":")[0].trim();if(q.length>0)return`${K} = ${q.join("=").trim()}`;return K}).join(", ")}) =>`}),Z=Z.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"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
3600
+
3601
+ `),Z}function sG($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function oG($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function rG($,Z,J,X={}){if(!$.trim())return;let Y=t1(),Q=H1($,JSON.stringify(Y)),G=M8.get(Q);if(G===void 0){try{let S=f$({loader:"ts",target:"browser",define:Y}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),G=S.transformSync(v)}catch{G=nG($)}M8.set(Q,G)}let z={exports:{}},q=z.exports,K=$2.cwd(),W={},U=[...G.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S)),H=new Map;for(let S of U)try{if(S.startsWith(".")){W[S]=await import(r0.resolve(r0.dirname(J),S));continue}let v=r0.resolve(K,"node_modules",S),i=r0.join(v,"package.json"),$0=JSON.parse(x("fs").readFileSync(i,"utf8")),z0=$0.main||"index.js";if($0.exports){let w0=typeof $0.exports==="string"?$0.exports:$0.exports["."];if(typeof w0==="string")z0=w0;else if(w0?.bun)z0=w0.bun;else if(w0?.import)z0=w0.import;else if(w0?.default)z0=w0.default}W[S]=await import(r0.resolve(v,z0))}catch(v){if(S.startsWith("."))H.set(S,v instanceof Error?v.message:String(v))}let j=(S)=>{if(W[S])return W[S];let v=H.get(S);if(v!==void 0)throw Error(`Cannot require '${S}' from ${J}: ${v}`);return x(S)},B=Z.props||{},V=(S)=>{if(!S)return B;let v={};for(let[i,$0]of Object.entries(S)){let z0=B[i];if(z0!==void 0)v[i]=z0;else if(typeof $0==="function")v[i]=$0();else v[i]=$0}return v};for(let[S,v]of Object.entries(B))Object.defineProperty(V,S,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(B,S))continue;try{Object.defineProperty(V,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let F=(S)=>{if(!S)return B;let v={...B};for(let[i,$0]of Object.entries(S)){let z0=$0&&typeof $0==="object"&&!Array.isArray($0)?$0:{type:$0};if(v[i]===void 0&&z0.default!==void 0)v[i]=typeof z0.default==="function"?z0.default():z0.default}return v},_=()=>Z.slots||{},O=(S,v)=>{let i={...S};for(let[$0,z0]of Object.entries(v))if(i[$0]===void 0)if(typeof z0==="function")i[$0]=z0();else i[$0]=z0;return i},L=(S)=>{let v=()=>S;return v.set=(i)=>{},v.update=(i)=>{},v},w=(S)=>{let v,i=!1;return()=>{if(!i)try{v=S(),i=!0}catch{v=void 0}return v}},R=(S)=>{},N=(S)=>S(),A=(S)=>{},T=(S)=>{},D=k3(Z);function M(S){let v=S||{};if(v.title!==void 0||v.description!==void 0)b({title:v.title,description:v.description})}function k(S){if(!S||typeof S!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,S),Z.__stxClientPayload=v}let I=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",i=S?.path??"",$0=Object.fromEntries(new URLSearchParams(v)),z0=Z.query,w0=Object.keys($0).length>0?$0:z0??{},l0=v||(Object.keys(w0).length>0?`?${new URLSearchParams(w0).toString()}`:"");return{params:Z.params??{},query:w0,path:i,name:"",fullPath:i+l0,hash:"",matched:[]}},y=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),E=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=s2(v,S||{})},b=(S)=>{E(x8(S||{}))},C=(S)=>({value:S}),f=(S)=>S,u=(S)=>({value:typeof S==="function"?S():S}),P=(S,v)=>{},h=(S)=>{},m=(S)=>{},j0=(S)=>S?S():Promise.resolve(),S0=(S)=>(v,...i)=>{},y0=(S)=>{},h0=(S,v)=>{},Y0=(S,v)=>v,B0=()=>({value:"light"}),M0=()=>L(!1),P0=(S)=>L(!1),s=()=>L(!1),p=()=>P0("(prefers-color-scheme: dark)"),q0=()=>P0("(prefers-color-scheme: light)"),Z0=()=>P0("(prefers-reduced-motion: reduce)"),V0=()=>P0("(prefers-contrast: more)"),k0={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:{}},j1=new Proxy(k0,{get(S,v){if(v in S)return S[v];return},set(S,v,i){return S[v]=i,!0}}),J2={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},y2=console;try{let S=h8(G,J),v=new Set(Object.keys(B)),i=Object.keys(Z).filter((r)=>!v.has(r)&&!cG.has(r)&&Z2(r)),$0=i.map((r)=>Z[r]);if(!i.includes("__stxServeContext"))i.push("__stxServeContext"),$0.push(void 0);let z0=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),w0=[],l0=[];for(let[r,a0]of Object.entries(B)){if(!Z2(r))continue;if(z0.has(r))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${r}\\b`).test(S))continue;w0.push(r),l0.push(a0)}let d=iG(S).map((r)=>`module.exports.${r} = typeof ${r} !== 'undefined' ? ${r} : module.exports.${r};`).join(`
3602
+ `),l=Z.params??{},G0=[],n=[];for(let r=0;r<i.length;r++){if(i[r]==="params")continue;G0.push(i[r]),n.push($0[r])}let _0=[...g8,...w0,...G0],R0=`return (async () => {
3598
3603
  ${S}
3599
3604
  ${d}
3600
3605
  return module.exports
3601
- })()`,f0=H1(R0,_0.join("\x00")),c0=F8.get(f0);if(!c0)c0=Function(..._0,R0),F8.set(f0,c0);let C0=Z.__stx_options?.runtimeConfig;if(C0||/\buse(?:Server)?RuntimeConfig\b/.test(G))await y9(Z,J,C0);let J1=await M8(Z.__stx_runtime_config??I8()??E8(),()=>X6(Z,()=>c0(z,q,j,B,V,F,O,k,Y6,k8,T8,L,w,R,D,A,T,I,M,y,E,b,N.setResponseStatus,N.setResponseHeader,N.notFound,C,f,u,P,h,m,j0,S0,y0,_,h0,Y0,B0,M0,P0,s,c,K0,Z0,V0,j1,J2,b2,k0.confirm,k0.alert,k0.fetch,l,...l0,...i)));if(X.preserveExisting){for(let[r,a0]of Object.entries(J1))if(!(r in Z)||Z[r]===void 0)Z[r]=a0}else Object.assign(Z,J1);for(let[r,a0]of Object.entries(B))if(!(r in Z))Z[r]=a0}catch(S){if(Z.__stx_strict_hydration)throw S;let v=S instanceof Error?S.message:String(S);if(fG(v))console.warn(`[stx] server <script> in ${J??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(xG(v))console.warn(`[stx] server <script> in ${J??"<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: ${v}`);else if($2.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${J??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await iG(G,Z,J)}catch(p){if($2.env.STX_DEBUG){let $0=p instanceof Error?p.message:String(p);console.warn(`[stx] fallback extraction also failed in ${J??"<unknown>"}: ${$0}`)}}}}function hG($){let Z=0,J=null,X=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G===J){if(J=null,X||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)X=!0}return J===null&&Z===0&&Y}var uG=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function C8($,Z){let J=Z?r0.dirname(Z):$2.cwd(),X=$2.cwd(),Y=$.split(`
3606
+ })()`,f0=H1(R0,_0.join("\x00")),c0=I8.get(f0);if(!c0)c0=Function(..._0,R0),I8.set(f0,c0);let C0=Z.__stx_options?.runtimeConfig;if(C0||/\buse(?:Server)?RuntimeConfig\b/.test(G))await C9(Z,J,C0);let J1=await C8(Z.__stx_runtime_config??S8()??f8(),()=>W6(Z,()=>c0(z,q,j,B,V,F,O,k,U6,v8,P8,L,w,R,N,A,T,M,I,y,E,b,D.setResponseStatus,D.setResponseHeader,D.notFound,C,f,u,P,h,m,j0,S0,y0,_,h0,Y0,B0,M0,P0,s,p,q0,Z0,V0,j1,J2,y2,k0.confirm,k0.alert,k0.fetch,l,...l0,...n)));if(X.preserveExisting){for(let[r,a0]of Object.entries(J1))if(!(r in Z)||Z[r]===void 0)Z[r]=a0}else Object.assign(Z,J1);for(let[r,a0]of Object.entries(B))if(!(r in Z))Z[r]=a0}catch(S){if(Z.__stx_strict_hydration)throw S;let v=S instanceof Error?S.message:String(S);if(sG(v))console.warn(`[stx] server <script> in ${J??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(oG(v))console.warn(`[stx] server <script> in ${J??"<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: ${v}`);else if($2.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${J??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await Yz(G,Z,J)}catch(i){if($2.env.STX_DEBUG){let $0=i instanceof Error?i.message:String(i);console.warn(`[stx] fallback extraction also failed in ${J??"<unknown>"}: ${$0}`)}}}}function aG($){let Z=0,J=null,X=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G===J){if(J=null,X||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)X=!0}return J===null&&Z===0&&Y}var tG=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function h8($,Z){let J=Z?r0.dirname(Z):$2.cwd(),X=$2.cwd(),Y=$.split(`
3602
3607
  `),Q=[],G=0;while(G<Y.length){let z=Y[G].trim();if(z.startsWith("interface ")||z.startsWith("export interface ")||z.startsWith("type ")||z.startsWith("export type ")){if(z.includes("{")&&!z.includes("}")){let q=0;for(;G<Y.length;G++){for(let K of Y[G])if(K==="{")q++;else if(K==="}")q--;if(q<=0)break}}G++;continue}if(z.startsWith("definePageMeta(")){let q=0,K=!1,W=G;for(let j=G;j<Y.length&&!K;j++){let B=null,V=!1,F=Y[j];for(let _=0;_<F.length;_++){let O=F[_];if(V){V=!1;continue}if(O==="\\"){V=!0;continue}if(B){if(O===B)B=null;continue}if(O==='"'||O==="'"||O==="`"){B=O;continue}if(O==="(")q++;else if(O===")"){if(q--,q===0){G=j+1,K=!0;break}}}}if(!K)G=Y.length;let U=Y.slice(W,G).join(`
3603
- `),H=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(B)H.push(`${j}: ${JSON.stringify(B[2])}`)}if(H.length>0)Q.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let q=z,K=0;while(!hG(q)&&G+K+1<Y.length)K++,q=`${q} ${Y[G+K].trim()}`;G+=K;let W=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=q.match(/^import\s+['"](.+?)['"]/),j=q,B=(V)=>{if(V.startsWith("."))return r0.resolve(J,V);if(V.startsWith("~/")||V.startsWith("@/"))return r0.resolve(X,V.slice(2));return V};if(W){let[,V,F]=W,_=B(F);Q.push(`const ${V} = (await import('${_}')).default`),Q.push(`module.exports.${V} = ${V};`)}else if(U){let[,V,F]=U,_=B(F),O=[],L=[],w=SG.has(F);for(let R of V.split(",")){let D=R.trim();if(!D)continue;let A=D.split(/\s+as\s+/);if(A.length===2){let[T,N]=[A[0].trim(),A[1].trim()];if(w&&L8.has(T)){Q.push(`const ${N} = ${T};`);continue}O.push(`${T}: ${N}`),L.push(N)}else{if(w&&L8.has(D))continue;O.push(D),L.push(D)}}if(O.length>0)Q.push(`const { ${O.join(", ")} } = await import('${_}')`);for(let R of L)Q.push(`module.exports.${R} = ${R};`)}else if(H){let V=B(H[1]);Q.push(`await import('${V}')`)}else Q.push(j);G++;continue}if(uG.test(z))Q.push(Y[G]),G++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let q=R8(Y,G),{type:K,name:W,value:U}=q;Q.push(`${K} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),G=q.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let q=S$(Y,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let q=R8(Y,G),{type:K,name:W,value:U}=q;Q.push(`${K} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),G=q.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let q=S$(Y,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let q=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),K=[...Y];K[G]=q;let W=S$(K,G);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);G=W.nextIndex}else if(z.startsWith("export default ")){let q=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${q};`),G++}else if(z.startsWith("class ")||z.startsWith("export class ")){let q=z.match(/(?:export\s+)?class\s+(\w+)/);if(q){let K=q[1],W=Y[G].replace(/^export\s+/,""),U=0,H=G;for(;H<Y.length;H++){let j=Y[H];for(let B of j)if(B==="{")U++;else if(B==="}")U--;if(H>G)W+=`
3604
- `+j;if(U<=0&&H>=G)break}Q.push(W),Q.push(`module.exports.${K} = ${K};`),G=H+1}else Q.push(z),G++}else if(z.includes("module.exports"))Q.push(z),G++;else if(z.trim()&&!z.startsWith("//"))Q.push(z),G++;else G++}return dG(Q.join(`
3605
- `),J,X)}function dG($,Z,J){let X=$.length,Y="",Q=0,G=null,z=!1,q=!1,K=0;while(Q<X){let W=$[Q],U=$[Q+1];if(z){if(Y+=W,W===`
3606
- `)z=!1;Q++;continue}if(q){if(Y+=W,W==="*"&&U==="/"){Y+=U,Q+=2,q=!1;continue}Q++;continue}if(!G&&W==="/"&&U==="/"){z=!0,Y+=W,Q++;continue}if(!G&&W==="/"&&U==="*"){q=!0,Y+=W,Q++;continue}if(G){if(Y+=W,W==="\\"){Y+=U,Q+=2;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(W==="$"&&U==="{"){K++,Y+=U,Q+=2;continue}if(W==="`"){G=null,Q++;continue}}Q++;continue}if(K>0){if(W==="{")K++;else if(W==="}")K--}if(W==='"'||W==="'"||W==="`"){G=W,Y+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let H=mG($,Q);if(H){let{quote:j,path:B,end:V}=H;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let F=B.startsWith(".")?r0.resolve(Z,B):r0.resolve(J,B.slice(2));Y+=`await import(${j}${F}${j})`,Q=V;continue}}}Y+=W,Q++}return Y}function mG($,Z){let J=Z+5;if(J>=$.length)return null;if(!/\s/.test($[J]))return null;while(J<$.length&&/\s/.test($[J]))J++;if(!$.startsWith("import",J))return null;J+=6;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;J++;while(J<$.length&&/\s/.test($[J]))J++;let X=$[J];if(X!=="'"&&X!=='"')return null;J++;let Y=J;while(J<$.length&&$[J]!==X)if($[J]==="\\")J+=2;else J++;if(J>=$.length)return null;let Q=$.slice(Y,J);J++;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!==")")return null;return{quote:X,path:Q,end:J+1}}function S8($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Y=L0($,J,J==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function P8($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let X=0,Y=0,Q="";while(X<J.length){let G=J[X];if(G==="{"||G==="["){let z=Y===0?S8(J,X):null;if(z){Z.push(...P8(z.pattern)),X=z.endPos,Q="";continue}Y++}else if(G==="}"||G==="]")Y--;if(Y>0){X++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",X++;continue}if(G===":"){Q="",X++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",X++;while(X<J.length&&J[X]!==","&&Y===0){if(J[X]==="{"||J[X]==="[")Y++;else if(J[X]==="}"||J[X]==="]")Y--;X++}continue}if(/[\w$]/.test(G))Q+=G;X++}if(Q.trim())Z.push(Q.trim());return Z}function lG($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let J=Z[0].length,X=(Y)=>Y===" "||Y==="\t";while(J<$.length&&X($[J]))J++;if($[J]===":"){let Y=0,Q=null;J++;for(;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Y++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Y--;continue}if(G==="="&&Y<=0){let z=$[J+1],q=$[J-1];if(z!=="="&&z!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[J]!=="=")return null}while(J<$.length&&X($[J]))J++;if($[J]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(J+1).trim()}}function w8($,Z,J,X){let Y=null,Q=!1;for(let G of $){if(Q){Q=!1;continue}if(G==="\\"){Q=!0;continue}if(Y){if(G===Y)Y=null;continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G===Z)X++;else if(G===J)X--}return X}function R8($,Z){let J=$[Z].trim(),X=lG(J),Y=X?[J,X.type,X.name,X.value]:null;if(!Y){let W=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let U=J.slice(W[0].length),H=Z;if(U.startsWith("{")||U.startsWith("[")){let B=U[0],V=B==="{"?"}":"]",F=w8(U,B,V,0),_=U;for(let O=Z+1;O<$.length&&F>0;O++)_+=` ${$[O].trim()}`,H=O,F=w8($[O],B,V,F);if(F>0)_=U,H=Z;U=_}let j=S8(U,0);if(j){let B=W[1],V=j.pattern,F=U.slice(j.endPos).trim();if(F.startsWith("=")){let _=F.slice(1).trim(),O=_,L=Math.max(H,Z);if(D8(_)){let A=N8($,L,_);O=A.value,L=A.nextIndex}else L=L+1;O=O.trim().replace(/;$/,"");let w=P8(V),R=`__stx_src_${Z}`,D=w.map((A)=>`module.exports.${A} = ${A};`).join(`
3608
+ `),H=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(B)H.push(`${j}: ${JSON.stringify(B[2])}`)}if(H.length>0)Q.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let q=z,K=0;while(!aG(q)&&G+K+1<Y.length)K++,q=`${q} ${Y[G+K].trim()}`;G+=K;let W=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=q.match(/^import\s+['"](.+?)['"]/),j=q,B=(V)=>{if(V.startsWith("."))return r0.resolve(J,V);if(V.startsWith("~/")||V.startsWith("@/"))return r0.resolve(X,V.slice(2));return V};if(W){let[,V,F]=W,_=B(F);Q.push(`const ${V} = (await import('${_}')).default`),Q.push(`module.exports.${V} = ${V};`)}else if(U){let[,V,F]=U,_=B(F),O=[],L=[],w=pG.has(F);for(let R of V.split(",")){let N=R.trim();if(!N)continue;let A=N.split(/\s+as\s+/);if(A.length===2){let[T,D]=[A[0].trim(),A[1].trim()];if(w&&A8.has(T)){Q.push(`const ${D} = ${T};`);continue}O.push(`${T}: ${D}`),L.push(D)}else{if(w&&A8.has(N))continue;O.push(N),L.push(N)}}if(O.length>0)Q.push(`const { ${O.join(", ")} } = await import('${_}')`);for(let R of L)Q.push(`module.exports.${R} = ${R};`)}else if(H){let V=B(H[1]);Q.push(`await import('${V}')`)}else Q.push(j);G++;continue}if(tG.test(z))Q.push(Y[G]),G++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let q=k8(Y,G),{type:K,name:W,value:U}=q;Q.push(`${K} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),G=q.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let q=v$(Y,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let q=k8(Y,G),{type:K,name:W,value:U}=q;Q.push(`${K} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),G=q.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let q=v$(Y,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let q=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),K=[...Y];K[G]=q;let W=v$(K,G);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);G=W.nextIndex}else if(z.startsWith("export default ")){let q=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${q};`),G++}else if(z.startsWith("class ")||z.startsWith("export class ")){let q=z.match(/(?:export\s+)?class\s+(\w+)/);if(q){let K=q[1],W=Y[G].replace(/^export\s+/,""),U=0,H=G;for(;H<Y.length;H++){let j=Y[H];for(let B of j)if(B==="{")U++;else if(B==="}")U--;if(H>G)W+=`
3609
+ `+j;if(U<=0&&H>=G)break}Q.push(W),Q.push(`module.exports.${K} = ${K};`),G=H+1}else Q.push(z),G++}else if(z.includes("module.exports"))Q.push(z),G++;else if(z.trim()&&!z.startsWith("//"))Q.push(z),G++;else G++}return eG(Q.join(`
3610
+ `),J,X)}function eG($,Z,J){let X=$.length,Y="",Q=0,G=null,z=!1,q=!1,K=0;while(Q<X){let W=$[Q],U=$[Q+1];if(z){if(Y+=W,W===`
3611
+ `)z=!1;Q++;continue}if(q){if(Y+=W,W==="*"&&U==="/"){Y+=U,Q+=2,q=!1;continue}Q++;continue}if(!G&&W==="/"&&U==="/"){z=!0,Y+=W,Q++;continue}if(!G&&W==="/"&&U==="*"){q=!0,Y+=W,Q++;continue}if(G){if(Y+=W,W==="\\"){Y+=U,Q+=2;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(W==="$"&&U==="{"){K++,Y+=U,Q+=2;continue}if(W==="`"){G=null,Q++;continue}}Q++;continue}if(K>0){if(W==="{")K++;else if(W==="}")K--}if(W==='"'||W==="'"||W==="`"){G=W,Y+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let H=$z($,Q);if(H){let{quote:j,path:B,end:V}=H;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let F=B.startsWith(".")?r0.resolve(Z,B):r0.resolve(J,B.slice(2));Y+=`await import(${j}${F}${j})`,Q=V;continue}}}Y+=W,Q++}return Y}function $z($,Z){let J=Z+5;if(J>=$.length)return null;if(!/\s/.test($[J]))return null;while(J<$.length&&/\s/.test($[J]))J++;if(!$.startsWith("import",J))return null;J+=6;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;J++;while(J<$.length&&/\s/.test($[J]))J++;let X=$[J];if(X!=="'"&&X!=='"')return null;J++;let Y=J;while(J<$.length&&$[J]!==X)if($[J]==="\\")J+=2;else J++;if(J>=$.length)return null;let Q=$.slice(Y,J);J++;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!==")")return null;return{quote:X,path:Q,end:J+1}}function u8($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Y=L0($,J,J==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function d8($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let X=0,Y=0,Q="";while(X<J.length){let G=J[X];if(G==="{"||G==="["){let z=Y===0?u8(J,X):null;if(z){Z.push(...d8(z.pattern)),X=z.endPos,Q="";continue}Y++}else if(G==="}"||G==="]")Y--;if(Y>0){X++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",X++;continue}if(G===":"){Q="",X++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",X++;while(X<J.length&&J[X]!==","&&Y===0){if(J[X]==="{"||J[X]==="[")Y++;else if(J[X]==="}"||J[X]==="]")Y--;X++}continue}if(/[\w$]/.test(G))Q+=G;X++}if(Q.trim())Z.push(Q.trim());return Z}function Zz($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let J=Z[0].length,X=(Y)=>Y===" "||Y==="\t";while(J<$.length&&X($[J]))J++;if($[J]===":"){let Y=0,Q=null;J++;for(;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Y++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Y--;continue}if(G==="="&&Y<=0){let z=$[J+1],q=$[J-1];if(z!=="="&&z!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[J]!=="=")return null}while(J<$.length&&X($[J]))J++;if($[J]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(J+1).trim()}}function T8($,Z,J,X){let Y=null,Q=!1;for(let G of $){if(Q){Q=!1;continue}if(G==="\\"){Q=!0;continue}if(Y){if(G===Y)Y=null;continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G===Z)X++;else if(G===J)X--}return X}function k8($,Z){let J=$[Z].trim(),X=Zz(J),Y=X?[J,X.type,X.name,X.value]:null;if(!Y){let W=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let U=J.slice(W[0].length),H=Z;if(U.startsWith("{")||U.startsWith("[")){let B=U[0],V=B==="{"?"}":"]",F=T8(U,B,V,0),_=U;for(let O=Z+1;O<$.length&&F>0;O++)_+=` ${$[O].trim()}`,H=O,F=T8($[O],B,V,F);if(F>0)_=U,H=Z;U=_}let j=u8(U,0);if(j){let B=W[1],V=j.pattern,F=U.slice(j.endPos).trim();if(F.startsWith("=")){let _=F.slice(1).trim(),O=_,L=Math.max(H,Z);if(E8(_)){let A=b8($,L,_);O=A.value,L=A.nextIndex}else L=L+1;O=O.trim().replace(/;$/,"");let w=d8(V),R=`__stx_src_${Z}`,N=w.map((A)=>`module.exports.${A} = ${A};`).join(`
3607
3612
  `);return{type:B,name:R,value:`${O}; ${B} ${V} = ${R};
3608
- ${D}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,G,z]=Y,q=z,K=Z;if(D8(z)){let W=N8($,Z,z);q=W.value,K=W.nextIndex}else K=Z+1;while(K<$.length){let W=$[K].trim();if(W.startsWith(".")||W.startsWith("?."))q+=`
3609
- ${$[K]}`,K++;else break}return q=q.trim().replace(/;$/,""),{type:Q,name:G,value:q,nextIndex:K}}function S$($,Z){let J=$[Z].trim(),X=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${J}`);let[,Y]=X,Q=J.replace(/^export\s+/,""),G=Z;if(cG(J)){let z=pG($,Z,Q);Q=z.functionCode,G=z.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function D8($){let Z=$.trim();if(Z.startsWith("{"))return L0(Z,"{","}",0)===-1;if(Z.startsWith("["))return L0(Z,"[","]",0)===-1;return!v8(Z)}function v8($){let Z={paren:0,bracket:0,brace:0},J=null,X=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J)continue;if((Q==='"'||Q==="'")&&!J){J=Q;continue}if(Q===J&&J!=="`"){J=null;continue}if(Q==="`"&&!J){J="`";continue}if(Q==="`"&&J==="`"&&X===0){J=null;continue}if(J==="`"&&Q==="$"&&$[Y+1]==="{"){X++,Y++;continue}if(X>0&&Q==="{"){X++;continue}if(X>0&&Q==="}"){X--;continue}if(J)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function f8($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let J=L0($,"(",")",Z);if(J===-1)return-1;return $.indexOf("{",J)}function cG($){let Z=f8($);if(Z===-1)return!0;return L0($,"{","}",Z)===-1}function N8($,Z,J){let X=J,Y=Z+1;while(Y<$.length&&!v8(X)){let Q=$[Y];X+=`
3613
+ ${N}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,G,z]=Y,q=z,K=Z;if(E8(z)){let W=b8($,Z,z);q=W.value,K=W.nextIndex}else K=Z+1;while(K<$.length){let W=$[K].trim();if(W.startsWith(".")||W.startsWith("?."))q+=`
3614
+ ${$[K]}`,K++;else break}return q=q.trim().replace(/;$/,""),{type:Q,name:G,value:q,nextIndex:K}}function v$($,Z){let J=$[Z].trim(),X=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${J}`);let[,Y]=X,Q=J.replace(/^export\s+/,""),G=Z;if(Jz(J)){let z=Xz($,Z,Q);Q=z.functionCode,G=z.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function E8($){let Z=$.trim();if(Z.startsWith("{"))return L0(Z,"{","}",0)===-1;if(Z.startsWith("["))return L0(Z,"[","]",0)===-1;return!m8(Z)}function m8($){let Z={paren:0,bracket:0,brace:0},J=null,X=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J)continue;if((Q==='"'||Q==="'")&&!J){J=Q;continue}if(Q===J&&J!=="`"){J=null;continue}if(Q==="`"&&!J){J="`";continue}if(Q==="`"&&J==="`"&&X===0){J=null;continue}if(J==="`"&&Q==="$"&&$[Y+1]==="{"){X++,Y++;continue}if(X>0&&Q==="{"){X++;continue}if(X>0&&Q==="}"){X--;continue}if(J)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function l8($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let J=L0($,"(",")",Z);if(J===-1)return-1;return $.indexOf("{",J)}function Jz($){let Z=l8($);if(Z===-1)return!0;return L0($,"{","}",Z)===-1}function b8($,Z,J){let X=J,Y=Z+1;while(Y<$.length&&!m8(X)){let Q=$[Y];X+=`
3610
3615
  ${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
3611
- ${$[Y]}`,Y++;else break}return{value:X,nextIndex:Y}}function pG($,Z,J){let X=J,Y=Z+1;while(Y<$.length){let Q=f8(X);if(Q!==-1){if(L0(X,"{","}",Q)!==-1)break}let G=$[Y];X+=`
3612
- ${G}`,Y++}return{functionCode:X,nextIndex:Y}}function A8($,Z){let J=e($,Z)??e(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...$2.env}})},Y=Object.keys(X).filter(Z2),Q=Y.map((G)=>X[G]);try{return Function(...Y,`'use strict'; return (${$});`)(...Q)}catch{try{return Function(...Y,`'use strict'; return ${$};`)(...Q)}catch{return}}}async function iG($,Z,J){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,z]=Q;try{let q=z.trim().replace(/;$/,""),K=A8(q,Z);if(K!==void 0)Z[G]=K}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,z]=Q;if(!(G in Z))try{let q=z.trim().replace(/;$/,""),K=A8(q,Z);if(K!==void 0)Z[G]=K}catch{}}}function nG($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:X}}function sG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var k2=new i1(500),S9=new i1(1000),c8=33554432,f$=c8;function oG($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===f$)return;f$=Z,P9.setMaxBytes(Z)}var P9=new i1(2000,{maxBytes:c8,sizeOf:($)=>$.output.length});function rG($){let Z=new WeakSet;try{let J=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(J);let Y={};for(let Q of Object.keys(X).sort())Y[Q]=J(X[Q]);return Y};return JSON.stringify(J($))}catch{return null}}function x8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function aG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!aG($)}var C9=new Map;function P$($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=C9.get(Z);if(J)return J;if(C9.size>=16)C9.clear();let X=new Bun.Transpiler($);return C9.set(Z,X),X}var g8=new WeakMap,tG=256;function M1($){try{let Z=P$({loader:"ts",target:"browser",define:t1()}),J=g8.get(Z);if(!J)J=new Map,g8.set(Z,J);let X=J.get($);if(X!==void 0)return X;let Y=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Y=Y.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Q=[];Y=Y.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let q=Q.length;return Q.push(z),`"__STX_EXPR_${q}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let q=Q.length;return Q.push(z),`"__STX_EXPR_${q}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let q=Q.length;return Q.push(z),`"__STX_EXPR_${q}__"`});let G=Z.transformSync(Y);for(let z=0;z<Q.length;z++)G=G.replace(`"__STX_EXPR_${z}__"`,Q[z]),G=G.replace(`'__STX_EXPR_${z}__'`,Q[z]);if(J.size>=tG){let z=J.keys().next();if(!z.done)J.delete(z.value)}return J.set($,G),G}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function eG($){let Z=[],J=new Set,X=0,Y=0,Q=$.length,G=(W)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===W){Y++;return}Y++}},z=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let W=1;while(Y<Q&&W>0)if($[Y]==="{")W++,Y++;else if($[Y]==="}")W--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")z();else Y++;continue}Y++}},q=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
3613
- `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(X!==0)return;let W=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let U=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(q())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))K();Y++}return Z}function $z($){let Z=[],J=0,X=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function Zz($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J=null;continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Jz($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Y=X,Q=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let q of $z(z)){let K=q.trim();if(!K||K.startsWith("..."))continue;let W=Zz(K);if(W===-1)continue;let U=K.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let H=K.slice(W+1).trim();if(!H)continue;try{let j=Object.keys(Z).filter(Z2),B=Function(...j,`"use strict"; return (${H});`);Z[U]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}async function U9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(_)=>_.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),z=(_)=>_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=J.__importedComponents;if(q){for(let _ of[Q,Q.toLowerCase(),G(Q),z(Q)])if(q.has(_))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],W=typeof Y.root==="string"?g.resolve(Y.root):void 0,U=W??g.dirname(X),H=[],j=(_)=>{if(_&&!H.includes(_))H.push(_)},B=J.__originalFilePath;if(B)j(g.join(g.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(g.join(g.dirname(X),"components")),j(Y.componentsDir),W)j(g.resolve(W,"resources/views/components")),j(g.resolve(W,"resources/components")),j(g.resolve(W,"src/components")),j(g.resolve(W,"components"));for(let _ of Y._layerComponentDirs??[])j(_);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let _ of V)j(typeof _==="string"?_:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return a(g.resolve(g.dirname(X),`${Q}.stx`));let F=h8(g.resolve(import.meta.dir,"components"));for(let _ of H){let O=g.isAbsolute(_)?_:g.resolve(U,_);if(h8(O)===F)continue;for(let L of K)if(await a(g.join(O,L)))return!0}return!1}function h8($){try{return l8.realpathSync($)}catch{return $}}function Xz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Yz($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function Qz($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function N1($,Z,J,X,Y,Q,G,z=new Set,q){let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-qpzxgkc5.js")),W=z??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let U=new Set(W);U.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=H&&H!=="load"&&Xz(H)?H:"";try{let B=(d)=>d.split("-").map((l)=>l.charAt(0).toUpperCase()+l.slice(1)).join(""),V=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,_=null,O=Y.__importedComponents;if(O){let d=[F,F.toLowerCase(),B(F),V(F)];for(let l of d)if(O.has(l)){_=O.get(l);break}}let L=[];if(!_){let d=[`${F}.stx`,`${B(F)}.stx`,`${V(F)}.stx`],l=[...new Set(d)],G0=Y.__originalFilePath,i=[];if(i.push(...G._layerComponentDirs??[]),G0){let D0=g.join(g.dirname(G0),"components");i.push(D0)}if(X)i.push(X);let _0=G._rootComponentsDir;if(typeof _0==="string"&&!i.includes(_0))i.push(_0);let R0=g.join(g.dirname(Q),"components");if(!i.includes(R0))i.push(R0);if(G.componentsDir&&G.componentsDir!==X&&!i.includes(G.componentsDir))i.push(G.componentsDir);let f0=typeof G.root==="string"?g.resolve(G.root):void 0,c0=f0??g.dirname(Q),C0=[];if(f0)C0.push(g.resolve(f0,"resources/views/components")),C0.push(g.resolve(f0,"resources/components")),C0.push(g.resolve(f0,"src/components")),C0.push(g.resolve(f0,"components"));C0.push(g.resolve(import.meta.dir,"components"));for(let D0 of C0)if(!i.includes(D0))i.push(D0);let J1=G._pluginComponentDirs;if(Array.isArray(J1)){for(let D0 of J1)if(typeof D0==="string"&&!i.includes(D0))i.push(D0)}if(G.fallbackComponentsDir&&!i.includes(G.fallbackComponentsDir))i.push(G.fallbackComponentsDir);let r=[...new Set(i.map((D0)=>{if(!D0)return D0;return g.isAbsolute(D0)?D0:g.resolve(c0,D0)}))];i.length=0,i.push(...r);let a0=`${F}\x00${Q}\x00${r.join("\x00")}`,y2=S9.get(a0);if(y2)if(await a(y2))_=y2;else S9.delete(a0);if(!_&&(F.startsWith("./")||F.startsWith("../")))_=g.resolve(g.dirname(Q),`${F}.stx`),L.push(_);else if(!_)for(let D0 of i){if(!D0)continue;for(let C2 of l){let S2=g.join(D0,C2);if(L.push(S2),await a(S2)){_=S2;break}}if(_)break;if(!_)try{let C2=await import("fs");if(!C2.statSync(D0,{throwIfNoEntry:!1})?.isDirectory())continue;let ZZ=8,v9=[{path:D0,depth:0}];while(v9.length>0&&!_){let P2=v9.pop();if(P2.depth>=ZZ)continue;let u$;try{u$=C2.readdirSync(P2.path,{withFileTypes:!0})}catch{continue}for(let v2 of u$){if(!v2.isDirectory())continue;if(v2.name==="node_modules"||v2.name.startsWith("."))continue;let d$=g.join(P2.path,v2.name);for(let JZ of l){let f9=g.join(d$,JZ);if(L.push(f9),await a(f9)){_=f9;break}}if(_)break;v9.push({path:d$,depth:P2.depth+1})}}}catch{}if(_)break}if(_)S9.set(a0,_)}if(!_||!await a(_)){let d=L.length>0?`
3616
+ ${$[Y]}`,Y++;else break}return{value:X,nextIndex:Y}}function Xz($,Z,J){let X=J,Y=Z+1;while(Y<$.length){let Q=l8(X);if(Q!==-1){if(L0(X,"{","}",Q)!==-1)break}let G=$[Y];X+=`
3617
+ ${G}`,Y++}return{functionCode:X,nextIndex:Y}}function y8($,Z){let J=e($,Z)??e(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...$2.env}})},Y=Object.keys(X).filter(Z2),Q=Y.map((G)=>X[G]);try{return Function(...Y,`'use strict'; return (${$});`)(...Q)}catch{try{return Function(...Y,`'use strict'; return ${$};`)(...Q)}catch{return}}}async function Yz($,Z,J){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,z]=Q;try{let q=z.trim().replace(/;$/,""),K=y8(q,Z);if(K!==void 0)Z[G]=K}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,z]=Q;if(!(G in Z))try{let q=z.trim().replace(/;$/,""),K=y8(q,Z);if(K!==void 0)Z[G]=K}catch{}}}function Qz($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:X}}function Gz($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var E2=new i1(500),P9=new i1(1000),a8=33554432,g$=a8;function zz($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===g$)return;g$=Z,v9.setMaxBytes(Z)}var v9=new i1(2000,{maxBytes:a8,sizeOf:($)=>$.output.length});function qz($){let Z=new WeakSet;try{let J=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(J);let Y={};for(let Q of Object.keys(X).sort())Y[Q]=J(X[Q]);return Y};return JSON.stringify(J($))}catch{return null}}function c8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kz($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!Kz($)}var S9=new Map;function f$($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let J=S9.get(Z);if(J)return J;if(S9.size>=16)S9.clear();let X=new Bun.Transpiler($);return S9.set(Z,X),X}var p8=new WeakMap,Wz=256;function M1($){try{let Z=f$({loader:"ts",target:"browser",define:t1()}),J=p8.get(Z);if(!J)J=new Map,p8.set(Z,J);let X=J.get($);if(X!==void 0)return X;let Y=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Y=Y.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Q=[];Y=Y.replace(/\{!![\s\S]*?!!\}/g,(z)=>{let q=Q.length;return Q.push(z),`"__STX_EXPR_${q}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(z)=>{let q=Q.length;return Q.push(z),`"__STX_EXPR_${q}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(z)=>{let q=Q.length;return Q.push(z),`"__STX_EXPR_${q}__"`});let G=Z.transformSync(Y);for(let z=0;z<Q.length;z++)G=G.replace(`"__STX_EXPR_${z}__"`,Q[z]),G=G.replace(`'__STX_EXPR_${z}__'`,Q[z]);if(J.size>=Wz){let z=J.keys().next();if(!z.done)J.delete(z.value)}return J.set($,G),G}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function Uz($){let Z=[],J=new Set,X=0,Y=0,Q=$.length,G=(W)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===W){Y++;return}Y++}},z=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let W=1;while(Y<Q&&W>0)if($[Y]==="{")W++,Y++;else if($[Y]==="}")W--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")z();else Y++;continue}Y++}},q=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
3618
+ `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(X!==0)return;let W=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((V)=>{let F=V.trim().split(":");return F[F.length-1].trim()});for(let V of B)if(V&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(V)&&!J.has(V))Z.push(V),J.add(V);return}let U=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Y<Q){if(q())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){X++,Y++;continue}if($[Y]==="}"){X--,Y++;continue}if(X===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))K();Y++}return Z}function Hz($){let Z=[],J=0,X=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function jz($){let Z=0,J=null;for(let X=0;X<$.length;X++){let Y=$[X];if(J){if(Y==="\\"){X++;continue}if(Y===J)J=null;continue}if(Y==='"'||Y==="'"||Y==="`"){J=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Bz($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let X=J.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Y=X,Q=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let q of Hz(z)){let K=q.trim();if(!K||K.startsWith("..."))continue;let W=jz(K);if(W===-1)continue;let U=K.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let H=K.slice(W+1).trim();if(!H)continue;try{let j=Object.keys(Z).filter(Z2),B=Function(...j,`"use strict"; return (${H});`);Z[U]=B(...j.map((V)=>Z[V]))}catch{}}}catch{}}async function H9($,Z,J,X,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(_)=>_.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),z=(_)=>_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=J.__importedComponents;if(q){for(let _ of[Q,Q.toLowerCase(),G(Q),z(Q)])if(q.has(_))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],W=typeof Y.root==="string"?g.resolve(Y.root):void 0,U=W??g.dirname(X),H=[],j=(_)=>{if(_&&!H.includes(_))H.push(_)},B=J.__originalFilePath;if(B)j(g.join(g.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(g.join(g.dirname(X),"components")),j(Y.componentsDir),W)j(g.resolve(W,"resources/views/components")),j(g.resolve(W,"resources/components")),j(g.resolve(W,"src/components")),j(g.resolve(W,"components"));for(let _ of Y._layerComponentDirs??[])j(_);let V=Y._pluginComponentDirs;if(Array.isArray(V))for(let _ of V)j(typeof _==="string"?_:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return a(g.resolve(g.dirname(X),`${Q}.stx`));let F=i8(g.resolve(import.meta.dir,"components"));for(let _ of H){let O=g.isAbsolute(_)?_:g.resolve(U,_);if(i8(O)===F)continue;for(let L of K)if(await a(g.join(O,L)))return!0}return!1}function i8($){try{return r8.realpathSync($)}catch{return $}}function Vz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function _z($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function Lz($){let Z=new Set,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Y;while((Y=J.exec(X))!==null)Z.add(Y[1]);J.lastIndex=0}return[...Z]}async function D1($,Z,J,X,Y,Q,G,z=new Set,q){let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-75vxhxn1.js")),W=z??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let U=new Set(W);U.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=H&&H!=="load"&&Vz(H)?H:"";try{let B=(d)=>d.split("-").map((l)=>l.charAt(0).toUpperCase()+l.slice(1)).join(""),V=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,_=null,O=Y.__importedComponents;if(O){let d=[F,F.toLowerCase(),B(F),V(F)];for(let l of d)if(O.has(l)){_=O.get(l);break}}let L=[];if(!_){let d=[`${F}.stx`,`${B(F)}.stx`,`${V(F)}.stx`],l=[...new Set(d)],G0=Y.__originalFilePath,n=[];if(n.push(...G._layerComponentDirs??[]),G0){let N0=g.join(g.dirname(G0),"components");n.push(N0)}if(X)n.push(X);let _0=G._rootComponentsDir;if(typeof _0==="string"&&!n.includes(_0))n.push(_0);let R0=g.join(g.dirname(Q),"components");if(!n.includes(R0))n.push(R0);if(G.componentsDir&&G.componentsDir!==X&&!n.includes(G.componentsDir))n.push(G.componentsDir);let f0=typeof G.root==="string"?g.resolve(G.root):void 0,c0=f0??g.dirname(Q),C0=[];if(f0)C0.push(g.resolve(f0,"resources/views/components")),C0.push(g.resolve(f0,"resources/components")),C0.push(g.resolve(f0,"src/components")),C0.push(g.resolve(f0,"components"));C0.push(g.resolve(import.meta.dir,"components"));for(let N0 of C0)if(!n.includes(N0))n.push(N0);let J1=G._pluginComponentDirs;if(Array.isArray(J1)){for(let N0 of J1)if(typeof N0==="string"&&!n.includes(N0))n.push(N0)}if(G.fallbackComponentsDir&&!n.includes(G.fallbackComponentsDir))n.push(G.fallbackComponentsDir);let r=[...new Set(n.map((N0)=>{if(!N0)return N0;return g.isAbsolute(N0)?N0:g.resolve(c0,N0)}))];n.length=0,n.push(...r);let a0=`${F}\x00${Q}\x00${r.join("\x00")}`,C2=P9.get(a0);if(C2)if(await a(C2))_=C2;else P9.delete(a0);if(!_&&(F.startsWith("./")||F.startsWith("../")))_=g.resolve(g.dirname(Q),`${F}.stx`),L.push(_);else if(!_)for(let N0 of n){if(!N0)continue;for(let S2 of l){let P2=g.join(N0,S2);if(L.push(P2),await a(P2)){_=P2;break}}if(_)break;if(!_)try{let S2=await import("fs");if(!S2.statSync(N0,{throwIfNoEntry:!1})?.isDirectory())continue;let qZ=8,f9=[{path:N0,depth:0}];while(f9.length>0&&!_){let v2=f9.pop();if(v2.depth>=qZ)continue;let m$;try{m$=S2.readdirSync(v2.path,{withFileTypes:!0})}catch{continue}for(let f2 of m$){if(!f2.isDirectory())continue;if(f2.name==="node_modules"||f2.name.startsWith("."))continue;let l$=g.join(v2.path,f2.name);for(let KZ of l){let x9=g.join(l$,KZ);if(L.push(x9),await a(x9)){_=x9;break}}if(_)break;f9.push({path:l$,depth:v2.depth+1})}}}catch{}if(_)break}if(_)P9.set(a0,_)}if(!_||!await a(_)){let d=L.length>0?`
3614
3619
  Searched paths:
3615
3620
  ${L.map((l)=>` - ${l}`).join(`
3616
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(_);let w;if(k2.has(_))w=k2.get(_);else try{w=await Bun.file(_).text(),k2.set(_,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents",f2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),D={};for(let[d,l]of Object.entries(Y))if(!d.startsWith("__")||R.has(d))D[d]=l;let A=J;if(J.includes("@include")){let{processIncludes:d}=await o("stx/includes",()=>import("./chunk-n99ajrwv.js"));A=await d(J,Y,Q,G,q)}let T=n0(A),N=[],I=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(d,l)=>{let G0=T.scripts[Number(l)]||"",i=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",_0=i.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),R0=!_0||["module","text/javascript","application/javascript"].includes(_0);if(!/\bserver\b/i.test(i)&&R0)return N.push(G0),"";return G0}),{extractSlotContent:k}=await o("stx/slots",()=>import("./chunk-twbw18vs.js")),M=k(I),y={};if(M.defaultSlot?.trim())y.default=M.defaultSlot;for(let[d,l]of M.namedSlots)y[d]=l.content;let E=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,C={...D,$uid:b,...Z,props:Z,slot:I,$slots:y,__processedComponents:U,__sections:{},__stx_signals_gate:X1(w)||Yz(J)};Jz(w,C);let f=w,u=Y9(f);if(u)f=u.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,h=[...w.matchAll(P)],m=[],j0=h.some((d)=>/\bserver\b/.test(d[1]||"")&&/\bcache\b/.test(d[1]||"")),S0=null,y0=null,h0=null,Y0=0,B0=null;if(oG(G),j0&&f$>0){let d=rG({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((l)=>l.configFile),uid:b});if(d!==null){S0=`${_}\x00${H1(w)}\x00${d}`;let l=P9.get(S0);if(l){for(let G0 of l.dependencies)q.add(G0);if($3(Y,l.clientFactories),E.n+=l.uidsConsumed,l.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let i of l.preservedClientExpressions)G0.add(i);Y.__stx_preserved_client_expressions=[...G0]}return l.output}y0=new Set(q),h0=t$(Y),Y0=E.n,B0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let d of h){let l=d[1]||"",G0=d[2]||"",i=l.includes("server");if(A1(l)&&G0.trim())G0=M1(G0);if(i&&G0)try{await K(G0,C,_)}catch(R0){}if(!i){let R0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),f0=R0.includes("{{")&&R0.includes("}}"),c0=R0.includes("{!!")&&R0.includes("!!}");if(f0||c0)R0=m9(R0,C);let C0=l.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");m.push(`<script${C0}>${R0}</script>`)}}let M0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),P0=M0?M0[1]:"",s=M0?M0[2]:"",c="",K0=P0&&/\bscoped\b/i.test(P0);if(M0)c=`<style${P0}>${s}</style>`;let Z0=f;if(Z0=Z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),M0)Z0=Z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,l=[];if(Z0=Z0.replace(d,(G0,i)=>{let _0=i.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(_0)l.push(`<style${_0[1]}>${_0[2]}</style>`);return""}),Z0=Z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),l.length>0)c=`${c}${l.join(`
3617
- `)}`}if(J&&Z0.includes("{{ text || slot }}"))Z0=Z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:V0}=await o("stx/slots",()=>import("./chunk-twbw18vs.js")),{defaultSlot:k0,namedSlots:j1}=M,J2=m.some((d)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),b2=(d)=>J2?p6(d,b):d,S=new Map([...j1].map(([d,l])=>[d,{...l,content:b2(l.content)}]));Z0=await V0(Z0,b2(k0),S,C);let v=Qz(m),p=Array.isArray(C.__stx_client_signal_names)?C.__stx_client_signal_names:[];if(v.length>0||p.length>0)C.__stx_client_signal_names=[...new Set([...p,...v])];let $0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(_),skipSignalsRuntime:!0,skipEventDirectives:J2||m.length===0,defaultLayout:void 0};C.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let z0=await C$(Z0,C,_,$0,q),w0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let d of z0.matchAll(/\{\{([\s\S]*?)\}\}/g))w0.add(d[1].trim());if(w0.size>0)Y.__stx_preserved_client_expressions=[...w0];let l0=b,v0=z0;if(J2){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${x8(JSON.stringify(Z))}"`}catch{}let l=j?` stx-hydrate="${x8(j)}"`:"";v0=`<div data-stx-scope="${l0}"${d}${l}>${z0}</div>`;let G0=await Promise.all(m.map(async(i)=>{let _0=i.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_0)return i;let[,R0,f0]=_0,{vendorStyleTags:c0,factoryBody:C0}=await qz(f0,_,G.buildMode==="compile"),J1=j?null:h9(Y,C0),r=J1?`window.__stxComponentFactories[${JSON.stringify(J1)}](${JSON.stringify(l0)});`:`(${C0})(${JSON.stringify(l0)});`;if(j)return`${c0}<script type="stx/island" data-stx-island="${l0}" data-stx-scoped data-stx-owner="${l0}"${R0}>${r}</script>`;return`${c0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${l0}"${R0}>${r}</script>`}));if(v0=v0+`
3621
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(_);let w;if(E2.has(_))w=E2.get(_);else try{w=await Bun.file(_).text(),E2.set(_,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents",x2,"__stx_client_signal_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),N={};for(let[d,l]of Object.entries(Y))if(!d.startsWith("__")||R.has(d))N[d]=l;let A=J;if(J.includes("@include")){let{processIncludes:d}=await o("stx/includes",()=>import("./chunk-6dmrpd71.js"));A=await d(J,Y,Q,G,q)}let T=n0(A),D=[],M=T.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(d,l)=>{let G0=T.scripts[Number(l)]||"",n=G0.match(/^<script\b([^>]*)>/i)?.[1]||"",_0=n.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),R0=!_0||["module","text/javascript","application/javascript"].includes(_0);if(!/\bserver\b/i.test(n)&&R0)return D.push(G0),"";return G0}),{extractSlotContent:k}=await o("stx/slots",()=>import("./chunk-fsee2x1q.js")),I=k(M),y={};if(I.defaultSlot?.trim())y.default=I.defaultSlot;for(let[d,l]of I.namedSlots)y[d]=l.content;let E=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${F.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,C={...N,$uid:b,...Z,props:Z,slot:M,$slots:y,__processedComponents:U,__sections:{},__stx_signals_gate:X1(w)||_z(J)};Bz(w,C);let f=w,u=Q9(f);if(u)f=u.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,h=[...w.matchAll(P)],m=[],j0=h.some((d)=>/\bserver\b/.test(d[1]||"")&&/\bcache\b/.test(d[1]||"")),S0=null,y0=null,h0=null,Y0=0,B0=null;if(zz(G),j0&&g$>0){let d=qz({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,layers:G._layerGraph?.layers.map((l)=>l.configFile),uid:b});if(d!==null){S0=`${_}\x00${H1(w)}\x00${d}`;let l=v9.get(S0);if(l){for(let G0 of l.dependencies)q.add(G0);if(J3(Y,l.clientFactories),E.n+=l.uidsConsumed,l.preservedClientExpressions.length>0){let G0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let n of l.preservedClientExpressions)G0.add(n);Y.__stx_preserved_client_expressions=[...G0]}return l.output}y0=new Set(q),h0=$3(Y),Y0=E.n,B0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let d of h){let l=d[1]||"",G0=d[2]||"",n=l.includes("server");if(A1(l)&&G0.trim())G0=M1(G0);if(n&&G0)try{await K(G0,C,_)}catch(R0){}if(!n){let R0=G0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),f0=R0.includes("{{")&&R0.includes("}}"),c0=R0.includes("{!!")&&R0.includes("!!}");if(f0||c0)R0=c9(R0,C);let C0=l.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");m.push(`<script${C0}>${R0}</script>`)}}let M0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),P0=M0?M0[1]:"",s=M0?M0[2]:"",p="",q0=P0&&/\bscoped\b/i.test(P0);if(M0)p=`<style${P0}>${s}</style>`;let Z0=f;if(Z0=Z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),M0)Z0=Z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,l=[];if(Z0=Z0.replace(d,(G0,n)=>{let _0=n.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(_0)l.push(`<style${_0[1]}>${_0[2]}</style>`);return""}),Z0=Z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),l.length>0)p=`${p}${l.join(`
3622
+ `)}`}if(J&&Z0.includes("{{ text || slot }}"))Z0=Z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:V0}=await o("stx/slots",()=>import("./chunk-fsee2x1q.js")),{defaultSlot:k0,namedSlots:j1}=I,J2=m.some((d)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),y2=(d)=>J2?t6(d,b):d,S=new Map([...j1].map(([d,l])=>[d,{...l,content:y2(l.content)}]));Z0=await V0(Z0,y2(k0),S,C);let v=Lz(m),i=Array.isArray(C.__stx_client_signal_names)?C.__stx_client_signal_names:[];if(v.length>0||i.length>0)C.__stx_client_signal_names=[...new Set([...i,...v])];let $0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(_),skipSignalsRuntime:!0,skipEventDirectives:J2||m.length===0,defaultLayout:void 0};C.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let z0=await P$(Z0,C,_,$0,q),w0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let d of z0.matchAll(/\{\{([\s\S]*?)\}\}/g))w0.add(d[1].trim());if(w0.size>0)Y.__stx_preserved_client_expressions=[...w0];let l0=b,v0=z0;if(J2){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${c8(JSON.stringify(Z))}"`}catch{}let l=j?` stx-hydrate="${c8(j)}"`:"";v0=`<div data-stx-scope="${l0}"${d}${l}>${z0}</div>`;let G0=await Promise.all(m.map(async(n)=>{let _0=n.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_0)return n;let[,R0,f0]=_0,{vendorStyleTags:c0,factoryBody:C0}=await wz(f0,_,G.buildMode==="compile"),J1=j?null:u9(Y,C0),r=J1?`window.__stxComponentFactories[${JSON.stringify(J1)}](${JSON.stringify(l0)});`:`(${C0})(${JSON.stringify(l0)});`;if(j)return`${c0}<script type="stx/island" data-stx-island="${l0}" data-stx-scoped data-stx-owner="${l0}"${R0}>${r}</script>`;return`${c0}<script data-stx-scoped data-stx-run="always" data-stx-owner="${l0}"${R0}>${r}</script>`}));if(v0=v0+`
3618
3623
  `+G0.join(`
3619
- `),c)v0+=`
3620
- `+c}else{if(c)v0+=`
3621
- `+c;if(m.length>0){let d=C.__stx_event_bindings||[],l=k9(C),G0=await Promise.all(m.map(async(i)=>{let _0=i.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!_0)return i;return await E9(_0[1],{eventBindings:d,templateContent:v0,filePath:_,projectRoot:process.cwd(),serverData:l,instanceId:b})}));v0+=`
3624
+ `),p)v0+=`
3625
+ `+p}else{if(p)v0+=`
3626
+ `+p;if(m.length>0){let d=C.__stx_event_bindings||[],l=E9(C),G0=await Promise.all(m.map(async(n)=>{let _0=n.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!_0)return n;return await b9(_0[1],{eventBindings:d,templateContent:v0,filePath:_,projectRoot:process.cwd(),serverData:l,instanceId:b})}));v0+=`
3622
3627
  `+G0.join(`
3623
- `),C.__stx_event_bindings=[]}}if(K0){let d=b9(v0,_);if(d.hasScoped)v0=d.html}if(S0&&y0){let d=Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[];P9.set(S0,{output:v0,dependencies:[...q].filter((l)=>!y0.has(l)),clientFactories:h0?e$(Y,h0):[],uidsConsumed:E.n-Y0,preservedClientExpressions:B0?d.filter((l)=>!B0.has(l)):[]})}return N.length>0?`${v0}
3624
- ${N.join(`
3625
- `)}`:v0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{W.delete($)}}async function a($){return Bun.file($).exists()}function x$($,Z){let J=g.resolve(Z),X=g.resolve($),Y=J.endsWith(g.sep)?J:J+g.sep;if(X===J||X.startsWith(Y))return X;return null}async function Gz($,Z,J,X){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=g.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await a(G)){if(X)console.log(`Found layout in ${$}: ${G}`);return J?.add(G),G}return null}async function s2($,Z,J,X){let Y=await zz($,Z,J,X);if(Y===null)return null;let Q=x$(Y,process.cwd());if(Q)return Q;let G=[J.root,J.layoutsDir,J.fallbackLayoutsDir,J.componentsDir,J.partialsDir,J.pagesDir,...J._layerLayoutDirs??[]].filter((z)=>typeof z==="string"&&z.length>0);for(let z of G){let q=g.isAbsolute(z)?z:g.resolve(process.cwd(),z);if(x$(Y,q))return g.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function zz($,Z,J,X){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=g.dirname(Z),Q=process.cwd();if($.startsWith("/")){let H=g.join(Q,$),j=x$(H,Q);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(J.debug)console.log(`Checking absolute path: ${j}`);if(await a(j)&&X)X.add(j);return j}let G=g.join(Y,$);if(await a(G)){if(J.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let H of[".stx",".tsx",".jsx"]){let j=`${G}${H}`;if(await a(j)){if(J.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let z=[];if(z.push(...J._layerLayoutDirs??[]),J.layoutsDir)z.push(g.isAbsolute(J.layoutsDir)?J.layoutsDir:g.resolve(process.cwd(),J.layoutsDir));let q=g.resolve(Y),K=process.cwd();for(let H=0;H<10;H++){let j=g.join(q,"layouts"),B=!1;try{B=l8.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){z.push(j);break}let V=g.dirname(q);if(V===q||V.length<K.length)break;q=V}for(let H of z){let j=await Gz(H,$,X,J.debug);if(j)return j}if(J.fallbackLayoutsDir){let H=g.isAbsolute(J.fallbackLayoutsDir)?J.fallbackLayoutsDir:g.resolve(process.cwd(),J.fallbackLayoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=[g.join(H,j)];if(!$.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let V of B)if(await a(V)){if(J.debug)console.log(`Found in options.fallbackLayoutsDir: ${V}`);if(X)X.add(V);return V}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),j=g.join(J.partialsDir||Y,"layouts",H[1]);if(await a(j)){if(J.debug)console.log(`Found in layouts path: ${j}`);if(X)X.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await a(B)){if(J.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(J.partialsDir){let H=g.join(J.partialsDir,"layouts");if(await a(H)){let j=g.join(H,$);if(await a(j)){if(J.debug)console.log(`Found in partials layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await a(B)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}}let W=J.partialsDir||g.join(process.cwd(),"views"),U=g.join(W,$);if(await a(U)){if(J.debug)console.log(`Found in views path: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let H=`${U}.stx`;if(await a(H)){if(J.debug)console.log(`Found in views path with extension: ${H}`);if(X)X.add(H);return H}}if(Y.includes("temp")){let H=g.join(g.dirname(Y),"layouts",$);if(await a(H)){if(J.debug)console.log(`Found in temp layouts dir: ${H}`);if(X)X.add(H);return H}if(!$.endsWith(".stx")){let j=`${H}.stx`;if(await a(j)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(J.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function p8($,Z,J){let X=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
3628
+ `),C.__stx_event_bindings=[]}}if(q0){let d=y9(v0,_);if(d.hasScoped)v0=d.html}if(S0&&y0){let d=Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[];v9.set(S0,{output:v0,dependencies:[...q].filter((l)=>!y0.has(l)),clientFactories:h0?Z3(Y,h0):[],uidsConsumed:E.n-Y0,preservedClientExpressions:B0?d.filter((l)=>!B0.has(l)):[]})}return D.length>0?`${v0}
3629
+ ${D.join(`
3630
+ `)}`:v0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{W.delete($)}}async function a($){return Bun.file($).exists()}function h$($,Z){let J=g.resolve(Z),X=g.resolve($),Y=J.endsWith(g.sep)?J:J+g.sep;if(X===J||X.startsWith(Y))return X;return null}async function Oz($,Z,J,X){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=g.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await a(G)){if(X)console.log(`Found layout in ${$}: ${G}`);return J?.add(G),G}return null}async function o2($,Z,J,X){let Y=await Fz($,Z,J,X);if(Y===null)return null;let Q=h$(Y,process.cwd());if(Q)return Q;let G=[J.root,J.layoutsDir,J.fallbackLayoutsDir,J.componentsDir,J.partialsDir,J.pagesDir,...J._layerLayoutDirs??[]].filter((z)=>typeof z==="string"&&z.length>0);for(let z of G){let q=g.isAbsolute(z)?z:g.resolve(process.cwd(),z);if(h$(Y,q))return g.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function Fz($,Z,J,X){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=g.dirname(Z),Q=process.cwd();if($.startsWith("/")){let H=g.join(Q,$),j=h$(H,Q);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(J.debug)console.log(`Checking absolute path: ${j}`);if(await a(j)&&X)X.add(j);return j}let G=g.join(Y,$);if(await a(G)){if(J.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let H of[".stx",".tsx",".jsx"]){let j=`${G}${H}`;if(await a(j)){if(J.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let z=[];if(z.push(...J._layerLayoutDirs??[]),J.layoutsDir)z.push(g.isAbsolute(J.layoutsDir)?J.layoutsDir:g.resolve(process.cwd(),J.layoutsDir));let q=g.resolve(Y),K=process.cwd();for(let H=0;H<10;H++){let j=g.join(q,"layouts"),B=!1;try{B=r8.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){z.push(j);break}let V=g.dirname(q);if(V===q||V.length<K.length)break;q=V}for(let H of z){let j=await Oz(H,$,X,J.debug);if(j)return j}if(J.fallbackLayoutsDir){let H=g.isAbsolute(J.fallbackLayoutsDir)?J.fallbackLayoutsDir:g.resolve(process.cwd(),J.fallbackLayoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=[g.join(H,j)];if(!$.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let V of B)if(await a(V)){if(J.debug)console.log(`Found in options.fallbackLayoutsDir: ${V}`);if(X)X.add(V);return V}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),j=g.join(J.partialsDir||Y,"layouts",H[1]);if(await a(j)){if(J.debug)console.log(`Found in layouts path: ${j}`);if(X)X.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await a(B)){if(J.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(J.partialsDir){let H=g.join(J.partialsDir,"layouts");if(await a(H)){let j=g.join(H,$);if(await a(j)){if(J.debug)console.log(`Found in partials layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await a(B)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}}let W=J.partialsDir||g.join(process.cwd(),"views"),U=g.join(W,$);if(await a(U)){if(J.debug)console.log(`Found in views path: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let H=`${U}.stx`;if(await a(H)){if(J.debug)console.log(`Found in views path with extension: ${H}`);if(X)X.add(H);return H}}if(Y.includes("temp")){let H=g.join(g.dirname(Y),"layouts",$);if(await a(H)){if(J.debug)console.log(`Found in temp layouts dir: ${H}`);if(X)X.add(H);return H}if(!$.endsWith(".stx")){let j=`${H}.stx`;if(await a(j)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(J.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function t8($,Z,J){let X=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
3626
3631
  `),z=0;for(let q=0;q<G.length;q++)if(z+=G[q].length+1,z>=Z){X=q+1,Y=G[q].trim();let K=Math.max(0,q-2),W=Math.min(G.length,q+3);Q=G.slice(K,W).map((U,H)=>{let j=K+H+1;return`${j===X?"> ":" "}${j}: ${U}`}).join(`
3627
- `);break}}else if(J){let G=$.indexOf(J);if(G>=0)return p8($,G)}}catch{}return{lineNumber:X,lineContent:Y,context:Q}}var t={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 H0($,Z,J,X,Y,Q){let{lineNumber:G,context:z}=p8(X,Y,Q),q=J.split("/").pop(),K=0;if(typeof Y==="number"&&Y>=0&&X){let U=X.lastIndexOf(`
3632
+ `);break}}else if(J){let G=$.indexOf(J);if(G>=0)return t8($,G)}}catch{}return{lineNumber:X,lineContent:Y,context:Q}}var t={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 H0($,Z,J,X,Y,Q){let{lineNumber:G,context:z}=t8(X,Y,Q),q=J.split("/").pop(),K=0;if(typeof Y==="number"&&Y>=0&&X){let U=X.lastIndexOf(`
3628
3633
  `,Math.max(0,Y-1));K=Y-(U+1)+1}let W="";if(G>0)W+=`
3629
3634
  ${J}:${G}${K>0?`:${K}`:""}: ${$.toLowerCase()} error: ${Z}
3630
3635
  `;if(W+=`
@@ -3637,8 +3642,8 @@ ${t.yellow}${t.bold}Message:${t.reset} ${Z}
3637
3642
  `,z)W+=`
3638
3643
  ${t.blue}${t.bold}Context:${t.reset}
3639
3644
  ${t.dim}${z}${t.reset}
3640
- `;return W}function O_(){k2.clear(),S9.clear(),P9.clear()}function F_(){return{size:k2.size,maxSize:500}}var v$=k1(128);async function qz($,Z,J){let X=H1($,Z,J),Y=v$.get(X);if(Y){if(m8(Y.deps))return Y;v$.delete(X)}let Q=g$($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=h$(Q.styles);G=a1(G).code;let{hasUserImports:q,bundleClientScript:K}=await o("stx/client-script-bundler",()=>import("./chunk-sen2cxqm.js")),W=[],U=!1;if(q(G)){let _=G;G=await K(_,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),U=G===_}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-r2k2sewg.js"));G=H(G);let j=$1(G),B=eG(j),V=`function(__scopeId) {
3641
- ${p1("const",[...u8,...B],j)}
3645
+ `;return W}function S_(){E2.clear(),P9.clear(),v9.clear()}function P_(){return{size:E2.size,maxSize:500}}var x$=k1(128);async function wz($,Z,J){let X=H1($,Z,J),Y=x$.get(X);if(Y){if(o8(Y.deps))return Y;x$.delete(X)}let Q=u$($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=d$(Q.styles);G=a1(G).code;let{hasUserImports:q,bundleClientScript:K}=await o("stx/client-script-bundler",()=>import("./chunk-4z3yyryn.js")),W=[],U=!1;if(q(G)){let _=G;G=await K(_,Z,{projectRoot:process.cwd(),minify:J,collectInputs:W}),U=G===_}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-v0ne90ft.js"));G=H(G);let j=$1(G),B=Uz(j),V=`function(__scopeId) {
3646
+ ${p1("const",[...n8,...B],j)}
3642
3647
  const __scope = window.stx._scopes = window.stx._scopes || {};
3643
3648
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
3644
3649
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -3666,18 +3671,18 @@ catch (e) {}
3666
3671
  finally {
3667
3672
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
3668
3673
  }
3669
- }`,F={vendorStyleTags:z,factoryBody:V,deps:d8([...W,...Q.styles.map((_)=>_.resolvedPath)])};if(!U&&Q.unresolved.length===0)v$.set(X,F);return F}var Kz=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Wz($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let J=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!J)return null;return{pkg:J[1],subpath:J[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function Uz($,Z){let J=Z;while(!0){let X=b1.join(J,"node_modules",$,"package.json");if(E2.existsSync(X))return b1.dirname(X);let Y=b1.dirname(J);if(Y===J)return null;J=Y}}function Hz($,Z){if(!$||typeof $!=="object")return null;let J=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return J(Y.import);if(typeof Y.default==="object")return J(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return J($[Z]);let X=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),z=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(z))continue;if(Z.length<G.length+z.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Y,prefix:G,suffix:z}}if(X){let Y=Z.slice(X.prefix.length,Z.length-X.suffix.length),Q=J($[X.pattern]);if(Q)return Q.replace("*",Y)}return null}function jz($,Z){let J=Wz($);if(!J||!J.subpath)return null;let X=Uz(J.pkg,Z);if(!X)return null;let Y;try{Y=JSON.parse(E2.readFileSync(b1.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${J.subpath}`,G=Hz(Y.exports,Q);if(!G)return null;let z=b1.resolve(X,G);return E2.existsSync(z)?z:null}function g$($,Z){let J=Z.filePath?b1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Y=new Set,Q=[],G=[];return{code:$.replace(Kz,(q,K)=>{let W;try{if(K.startsWith("./")||K.startsWith("../")||K.startsWith("/")){if(W=K.startsWith("/")?K:b1.resolve(J,K),!E2.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(K,X)}catch{U=jz(K,X)}if(!U)throw Error(`could not resolve ${K} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(K)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),G.push(K),""}if(Y.has(W))return"";Y.add(W);try{let U=E2.readFileSync(W,"utf8");Q.push({source:K,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`),G.push(K)}return""}),styles:Q,unresolved:G}}function Bz($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function h$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${Bz(Z.source)}" data-stx-layer="vendor">
3674
+ }`,F={vendorStyleTags:z,factoryBody:V,deps:s8([...W,...Q.styles.map((_)=>_.resolvedPath)])};if(!U&&Q.unresolved.length===0)x$.set(X,F);return F}var Rz=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function Nz($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let J=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!J)return null;return{pkg:J[1],subpath:J[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function Dz($,Z){let J=Z;while(!0){let X=b1.join(J,"node_modules",$,"package.json");if(b2.existsSync(X))return b1.dirname(X);let Y=b1.dirname(J);if(Y===J)return null;J=Y}}function Az($,Z){if(!$||typeof $!=="object")return null;let J=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return J(Y.import);if(typeof Y.default==="object")return J(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return J($[Z]);let X=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),z=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(z))continue;if(Z.length<G.length+z.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Y,prefix:G,suffix:z}}if(X){let Y=Z.slice(X.prefix.length,Z.length-X.suffix.length),Q=J($[X.pattern]);if(Q)return Q.replace("*",Y)}return null}function Mz($,Z){let J=Nz($);if(!J||!J.subpath)return null;let X=Dz(J.pkg,Z);if(!X)return null;let Y;try{Y=JSON.parse(b2.readFileSync(b1.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${J.subpath}`,G=Az(Y.exports,Q);if(!G)return null;let z=b1.resolve(X,G);return b2.existsSync(z)?z:null}function u$($,Z){let J=Z.filePath?b1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Y=new Set,Q=[],G=[];return{code:$.replace(Rz,(q,K)=>{let W;try{if(K.startsWith("./")||K.startsWith("../")||K.startsWith("/")){if(W=K.startsWith("/")?K:b1.resolve(J,K),!b2.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(K,X)}catch{U=Mz(K,X)}if(!U)throw Error(`could not resolve ${K} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(K)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),G.push(K),""}if(Y.has(W))return"";Y.add(W);try{let U=b2.readFileSync(W,"utf8");Q.push({source:K,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`),G.push(K)}return""}),styles:Q,unresolved:G}}function Iz($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function d$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${Iz(Z.source)}" data-stx-layer="vendor">
3670
3675
  @layer vendor {
3671
3676
  ${Z.contents}
3672
3677
  }
3673
3678
  </style>`}).join(`
3674
3679
  `)}
3675
- `}var Vz=o8;function a1($){let Z=u0($),J=new Set;for(let z of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of z[1].split(",")){let K=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(K)J.add(K)}let X=new Set;for(let z of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))X.add(z[1]);for(let z of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of z[1].split(",")){let K=q.trim().split(/[:=]/).pop()?.trim();if(K)X.add(K)}let Y=A2.filter((z)=>{if(J.has(z)||X.has(z))return!1;return new RegExp(`\\b${z}\\s*\\(`).test(Z)}),Q=t8(Z).filter((z)=>!J.has(z)&&!X.has(z));if(Y.length===0&&Q.length===0)return{code:$,imports:Y,models:Q};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
3680
+ `}var Tz=JZ;function a1($){let Z=u0($),J=new Set;for(let z of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of z[1].split(",")){let K=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(K)J.add(K)}let X=new Set;for(let z of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))X.add(z[1]);for(let z of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of z[1].split(",")){let K=q.trim().split(/[:=]/).pop()?.trim();if(K)X.add(K)}let Y=M2.filter((z)=>{if(J.has(z)||X.has(z))return!1;return new RegExp(`\\b${z}\\s*\\(`).test(Z)}),Q=QZ(Z).filter((z)=>!J.has(z)&&!X.has(z));if(Y.length===0&&Q.length===0)return{code:$,imports:Y,models:Q};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
3676
3681
  `)}
3677
- ${$}`,imports:Y,models:Q}}var _z=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 t8($){let Z=new Set,J=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=J.exec($))!==null)if(!_z.has(X[1]))Z.add(X[1]);return Array.from(Z)}function Lz($){let Z=new Set;for(let J of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(J[1]);for(let J of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let X of J[1].split(",")){let Y=X.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function e8($){let Z=new Set,J=new Set,X=$;X=X.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let Y=new Set,Q=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,G;while((G=Q.exec($))!==null){let U=G[1],H=G[2];if(G[0].includes("import type"))continue;let j=[];for(let V of U.split(",")){let F=V.trim();if(!F||F.startsWith("type "))continue;let _=F.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let O=_[1],L=_[2]||O;if(Y.add(O),Y.add(L),H==="stx"||H==="@stacksjs/stx")Z.add(O);else J.add(O);if(L!==O)j.push(`${L} = ${O}`)}let B=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],B)}let z=Lz(X);for(let U of Vz){if(Y.has(U)||z.has(U))continue;if(new RegExp(`\\b${U}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(X))Z.add(U)}let q=u0(X),K=new Set;for(let U of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let H of U[1].split(",")){let j=H.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let B of j){let V=B.trim();if(V)K.add(V)}}for(let U of A2){if(Y.has(U)||z.has(U)||K.has(U))continue;if(new RegExp(`\\b${U}\\b`,"g").test(q))J.add(U)}let W=t8(X);for(let U of W)if(!Y.has(U)&&!z.has(U))J.add(U);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(J)}}function $Z($,Z){let J=[];if($.length>0)J.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)J.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(J.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
3682
+ ${$}`,imports:Y,models:Q}}var kz=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 QZ($){let Z=new Set,J=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=J.exec($))!==null)if(!kz.has(X[1]))Z.add(X[1]);return Array.from(Z)}function Ez($){let Z=new Set;for(let J of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(J[1]);for(let J of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let X of J[1].split(",")){let Y=X.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function GZ($){let Z=new Set,J=new Set,X=$;X=X.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let Y=new Set,Q=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,G;while((G=Q.exec($))!==null){let U=G[1],H=G[2];if(G[0].includes("import type"))continue;let j=[];for(let V of U.split(",")){let F=V.trim();if(!F||F.startsWith("type "))continue;let _=F.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let O=_[1],L=_[2]||O;if(Y.add(O),Y.add(L),H==="stx"||H==="@stacksjs/stx")Z.add(O);else J.add(O);if(L!==O)j.push(`${L} = ${O}`)}let B=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],B)}let z=Ez(X);for(let U of Tz){if(Y.has(U)||z.has(U))continue;if(new RegExp(`\\b${U}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(X))Z.add(U)}let q=u0(X),K=new Set;for(let U of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let H of U[1].split(",")){let j=H.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let B of j){let V=B.trim();if(V)K.add(V)}}for(let U of M2){if(Y.has(U)||z.has(U)||K.has(U))continue;if(new RegExp(`\\b${U}\\b`,"g").test(q))J.add(U)}let W=QZ(X);for(let U of W)if(!Y.has(U)&&!z.has(U))J.add(U);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(J)}}function zZ($,Z){let J=[];if($.length>0)J.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)J.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(J.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
3678
3683
  ${J.join(`
3679
3684
  `)}
3680
- ${Oz($,Z)}`;return""}function v_($,Z=[]){let{browserImports:J}=e8($),X=new Set(Z);return $Z([],J.filter((Y)=>!X.has(Y)))}function Oz($,Z){let J=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(J.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
3685
+ ${bz($,Z)}`;return""}function r_($,Z=[]){let{browserImports:J}=GZ($),X=new Set(Z);return zZ([],J.filter((Y)=>!X.has(Y)))}function bz($,Z){let J=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(J.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
3681
3686
  [${J.join(", ")}].forEach(function (e) {
3682
3687
  if (e[1] !== 'undefined') return;
3683
3688
  console.error(
@@ -3686,10 +3691,10 @@ ${Oz($,Z)}`;return""}function v_($,Z=[]){let{browserImports:J}=e8($),X=new Set(Z
3686
3691
  + 'or it should be imported from a relative path so the bundler includes it.'
3687
3692
  );
3688
3693
  });
3689
- `}function k9($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let X={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;X[Y]=Q}return X.__stxDeclaredPayload=!0,X}let J={};for(let X in $){if(X.startsWith("__")||X.startsWith("$"))continue;let Y=$[X];if(typeof Y==="function")continue;J[X]=Y}return J}function i8($,Z){let J=new Set;for(let X of $.split(",")){let Y=X.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(Z){let Q=Y.lastIndexOf(":");if(Q!==-1)Y=Y.slice(Q+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))J.add(Y)}return J}function Fz($,Z){let J=u0($),{depths:X,balanced:Y}=a8(J),Q=(z)=>!Y||X[z]===0,G=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${Z}\\b)`,"g");for(let z of J.matchAll(G)){let q=(z.index??0)+z[0].length-z[1].length;if(Q(q))return!0}for(let z of J.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(Q(z.index??0)&&i8(z[1],!0).has(Z))return!0;for(let z of J.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(Q(z.index??0)&&i8(z[1],!1).has(Z))return!0;return!1}function wz($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var Rz=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,n8=new Set;function Dz($,Z){let J=Rz.test($),X=Z.length>32768;if(!J&&!X)return;if(n8.has($))return;if(n8.add($),J)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(X)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function N$($,Z){if(!Z)return"";let J=u0($),X=Z.__stxDeclaredPayload===!0,Y=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!X&&!wz(J,Q))continue;if(Fz($,Q)){if(X)console.warn(`[stx] defineClientPayload declares "${Q}", but this client block also declares "${Q}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${Q}" from defineClientPayload.`);continue}let z;try{z=JSON.stringify(G)}catch{continue}if(z===void 0)continue;Dz(Q,z),Y.push(` var ${Q} = ${z.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3694
+ `}function E9($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let X={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;X[Y]=Q}return X.__stxDeclaredPayload=!0,X}let J={};for(let X in $){if(X.startsWith("__")||X.startsWith("$"))continue;let Y=$[X];if(typeof Y==="function")continue;J[X]=Y}return J}function e8($,Z){let J=new Set;for(let X of $.split(",")){let Y=X.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(Z){let Q=Y.lastIndexOf(":");if(Q!==-1)Y=Y.slice(Q+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))J.add(Y)}return J}function yz($,Z){let J=u0($),{depths:X,balanced:Y}=YZ(J),Q=(z)=>!Y||X[z]===0,G=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${Z}\\b)`,"g");for(let z of J.matchAll(G)){let q=(z.index??0)+z[0].length-z[1].length;if(Q(q))return!0}for(let z of J.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(Q(z.index??0)&&e8(z[1],!0).has(Z))return!0;for(let z of J.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(Q(z.index??0)&&e8(z[1],!1).has(Z))return!0;return!1}function Cz($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var Sz=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,$Z=new Set;function Pz($,Z){let J=Sz.test($),X=Z.length>32768;if(!J&&!X)return;if($Z.has($))return;if($Z.add($),J)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(X)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function M$($,Z){if(!Z)return"";let J=u0($),X=Z.__stxDeclaredPayload===!0,Y=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!X&&!Cz(J,Q))continue;if(yz($,Q)){if(X)console.warn(`[stx] defineClientPayload declares "${Q}", but this client block also declares "${Q}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${Q}" from defineClientPayload.`);continue}let z;try{z=JSON.stringify(G)}catch{continue}if(z===void 0)continue;Pz(Q,z),Y.push(` var ${Q} = ${z.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3690
3695
  ${Y.join(`
3691
3696
  `)}
3692
- `}var Nz={left:0,middle:1,right:2};function Az($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let J of $.systemKeys)Z.push(`if (!$event.${J}Key) return`);if($.keys.length>0){let J=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if($.mouse!==null){let J=Nz[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Mz($,Z){let{elementId:J,event:X,modifiers:Y}=$,Q=x9($.handler),G=Az(Y),z=[];if(Y.once)z.push("once: true");if(Y.capture)z.push("capture: true");if(Y.passive)z.push("passive: true");let q=z.length>0?`, { ${z.join(", ")} }`:"",K="";if(G)K+=`${G}; `;let W=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
3697
+ `}var vz={left:0,middle:1,right:2};function fz($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let J of $.systemKeys)Z.push(`if (!$event.${J}Key) return`);if($.keys.length>0){let J=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if($.mouse!==null){let J=vz[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function xz($,Z){let{elementId:J,event:X,modifiers:Y}=$,Q=g9($.handler),G=fz(Y),z=[];if(Y.once)z.push("once: true");if(Y.capture)z.push("capture: true");if(Y.passive)z.push("passive: true");let q=z.length>0?`, { ${z.join(", ")} }`:"",K="";if(G)K+=`${G}; `;let W=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
3693
3698
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
3694
3699
  };`;function H(j){if(/\$emit\s*\(/.test(j))return`${U}
3695
3700
  ${j}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -3732,23 +3737,23 @@ else {
3732
3737
  else {
3733
3738
  ${Q}
3734
3739
  }
3735
- }${q})`}function Iz($){if($.length===0)return"";return`
3740
+ }${q})`}function gz($){if($.length===0)return"";return`
3736
3741
  // STX: auto-generated event bindings
3737
- ${$.map((J,X)=>Mz(J,X)).join(`
3738
- `)}`}function s8($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=X.length,G=0;while(G<Q){let z=X[G];if(z==="'"||z==='"'||z==="`"){let q=z;if(G++,q==="`"){let K=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&K===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){K++,G+=2;continue}if(X[G]==="}"&&K>0){K--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
3739
- `)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let q=X.slice(G),K=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=K[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=W[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let H=U[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=U[0].length;continue}}G++}return Z}var Tz=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 kz($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(H){let j;while((j=J.exec(H))!==null){let B=j[0];if(!Tz.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)X(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function E9($,Z={}){let J=$,X="",Y=!1,Q=[],G=g$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=h$(G.styles),q=a1(J);J=q.code,Q=[...q.imports,...q.models];let{hasUserImports:K,bundleClientScript:W}=await o("stx/client-script-bundler",()=>import("./chunk-sen2cxqm.js"));if(K(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=e8(J);J=L.code,X=$Z(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${N$(J,Z.serverData)}${X}`,J=$1(J),!Y&&A1(Z.attrs||""))J=M1(J);let U=Iz(Z.eventBindings||[]),H=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(H),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let L=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
3742
+ ${$.map((J,X)=>xz(J,X)).join(`
3743
+ `)}`}function ZZ($){let Z=[],J=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=X.length,G=0;while(G<Q){let z=X[G];if(z==="'"||z==='"'||z==="`"){let q=z;if(G++,q==="`"){let K=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&K===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){K++,G+=2;continue}if(X[G]==="}"&&K>0){K--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(z==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
3744
+ `)G++;continue}if(z==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let q=X.slice(G),K=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=K[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),V=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(V&&!V.startsWith("_")&&!J.has(V))Z.push(V),J.add(V)}),G+=W[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let H=U[1];if(!H.startsWith("_")&&!J.has(H))Z.push(H),J.add(H);G+=U[0].length;continue}}G++}return Z}var hz=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 uz($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(H){let j;while((j=J.exec(H))!==null){let B=j[0];if(!hz.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)X(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)X(Q[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=W.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function b9($,Z={}){let J=$,X="",Y=!1,Q=[],G=u$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let z=d$(G.styles),q=a1(J);J=q.code,Q=[...q.imports,...q.models];let{hasUserImports:K,bundleClientScript:W}=await o("stx/client-script-bundler",()=>import("./chunk-4z3yyryn.js"));if(K(J))J=await W(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=GZ(J);J=L.code,X=zZ(L.stxImports,L.browserImports.filter((w)=>!Q.includes(w)))}if(X=`${M$(J,Z.serverData)}${X}`,J=$1(J),!Y&&A1(Z.attrs||""))J=M1(J);let U=gz(Z.eventBindings||[]),H=(Z.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(H),B=Z.instanceId?` data-stx-instance="${Z.instanceId}"`:"";if(j){let L=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),w=`type="module" data-stx-scoped${B}${L?` ${L}`:""}`;return`${z}<script ${w}>
3740
3745
  ${r1(`${X}${J}
3741
3746
  ${U}`)}
3742
- </script>`}let V=r8($),F=/function __stx_setup_/.test(J),_=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function O(L){let w=L.length>0?`
3747
+ </script>`}let V=XZ($),F=/function __stx_setup_/.test(J),_=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function O(L){let w=L.length>0?`
3743
3748
  return { ${L.join(", ")} };`:"";return`${z}<script data-stx-scoped data-stx-run="always"${B}>
3744
3749
  window.stx.mount(function() {
3745
3750
  'use strict';
3746
3751
  ${r1(`${X}${J}
3747
3752
  ${U}${w}`)}
3748
- })</script>`}if(!_&&!F){if(V)return O(s8($));if(Z.templateContent){let L=s8($);if(L.length>0){let w=kz(Z.templateContent);if(L.some((D)=>w.has(D)))return O(L)}}}return`${z}<script data-stx-scoped data-stx-run="always"${B}>
3753
+ })</script>`}if(!_&&!F){if(V)return O(ZZ($));if(Z.templateContent){let L=ZZ($);if(L.length>0){let w=uz(Z.templateContent);if(L.some((N)=>w.has(N)))return O(L)}}}return`${z}<script data-stx-scoped data-stx-run="always"${B}>
3749
3754
  ;(function() {
3750
3755
  'use strict';
3751
3756
  ${r1(`${X}${J}
3752
3757
  ${U}`)}
3753
3758
  })()</script>`}
3754
- export{yZ as Bl,CZ as Cl,SZ as Dl,t0 as El,p9 as Fl,i9 as Gl,n9 as Hl,s9 as Il,w3 as Jl,F3 as Kl,dZ as Ll,lZ as Ml,pZ as Nl,qq as Ol,Kq as Pl,Wq as Ql,Uq as Rl,Hq as Sl,EZ as Tl,V3 as Ul,_3 as Vl,L3 as Wl,O3 as Xl,Gq as Yl,b3 as Zl,z2 as _l,x9 as $l,g9 as am,zZ as bm,s$ as cm,bz as dm,A2 as em,t1 as fm,jB as gm,g$ as hm,h$ as im,Vz as jm,a1 as km,e8 as lm,$Z as mm,v_ as nm,k9 as om,N$ as pm,E9 as qm,Pz as rm,h2 as sm,vz as tm,fz as um,xz as vm,gz as wm,d2 as xm,WZ as ym,iz as zm,UZ as Am,nz as Bm,d9 as Cm,Q3 as Dm,X1 as Em,m9 as Fm,BZ as Gm,sz as Hm,V1 as Im,VZ as Jm,x0 as Km,oz as Lm,tz as Mm,DZ as Nm,NZ as Om,H3 as Pm,j3 as Qm,B3 as Rm,Yq as Sm,R3 as Tm,r9 as Um,Q2 as Vm,m2 as Wm,_q as Xm,o9 as Ym,sZ as Zm,oZ as _m,rZ as $m,Lq as an,N3 as bn,A3 as cn,z1 as dn,Z9 as en,L0 as fn,_7 as gn,O5 as hn,q1 as in,O1 as jn,L7 as kn,H2 as ln,J9 as mn,F5 as nn,QX as on,zX as pn,w7 as qn,KX as rn,WX as sn,D7 as tn,F1 as un,FW as vn,N7 as wn,M5 as xn,VX as yn,A5 as zn,_X as An,LX as Bn,wW as Cn,RW as Dn,A7 as En,M7 as Fn,I7 as Gn,OX as Hn,FX as In,DW as Jn,NW as Kn,wX as Ln,AW as Mn,MW as Nn,E7 as On,S7 as Pn,k5 as Qn,fW as Rn,V2 as Sn,E5 as Tn,b5 as Un,xW as Vn,fX as Wn,gW as Xn,xX as Yn,f7 as Zn,hW as _n,gX as $n,uW as ao,dW as bo,Y9 as co,g7 as do,h7 as eo,u7 as fo,iW as go,l7 as ho,GU as io,zU as jo,qU as ko,KU as lo,YY as mo,H4 as no,e5 as oo,BY as po,$$ as qo,V6 as ro,gj as so,F6 as to,IQ as uo,WB as vo,yQ as wo,C6 as xo,A$ as yo,S6 as zo,v6 as Ao,M$ as Bo,nQ as Co,sQ as Do,f6 as Eo,T6 as Fo,oQ as Go,aQ as Ho,j$ as Io,Y6 as Jo,Q6 as Ko,y8 as Lo,vG as Mo,fG as No,xG as Oo,gG as Po,hG as Qo,C8 as Ro,lG as So,nG as To,sG as Uo,S4 as Vo,P4 as Wo,hH as Xo,A4 as Yo,uH as Zo,J$ as _o,X$ as $o,Y$ as ap,g4 as bp,h4 as cp,u4 as dp,$7 as ep,Z7 as fp,J7 as gp,X7 as hp,K5 as ip,W5 as jp,jK as kp,BK as lp,VK as mp,CJ as np,_K as op,Kj as pp,Wj as qp,m4 as rp,Uj as sp,mY as tp,c4 as up,s4 as vp,W$ as wp,YQ as xp,U$ as yp,e4 as zp,$6 as Ap,jQ as Bp,Rj as Cp,Dj as Dp,Z6 as Ep,Nj as Fp,Aj as Gp,H$ as Hp,q6 as Ip,D9 as Jp,N9 as Kp,o1 as Lp,_Q as Mp,W6 as Np,U6 as Op,Ej as Pp,_$ as Qp,LQ as Rp,OQ as Sp,L$ as Tp,O$ as Up,H6 as Vp,j6 as Wp,I$ as Xp,T$ as Yp,b$ as Zp,C$ as _p,NG as $p,kG as aq,EG as bq,bG as cq,yG as dq,aG as eq,A1 as fq,P$ as gq,M1 as hq,U9 as iq,Xz as jq,Yz as kq,Qz as lq,N1 as mq,a as nq,s2 as oq,p8 as pq,H0 as qq,O_ as rq,F_ as sq,y3 as tq,C3 as uq,_1 as vq,S3 as wq,C1 as xq,P3 as yq,q2 as zq,bq as Aq,WJ as Bq,t9 as Cq,yq as Dq,e9 as Eq,Cq as Fq,Sq as Gq,Q1 as Hq,Pq as Iq,vq as Jq,fq as Kq,xq as Lq,gq as Mq,hq as Nq,UJ as Oq,Z5 as Pq,v3 as Qq,dq as Rq,mq as Sq,lq as Tq,cq as Uq,pq as Vq,x3 as Wq,iq as Xq,g3 as Yq,nq as Zq,sq as _q,K2 as $q,LJ as ar,tq as br,FJ as cr,c3 as dr,i2 as er,YK as fr,a3 as gr,q5 as hr,DK as ir,H5 as jr,gJ as kr,mJ as lr,NK as mr,AK as nr,MK as or,IK as pr,TK as qr,kK as rr,lJ as sr,cJ as tr,Y7 as ur,j5 as vr,sJ as wr,V5 as xr,B7 as yr,pK as zr,iK as Ar,L5 as Br,$X as Cr,V7 as Dr};
3759
+ export{hZ as Bl,uZ as Cl,dZ as Dl,t0 as El,n9 as Fl,s9 as Gl,o9 as Hl,r9 as Il,M3 as Jl,A3 as Kl,oZ as Ll,aZ as Ml,eZ as Nl,Dq as Ol,Aq as Pl,Mq as Ql,Iq as Rl,Tq as Sl,xZ as Tl,w3 as Ul,R3 as Vl,N3 as Wl,D3 as Xl,Rq as Yl,v3 as Zl,q2 as _l,g9 as $l,h9 as am,BZ as bm,r$ as cm,mz as dm,M2 as em,t1 as fm,kB as gm,u$ as hm,d$ as im,Tz as jm,a1 as km,GZ as lm,zZ as mm,r_ as nm,E9 as om,M$ as pm,b9 as qm,iz as rm,u2 as sm,nz as tm,sz as um,oz as vm,rz as wm,m2 as xm,LZ as ym,Gq as zm,OZ as Am,zq as Bm,l9 as Cm,W3 as Dm,X1 as Em,c9 as Fm,RZ as Gm,qq as Hm,V1 as Im,NZ as Jm,Kq as Km,x0 as Lm,Wq as Mm,jq as Nm,bZ as Om,yZ as Pm,L3 as Qm,O3 as Rm,F3 as Sm,Fq as Tm,I3 as Um,t9 as Vm,G2 as Wm,l2 as Xm,yq as Ym,a9 as Zm,JJ as _m,XJ as $m,YJ as an,Cq as bn,k3 as cn,E3 as dn,z1 as en,J9 as fn,L0 as gn,D7 as hn,w5 as in,q1 as jn,O1 as kn,A7 as ln,j2 as mn,X9 as nn,R5 as on,LX as pn,FX as qn,T7 as rn,RX as sn,NX as tn,E7 as un,F1 as vn,PW as wn,b7 as xn,T5 as yn,TX as zn,I5 as An,kX as Bn,EX as Cn,vW as Dn,fW as En,y7 as Fn,C7 as Gn,S7 as Hn,bX as In,yX as Jn,xW as Kn,gW as Ln,CX as Mn,hW as Nn,uW as On,f7 as Pn,u7 as Qn,b5 as Rn,aW as Sn,_2 as Tn,y5 as Un,C5 as Vn,tW as Wn,sX as Xn,eW as Yn,oX as Zn,l7 as _n,$U as $n,rX as ao,ZU as bo,JU as co,Q9 as do,p7 as eo,i7 as fo,n7 as go,zU as ho,r7 as io,RU as jo,NU as ko,DU as lo,AU as mo,_Y as no,F4 as oo,Z$ as po,IY as qo,J$ as ro,N6 as so,ej as to,I6 as uo,gQ as vo,MB as wo,lQ as xo,h6 as yo,I$ as zo,u6 as Ao,m6 as Bo,T$ as Co,QG as Do,GG as Eo,l6 as Fo,P6 as Go,zG as Ho,KG as Io,V$ as Jo,U6 as Ko,H6 as Lo,g8 as Mo,nG as No,sG as Oo,oG as Po,rG as Qo,aG as Ro,h8 as So,Zz as To,Qz as Uo,Gz as Vo,u4 as Wo,d4 as Xo,$j as Yo,y4 as Zo,Zj as _o,Y$ as $o,Q$ as ap,G$ as bp,p4 as cp,i4 as dp,n4 as ep,Q7 as fp,G7 as gp,z7 as hp,q7 as ip,U5 as jp,H5 as kp,kK as lp,EK as mp,bK as np,cJ as op,yK as pp,Aj as qp,Mj as rp,o4 as sp,Ij as tp,$Q as up,a4 as vp,Z6 as wp,H$ as xp,_Q as yp,j$ as zp,G6 as Ap,z6 as Bp,MQ as Cp,fj as Dp,xj as Ep,q6 as Fp,gj as Gp,hj as Hp,B$ as Ip,V6 as Jp,D9 as Kp,A9 as Lp,o1 as Mp,kQ as Np,L6 as Op,O6 as Pp,cj as Qp,O$ as Rp,EQ as Sp,bQ as Tp,F$ as Up,w$ as Vp,F6 as Wp,w6 as Xp,k$ as Yp,E$ as Zp,C$ as _p,P$ as $p,vG as aq,uG as bq,dG as cq,mG as dq,lG as eq,Kz as fq,A1 as gq,f$ as hq,M1 as iq,H9 as jq,Vz as kq,_z as lq,Lz as mq,D1 as nq,a as oq,o2 as pq,t8 as qq,H0 as rq,S_ as sq,P_ as tq,f3 as uq,x3 as vq,_1 as wq,g3 as xq,C1 as yq,h3 as zq,K2 as Aq,pq as Bq,OJ as Cq,$5 as Dq,iq as Eq,Z5 as Fq,nq as Gq,sq as Hq,Q1 as Iq,oq as Jq,rq as Kq,aq as Lq,tq as Mq,eq as Nq,$K as Oq,FJ as Pq,X5 as Qq,u3 as Rq,JK as Sq,XK as Tq,YK as Uq,QK as Vq,GK as Wq,m3 as Xq,zK as Yq,l3 as Zq,qK as _q,KK as $q,W2 as ar,MJ as br,jK as cr,TJ as dr,o3 as er,n2 as fr,FK as gr,J7 as hr,W5 as ir,xK as jr,B5 as kr,rJ as lr,$X as mr,gK as nr,hK as or,uK as pr,dK as qr,mK as rr,lK as sr,ZX as tr,JX as ur,U7 as vr,V5 as wr,GX as xr,L5 as yr,R7 as zr,GW as Ar,zW as Br,F5 as Cr,HX as Dr,N7 as Er};