@stacksjs/stx 0.2.279 → 0.2.281

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 (62) hide show
  1. package/dist/{chunk-an8s3rjv.js → chunk-0cdkfqw6.js} +2 -2
  2. package/dist/{chunk-08a9bfpq.js → chunk-0kexd0d9.js} +1 -1
  3. package/dist/{chunk-wz87behc.js → chunk-3p2w5dag.js} +1 -1
  4. package/dist/{chunk-rqx69p0n.js → chunk-3rbdvrp0.js} +1 -1
  5. package/dist/{chunk-1wbr71dj.js → chunk-40bzrw9q.js} +1 -1
  6. package/dist/{chunk-ddh7j0ed.js → chunk-4k0y2fnh.js} +1 -1
  7. package/dist/{chunk-1k3zp68a.js → chunk-61rfw29f.js} +1 -1
  8. package/dist/{chunk-2x85y8hb.js → chunk-6vaa771b.js} +1 -1
  9. package/dist/{chunk-2r0sm7yh.js → chunk-78yh2zqa.js} +9 -9
  10. package/dist/{chunk-4afj0w1m.js → chunk-86d1vte8.js} +1 -1
  11. package/dist/{chunk-9334fg4q.js → chunk-99ppngnm.js} +1 -1
  12. package/dist/{chunk-aj9xtx4y.js → chunk-9w2e55wt.js} +2 -2
  13. package/dist/{chunk-dgtbkxfd.js → chunk-bavv2k2z.js} +1 -1
  14. package/dist/{chunk-42mwkqa5.js → chunk-bkbnxd7s.js} +1 -1
  15. package/dist/{chunk-0m5vyswh.js → chunk-cnbqznms.js} +1 -1
  16. package/dist/{chunk-1kgz9eet.js → chunk-d8j22791.js} +1 -1
  17. package/dist/chunk-e7avk421.js +28 -0
  18. package/dist/{chunk-3cqwrprg.js → chunk-edctags2.js} +1 -1
  19. package/dist/{chunk-cbaa2gpx.js → chunk-exwdzxbq.js} +1 -1
  20. package/dist/{chunk-fg50mb11.js → chunk-gdja5ak8.js} +1 -1
  21. package/dist/{chunk-gyr2qp4d.js → chunk-gex3spzq.js} +1 -1
  22. package/dist/{chunk-e3m5zefg.js → chunk-gm2wsf2d.js} +1 -1
  23. package/dist/{chunk-qs1kypwa.js → chunk-h0t73k2z.js} +325 -325
  24. package/dist/{chunk-34d33f18.js → chunk-hcjmvwnt.js} +1 -1
  25. package/dist/{chunk-c40n039h.js → chunk-hghg9hcj.js} +1 -1
  26. package/dist/{chunk-2m8aq999.js → chunk-hqsadyfr.js} +1 -1
  27. package/dist/{chunk-s0v2g53x.js → chunk-hysmnz0q.js} +1 -1
  28. package/dist/{chunk-083kj0ge.js → chunk-k7m8p93y.js} +1 -1
  29. package/dist/{chunk-kr2q64k9.js → chunk-pgvskhg2.js} +1 -1
  30. package/dist/{chunk-8c18h010.js → chunk-q2twgdxk.js} +1 -1
  31. package/dist/{chunk-b6txvycf.js → chunk-qp1shwek.js} +1 -1
  32. package/dist/{chunk-ashkqdsb.js → chunk-qrx23zbx.js} +1 -1
  33. package/dist/{chunk-f0f8pne1.js → chunk-rvmt27kv.js} +1 -1
  34. package/dist/{chunk-zpne6q7q.js → chunk-s6759be9.js} +1 -1
  35. package/dist/chunk-vc973skb.js +898 -0
  36. package/dist/{chunk-tjgyd8gt.js → chunk-vxskcekj.js} +1 -1
  37. package/dist/{chunk-jsnybr5z.js → chunk-x8pbbdp1.js} +1 -1
  38. package/dist/{chunk-q0ctxav6.js → chunk-xen25bsv.js} +1 -1
  39. package/dist/{chunk-eakr9att.js → chunk-y8sqjqwg.js} +1 -1
  40. package/dist/{chunk-3564b157.js → chunk-y91519ss.js} +1 -1
  41. package/dist/{chunk-abx8rmt4.js → chunk-ydzmhy4c.js} +1 -1
  42. package/dist/{chunk-q9y29cgw.js → chunk-yqkjgz9q.js} +1 -1
  43. package/dist/{chunk-ev7490c4.js → chunk-z4mrwx1z.js} +1 -1
  44. package/dist/{chunk-5q8yyck0.js → chunk-ztzas1ew.js} +1 -1
  45. package/dist/cli.js +7 -7
  46. package/dist/color-mode-boot.d.ts +0 -50
  47. package/dist/color-mode-boot.js +2 -12
  48. package/dist/component-processing.js +12 -1
  49. package/dist/composable-loader.d.ts +10 -1
  50. package/dist/composable-loader.js +4 -4
  51. package/dist/craft-entry.js +1 -1
  52. package/dist/craft.js +1 -1
  53. package/dist/head-injection.d.ts +17 -0
  54. package/dist/head-injection.js +14 -6
  55. package/dist/process.js +37 -36
  56. package/dist/pwa.js +1 -1
  57. package/dist/runtime-injection.js +5 -6
  58. package/dist/seo.js +9 -1
  59. package/dist/ssg.js +2 -2
  60. package/package.json +5 -5
  61. package/dist/chunk-9mjw29f1.js +0 -28
  62. package/dist/chunk-dqzxr0pk.js +0 -898
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Cs as f6,Ds as x6,ss as O2}from"./chunk-xpxw2ked.js";import{Js as t5}from"./chunk-6gb72zp2.js";import{Rs as c0}from"./chunk-shyqtvbq.js";import{Ss as p1,Ts as m1,Us as L2,Vs as G5,Xs as b1,Ys as h2,Zs as u2,nt as w2}from"./chunk-abx8rmt4.js";import{ot as g6,qt as h6,rt as u6,tt as L5}from"./chunk-w1asc0zd.js";import{ut as h9}from"./chunk-xqwmj65h.js";import{Bt as G$,Dt as b2,xt as R2}from"./chunk-0ym08enb.js";import{Ot as D2}from"./chunk-q4desjj6.js";import{Pt as M7,Qt as i2,Rt as g2,St as c1,Wt as n2,Xt as X7,Yt as I9,_t as g8,bu as Y2}from"./chunk-gfhzedsr.js";import{Mu as F2,Ou as iG,Pu as J3,Ru as B5,lu as H4,ou as j9,vu as Z4}from"./chunk-sfaayvmn.js";import{Wu as d6}from"./chunk-azfjfrns.js";import{$u as x}from"./chunk-z45t29sf.js";import S1 from"path";import S5 from"fs";var e4=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"]),$7={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"},e2=new Set(["ctrl","alt","shift","meta"]),J7={left:0,middle:1,right:2};function Z7($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let X of $){let J=X.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(e2.has(J))Z.systemKeys.push(J);else if(J in J7)Z.mouse=J;else if(J in $7||/^[a-z]$/.test(J))Z.keys.push($7[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function Y7($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,q]=Y,W=Y.index,K=W+Q.length,U=`__stx_evt_${X++}`,z=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=H.exec(q))!==null){let[,_,L]=B,V=_.split("."),O=V[0];if(!e4.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:L,modifiers:Z7(V.slice(1)),elementId:U})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,L]=B,V=_.split("."),O=V[0];if(!e4.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:L,modifiers:Z7(V.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:Q,elementId:U,events:z,startIndex:W,endIndex:K})}return Z}function $Z($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let J of X.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(X.keys.length>0){let J=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(X.mouse!==null){let J=J7[X.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function ZZ($,Z){let X=$;if(Z.debounce!==null)X=`__stx_debounce(() => { ${X} }, ${Z.debounce})`;else if(Z.throttle!==null)X=`__stx_throttle(() => { ${X} }, ${Z.throttle})`;return X}function l$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function XZ($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=$Z($),Y=ZZ(l$($.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(", ")} }`:"",q=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2
+ import{Cs as g6,Ds as h6,ss as D2}from"./chunk-xpxw2ked.js";import{Js as t5}from"./chunk-6gb72zp2.js";import{Rs as c0}from"./chunk-shyqtvbq.js";import{Ss as p1,Ts as m1,Us as M2,Vs as G5,Xs as b1,Ys as p2,Zs as i2,nt as A2}from"./chunk-ydzmhy4c.js";import{ot as u6,qt as d6,rt as m6,tt as F5}from"./chunk-w1asc0zd.js";import{ut as u9}from"./chunk-xqwmj65h.js";import{Bt as G$,Dt as f2,xt as k2}from"./chunk-0ym08enb.js";import{Ot as I2}from"./chunk-q4desjj6.js";import{Pt as k7,Qt as t2,Rt as c2,St as c1,Wt as e2,Xt as Y7,Yt as T9,_t as u8,bu as G2}from"./chunk-gfhzedsr.js";import{Mu as N2,Ou as $q,Pu as J3,Ru as H5,lu as j4,ou as _9,vu as Z4}from"./chunk-sfaayvmn.js";import{Wu as l6}from"./chunk-azfjfrns.js";import{$u as x}from"./chunk-z45t29sf.js";import S1 from"path";import S5 from"fs";var Z7=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"]),X7={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"},QZ=new Set(["ctrl","alt","shift","meta"]),Q7={left:0,middle:1,right:2};function J7($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let X of $){let J=X.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(QZ.has(J))Z.systemKeys.push(J);else if(J in Q7)Z.mouse=J;else if(J in X7||/^[a-z]$/.test(J))Z.keys.push(X7[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function G7($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,q]=Y,W=Y.index,U=W+Q.length,z=`__stx_evt_${X++}`,K=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=H.exec(q))!==null){let[,_,F]=B,V=_.split("."),O=V[0];if(!Z7.has(O))continue;K.push({attribute:`@${_}`,event:O,handler:F,modifiers:J7(V.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,F]=B,V=_.split("."),O=V[0];if(!Z7.has(O))continue;K.push({attribute:`@${_}`,event:O,handler:F,modifiers:J7(V.slice(1)),elementId:z})}if(K.length>0)Z.push({originalTag:Q,elementId:z,events:K,startIndex:W,endIndex:U})}return Z}function GZ($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let J of X.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(X.keys.length>0){let J=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(X.mouse!==null){let J=Q7[X.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function qZ($,Z){let X=$;if(Z.debounce!==null)X=`__stx_debounce(() => { ${X} }, ${Z.debounce})`;else if(Z.throttle!==null)X=`__stx_throttle(() => { ${X} }, ${Z.throttle})`;return X}function l$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function WZ($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=GZ($),Y=qZ(l$($.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(", ")} }`:"",q=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('${X}');
5
5
  if (!$el) return;
@@ -108,22 +108,22 @@ else {
108
108
  }
109
109
 
110
110
  // Event listeners
111
- ${$.map(XZ).join(`
111
+ ${$.map(WZ).join(`
112
112
  `)}
113
113
  })();
114
- </script>`}function JZ($){let Z=Y7($);if(Z.length===0)return{template:$,bindings:[]};let X=$,J=[];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 q=G.match(/id=["']([^"']+)["']/);if(q)for(let W of Q.events)W.elementId=q[1]}for(let q of Q.events){let W=q.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(K,""),G=G.replace(U,"")}X=X.slice(0,Q.startIndex)+G+X.slice(Q.endIndex),J.push(...Q.events)}return{template:X,bindings:J}}function Q7($,Z,X){if(X7($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=JZ($),K=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...K,...W],q}let J=Y7($);if(J.length===0)return $;let Y=$;for(let q=J.length-1;q>=0;q--){let W=J[q],K=W.originalTag;if(!K.includes(" id="))K=K.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let U=K.match(/id=["']([^"']+)["']/);if(U)for(let z of W.events)z.elementId=U[1]}for(let U of W.events){let z=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");K=K.replace(H,""),K=K.replace(B,"")}Y=Y.slice(0,W.startIndex)+K+Y.slice(W.endIndex)}let Q=c$(J.flatMap((q)=>q.events)),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
115
- `+Y.slice(G);else Y+=Q;return Y}function HW($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}function $1($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,Y)=>{return`const { ${Y.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
114
+ </script>`}function UZ($){let Z=G7($);if(Z.length===0)return{template:$,bindings:[]};let X=$,J=[];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 q=G.match(/id=["']([^"']+)["']/);if(q)for(let W of Q.events)W.elementId=q[1]}for(let q of Q.events){let W=q.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(U,""),G=G.replace(z,"")}X=X.slice(0,Q.startIndex)+G+X.slice(Q.endIndex),J.push(...Q.events)}return{template:X,bindings:J}}function q7($,Z,X){if(Y7($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=UZ($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let J=G7($);if(J.length===0)return $;let Y=$;for(let q=J.length-1;q>=0;q--){let W=J[q],U=W.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=U.match(/id=["']([^"']+)["']/);if(z)for(let K of W.events)K.elementId=z[1]}for(let z of W.events){let K=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");U=U.replace(H,""),U=U.replace(B,"")}Y=Y.slice(0,W.startIndex)+U+Y.slice(W.endIndex)}let Q=c$(J.flatMap((q)=>q.events)),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
115
+ `+Y.slice(G);else Y+=Q;return Y}function wW($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}function $1($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,Y)=>{return`const { ${Y.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
116
116
  `});let X=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(X,(J,Y)=>{return`const { ${Y.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
117
- `}),$}function jW($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}import yq from"fs";import h from"path";import{createHash as YZ}from"crypto";var u5="__stx_component_client_factories";function d5($){let Z=$[u5];return Z instanceof Map?Z:null}function G7($){$[u5]=new Map}function p$($,Z){let X=d5($);if(!X)return null;let J=YZ("sha256").update(Z).digest("hex").slice(0,16),Y=X.get(J);if(Y)Y.instances++;else X.set(J,{body:Z,instances:1});return J}function q7($,Z){let X=d5(Z);if(!X?.size)return $;let J=$;for(let[W,K]of X){if(K.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(W)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(U,(z,H)=>`(${K.body})(${H});`)}let Y=[...X].filter(([,W])=>W.instances>1);if(Y.length===0)return J;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
117
+ `}),$}function DW($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}import hq from"fs";import h from"path";import{createHash as zZ}from"crypto";var u5="__stx_component_client_factories";function d5($){let Z=$[u5];return Z instanceof Map?Z:null}function W7($){$[u5]=new Map}function p$($,Z){let X=d5($);if(!X)return null;let J=zZ("sha256").update(Z).digest("hex").slice(0,16),Y=X.get(J);if(Y)Y.instances++;else X.set(J,{body:Z,instances:1});return J}function U7($,Z){let X=d5(Z);if(!X?.size)return $;let J=$;for(let[W,U]of X){if(U.instances!==1)continue;let z=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(W)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(z,(K,H)=>`(${U.body})(${H});`)}let Y=[...X].filter(([,W])=>W.instances>1);if(Y.length===0)return J;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
118
118
  (function() {
119
119
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
120
- ${Y.map(([W,K])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${K.body}; }
120
+ ${Y.map(([W,U])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${U.body}; }
121
121
  catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(W)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
122
122
  `)}
123
123
  })();
124
124
  </script>`,q=J.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(q<0)return`${G}
125
125
  ${J}`;return`${J.slice(0,q)}${G}
126
- ${J.slice(q)}`}function W7($){let Z=d5($),X=new Map;if(Z)for(let[J,Y]of Z)X.set(J,Y.instances);return X}function K7($,Z){let X=d5($);if(!X)return[];let J=[];for(let[Y,Q]of X){let G=Q.instances-(Z.get(Y)??0);if(G>0)J.push({body:Q.body,count:G})}return J}function U7($,Z){for(let{body:X,count:J}of Z)for(let Y=0;Y<J;Y++)p$($,X)}var QZ={maxSanitizeDepth:10,allowBracketNotation:!1},H7={...QZ};var B7=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],GZ=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),j7=new Set(["__proto__","constructor","prototype"]),qZ=/[\w)\]]\s*\[\s*['"]/;function WZ($){let Z="",X=null,J=!1;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if(J){J=!1;continue}if(Q==="\\"&&X){J=!0;continue}if(X){if(X==="`"&&Q==="$"&&Y+1<$.length&&$[Y+1]==="{"){let G=1;Y+=2;while(Y<$.length&&G>0){if($[Y]==="{")G++;else if($[Y]==="}")G--;if(G>0)Z+=$[Y],Y++}continue}if(Q===X)X=null;continue}if(Q==='"'||Q==="'"||Q==="`"){X=Q;continue}Z+=Q}return Z}function KZ($,Z){let X=/[$A-Z_a-z][$\w]*/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=$[J.index-1];if(GZ.has(Y))throw Error(`Potentially unsafe expression (matched /\\b${Y}\\b/; identifier ${Y}): ${Z}`);if(Q==="."&&j7.has(Y))throw Error(`Potentially unsafe expression (matched /.${Y}/; property ${Y}): ${Z}`)}}function UZ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,X;while((X=Z.exec($))!==null){let J=X[2];if(!j7.has(J))continue;let Y=$.slice(0,X.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(X.index+X[0].length).match(/^\s*(\S)/)?.[1];if(!((Y==="{"||Y===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${X[2]}): ${$}`)}}function m5($){let Z=$.trim(),X=WZ(Z);KZ(X,Z),UZ(Z);for(let J of B7)if(J.test(X))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!H7.allowBracketNotation&&qZ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function zZ($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[X,J]of Object.entries($)){if(X.startsWith("__")||B7.some((Y)=>Y.test(X)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[X]=i$(J);else Z[X]=J}return Z}function i$($,Z=0){if(Z>=H7.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>i$(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let X={};for(let[J,Y]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(Y&&typeof Y==="object")X[J]=i$(Y,Z+1);else X[J]=Y}return X}function e($,Z){try{let X=zZ(Z),J=Object.keys(X),Y=Object.values(X);return W0($,J)(...Y)}catch{return}}function q0($){try{return m5($),!0}catch{return!1}}function R0($,Z){try{let X=e($,Z);if(X&&typeof X==="object"&&!Array.isArray(X))return X;return{}}catch{return{}}}var _7=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]);function l5($){return $.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}function W0($,Z){let X=m5($),J=/^[A-Za-z_$][\w$]*$/,Y=[],Q=[];for(let K=0;K<Z.length;K++){let U=Z[K];if(!J.test(U))continue;if(_7.has(U))continue;Y.push(K),Q.push(U)}let G=(K)=>Function(...Q,...K,`
126
+ ${J.slice(q)}`}function z7($){let Z=d5($),X=new Map;if(Z)for(let[J,Y]of Z)X.set(J,Y.instances);return X}function K7($,Z){let X=d5($);if(!X)return[];let J=[];for(let[Y,Q]of X){let G=Q.instances-(Z.get(Y)??0);if(G>0)J.push({body:Q.body,count:G})}return J}function H7($,Z){for(let{body:X,count:J}of Z)for(let Y=0;Y<J;Y++)p$($,X)}var KZ={maxSanitizeDepth:10,allowBracketNotation:!1},j7={...KZ};var _7=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],HZ=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),V7=new Set(["__proto__","constructor","prototype"]),BZ=/[\w)\]]\s*\[\s*['"]/;function jZ($){let Z="",X=null,J=!1;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if(J){J=!1;continue}if(Q==="\\"&&X){J=!0;continue}if(X){if(X==="`"&&Q==="$"&&Y+1<$.length&&$[Y+1]==="{"){let G=1;Y+=2;while(Y<$.length&&G>0){if($[Y]==="{")G++;else if($[Y]==="}")G--;if(G>0)Z+=$[Y],Y++}continue}if(Q===X)X=null;continue}if(Q==='"'||Q==="'"||Q==="`"){X=Q;continue}Z+=Q}return Z}function _Z($,Z){let X=/[$A-Z_a-z][$\w]*/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=$[J.index-1];if(HZ.has(Y))throw Error(`Potentially unsafe expression (matched /\\b${Y}\\b/; identifier ${Y}): ${Z}`);if(Q==="."&&V7.has(Y))throw Error(`Potentially unsafe expression (matched /.${Y}/; property ${Y}): ${Z}`)}}function VZ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,X;while((X=Z.exec($))!==null){let J=X[2];if(!V7.has(J))continue;let Y=$.slice(0,X.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(X.index+X[0].length).match(/^\s*(\S)/)?.[1];if(!((Y==="{"||Y===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${X[2]}): ${$}`)}}function m5($){let Z=$.trim(),X=jZ(Z);_Z(X,Z),VZ(Z);for(let J of _7)if(J.test(X))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!j7.allowBracketNotation&&BZ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function OZ($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[X,J]of Object.entries($)){if(X.startsWith("__")||_7.some((Y)=>Y.test(X)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[X]=i$(J);else Z[X]=J}return Z}function i$($,Z=0){if(Z>=j7.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>i$(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let X={};for(let[J,Y]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(Y&&typeof Y==="object")X[J]=i$(Y,Z+1);else X[J]=Y}return X}function e($,Z){try{let X=OZ(Z),J=Object.keys(X),Y=Object.values(X);return W0($,J)(...Y)}catch{return}}function q0($){try{return m5($),!0}catch{return!1}}function R0($,Z){try{let X=e($,Z);if(X&&typeof X==="object"&&!Array.isArray(X))return X;return{}}catch{return{}}}var O7=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]);function l5($){return $.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}function W0($,Z){let X=m5($),J=/^[A-Za-z_$][\w$]*$/,Y=[],Q=[];for(let U=0;U<Z.length;U++){let z=Z[U];if(!J.test(z))continue;if(O7.has(z))continue;Y.push(U),Q.push(z)}let G=(U)=>Function(...Q,...U,`
127
127
  'use strict';
128
128
  try {
129
129
  return ${X};
@@ -134,7 +134,7 @@ catch (e) {
134
134
  }
135
135
  throw e;
136
136
  }
137
- `),q=G([]);if(Q.length===Z.length)return z7(q,Q,G);return z7((...K)=>{let U=Array(Y.length);for(let z=0;z<Y.length;z++)U[z]=K[Y[z]];return q(...U)},Q,G,(K)=>{q=G(K)})}function z7($,Z,X,J){let Q=/^(\w+) is not defined$/,G=$,q=[],W=new Set(Z);return(...K)=>{for(let U=0;U<=8;U++)try{return G(...K)}catch(z){let H=z instanceof Error?z.message:"",B=Q.exec(H);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(W.has(j)||_7.has(j))return;W.add(j),q.push(j),G=X(q),J?.(q)}return}}function c5($){let Z=$.trim(),X=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of X)if(J.test(Z))return!1;return!0}var V7=0,p5=new Map;function LW(){V7=0,p5.clear()}function i5($,Z){let X=V7++,J=`<!--__STX_${$.toUpperCase()}_${X}__-->`;return p5.set(J,{type:$,expression:Z}),J}function wW(){let $={};for(let[Z,X]of p5)$[Z]={type:X.type,expression:X.expression};return $}function RW($){let Z={},X=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=J[1].toLowerCase(),G=p5.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function DW($,Z){let X=$;for(let[J,Y]of Z)X=X.split(J).join(Y);return X}function NW($){return $.includes("<!--__STX_")}var O7=/<script\b[^>]*>/iy,F7=/<\/script\s*>/ig,L7=/<style\b[^>]*>/iy,w7=/<\/style\s*>/ig;function R7($,Z,X,J){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)return-1;J.lastIndex=X.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function Q1($,Z){return R7($,Z,O7,F7)}function C1($,Z){return R7($,Z,L7,w7)}function U5($,Z){if(!$.startsWith("<!--",Z))return-1;let X=$.indexOf("-->",Z+4);if(X===-1)return-1;return X+3}function HZ($,Z){if($.startsWith("<!--",Z)){let X=U5($,Z);return X===-1?$.length:X}for(let[X,J]of[[O7,F7],[L7,w7]]){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)continue;J.lastIndex=X.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function n5($,Z){let X=[],J=0,Y=$.length,Q=!1,G=null;while(J<Y){let q=$[J];if(Q){if(G){if(q===G)G=null}else if(q==='"'||q==="'")G=q;else if(q===">")Q=!1;J++;continue}if(q!=="<"){J++;continue}let W=Z($,J);if(W>J){X.push({start:J,end:W,token:$.slice(J,W)}),J=W;continue}let K=HZ($,J);if(K>J){J=K;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return X}function o0($,Z,X){let J=n5($,Z);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((q)=>q.token),Q="",G=0;for(let q=0;q<J.length;q++){let W=J[q];Q+=$.slice(G,W.start),Q+=X(W.token,q),G=W.end}return Q+=$.slice(G),{output:Q,tokens:Y}}function r0($){let{output:Z,tokens:X}=o0($,Q1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:Z,scripts:X}}function P1($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(X,J)=>Z[+J]??"")}var z5={},D7=new Map;function BZ($){let Z=D7.get($);if(!Z){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${X}(?!\\w)`,"g"),D7.set($,Z)}return Z.lastIndex=0,Z}var s5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let X=String($);return X.charAt(0).toUpperCase()+X.slice(1)},number:($,Z,X=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(X),10))}catch{return""}},fmt:($,Z,X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(X)}catch{return String($)}},join:($,Z,X=",")=>{if(!Array.isArray($))return"";return $.join(String(X))},escape:($,Z)=>{if($===void 0||$===null)return"";return A7(String($))},translate:($,Z,X={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return Y?$:"";let q=String(G);return Object.entries(X).forEach(([W,K])=>{q=q.replace(BZ(W),String(K))}),q},t:($,Z,X={})=>{return s5.translate($,Z,X)},truncate:($,Z,X=50,J="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=X)return Y;if(X<=J.length)return J.substring(0,X);return Y.substring(0,X-J.length)+J},date:($,Z,X="short",J="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(X==="iso")return Y.toISOString();return new Intl.DateTimeFormat(J,Q[X]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,X="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:X}).format(Y)}catch{return String($)}},pluralize:($,Z,X,J)=>{let Y=Number($);if(Number.isNaN(Y))return X;let Q=J||`${X}s`;return Y===1?X: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 X=String($);return X.charAt(X.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,X=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return X?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,X="")=>{return $===void 0||$===null||$===""?X:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,X=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(X,J);return $},replace:($,Z,X,J="")=>{if($===void 0||$===null)return"";let Y=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let X=Number($);return Number.isNaN(X)?0:Math.abs(X)},round:($,Z,X=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Y=10**X;return Math.round(J*Y)/Y}};function jZ($,Z){if($ in s5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);z5[$]=Z}function SW($){for(let[Z,X]of Object.entries($))jZ(Z,X)}function _Z(){return{...s5,...z5}}function CW(){for(let $ of Object.keys(z5))delete z5[$]}function n$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function A7($){return n$($).replace(/\{{2,}/g,(Z)=>VZ(Z.length)).replace(/\{(?=!)/g,`&#123;${k7}`)}var k7="&#8288;";function VZ($){return Array.from({length:$},()=>"&#123;").join(k7)}function G1($,Z){let{scripts:X}=r0($);for(let J of X){let Y=J.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)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0;if(M7(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 N7($,Z){let X=["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"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let K=0;K<J.length;K++){let U=J[K];if(!Q&&U==="`"){Q=!0,G=0;continue}if(Q){if(U==="`"&&G===0){Q=!1;continue}if(U==="$"&&J[K+1]==="{"){G++,K++,Y+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Y+=U;continue}continue}Y+=U}J=Y;let q=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=q.exec(J))!==null){let K=W[1];if(!J.substring(0,W.index).trimEnd().endsWith(".")){if(!X.includes(K)&&!(K in Z))return!1}}return!0}function OZ($,Z){let X=Z.__stx_serverDeclared;if(!X||X.size===0)return!1;let J=c0($);for(let Y of X)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function s$($,Z){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=f0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=f0(Y,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),X}function FZ($,Z){if(!$.includes("{"))return $;let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=f0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=f0(Y,Z);if(G===void 0)return J;if(G===null)return"";return String(G).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return J}}),X}function PW($,Z,X={}){let{output:J,scripts:Y}=r0($),Q=Y.map((G)=>{let q=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),K=G.search(/<\/script\s*>$/i);if(!q||!W||K===-1)return G;let U=q[1],z=q[2];if(/\bdata-raw\b/.test(U))return G;if(X.skipServer&&/\bserver\b/.test(U))return G;let B=`<script${FZ(U,Z)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return B+z+G.slice(K);return B+s$(z,Z)+G.slice(K)});return P1(J,Q)}function O1($,Z,X){let J=$,Y=(z,H)=>{let B=C1(z,H);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(H,B))?-1:B},Q=(z,H,B,j)=>{let _=B.length,{output:L,tokens:V}=o0(z,H,(O,F)=>j(_+F));return B.push(...V),L},G=[];J=Q(J,Y,G,(z)=>`<!--__STX_STYLE_${z}__-->`);let q=[];J=Q(J,Q1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let W=Z?.__stx_signals_gate===!0||G1($),K=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,H,B)=>{try{let j=f0(H,Z);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return B0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${_}`,X,$,B,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,H,B)=>{try{let j=f0(H,Z);if(j===void 0&&Z.__stx_buildMode==="compile")return i5("raw",H.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(Z.__stx_buildMode==="compile")return i5("raw",H.trim());let _=j instanceof Error?j.message:String(j);return B0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${_}`,X,$,B,z)}}),J=Q(J,Q1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),J=Q(J,Y,G,(z)=>`<!--__STX_STYLE_${z}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(z,H,B)=>{let j=H.trim();if(U.has(j))return z;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],L=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,O=j.match(L)?.[1],F=O&&((O in Z)||_.includes(O)),w=Boolean(O&&K.has(O)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=j.match(R),M=D&&!_.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(j))return"";try{let k=f0(H,Z);if(w)return z;if(W&&!N7(j,Z))return z;if(Z.__stx_buildMode==="compile"&&!W&&(k===void 0||OZ(j,Z)))return i5("expr",j);return k!==void 0&&k!==null?A7(String(k)):""}catch(k){if(w)return z;if(W&&!N7(j,Z))return z;if(M)return z;let N=k instanceof Error?k.message:String(k);return B0("Expression",`Error evaluating: {{ ${j} }}: ${N}`,X,$,B,z)}});for(let z=0;z<q.length;z++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>q[z]);for(let z=0;z<G.length;z++)J=J.replace(`<!--__STX_STYLE_${z}__-->`,()=>G[z]);return J}function LZ($,Z,X){if(!Z.trim())return $;let J=$,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 q=z5[G]||s5[G];if(!q)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(_Z()).join(", ")}`);let W=[];if(Y.startsWith(":")){let K=Y.match(/^:([^|\s]+)/);if(K){let U=K[1].trim();try{let z=Number(U);W=[Number.isNaN(z)?U:z]}catch{W=[U]}Y=Y.substring(K[0].length).trim()}}else if(Y.startsWith("(")){let K=1,U=1;while(K>0&&U<Y.length){if(Y[U]==="(")K++;if(Y[U]===")")K--;U++}if(K===0){let z=Y.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))W=[f0(`(${z})`,X,!0)];else{let H=[],B="",j=null,_=0,L=0,V=0,O=!1;for(let F=0;F<z.length;F++){let w=z[F];if(O){B+=w,O=!1;continue}if(w==="\\"){B+=w,O=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&_===0&&L===0&&V===0){H.push(B),B="";continue}B+=w}if(B)H.push(B);W=H.map((F)=>{let w=F.trim();return f0(w,X,!0)})}}catch{W=[z]}Y=Y.substring(U).trim()}}try{J=q(J,X,...W)}catch(K){let U=K instanceof Error?K.message:String(K);throw Error(`Error applying filter '${G}': ${U}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function wZ($){let Z=!1,X="",J=0,Y=0,Q=0,G=!1;for(let q=0;q<$.length;q++){let W=$[q],K=$[q+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,X=W;else if(W===X)Z=!1,X="";continue}if(Z&&X==="`"&&W==="$"&&K==="{"){let U=1;q+=2;while(q<$.length&&U>0){if($[q]==="{")U++;else if($[q]==="}")U--;if(U>0)q++}continue}if(Z)continue;if(W==="(")J++;else if(W===")")J--;else if(W==="[")Y++;else if(W==="]")Y--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&J===0&&Y===0&&Q===0){if(K==="|"){q++;continue}if(K==="="){q++;continue}return q}}return-1}function f0($,Z,X=!1){try{let J=$.trim(),Y=wZ(J);if(Y>0){let Q=J.substring(0,Y).trim(),G=J.substring(Y+1).trim(),q=f0(Q,Z,!0);return LZ(q,G,Z)}if(!q0(J)){if(!X)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return e(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return W0(J,Q)(...G)}catch{return e(J,Z)}}catch(J){if(J instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(J.message);if(Y){let Q=Y[1],G=RZ(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!X)console.error(`Error evaluating expression: ${$}`,J);throw J}}function RZ($,Z){let X=null;for(let Y of Z){if(Y===$)continue;let Q=DZ($,Y);if(X===null||Q<X.dist)X={key:Y,dist:Q}}if(!X)return null;let J=Math.max($.length,X.key.length);if(X.dist<=2||X.dist/J<=0.35)return X.key;return null}function DZ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[X,J]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(X.length+1),Q=Array(X.length+1);for(let G=0;G<=X.length;G++)Y[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let q=1;q<=X.length;q++){let W=X[q-1]===J[G-1]?0:1;Q[q]=Math.min(Q[q-1]+1,Y[q]+1,Y[q-1]+W)}for(let q=0;q<=X.length;q++)Y[q]=Q[q]}return Y[X.length]}function vW($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import nG from"fs";import A0 from"path";var o$=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],I7=/<body\b([^>]*)>/gi;function q1($){let Z=0,X,J=o$.map(()=>{return});while(Z<$.length){if(X===void 0||X!==null&&X.index<Z)I7.lastIndex=Z,X=I7.exec($);if(!X)return null;let Y=X.index,Q=-1,G=null;for(let W=0;W<o$.length;W++){let K=o$[W],U=J[W];if(U===void 0||U!==null&&U.index<Z)K.open.lastIndex=Z,U=K.open.exec($),J[W]=U;if(!U)continue;if(U.index<Y&&(Q===-1||U.index<Q))Q=U.index,G=K.close}if(Q===-1||!G)return{index:Y,tag:X[0],attrs:X[1]??""};G.lastIndex=Q;let q=G.exec($);if(!q)return null;Z=q.index+q[0].length}return null}function v1($,Z){let X=q1($);if(!X)return $;return $.slice(0,X.index)+Z(X.tag,X.attrs)+$.slice(X.index+X.tag.length)}var T7=null;function NZ($){if(!T7)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return T7}function gW($){let Z=NZ("onUpdate");if(Z)Z.updateHooks.push($)}function E7(){return`
137
+ `),q=G([]);if(Q.length===Z.length)return B7(q,Q,G);return B7((...U)=>{let z=Array(Y.length);for(let K=0;K<Y.length;K++)z[K]=U[Y[K]];return q(...z)},Q,G,(U)=>{q=G(U)})}function B7($,Z,X,J){let Q=/^(\w+) is not defined$/,G=$,q=[],W=new Set(Z);return(...U)=>{for(let z=0;z<=8;z++)try{return G(...U)}catch(K){let H=K instanceof Error?K.message:"",B=Q.exec(H);if(!(K instanceof ReferenceError)||!B)return;let j=B[1];if(W.has(j)||O7.has(j))return;W.add(j),q.push(j),G=X(q),J?.(q)}return}}function c5($){let Z=$.trim(),X=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of X)if(J.test(Z))return!1;return!0}var F7=0,p5=new Map;function IW(){F7=0,p5.clear()}function i5($,Z){let X=F7++,J=`<!--__STX_${$.toUpperCase()}_${X}__-->`;return p5.set(J,{type:$,expression:Z}),J}function TW(){let $={};for(let[Z,X]of p5)$[Z]={type:X.type,expression:X.expression};return $}function EW($){let Z={},X=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=J[1].toLowerCase(),G=p5.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function bW($,Z){let X=$;for(let[J,Y]of Z)X=X.split(J).join(Y);return X}function yW($){return $.includes("<!--__STX_")}var L7=/<script\b[^>]*>/iy,w7=/<\/script\s*>/ig,R7=/<style\b[^>]*>/iy,D7=/<\/style\s*>/ig;function N7($,Z,X,J){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)return-1;J.lastIndex=X.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function Q1($,Z){return N7($,Z,L7,w7)}function C1($,Z){return N7($,Z,R7,D7)}function U5($,Z){if(!$.startsWith("<!--",Z))return-1;let X=$.indexOf("-->",Z+4);if(X===-1)return-1;return X+3}function FZ($,Z){if($.startsWith("<!--",Z)){let X=U5($,Z);return X===-1?$.length:X}for(let[X,J]of[[L7,w7],[R7,D7]]){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)continue;J.lastIndex=X.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function n5($,Z){let X=[],J=0,Y=$.length,Q=!1,G=null;while(J<Y){let q=$[J];if(Q){if(G){if(q===G)G=null}else if(q==='"'||q==="'")G=q;else if(q===">")Q=!1;J++;continue}if(q!=="<"){J++;continue}let W=Z($,J);if(W>J){X.push({start:J,end:W,token:$.slice(J,W)}),J=W;continue}let U=FZ($,J);if(U>J){J=U;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return X}function o0($,Z,X){let J=n5($,Z);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((q)=>q.token),Q="",G=0;for(let q=0;q<J.length;q++){let W=J[q];Q+=$.slice(G,W.start),Q+=X(W.token,q),G=W.end}return Q+=$.slice(G),{output:Q,tokens:Y}}function r0($){let{output:Z,tokens:X}=o0($,Q1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:Z,scripts:X}}function P1($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(X,J)=>Z[+J]??"")}var z5={},M7=new Map;function LZ($){let Z=M7.get($);if(!Z){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${X}(?!\\w)`,"g"),M7.set($,Z)}return Z.lastIndex=0,Z}var s5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let X=String($);return X.charAt(0).toUpperCase()+X.slice(1)},number:($,Z,X=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(X),10))}catch{return""}},fmt:($,Z,X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(X)}catch{return String($)}},join:($,Z,X=",")=>{if(!Array.isArray($))return"";return $.join(String(X))},escape:($,Z)=>{if($===void 0||$===null)return"";return I7(String($))},translate:($,Z,X={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return Y?$:"";let q=String(G);return Object.entries(X).forEach(([W,U])=>{q=q.replace(LZ(W),String(U))}),q},t:($,Z,X={})=>{return s5.translate($,Z,X)},truncate:($,Z,X=50,J="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=X)return Y;if(X<=J.length)return J.substring(0,X);return Y.substring(0,X-J.length)+J},date:($,Z,X="short",J="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(X==="iso")return Y.toISOString();return new Intl.DateTimeFormat(J,Q[X]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,X="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:X}).format(Y)}catch{return String($)}},pluralize:($,Z,X,J)=>{let Y=Number($);if(Number.isNaN(Y))return X;let Q=J||`${X}s`;return Y===1?X: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 X=String($);return X.charAt(X.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,X=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return X?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,X="")=>{return $===void 0||$===null||$===""?X:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,X=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(X,J);return $},replace:($,Z,X,J="")=>{if($===void 0||$===null)return"";let Y=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let X=Number($);return Number.isNaN(X)?0:Math.abs(X)},round:($,Z,X=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Y=10**X;return Math.round(J*Y)/Y}};function wZ($,Z){if($ in s5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);z5[$]=Z}function uW($){for(let[Z,X]of Object.entries($))wZ(Z,X)}function RZ(){return{...s5,...z5}}function dW(){for(let $ of Object.keys(z5))delete z5[$]}function n$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function I7($){return n$($).replace(/\{{2,}/g,(Z)=>DZ(Z.length)).replace(/\{(?=!)/g,`&#123;${T7}`)}var T7="&#8288;";function DZ($){return Array.from({length:$},()=>"&#123;").join(T7)}function G1($,Z){let{scripts:X}=r0($);for(let J of X){let Y=J.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)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0;if(k7(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 A7($,Z){let X=["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"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let U=0;U<J.length;U++){let z=J[U];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&J[U+1]==="{"){G++,U++,Y+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){Y+=z;continue}continue}Y+=z}J=Y;let q=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=q.exec(J))!==null){let U=W[1];if(!J.substring(0,W.index).trimEnd().endsWith(".")){if(!X.includes(U)&&!(U in Z))return!1}}return!0}function NZ($,Z){let X=Z.__stx_serverDeclared;if(!X||X.size===0)return!1;let J=c0($);for(let Y of X)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function s$($,Z){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=f0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=f0(Y,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),X}function MZ($,Z){if(!$.includes("{"))return $;let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=f0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=f0(Y,Z);if(G===void 0)return J;if(G===null)return"";return String(G).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return J}}),X}function mW($,Z,X={}){let{output:J,scripts:Y}=r0($),Q=Y.map((G)=>{let q=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),U=G.search(/<\/script\s*>$/i);if(!q||!W||U===-1)return G;let z=q[1],K=q[2];if(/\bdata-raw\b/.test(z))return G;if(X.skipServer&&/\bserver\b/.test(z))return G;let B=`<script${MZ(z,Z)}>`;if(/\bsrc\s*=/.test(z)||/\btype\s*=\s*["']application\/json["']/.test(z))return B+K+G.slice(U);return B+s$(K,Z)+G.slice(U)});return P1(J,Q)}function O1($,Z,X){let J=$,Y=(K,H)=>{let B=C1(K,H);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K.slice(H,B))?-1:B},Q=(K,H,B,j)=>{let _=B.length,{output:F,tokens:V}=o0(K,H,(O,L)=>j(_+L));return B.push(...V),F},G=[];J=Q(J,Y,G,(K)=>`<!--__STX_STYLE_${K}__-->`);let q=[];J=Q(J,Q1,q,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`);let W=Z?.__stx_signals_gate===!0||G1($),U=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,H,B)=>{try{let j=f0(H,Z);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return B0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${_}`,X,$,B,K)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(K,H,B)=>{try{let j=f0(H,Z);if(j===void 0&&Z.__stx_buildMode==="compile")return i5("raw",H.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(Z.__stx_buildMode==="compile")return i5("raw",H.trim());let _=j instanceof Error?j.message:String(j);return B0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${_}`,X,$,B,K)}}),J=Q(J,Q1,q,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`),J=Q(J,Y,G,(K)=>`<!--__STX_STYLE_${K}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(K,H,B)=>{let j=H.trim();if(z.has(j))return K;let _=["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=j.match(F)?.[1],L=O&&((O in Z)||_.includes(O)),w=Boolean(O&&U.has(O)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=j.match(R),M=D&&!_.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(j))return"";try{let k=f0(H,Z);if(w)return K;if(W&&!A7(j,Z))return K;if(Z.__stx_buildMode==="compile"&&!W&&(k===void 0||NZ(j,Z)))return i5("expr",j);return k!==void 0&&k!==null?I7(String(k)):""}catch(k){if(w)return K;if(W&&!A7(j,Z))return K;if(M)return K;let N=k instanceof Error?k.message:String(k);return B0("Expression",`Error evaluating: {{ ${j} }}: ${N}`,X,$,B,K)}});for(let K=0;K<q.length;K++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>q[K]);for(let K=0;K<G.length;K++)J=J.replace(`<!--__STX_STYLE_${K}__-->`,()=>G[K]);return J}function AZ($,Z,X){if(!Z.trim())return $;let J=$,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 q=z5[G]||s5[G];if(!q)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(RZ()).join(", ")}`);let W=[];if(Y.startsWith(":")){let U=Y.match(/^:([^|\s]+)/);if(U){let z=U[1].trim();try{let K=Number(z);W=[Number.isNaN(K)?z:K]}catch{W=[z]}Y=Y.substring(U[0].length).trim()}}else if(Y.startsWith("(")){let U=1,z=1;while(U>0&&z<Y.length){if(Y[z]==="(")U++;if(Y[z]===")")U--;z++}if(U===0){let K=Y.substring(1,z-1).trim();if(K)try{if(K.startsWith("{")&&K.endsWith("}"))W=[f0(`(${K})`,X,!0)];else{let H=[],B="",j=null,_=0,F=0,V=0,O=!1;for(let L=0;L<K.length;L++){let w=K[L];if(O){B+=w,O=!1;continue}if(w==="\\"){B+=w,O=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")F++;else if(w==="]")F--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&_===0&&F===0&&V===0){H.push(B),B="";continue}B+=w}if(B)H.push(B);W=H.map((L)=>{let w=L.trim();return f0(w,X,!0)})}}catch{W=[K]}Y=Y.substring(z).trim()}}try{J=q(J,X,...W)}catch(U){let z=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${G}': ${z}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function kZ($){let Z=!1,X="",J=0,Y=0,Q=0,G=!1;for(let q=0;q<$.length;q++){let W=$[q],U=$[q+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,X=W;else if(W===X)Z=!1,X="";continue}if(Z&&X==="`"&&W==="$"&&U==="{"){let z=1;q+=2;while(q<$.length&&z>0){if($[q]==="{")z++;else if($[q]==="}")z--;if(z>0)q++}continue}if(Z)continue;if(W==="(")J++;else if(W===")")J--;else if(W==="[")Y++;else if(W==="]")Y--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&J===0&&Y===0&&Q===0){if(U==="|"){q++;continue}if(U==="="){q++;continue}return q}}return-1}function f0($,Z,X=!1){try{let J=$.trim(),Y=kZ(J);if(Y>0){let Q=J.substring(0,Y).trim(),G=J.substring(Y+1).trim(),q=f0(Q,Z,!0);return AZ(q,G,Z)}if(!q0(J)){if(!X)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return e(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return W0(J,Q)(...G)}catch{return e(J,Z)}}catch(J){if(J instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(J.message);if(Y){let Q=Y[1],G=IZ(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!X)console.error(`Error evaluating expression: ${$}`,J);throw J}}function IZ($,Z){let X=null;for(let Y of Z){if(Y===$)continue;let Q=TZ($,Y);if(X===null||Q<X.dist)X={key:Y,dist:Q}}if(!X)return null;let J=Math.max($.length,X.key.length);if(X.dist<=2||X.dist/J<=0.35)return X.key;return null}function TZ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[X,J]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(X.length+1),Q=Array(X.length+1);for(let G=0;G<=X.length;G++)Y[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let q=1;q<=X.length;q++){let W=X[q-1]===J[G-1]?0:1;Q[q]=Math.min(Q[q-1]+1,Y[q]+1,Y[q-1]+W)}for(let q=0;q<=X.length;q++)Y[q]=Q[q]}return Y[X.length]}function lW($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import Zq from"fs";import A0 from"path";var o$=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],E7=/<body\b([^>]*)>/gi;function q1($){let Z=0,X,J=o$.map(()=>{return});while(Z<$.length){if(X===void 0||X!==null&&X.index<Z)E7.lastIndex=Z,X=E7.exec($);if(!X)return null;let Y=X.index,Q=-1,G=null;for(let W=0;W<o$.length;W++){let U=o$[W],z=J[W];if(z===void 0||z!==null&&z.index<Z)U.open.lastIndex=Z,z=U.open.exec($),J[W]=z;if(!z)continue;if(z.index<Y&&(Q===-1||z.index<Q))Q=z.index,G=U.close}if(Q===-1||!G)return{index:Y,tag:X[0],attrs:X[1]??""};G.lastIndex=Q;let q=G.exec($);if(!q)return null;Z=q.index+q[0].length}return null}function v1($,Z){let X=q1($);if(!X)return $;return $.slice(0,X.index)+Z(X.tag,X.attrs)+$.slice(X.index+X.tag.length)}var b7=null;function EZ($){if(!b7)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return b7}function iW($){let Z=EZ("onUpdate");if(Z)Z.updateHooks.push($)}function y7(){return`
138
138
  // STX Lifecycle Runtime
139
139
  (function() {
140
140
  if (typeof window === 'undefined') return;
@@ -482,7 +482,7 @@ else {
482
482
 
483
483
  console.log('[stx] Lifecycle runtime initialized');
484
484
  })();
485
- `}function r$($){return Symbol($)}var hW=r$("theme"),uW=r$("router"),dW=r$("i18n");import*as y7 from"crypto";function b7($){let Z=/\$(\w+)\./g,X=[],J;while((J=Z.exec($))!==null)if(!X.includes(J[1]))X.push(J[1]);return X}function MZ(){return`stx-${y7.randomBytes(4).toString("hex")}`}function AZ($){return/\$\w+\./.test($)}function kZ($){let Z=[],X=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(J,(Q,G,q,W)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let K=[],U=!1,z=q,H=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...q.matchAll(H)];for(let L of B){let V=L[0],O=L[1],F=L[2];if(AZ(F)){U=!0;let w=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(K.push({attr:O,expr:R,fullMatch:V,originalAttr:O}),b7(R).forEach((M)=>X.add(M)),O==="text")z=z.replace(V,"");else if(O==="class")z=z.replace(V,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(V,"");else z=z.replace(V,`${O}=""`)}}}if(!U)return Q;let j=z.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=MZ(),z=` id="${_}"${z}`;for(let L of K)Z.push({elementId:_,attribute:L.attr,expression:L.expr,stores:b7(L.expr)});return`<${G}${z}${W}`}),{html:Y,bindings:Z,stores:X}}function IZ($,Z){if($.length===0)return"";let X=Array.from(Z),J=`
485
+ `}function r$($){return Symbol($)}var nW=r$("theme"),sW=r$("router"),oW=r$("i18n");import*as C7 from"crypto";function S7($){let Z=/\$(\w+)\./g,X=[],J;while((J=Z.exec($))!==null)if(!X.includes(J[1]))X.push(J[1]);return X}function bZ(){return`stx-${C7.randomBytes(4).toString("hex")}`}function yZ($){return/\$\w+\./.test($)}function SZ($){let Z=[],X=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(J,(Q,G,q,W)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let U=[],z=!1,K=q,H=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...q.matchAll(H)];for(let F of B){let V=F[0],O=F[1],L=F[2];if(yZ(L)){z=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(U.push({attr:O,expr:R,fullMatch:V,originalAttr:O}),S7(R).forEach((M)=>X.add(M)),O==="text")K=K.replace(V,"");else if(O==="class")K=K.replace(V,'class=""');else if(O==="disabled"||O==="hidden")K=K.replace(V,"");else K=K.replace(V,`${O}=""`)}}}if(!z)return Q;let j=K.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=bZ(),K=` id="${_}"${K}`;for(let F of U)Z.push({elementId:_,attribute:F.attr,expression:F.expr,stores:S7(F.expr)});return`<${G}${K}${W}`}),{html:Y,bindings:Z,stores:X}}function CZ($,Z){if($.length===0)return"";let X=Array.from(Z),J=`
486
486
  <script>
487
487
  (function() {
488
488
  'use strict';
@@ -640,10 +640,10 @@ else {
640
640
  }
641
641
  })();
642
642
  </script>
643
- `,J}function S7($){let{html:Z,bindings:X,stores:J}=kZ($);if(X.length===0)return $;let Y=IZ(X,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function C7($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return TZ(Z);case"google-analytics":return EZ(Z);case"plausible":return bZ(Z);case"self-hosted":return yZ(Z);case"custom":return SZ(Z);default:return""}}function TZ($){let Z=$.fathom;if(!Z?.siteId)return"";let X=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",Y=[`data-site="${x0(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="${x0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
643
+ `,J}function P7($){let{html:Z,bindings:X,stores:J}=SZ($);if(X.length===0)return $;let Y=CZ(X,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function v7($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return PZ(Z);case"google-analytics":return vZ(Z);case"plausible":return fZ(Z);case"self-hosted":return xZ(Z);case"custom":return gZ(Z);default:return""}}function PZ($){let Z=$.fathom;if(!Z?.siteId)return"";let X=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",Y=[`data-site="${x0(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="${x0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
644
644
  <!-- Fathom Analytics -->
645
645
  <script src="${x0(X)}" ${Y.join(" ")}${J}></script>
646
- `}function EZ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let X=x0(Z.measurementId),J=Z.debug?`gtag('config', '${X}', { 'debug_mode': true });`:"";return`
646
+ `}function vZ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let X=x0(Z.measurementId),J=Z.debug?`gtag('config', '${X}', { 'debug_mode': true });`:"";return`
647
647
  <!-- Google Analytics -->
648
648
  <script async src="https://www.googletagmanager.com/gtag/js?id=${X}"></script>
649
649
  <script>
@@ -653,10 +653,10 @@ else {
653
653
  gtag('config', '${X}');
654
654
  ${J}
655
655
  </script>
656
- `}function bZ($){let Z=$.plausible;if(!Z?.domain)return"";let X=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${x0(Z.domain)}"`],Y=X,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&X==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
656
+ `}function fZ($){let Z=$.plausible;if(!Z?.domain)return"";let X=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${x0(Z.domain)}"`],Y=X,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&X==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
657
657
  <!-- Plausible Analytics -->
658
658
  <script defer data-domain="${x0(Z.domain)}" src="${x0(Y)}"></script>
659
- `}function yZ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let X=x0(Z.siteId),J=x0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
659
+ `}function xZ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let X=x0(Z.siteId),J=x0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
660
660
  d.addEventListener('click',function(e){
661
661
  var a=e.target.closest('a');
662
662
  if(a&&a.hostname!==location.hostname){
@@ -689,7 +689,7 @@ else {
689
689
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
690
690
  })();
691
691
  </script>
692
- `}function SZ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
692
+ `}function gZ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
693
693
  <!-- Custom Analytics -->
694
694
  <script>
695
695
  ${Z.inlineScript}
@@ -697,7 +697,7 @@ ${Z.inlineScript}
697
697
  `;if(!Z.scriptUrl)return"";let X=[];if(Z.scriptId)X.push(`id="${x0(Z.scriptId)}"`);if(Z.attributes)for(let[Y,Q]of Object.entries(Z.attributes))X.push(`${x0(Y)}="${x0(Q)}"`);return`
698
698
  <!-- Custom Analytics -->
699
699
  <script${X.length>0?` ${X.join(" ")}`:""} src="${x0(Z.scriptUrl)}" defer></script>
700
- `}function P7($,Z){let X=C7(Z);if(!X)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}return $.replace("</head>",`${X}</head>`)}function x0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var cW={name:"analytics",hasEndTag:!1,handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};return C7(Y)}};var CZ={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 v7($){let Z=$.heatmap;if(!Z?.enabled)return"";let X={...CZ,...Z};return`
700
+ `}function f7($,Z){let X=v7(Z);if(!X)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}return $.replace("</head>",`${X}</head>`)}function x0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var tW={name:"analytics",hasEndTag:!1,handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};return v7(Y)}};var hZ={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 x7($){let Z=$.heatmap;if(!Z?.enabled)return"";let X={...hZ,...Z};return`
701
701
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
702
702
  <script>
703
703
  (function() {
@@ -1080,7 +1080,7 @@ else {
1080
1080
  };
1081
1081
  })();
1082
1082
  </script>
1083
- `}function f7($,Z){let X=v7(Z);if(!X)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}var x7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};if(Z.length>0){let Q=PZ(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return v7(Y)}};function PZ($){let Z={},X=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of X){let[Y,Q]=J.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 g7{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 X of this.sessions.values())if(X.page===$)Z.push(...X.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((J)=>J.type==="scroll"),X=new Map;for(let J of Z)if(J.depth!==void 0)X.set(J.depth,(X.get(J.depth)||0)+1);return Array.from(X.entries()).map(([J,Y])=>({depth:J,count:Y})).sort((J,Y)=>J.depth-Y.depth)}getZoneStats($){let Z=new Map,X=this.getPageData($);for(let J of X)if(J.zone){let Y=Z.get(J.zone)||{clicks:0,hovers:0};if(J.type==="click")Y.clicks++;else if(J.type==="move")Y.hovers++;Z.set(J.zone,Y)}return Z}generateGridData($,Z=20){let X=this.getPageData($),J=[];for(let Q=0;Q<Z;Q++){J[Q]=[];for(let G=0;G<Z;G++)J[Q][G]=0}for(let Q of X){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),q=Math.min(Math.floor(Q.y/100*Z),Z-1);J[q][G]+=Q.type==="click"?3:1}let Y=0;for(let Q of J)for(let G of Q)Y=Math.max(Y,G);return J.map((Q,G)=>Q.map((q,W)=>({x:W,y:G,intensity:Y>0?q/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 iW(){return new g7}var vZ;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(vZ||={});var fZ;((J)=>{J.In="in";J.Out="out";J.Both="both"})(fZ||={});var xZ;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(xZ||={});var Z1={duration:300,delay:0,ease:"ease",direction:"both"};function gZ($,Z={}){let{duration:X,delay:J,ease:Y,direction:Q,custom:G}={...Z1,...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);"}
1083
+ `}function g7($,Z){let X=x7(Z);if(!X)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}var h7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};if(Z.length>0){let Q=uZ(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return x7(Y)}};function uZ($){let Z={},X=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of X){let[Y,Q]=J.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 u7{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 X of this.sessions.values())if(X.page===$)Z.push(...X.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((J)=>J.type==="scroll"),X=new Map;for(let J of Z)if(J.depth!==void 0)X.set(J.depth,(X.get(J.depth)||0)+1);return Array.from(X.entries()).map(([J,Y])=>({depth:J,count:Y})).sort((J,Y)=>J.depth-Y.depth)}getZoneStats($){let Z=new Map,X=this.getPageData($);for(let J of X)if(J.zone){let Y=Z.get(J.zone)||{clicks:0,hovers:0};if(J.type==="click")Y.clicks++;else if(J.type==="move")Y.hovers++;Z.set(J.zone,Y)}return Z}generateGridData($,Z=20){let X=this.getPageData($),J=[];for(let Q=0;Q<Z;Q++){J[Q]=[];for(let G=0;G<Z;G++)J[Q][G]=0}for(let Q of X){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),q=Math.min(Math.floor(Q.y/100*Z),Z-1);J[q][G]+=Q.type==="click"?3:1}let Y=0;for(let Q of J)for(let G of Q)Y=Math.max(Y,G);return J.map((Q,G)=>Q.map((q,W)=>({x:W,y:G,intensity:Y>0?q/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 $U(){return new u7}var dZ;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(dZ||={});var mZ;((J)=>{J.In="in";J.Out="out";J.Both="both"})(mZ||={});var lZ;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(lZ||={});var Z1={duration:300,delay:0,ease:"ease",direction:"both"};function cZ($,Z={}){let{duration:X,delay:J,ease:Y,direction:Q,custom:G}={...Z1,...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);"}
1084
1084
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1085
1085
  @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);"}
1086
1086
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1090,7 +1090,7 @@ else {
1090
1090
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1091
1091
  @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);"}
1092
1092
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1093
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function hZ(){return`
1093
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function pZ(){return`
1094
1094
  <script data-stx-scoped data-stx-run="once">
1095
1095
  // Motion preferences handling
1096
1096
  (function() {
@@ -1118,7 +1118,7 @@ else {
1118
1118
  });
1119
1119
  })();
1120
1120
  </script>
1121
- `}function uZ($){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((X)=>X.test($))}function dZ($=0.1,Z="0px"){return`
1121
+ `}function iZ($){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((X)=>X.test($))}function nZ($=0.1,Z="0px"){return`
1122
1122
  <script data-stx-scoped data-stx-run="always">
1123
1123
  // Intersection Observer for scroll animations
1124
1124
  (function() {
@@ -1161,7 +1161,7 @@ else {
1161
1161
  }
1162
1162
  })();
1163
1163
  </script>
1164
- `}function mZ(){return`
1164
+ `}function sZ(){return`
1165
1165
  <style id="stx-animation-base">
1166
1166
  :root {
1167
1167
  --stx-transition-duration: 300ms;
@@ -1276,7 +1276,7 @@ else {
1276
1276
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1277
1277
  }
1278
1278
  </style>
1279
- `}function lZ($,Z,X={}){let{staggerDelay:J=50,sequence:Y=!1}=X;return`
1279
+ `}function oZ($,Z,X={}){let{staggerDelay:J=50,sequence:Y=!1}=X;return`
1280
1280
  <script data-stx-scoped data-stx-run="always">
1281
1281
  // Animation Group: ${$}
1282
1282
  (function() {
@@ -1313,21 +1313,21 @@ else {
1313
1313
  }
1314
1314
  })();
1315
1315
  </script>
1316
- `}var a$={name:"transition",handler:($,Z,X,J)=>{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)||Z1.duration:Z1.duration,G=Z.length>2?Z[2]||Z1.ease:Z1.ease,q=Z.length>3?Number.parseInt(Z[3],10)||Z1.delay:Z1.delay,W=Z.length>4?Z[4]||Z1.direction:Z1.direction,K=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=gZ(Y,{duration:Q,delay:q,ease:G,direction:W}),z="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="${z} ${H} ${W==="out"?"stx-out":""}"
1317
- style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},t$={name:"scrollAnimate",handler:($,Z,X,J)=>{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",q=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,W=Z.length>4?Number.parseInt(Z[4],10)||0:0,K=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Y==="fade")z+=" stx-fade";else if(Y==="slide-up"||Y==="slide")z+=" stx-from-bottom";else if(Y==="slide-down")z+=" stx-from-top";else if(Y==="slide-left")z+=" stx-from-right";else if(Y==="slide-right")z+=" stx-from-left";else if(Y==="scale")z+=" stx-scale";else if(Y.includes("-"))z+=` stx-${Y}`;else z+=` stx-${Y}`;return`<div id="${K}" class="${z}" style="${U}" data-threshold="${q}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},e$={name:"animationGroup",handler:($,Z,X,J)=>{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=X.staggerDelay||50,q=X.sequence||!0,W=lZ(Y,Q,{staggerDelay:G,sequence:q});return`${$}
1318
- ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},$3={name:"motion",handler:($,Z,X,J)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=hZ();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function u7($,Z,X,J){let Y=$;if(J.animation?.enabled===!1)return Y;let Q=X.includes("test")&&X.includes("animation");if(!uZ(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let q=mZ();Y=Y.replace("</head>",`${q}
1319
- </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let W=dZ(),K=Y.lastIndexOf("</body>");if(K!==-1)Y=Y.slice(0,K)+W+`
1320
- `+Y.slice(K)}}return Y}var h7={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 cZ($,Z){let X=Z.map((J)=>{let Y=J.offset!==void 0?`${J.offset*100}%`:"from",Q=Object.entries(J.properties).map(([G,q])=>`${G}: ${q}`).join("; ");return`${Y} { ${Q} }`}).join(`
1316
+ `}var a$={name:"transition",handler:($,Z,X,J)=>{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)||Z1.duration:Z1.duration,G=Z.length>2?Z[2]||Z1.ease:Z1.ease,q=Z.length>3?Number.parseInt(Z[3],10)||Z1.delay:Z1.delay,W=Z.length>4?Z[4]||Z1.direction:Z1.direction,U=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=cZ(Y,{duration:Q,delay:q,ease:G,direction:W}),K="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="${U}" class="${K} ${H} ${W==="out"?"stx-out":""}"
1317
+ style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},t$={name:"scrollAnimate",handler:($,Z,X,J)=>{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",q=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,W=Z.length>4?Number.parseInt(Z[4],10)||0:0,U=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,z=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,K="stx-transition stx-observe stx-out";if(Y==="fade")K+=" stx-fade";else if(Y==="slide-up"||Y==="slide")K+=" stx-from-bottom";else if(Y==="slide-down")K+=" stx-from-top";else if(Y==="slide-left")K+=" stx-from-right";else if(Y==="slide-right")K+=" stx-from-left";else if(Y==="scale")K+=" stx-scale";else if(Y.includes("-"))K+=` stx-${Y}`;else K+=` stx-${Y}`;return`<div id="${U}" class="${K}" style="${z}" data-threshold="${q}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},e$={name:"animationGroup",handler:($,Z,X,J)=>{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((U)=>U.startsWith("#")||U.startsWith(".")?U:`#${U}`),G=X.staggerDelay||50,q=X.sequence||!0,W=oZ(Y,Q,{staggerDelay:G,sequence:q});return`${$}
1318
+ ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},$3={name:"motion",handler:($,Z,X,J)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=pZ();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function m7($,Z,X,J){let Y=$;if(J.animation?.enabled===!1)return Y;let Q=X.includes("test")&&X.includes("animation");if(!iZ(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let q=sZ();Y=Y.replace("</head>",`${q}
1319
+ </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let W=nZ(),U=Y.lastIndexOf("</body>");if(U!==-1)Y=Y.slice(0,U)+W+`
1320
+ `+Y.slice(U)}}return Y}var d7={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 rZ($,Z){let X=Z.map((J)=>{let Y=J.offset!==void 0?`${J.offset*100}%`:"from",Q=Object.entries(J.properties).map(([G,q])=>`${G}: ${q}`).join("; ");return`${Y} { ${Q} }`}).join(`
1321
1321
  `);return`@keyframes ${$} {
1322
1322
  ${X}
1323
- }`}var pZ={name:"keyframe",hasEndTag:!0,handler:($,Z,X,J)=>{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",q=Z[3]||"1",W=Z[4]?.replace(/['"`]/g,"")||"normal",K=Z[5]?.replace(/['"`]/g,"")||"forwards",U=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,z=`
1323
+ }`}var aZ={name:"keyframe",hasEndTag:!0,handler:($,Z,X,J)=>{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",q=Z[3]||"1",W=Z[4]?.replace(/['"`]/g,"")||"normal",U=Z[5]?.replace(/['"`]/g,"")||"forwards",z=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,K=`
1324
1324
  animation-name: ${Y};
1325
1325
  animation-duration: ${Q}ms;
1326
1326
  animation-timing-function: ${G};
1327
1327
  animation-iteration-count: ${q};
1328
1328
  animation-direction: ${W};
1329
- animation-fill-mode: ${K};
1330
- `.trim().replace(/\s+/g," ");return`<div id="${U}" style="${z}">${$}</div>`},description:"Applies a keyframe animation to an element"};function iZ($,Z,X,J,Y){return`
1329
+ animation-fill-mode: ${U};
1330
+ `.trim().replace(/\s+/g," ");return`<div id="${z}" style="${K}">${$}</div>`},description:"Applies a keyframe animation to an element"};function tZ($,Z,X,J,Y){return`
1331
1331
  <script data-stx-scoped data-stx-run="always">
1332
1332
  (function() {
1333
1333
  const container = document.getElementById('${$}');
@@ -1341,7 +1341,7 @@ ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
1341
1341
  child.classList.add('${Y}');
1342
1342
  });
1343
1343
  })();
1344
- </script>`}var nZ={name:"stagger",hasEndTag:!0,handler:($,Z,X,J)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"> *",Q=Z[1]?Number.parseInt(Z[1],10):100,G=Z[2]?Number.parseInt(Z[2],10):0,q=Z[3]?.replace(/['"`]/g,"")||"fade",W=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,K="stx-stagger-item";if(q==="fade")K+=" stx-fade";else if(q==="slide")K+=" stx-from-bottom";else if(q==="scale")K+=" stx-scale";let U=iZ(W,Y,G,Q,K);return`${`
1344
+ </script>`}var eZ={name:"stagger",hasEndTag:!0,handler:($,Z,X,J)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"> *",Q=Z[1]?Number.parseInt(Z[1],10):100,G=Z[2]?Number.parseInt(Z[2],10):0,q=Z[3]?.replace(/['"`]/g,"")||"fade",W=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,U="stx-stagger-item";if(q==="fade")U+=" stx-fade";else if(q==="slide")U+=" stx-from-bottom";else if(q==="scale")U+=" stx-scale";let z=tZ(W,Y,G,Q,U);return`${`
1345
1345
  <style>
1346
1346
  #${W} .stx-stagger-item {
1347
1347
  opacity: 0;
@@ -1351,12 +1351,12 @@ ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
1351
1351
  from { opacity: 0; transform: translateY(10px); }
1352
1352
  to { opacity: 1; transform: translateY(0); }
1353
1353
  }
1354
- </style>`}<div id="${W}" class="stx-stagger-container">${$}</div>${U}`},description:"Applies staggered animations to child elements"};function sZ($){let{stiffness:Z,damping:X}=$,J=X/(2*Math.sqrt(Z));if(J<0.5)return"cubic-bezier(0.175, 0.885, 0.32, 1.275)";else if(J<1)return"cubic-bezier(0.34, 1.56, 0.64, 1)";else return"cubic-bezier(0.25, 0.1, 0.25, 1)"}var oZ={name:"spring",hasEndTag:!0,handler:($,Z,X,J)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(h7[Y])Q=h7[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,q=`stx-spring-${Math.random().toString(36).slice(2,9)}`,W=sZ(Q),K=`
1354
+ </style>`}<div id="${W}" class="stx-stagger-container">${$}</div>${z}`},description:"Applies staggered animations to child elements"};function $X($){let{stiffness:Z,damping:X}=$,J=X/(2*Math.sqrt(Z));if(J<0.5)return"cubic-bezier(0.175, 0.885, 0.32, 1.275)";else if(J<1)return"cubic-bezier(0.34, 1.56, 0.64, 1)";else return"cubic-bezier(0.25, 0.1, 0.25, 1)"}var ZX={name:"spring",hasEndTag:!0,handler:($,Z,X,J)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(d7[Y])Q=d7[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,q=`stx-spring-${Math.random().toString(36).slice(2,9)}`,W=$X(Q),U=`
1355
1355
  transition: all ${G}ms ${W};
1356
1356
  --stx-spring-stiffness: ${Q.stiffness};
1357
1357
  --stx-spring-damping: ${Q.damping};
1358
1358
  --stx-spring-mass: ${Q.mass};
1359
- `.trim().replace(/\s+/g," ");return`<div id="${q}" class="stx-spring" style="${K}">${$}</div>`},description:"Applies spring physics animations to an element"};function sW($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
1359
+ `.trim().replace(/\s+/g," ");return`<div id="${q}" class="stx-spring" style="${U}">${$}</div>`},description:"Applies spring physics animations to an element"};function XU($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
1360
1360
  <script data-stx-scoped data-stx-run="always">
1361
1361
  (function() {
1362
1362
  const timeline = ${JSON.stringify($)};
@@ -1393,7 +1393,7 @@ else {
1393
1393
  runTimeline();
1394
1394
  }
1395
1395
  })();
1396
- </script>`}function oW($,Z,X){let J=cZ($,Z),Y=`
1396
+ </script>`}function JU($,Z,X){let J=rZ($,Z),Y=`
1397
1397
  .${$}-animation {
1398
1398
  animation-name: ${$};
1399
1399
  animation-duration: ${X.duration}ms;
@@ -1403,7 +1403,7 @@ else {
1403
1403
  animation-direction: ${X.direction||"normal"};
1404
1404
  animation-fill-mode: ${X.fill||"forwards"};
1405
1405
  }`;return`${J}
1406
- ${Y}`}function rW($){let Z=$.trim().split(/\s+/),X={duration:300};for(let J=0;J<Z.length;J++){let Y=Z[J];if(/^\d+(?:ms|s)?$/.test(Y)){let Q=Number.parseInt(Y,10);if(J===0)X.duration=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q;else X.delay=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q}else if(Y==="infinite"||/^\d+$/.test(Y))X.iterations=Y==="infinite"?"infinite":Number.parseInt(Y,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Y))X.direction=Y;else if(["none","forwards","backwards","both"].includes(Y))X.fill=Y;else X.easing=Y}return X}function aW(){return`
1406
+ ${Y}`}function YU($){let Z=$.trim().split(/\s+/),X={duration:300};for(let J=0;J<Z.length;J++){let Y=Z[J];if(/^\d+(?:ms|s)?$/.test(Y)){let Q=Number.parseInt(Y,10);if(J===0)X.duration=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q;else X.delay=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q}else if(Y==="infinite"||/^\d+$/.test(Y))X.iterations=Y==="infinite"?"infinite":Number.parseInt(Y,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Y))X.direction=Y;else if(["none","forwards","backwards","both"].includes(Y))X.fill=Y;else X.easing=Y}return X}function QU(){return`
1407
1407
  <script data-stx-scoped data-stx-run="once">
1408
1408
  window.__stxAnimation = {
1409
1409
  // Registry of animations
@@ -1475,7 +1475,7 @@ else {
1475
1475
  );
1476
1476
  }
1477
1477
  };
1478
- </script>`}function tW($){let Z=$.customDirectives||[];return Z.push(a$),Z.push(e$),Z.push($3),Z.push(t$),Z.push(pZ),Z.push(nZ),Z.push(oZ),{...$,customDirectives:Z}}function d7($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function m7($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var rZ=100,aZ=599,X3="__stxResponseStatus",H5="__stxResponseHeaders";function o5($){return typeof $==="number"&&Number.isInteger($)&&$>=rZ&&$<=aZ}function XK($){for(let Z of $.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let X=Z[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!X)continue;let J=Number(X[1]);if(o5(J))return J}return}function Z3($,Z){if(!$||typeof $!=="object")return!1;let X=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!o5(X))return!1;return $[X3]=X,!0}function tZ($,Z,X){if(!$||typeof $!=="object")return;let J=String(Z??"").trim();if(!J)return;$[H5]={...$[H5],[J]:String(X)}}function eZ($){let Z=$?.[X3];return o5(Z)?Z:void 0}function $X($){let Z=$?.[H5];if(!Z||typeof Z!=="object")return;let X=Object.entries(Z).map(([J,Y])=>[J,String(Y)]);return X.length>0?Object.fromEntries(X):void 0}function JK($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let X=eZ($);if(X!==void 0)Z[X3]=X;let J=$X($);if(J)Z[H5]={...Z[H5],...J}}function l7($){return{setResponseStatus:(Z)=>{Z3($,Z)},notFound:(Z=404)=>{let X=o5(Z)&&Z>=400?Z:404;Z3($,X)},setResponseHeader:(Z,X)=>{tZ($,Z,X)}}}function c7($,Z,X={}){if(!$.includes("@status"))return $;let{filePath:J,buildMode:Y}=X,Q=Y==="compile",G="",q=0,W=/@status\s*\(/g,K;while((K=W.exec($))!==null){let U=ZX($,K.index+K[0].length-1);if(U<0)break;let z=$.slice(K.index+K[0].length,U).trim(),H=/^\d+$/.test(z)?Number(z):e(z,Z),B=J?` in ${J}`:"";if(Q)console.warn(`[stx] @status(${z})${B} 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(${z}) from <script server> instead \u2014 that runs per request.`);else if(!Z3(Z,H))console.warn(`[stx] @status(${z})${B} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(q,K.index),q=U+1+($.slice(U+1).match(/^[^\S\n]*\n?/)?.[0].length??0),W.lastIndex=q}return q===0?$:G+$.slice(q)}function ZX($,Z){let X=1,J=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(J){if(G==="\\")Y=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")X++;else if(G===")"&&--X===0)return Q}return-1}var XX=0,JX=0;function p7($,Z){let X=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(X)return X[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function YX($){let Z=[],X=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=X.exec($))!==null){let[Y,Q,G]=J,q=J.index,W=p7(G,"x-data");if(!W)continue;let K=`__stx_scope_${XX++}`,U=p7(G,"x-init"),z=QX($,Q,q+Y.length),H=$.slice(q,z.endIndex),B=GX(H);Z.push({id:K,selector:`[data-stx-scope="${K}"]`,stateExpr:W,initExpr:U,bindings:[],refs:B})}return Z}function QX($,Z,X){let J=1,Y=X,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),q=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y,q.lastIndex=Y;let W=Q.exec($),K=G.exec($),U=q.exec($);if(U&&U.index<(W?.index??1/0)){Y=U.index+U[0].length;continue}if(!K)return{endIndex:$.length};if(W&&W.index<K.index)J++,Y=W.index+W[0].length;else{if(J--,J===0)return{endIndex:K.index+K[0].length};Y=K.index+K[0].length}}return{endIndex:$.length}}function GX($){let Z=new Map,X=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=J.exec(X))!==null){let[,Q,G]=Y,q=qX(Q);Z.set(G,q)}return Z}function qX($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${JX++}`}function WX(){return`
1478
+ </script>`}function GU($){let Z=$.customDirectives||[];return Z.push(a$),Z.push(e$),Z.push($3),Z.push(t$),Z.push(aZ),Z.push(eZ),Z.push(ZX),{...$,customDirectives:Z}}function l7($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function c7($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var XX=100,JX=599,X3="__stxResponseStatus",K5="__stxResponseHeaders";function o5($){return typeof $==="number"&&Number.isInteger($)&&$>=XX&&$<=JX}function zU($){for(let Z of $.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let X=Z[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!X)continue;let J=Number(X[1]);if(o5(J))return J}return}function Z3($,Z){if(!$||typeof $!=="object")return!1;let X=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!o5(X))return!1;return $[X3]=X,!0}function YX($,Z,X){if(!$||typeof $!=="object")return;let J=String(Z??"").trim();if(!J)return;$[K5]={...$[K5],[J]:String(X)}}function QX($){let Z=$?.[X3];return o5(Z)?Z:void 0}function GX($){let Z=$?.[K5];if(!Z||typeof Z!=="object")return;let X=Object.entries(Z).map(([J,Y])=>[J,String(Y)]);return X.length>0?Object.fromEntries(X):void 0}function KU($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let X=QX($);if(X!==void 0)Z[X3]=X;let J=GX($);if(J)Z[K5]={...Z[K5],...J}}function p7($){return{setResponseStatus:(Z)=>{Z3($,Z)},notFound:(Z=404)=>{let X=o5(Z)&&Z>=400?Z:404;Z3($,X)},setResponseHeader:(Z,X)=>{YX($,Z,X)}}}function i7($,Z,X={}){if(!$.includes("@status"))return $;let{filePath:J,buildMode:Y}=X,Q=Y==="compile",G="",q=0,W=/@status\s*\(/g,U;while((U=W.exec($))!==null){let z=qX($,U.index+U[0].length-1);if(z<0)break;let K=$.slice(U.index+U[0].length,z).trim(),H=/^\d+$/.test(K)?Number(K):e(K,Z),B=J?` in ${J}`:"";if(Q)console.warn(`[stx] @status(${K})${B} 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(${K}) from <script server> instead \u2014 that runs per request.`);else if(!Z3(Z,H))console.warn(`[stx] @status(${K})${B} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(q,U.index),q=z+1+($.slice(z+1).match(/^[^\S\n]*\n?/)?.[0].length??0),W.lastIndex=q}return q===0?$:G+$.slice(q)}function qX($,Z){let X=1,J=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(J){if(G==="\\")Y=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")X++;else if(G===")"&&--X===0)return Q}return-1}var WX=0,UX=0;function n7($,Z){let X=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(X)return X[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function zX($){let Z=[],X=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=X.exec($))!==null){let[Y,Q,G]=J,q=J.index,W=n7(G,"x-data");if(!W)continue;let U=`__stx_scope_${WX++}`,z=n7(G,"x-init"),K=KX($,Q,q+Y.length),H=$.slice(q,K.endIndex),B=HX(H);Z.push({id:U,selector:`[data-stx-scope="${U}"]`,stateExpr:W,initExpr:z,bindings:[],refs:B})}return Z}function KX($,Z,X){let J=1,Y=X,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),q=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y,q.lastIndex=Y;let W=Q.exec($),U=G.exec($),z=q.exec($);if(z&&z.index<(W?.index??1/0)){Y=z.index+z[0].length;continue}if(!U)return{endIndex:$.length};if(W&&W.index<U.index)J++,Y=W.index+W[0].length;else{if(J--,J===0)return{endIndex:U.index+U[0].length};Y=U.index+U[0].length}}return{endIndex:$.length}}function HX($){let Z=new Map,X=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=J.exec(X))!==null){let[,Q,G]=Y,q=BX(Q);Z.set(G,q)}return Z}function BX($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${UX++}`}function jX(){return`
1479
1479
  // STX Reactive Runtime - x-cloak and transition CSS
1480
1480
  (function() {
1481
1481
  var style = document.createElement('style');
@@ -1682,7 +1682,7 @@ window.__stx_reactive = (function() {
1682
1682
 
1683
1683
  return { initScope: initScope, reactive: reactive };
1684
1684
  })();
1685
- `}function i7($,Z){let X=$.replace(/\{!!([\s\S]*?)!!\}/g,(q,W)=>{try{let K=f0(W,Z,!0);if(K===void 0)return q;return String(K)}catch{return q}}),J="",Y=0,Q=null;while(Y<X.length){let q=X[Y];if(Q&&q==="\\"){J+=q+(X[Y+1]??""),Y+=2;continue}if(q==="{"&&X[Y+1]==="{"){let W=X.indexOf("}}",Y+2);if(W!==-1){let K=X.slice(Y,W+2);J+=G(X.slice(Y+2,W),K,Q),Y=W+2;continue}}if(Q){if(q===Q)Q=null}else if(q==="'"||q==='"'||q==="`")Q=q;J+=q,Y++}return J;function G(q,W,K){let U;try{U=f0(q,Z,!0)}catch{return W}if(U===void 0)return W;if(K){let z=String(U).replace(/\\/g,"\\\\").replace(new RegExp(K==="`"?"`":K,"g"),`\\${K}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return K==="`"?z.replace(/\$\{/g,"\\${"):z}if(typeof U==="string"){let z=U.trim();if(z.startsWith("{")&&z.endsWith("}")||z.startsWith("[")&&z.endsWith("]"))try{return JSON.parse(z),z}catch{}}return JSON.stringify(U)}}function KX($,Z){if($.length===0)return"";let X=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),Q=i7(J.stateExpr,Z),G=J.initExpr?i7(J.initExpr,Z):null,q=JSON.stringify(Q),W=G?JSON.stringify(G):"null";return`
1685
+ `}function s7($,Z){let X=$.replace(/\{!!([\s\S]*?)!!\}/g,(q,W)=>{try{let U=f0(W,Z,!0);if(U===void 0)return q;return String(U)}catch{return q}}),J="",Y=0,Q=null;while(Y<X.length){let q=X[Y];if(Q&&q==="\\"){J+=q+(X[Y+1]??""),Y+=2;continue}if(q==="{"&&X[Y+1]==="{"){let W=X.indexOf("}}",Y+2);if(W!==-1){let U=X.slice(Y,W+2);J+=G(X.slice(Y+2,W),U,Q),Y=W+2;continue}}if(Q){if(q===Q)Q=null}else if(q==="'"||q==='"'||q==="`")Q=q;J+=q,Y++}return J;function G(q,W,U){let z;try{z=f0(q,Z,!0)}catch{return W}if(z===void 0)return W;if(U){let K=String(z).replace(/\\/g,"\\\\").replace(new RegExp(U==="`"?"`":U,"g"),`\\${U}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return U==="`"?K.replace(/\$\{/g,"\\${"):K}if(typeof z==="string"){let K=z.trim();if(K.startsWith("{")&&K.endsWith("}")||K.startsWith("[")&&K.endsWith("]"))try{return JSON.parse(K),K}catch{}}return JSON.stringify(z)}}function _X($,Z){if($.length===0)return"";let X=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),Q=s7(J.stateExpr,Z),G=J.initExpr?s7(J.initExpr,Z):null,q=JSON.stringify(Q),W=G?JSON.stringify(G):"null";return`
1686
1686
  (function() {
1687
1687
  var scopeEl = document.querySelector('${J.selector}');
1688
1688
  if (!scopeEl) return;
@@ -1691,13 +1691,13 @@ window.__stx_reactive = (function() {
1691
1691
  })();`}).join(`
1692
1692
  `);return`
1693
1693
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
1694
- ${WX()}
1694
+ ${jX()}
1695
1695
  ${X}
1696
- </script>`}function n7($,Z,X){if(!zX($))return $;let J=YX($);if(J.length===0)return $;let Y=UX($,J),Q=KX(J,Z),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
1697
- `+Y.slice(G);else Y+=Q;return Y}function UX($,Z){let X=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,Q,G)=>{let q=Z[X++];if(!q)return Y;let W=/data-stx-scope="([^"]*)"/.exec(G);if(W)return q.id=W[1],q.selector=`[data-stx-scope="${q.id}"]`,Y;return`<${Q} data-stx-scope="${q.id}"${G}>`});return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),J=J.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),J}function zX($){return/x-data\s*=\s*["']/.test($)}import NJ from"fs";import T3 from"path";import{createHighlighter as MJ}from"ts-syntax-highlighter";import W$ from"fs";import T0 from"path";import{loadConfigWithResult as VJ}from"bunfig";B5();async function HX($,Z,X,J){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=J3();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var s7={name:"stxRouter",handler:HX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function W1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function o7($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function r7($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,X=$.match(Z);if(!X)return{data:{},content:$.trim()};let J=X[1],Y=$.slice(X[0].length),Q={};for(let G of J.split(`
1698
- `)){let q=G.trim();if(!q||q.startsWith("#"))continue;let W=q.indexOf(":");if(W===-1)continue;let K=q.slice(0,W).trim(),U=q.slice(W+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}Q[K]=U}return{data:Q,content:Y.trim()}}function j5($,Z={}){let{gfm:X=!0,breaks:J=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,H)=>{let B=Q.length,j=z?` class="language-${W1(z)}"`:"";return Q.push(`<pre><code${j}>${W1(H.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),Y=Y.replace(/`([^`]*)`/g,(U,z)=>`<code>${W1(z)}</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>"),X)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,z,H)=>{return`<img src="${o7(H)?W1(H):""}" alt="${W1(z)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,H)=>{return`<a href="${o7(H)?W1(H):""}">${z}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
1699
- `),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>"),X)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,z,H)=>{let j=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${W1(L)}</th>`).join("")}</tr>`,_=H.trim().split(`
1700
- `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${W1(O)}</td>`).join("")}</tr>`}).join(`
1696
+ </script>`}function o7($,Z,X){if(!OX($))return $;let J=zX($);if(J.length===0)return $;let Y=VX($,J),Q=_X(J,Z),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
1697
+ `+Y.slice(G);else Y+=Q;return Y}function VX($,Z){let X=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,Q,G)=>{let q=Z[X++];if(!q)return Y;let W=/data-stx-scope="([^"]*)"/.exec(G);if(W)return q.id=W[1],q.selector=`[data-stx-scope="${q.id}"]`,Y;return`<${Q} data-stx-scope="${q.id}"${G}>`});return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),J=J.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),J}function OX($){return/x-data\s*=\s*["']/.test($)}import EJ from"fs";import T3 from"path";import{createHighlighter as bJ}from"ts-syntax-highlighter";import W$ from"fs";import T0 from"path";import{loadConfigWithResult as DJ}from"bunfig";H5();async function FX($,Z,X,J){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=J3();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var r7={name:"stxRouter",handler:FX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function W1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function a7($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function t7($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,X=$.match(Z);if(!X)return{data:{},content:$.trim()};let J=X[1],Y=$.slice(X[0].length),Q={};for(let G of J.split(`
1698
+ `)){let q=G.trim();if(!q||q.startsWith("#"))continue;let W=q.indexOf(":");if(W===-1)continue;let U=q.slice(0,W).trim(),z=q.slice(W+1).trim();if(typeof z==="string"){if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))z=z.slice(1,-1);else if(z.startsWith("[")&&z.endsWith("]"))try{z=JSON.parse(z)}catch{}else if(z==="true")z=!0;else if(z==="false")z=!1;else if(/^-?\d+(?:\.\d+)?$/.test(z))z=Number(z)}Q[U]=z}return{data:Q,content:Y.trim()}}function B5($,Z={}){let{gfm:X=!0,breaks:J=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(z,K,H)=>{let B=Q.length,j=K?` class="language-${W1(K)}"`:"";return Q.push(`<pre><code${j}>${W1(H.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),Y=Y.replace(/`([^`]*)`/g,(z,K)=>`<code>${W1(K)}</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>"),X)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(z,K,H)=>{return`<img src="${a7(H)?W1(H):""}" alt="${W1(K)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(z,K,H)=>{return`<a href="${a7(H)?W1(H):""}">${K}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
1699
+ `),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>"),X)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(z,K,H)=>{let j=`<tr>${K.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${W1(F)}</th>`).join("")}</tr>`,_=H.trim().split(`
1700
+ `).map((F)=>{return`<tr>${F.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${W1(O)}</td>`).join("")}</tr>`}).join(`
1701
1701
  `);return`<table>
1702
1702
  <thead>
1703
1703
  ${j}
@@ -1706,15 +1706,15 @@ ${j}
1706
1706
  ${_}
1707
1707
  </tbody>
1708
1708
  </table>`});if(X)Y=Y.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Y=Y.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Y.split(`
1709
- `),q=[],W=!1,K=[];for(let U of G){let z=U.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(z)||/^\0CODEBLOCK\d+\0$/.test(z)||z===""){if(W&&K.length>0)q.push(`<p>${K.join(J?`<br />
1709
+ `),q=[],W=!1,U=[];for(let z of G){let K=z.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(K)||/^\0CODEBLOCK\d+\0$/.test(K)||K===""){if(W&&U.length>0)q.push(`<p>${U.join(J?`<br />
1710
1710
  `:`
1711
- `)}</p>`),K=[],W=!1;q.push(U)}else W=!0,K.push(z)}if(W&&K.length>0)q.push(`<p>${K.join(J?`<br />
1711
+ `)}</p>`),U=[],W=!1;q.push(z)}else W=!0,U.push(K)}if(W&&U.length>0)q.push(`<p>${U.join(J?`<br />
1712
1712
  `:`
1713
1713
  `)}</p>`);if(Y=q.join(`
1714
1714
  `),J)Y=Y.replace(/\n/g,`<br />
1715
- `);for(let U=0;U<Q.length;U++)Y=Y.replace(`\x00CODEBLOCK${U}\x00`,Q[U]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function a7($,Z,X=""){let J=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let q=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),K=W?W[1]:"",U=q+G[0].length,z=1,H=U,B=-1;while(z>0&&H<$.length){let L=$.indexOf("@markdown",H),V=$.indexOf("@endmarkdown",H);if(V===-1)break;if(L!==-1&&L<V&&L!==q){let O=$[L+9];if(O==="("||O===`
1716
- `||O==="\r"||O===" "||O===void 0)z++;H=L+9}else{if(z--,z===0){B=V;break}H=V+12}}if(B===-1)continue;let j=$.slice(U,B),_=$.slice(q,B+12);Y.push({fullMatch:_,options:K,content:j,index:q}),Q.lastIndex=B+12}for(let{fullMatch:q,options:W,content:K,index:U}of Y)try{let z={};if(W)W.split(",").forEach((j)=>{let _=j.trim();if(_)z[_]=!0});let H={gfm:z.gfm??!0,breaks:z.breaks??!1},B=j5(K.trim(),H);J=J.split(q).join(B)}catch(z){let H=z instanceof Error?z.message:String(z),B=B0("Markdown Directive",`Error processing markdown: ${H}`,X,$,U,q);J=J.split(q).join(B)}return J}async function t7($,Z,X,J){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}),j5($.trim(),Y)}var F1=[320,480,640,768,1024,1280,1536,1920,2560],e7=[1,1.5,2,3],f1=["avif","webp","jpeg"],$6={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},BX={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function _5($,Z=F1,X={},J){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${K1($,{...X,w:Y,fm:J})} ${Y}w`}).join(", ")}function VK($,Z=320,X=2560,J=0.08,Y={},Q){let G=jX(Z,X,J);return _5($,G,Y,Q)}function jX($,Z,X=0.08){let J=[],Y=$;while(Y<Z)J.push(Math.round(Y)),Y*=1+X*2;if(J[J.length-1]!==Z)J.push(Z);return J}function Y3($,Z,X=e7,J={},Y){return X.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${K1($,{...J,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function OK($,Z,X=e7,J=80,Y={},Q){let G={1:J,1.5:Math.round(J*0.9),2:Math.round(J*0.8),3:Math.round(J*0.7),4:Math.round(J*0.6),5:Math.round(J*0.5)};return X.sort((q,W)=>q-W).map((q)=>{let W=Math.round(Z*q),K=G[q]||Math.round(J*Math.max(0.5,1-q*0.1));return`${K1($,{...Y,w:W,q:K,dpr:q,fm:Q})} ${q}x`}).join(", ")}function Q3($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=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 J.push(Z),J.join(", ")}function FK($,Z="100vw"){if(!$||$.length===0)return Z;let J=[...$].sort((Y,Q)=>(Y.maxWidth||0)-(Q.maxWidth||0)).filter((Y)=>Y.maxWidth).map((Y)=>`(max-width: ${Y.maxWidth}px) ${Y.imageWidth}`);return J.push(Z),J.join(", ")}var LK={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 K1($,Z={}){let X=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(X.length===0)return $;let J=X.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${J}`}function wK($){let[Z,X]=$.split("?"),J={};if(X)new URLSearchParams(X).forEach((Q,G)=>{if(/^\d+$/.test(Q))J[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))J[G]=Number.parseFloat(Q);else if(Q==="true")J[G]=!0;else if(Q==="false")J[G]=!1;else J[G]=Q});return{src:Z,params:J}}function RK($){let{src:Z,widths:X,dprValues:J,fixedWidth:Y,formats:Q=f1,baseUrl:G="",params:q={}}=$,W=[];for(let K of Q){let U,z;if(Y!==void 0&&J)U=Y3(Z,Y,J,q,K),z=J.map((H)=>({path:"",url:K1(Z,{...q,w:Math.round(Y*H),fm:K}),width:Math.round(Y*H),height:0,format:K,size:0,dpr:H}));else{let H=X||F1;U=_5(Z,H,q,K),z=H.map((B)=>({path:"",url:K1(Z,{...q,w:B,fm:K}),width:B,height:0,format:K,size:0}))}W.push({srcset:U,format:K,mimeType:$6[K],variants:z})}return W}function DK($,Z="100vw"){return $.map(({srcset:X,mimeType:J})=>`<source type="${J}" srcset="${X}" sizes="${Z}" />`).join(`
1717
- `)}function NK($,Z){if($.length===0)return;let X=[...$].sort((Y,Q)=>Y.width-Q.width),J=X.find((Y)=>Y.width>=Z);if(J)return J;return X[X.length-1]}function G3($){return $6[$]||"application/octet-stream"}function MK($){return BX[$]||$}function AK($){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 _X={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},q3=`
1715
+ `);for(let z=0;z<Q.length;z++)Y=Y.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function e7($,Z,X=""){let J=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let q=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),U=W?W[1]:"",z=q+G[0].length,K=1,H=z,B=-1;while(K>0&&H<$.length){let F=$.indexOf("@markdown",H),V=$.indexOf("@endmarkdown",H);if(V===-1)break;if(F!==-1&&F<V&&F!==q){let O=$[F+9];if(O==="("||O===`
1716
+ `||O==="\r"||O===" "||O===void 0)K++;H=F+9}else{if(K--,K===0){B=V;break}H=V+12}}if(B===-1)continue;let j=$.slice(z,B),_=$.slice(q,B+12);Y.push({fullMatch:_,options:U,content:j,index:q}),Q.lastIndex=B+12}for(let{fullMatch:q,options:W,content:U,index:z}of Y)try{let K={};if(W)W.split(",").forEach((j)=>{let _=j.trim();if(_)K[_]=!0});let H={gfm:K.gfm??!0,breaks:K.breaks??!1},B=B5(U.trim(),H);J=J.split(q).join(B)}catch(K){let H=K instanceof Error?K.message:String(K),B=B0("Markdown Directive",`Error processing markdown: ${H}`,X,$,z,q);J=J.split(q).join(B)}return J}async function $6($,Z,X,J){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}),B5($.trim(),Y)}var F1=[320,480,640,768,1024,1280,1536,1920,2560],Z6=[1,1.5,2,3],f1=["avif","webp","jpeg"],X6={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},LX={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function j5($,Z=F1,X={},J){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${U1($,{...X,w:Y,fm:J})} ${Y}w`}).join(", ")}function MU($,Z=320,X=2560,J=0.08,Y={},Q){let G=wX(Z,X,J);return j5($,G,Y,Q)}function wX($,Z,X=0.08){let J=[],Y=$;while(Y<Z)J.push(Math.round(Y)),Y*=1+X*2;if(J[J.length-1]!==Z)J.push(Z);return J}function Y3($,Z,X=Z6,J={},Y){return X.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${U1($,{...J,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function AU($,Z,X=Z6,J=80,Y={},Q){let G={1:J,1.5:Math.round(J*0.9),2:Math.round(J*0.8),3:Math.round(J*0.7),4:Math.round(J*0.6),5:Math.round(J*0.5)};return X.sort((q,W)=>q-W).map((q)=>{let W=Math.round(Z*q),U=G[q]||Math.round(J*Math.max(0.5,1-q*0.1));return`${U1($,{...Y,w:W,q:U,dpr:q,fm:Q})} ${q}x`}).join(", ")}function Q3($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=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 J.push(Z),J.join(", ")}function kU($,Z="100vw"){if(!$||$.length===0)return Z;let J=[...$].sort((Y,Q)=>(Y.maxWidth||0)-(Q.maxWidth||0)).filter((Y)=>Y.maxWidth).map((Y)=>`(max-width: ${Y.maxWidth}px) ${Y.imageWidth}`);return J.push(Z),J.join(", ")}var IU={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 U1($,Z={}){let X=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(X.length===0)return $;let J=X.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${J}`}function TU($){let[Z,X]=$.split("?"),J={};if(X)new URLSearchParams(X).forEach((Q,G)=>{if(/^\d+$/.test(Q))J[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))J[G]=Number.parseFloat(Q);else if(Q==="true")J[G]=!0;else if(Q==="false")J[G]=!1;else J[G]=Q});return{src:Z,params:J}}function EU($){let{src:Z,widths:X,dprValues:J,fixedWidth:Y,formats:Q=f1,baseUrl:G="",params:q={}}=$,W=[];for(let U of Q){let z,K;if(Y!==void 0&&J)z=Y3(Z,Y,J,q,U),K=J.map((H)=>({path:"",url:U1(Z,{...q,w:Math.round(Y*H),fm:U}),width:Math.round(Y*H),height:0,format:U,size:0,dpr:H}));else{let H=X||F1;z=j5(Z,H,q,U),K=H.map((B)=>({path:"",url:U1(Z,{...q,w:B,fm:U}),width:B,height:0,format:U,size:0}))}W.push({srcset:z,format:U,mimeType:X6[U],variants:K})}return W}function bU($,Z="100vw"){return $.map(({srcset:X,mimeType:J})=>`<source type="${J}" srcset="${X}" sizes="${Z}" />`).join(`
1717
+ `)}function yU($,Z){if($.length===0)return;let X=[...$].sort((Y,Q)=>Y.width-Q.width),J=X.find((Y)=>Y.width>=Z);if(J)return J;return X[X.length-1]}function G3($){return X6[$]||"application/octet-stream"}function SU($){return LX[$]||$}function CU($){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 RX={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},q3=`
1718
1718
  .stx-img-placeholder {
1719
1719
  position: relative;
1720
1720
  overflow: hidden;
@@ -1743,9 +1743,9 @@ ${_}
1743
1743
  filter: blur(0);
1744
1744
  transform: scale(1);
1745
1745
  }
1746
- `.trim();async function W3(){try{return await import("ts-images")}catch{return null}}async function Z6($,Z={}){let X={..._X,...Z},J=await W3();if(J)try{return await VX($,X,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return X6($,X)}async function VX($,Z,X){let{generatePlaceholder:J,generateThumbHash:Y}=X,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 q=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:q.dataURL,width:q.width,height:q.height,aspectRatio:q.aspectRatio,originalWidth:q.originalWidth,originalHeight:q.originalHeight,strategy:Z.strategy,dominantColor:q.dominantColor,css:q.css}}function X6($,Z){let X=Z.width||20,J=Z.height||X,Y="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${J}" viewBox="0 0 ${X} ${J}"><rect fill="#e5e7eb" width="${X}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:X,height:J,aspectRatio:X/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function IK($){let Z=await W3();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await X6($,{strategy:"thumbhash",width:32,height:32})).dataURL}function TK($){let Z=$[0]|$[1]<<8|$[2]<<16,X=(Z&63)/63,J=(Z>>6&63)/31.5-1,Y=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,q=$[3]|$[4]<<8,W=(q>>3&63)/63,K=(q>>9&63)/63,U=q>>15!==0,z=Math.max(3,U?G?5:7:G?5:7),H=Math.max(3,U?G?5:7:G?5:7),B=32,j=32,_=Math.max(0,Math.min(255,Math.round((X+J)*255))),L=Math.max(0,Math.min(255,Math.round(X*255))),V=Math.max(0,Math.min(255,Math.round((X-J)*255))),O=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1747
- <rect fill="rgb(${_},${L},${V})" width="32" height="32"/>
1748
- </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(O)}`}async function EK($,Z=20,X=50){return Z6($,{strategy:"blur",width:Z,quality:X,blurLevel:40})}async function bK($){let Z=await W3();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function yK($,Z=1,X=1){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${X}"><rect fill="${$}" width="${Z}" height="${X}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`}function J6($,Z,X={}){let J=X.transitionDuration||300,Y=X.easing||"ease-out";return`
1746
+ `.trim();async function W3(){try{return await import("ts-images")}catch{return null}}async function J6($,Z={}){let X={...RX,...Z},J=await W3();if(J)try{return await DX($,X,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return Y6($,X)}async function DX($,Z,X){let{generatePlaceholder:J,generateThumbHash:Y}=X,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 q=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:q.dataURL,width:q.width,height:q.height,aspectRatio:q.aspectRatio,originalWidth:q.originalWidth,originalHeight:q.originalHeight,strategy:Z.strategy,dominantColor:q.dominantColor,css:q.css}}function Y6($,Z){let X=Z.width||20,J=Z.height||X,Y="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${J}" viewBox="0 0 ${X} ${J}"><rect fill="#e5e7eb" width="${X}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:X,height:J,aspectRatio:X/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function vU($){let Z=await W3();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await Y6($,{strategy:"thumbhash",width:32,height:32})).dataURL}function fU($){let Z=$[0]|$[1]<<8|$[2]<<16,X=(Z&63)/63,J=(Z>>6&63)/31.5-1,Y=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,q=$[3]|$[4]<<8,W=(q>>3&63)/63,U=(q>>9&63)/63,z=q>>15!==0,K=Math.max(3,z?G?5:7:G?5:7),H=Math.max(3,z?G?5:7:G?5:7),B=32,j=32,_=Math.max(0,Math.min(255,Math.round((X+J)*255))),F=Math.max(0,Math.min(255,Math.round(X*255))),V=Math.max(0,Math.min(255,Math.round((X-J)*255))),O=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1747
+ <rect fill="rgb(${_},${F},${V})" width="32" height="32"/>
1748
+ </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(O)}`}async function xU($,Z=20,X=50){return J6($,{strategy:"blur",width:Z,quality:X,blurLevel:40})}async function gU($){let Z=await W3();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function hU($,Z=1,X=1){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${X}"><rect fill="${$}" width="${Z}" height="${X}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`}function Q6($,Z,X={}){let J=X.transitionDuration||300,Y=X.easing||"ease-out";return`
1749
1749
  #${$} {
1750
1750
  --stx-img-transition-duration: ${J}ms;
1751
1751
  --stx-img-transition-easing: ${Y};
@@ -1762,8 +1762,8 @@ ${_}
1762
1762
  #${$}.stx-img-loaded img {
1763
1763
  opacity: 1;
1764
1764
  }
1765
- `.trim()}function SK($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var x1=new Map;async function Y6($,Z={}){let X=`${$}:${JSON.stringify(Z)}`;if(x1.has(X))return x1.get(X);let J=await Z6($,Z);return x1.set(X,J),J}function CK(){x1.clear()}function PK(){return{size:x1.size,keys:Array.from(x1.keys())}}async function OX(){try{return await import("./chunk-e5vy94ck.js")}catch($){if(!Q6)console.warn("[stx-media] Image processor not available, some features disabled:",$),Q6=!0;return null}}var Q6=!1,K3=80,r5="async",a5="lazy",G6=!1;async function V5($,Z={}){let X=Z,J=$;if(J.process&&!J.skipOptimization){if(X.tsImagesConfig?.enabled&&!X.isDev)return DX(J,X)}if(X.processedResult?.processed)return H3($,X.processedResult,Z);if(X.responsiveVariants)return K6($,X.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:q,sizes:W,widths:K=F1,dpr:U,formats:z=f1,quality:H=K3,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:L=!0,priority:V=!1,loading:O=V?"eager":a5,decoding:F=r5,fetchpriority:w,objectFit:R,objectPosition:D,crossorigin:M,referrerpolicy:k}=$,N=$.class,A=$.style,T=$.id,I=$.data||{},{isDev:S=!1,baseUrl:E=""}=Z;if(S&&!Z.optimize)return wX($);let b,y,P=T||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!V)try{b=await Y6(Y,{strategy:j,..._}),y=J6(P,b,_)}catch{}let f=U!==void 0&&G!==void 0,d;if(f)d=LX($,P,b,Z);else d=await FX($,P,b,Z);let g;if(V){let k0=z.includes("webp")?"webp":z[0],C0=_5(Y,K,{...B,q:H},k0),X0=typeof W==="object"?Q3(W):W||"100vw";g=`<link rel="preload" as="image" imagesrcset="${C0}" imagesizes="${X0}" />`}let Q0=[];if(!G6&&j!=="none")Q0.push(q3),G6=!0;if(y)Q0.push(y);let e0=L?W6(P):void 0;return{html:d,preloadLink:g,css:Q0.length>0?Q0.join(`
1766
- `):void 0,script:e0}}async function FX($,Z,X,J){let{src:Y,alt:Q,width:G,height:q,sizes:W,widths:K=F1,formats:U=f1,quality:z=K3,params:H={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":a5,decoding:L=r5,fetchpriority:V,objectFit:O,objectPosition:F,crossorigin:w,referrerpolicy:R}=$,D=$.class,M=$.style,k=$.data||{},N=typeof W==="object"?Q3(W):W||"100vw",A=[];for(let S of U){let E=_5(Y,K,{...H,q:z},S),b=G3(S);if(B&&!j)A.push(` <source type="${b}" data-srcset="${E}" data-sizes="${N}" />`);else A.push(` <source type="${b}" srcset="${E}" sizes="${N}" />`)}let T=U3({src:K1(Y,{...H,q:z}),alt:Q,width:G,height:q,loading:j?void 0:_,decoding:L,fetchpriority:j?"high":V,objectFit:O,objectPosition:F,crossorigin:w,referrerpolicy:R,className:q6(D,X),style:z3(M,O,F,X),lazy:B&&!j,data:k}),I;if(X){let S=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${Z}" class="stx-img-placeholder" style="${S}">
1765
+ `.trim()}function uU($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var x1=new Map;async function G6($,Z={}){let X=`${$}:${JSON.stringify(Z)}`;if(x1.has(X))return x1.get(X);let J=await J6($,Z);return x1.set(X,J),J}function dU(){x1.clear()}function mU(){return{size:x1.size,keys:Array.from(x1.keys())}}async function NX(){try{return await import("./chunk-e5vy94ck.js")}catch($){if(!q6)console.warn("[stx-media] Image processor not available, some features disabled:",$),q6=!0;return null}}var q6=!1,U3=80,r5="async",a5="lazy",W6=!1;async function _5($,Z={}){let X=Z,J=$;if(J.process&&!J.skipOptimization){if(X.tsImagesConfig?.enabled&&!X.isDev)return TX(J,X)}if(X.processedResult?.processed)return H3($,X.processedResult,Z);if(X.responsiveVariants)return K6($,X.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:q,sizes:W,widths:U=F1,dpr:z,formats:K=f1,quality:H=U3,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:F=!0,priority:V=!1,loading:O=V?"eager":a5,decoding:L=r5,fetchpriority:w,objectFit:R,objectPosition:D,crossorigin:M,referrerpolicy:k}=$,N=$.class,A=$.style,T=$.id,I=$.data||{},{isDev:S=!1,baseUrl:E=""}=Z;if(S&&!Z.optimize)return kX($);let b,y,P=T||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!V)try{b=await G6(Y,{strategy:j,..._}),y=Q6(P,b,_)}catch{}let f=z!==void 0&&G!==void 0,d;if(f)d=AX($,P,b,Z);else d=await MX($,P,b,Z);let g;if(V){let k0=K.includes("webp")?"webp":K[0],C0=j5(Y,U,{...B,q:H},k0),X0=typeof W==="object"?Q3(W):W||"100vw";g=`<link rel="preload" as="image" imagesrcset="${C0}" imagesizes="${X0}" />`}let Q0=[];if(!W6&&j!=="none")Q0.push(q3),W6=!0;if(y)Q0.push(y);let e0=F?z6(P):void 0;return{html:d,preloadLink:g,css:Q0.length>0?Q0.join(`
1766
+ `):void 0,script:e0}}async function MX($,Z,X,J){let{src:Y,alt:Q,width:G,height:q,sizes:W,widths:U=F1,formats:z=f1,quality:K=U3,params:H={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":a5,decoding:F=r5,fetchpriority:V,objectFit:O,objectPosition:L,crossorigin:w,referrerpolicy:R}=$,D=$.class,M=$.style,k=$.data||{},N=typeof W==="object"?Q3(W):W||"100vw",A=[];for(let S of z){let E=j5(Y,U,{...H,q:K},S),b=G3(S);if(B&&!j)A.push(` <source type="${b}" data-srcset="${E}" data-sizes="${N}" />`);else A.push(` <source type="${b}" srcset="${E}" sizes="${N}" />`)}let T=z3({src:U1(Y,{...H,q:K}),alt:Q,width:G,height:q,loading:j?void 0:_,decoding:F,fetchpriority:j?"high":V,objectFit:O,objectPosition:L,crossorigin:w,referrerpolicy:R,className:U6(D,X),style:K3(M,O,L,X),lazy:B&&!j,data:k}),I;if(X){let S=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${Z}" class="stx-img-placeholder" style="${S}">
1767
1767
  <picture>
1768
1768
  ${A.join(`
1769
1769
  `)}
@@ -1773,9 +1773,9 @@ ${A.join(`
1773
1773
  ${A.join(`
1774
1774
  `)}
1775
1775
  <img ${T} />
1776
- </picture>`;return I}function LX($,Z,X,J){let{src:Y,alt:Q,width:G,height:q,dpr:W=[1,2,3],quality:K=K3,params:U={},lazy:z=!0,priority:H=!1,loading:B=H?"eager":a5,decoding:j=r5,fetchpriority:_,objectFit:L,objectPosition:V,crossorigin:O,referrerpolicy:F}=$,w=$.class,R=$.style,D=$.data||{},M=typeof G==="number"?G:Number.parseInt(String(G),10),k=Y3(Y,M,W,{...U,q:K}),N=U3({src:K1(Y,{...U,w:M,q:K}),alt:Q,width:G,height:q,loading:H?void 0:B,decoding:j,fetchpriority:H?"high":_,objectFit:L,objectPosition:V,crossorigin:O,referrerpolicy:F,className:q6(w,X),style:z3(R,L,V,X),lazy:z&&!H,data:D}),A=z&&!H?`data-srcset="${k}"`:`srcset="${k}"`;if(X){let T=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${T}">
1776
+ </picture>`;return I}function AX($,Z,X,J){let{src:Y,alt:Q,width:G,height:q,dpr:W=[1,2,3],quality:U=U3,params:z={},lazy:K=!0,priority:H=!1,loading:B=H?"eager":a5,decoding:j=r5,fetchpriority:_,objectFit:F,objectPosition:V,crossorigin:O,referrerpolicy:L}=$,w=$.class,R=$.style,D=$.data||{},M=typeof G==="number"?G:Number.parseInt(String(G),10),k=Y3(Y,M,W,{...z,q:U}),N=z3({src:U1(Y,{...z,w:M,q:U}),alt:Q,width:G,height:q,loading:H?void 0:B,decoding:j,fetchpriority:H?"high":_,objectFit:F,objectPosition:V,crossorigin:O,referrerpolicy:L,className:U6(w,X),style:K3(R,F,V,X),lazy:K&&!H,data:D}),A=K&&!H?`data-srcset="${k}"`:`srcset="${k}"`;if(X){let T=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${T}">
1777
1777
  <img ${N} ${A} />
1778
- </div>`}return`<img ${Z?`id="${Z}" `:""}${N} ${A} />`}function wX($){let{src:Z,alt:X,width:J,height:Y,loading:Q=a5,decoding:G=r5,fetchpriority:q,objectFit:W,objectPosition:K,crossorigin:U,referrerpolicy:z,priority:H=!1}=$,B=$.class,j=$.style,_=$.id,L=$.data||{};return{html:`<img ${U3({src:Z,alt:X,width:J,height:Y,loading:H?"eager":Q,decoding:G,fetchpriority:H?"high":q,objectFit:W,objectPosition:K,crossorigin:U,referrerpolicy:z,className:B,style:z3(j,W,K),id:_,data:L})} />`}}function U3($){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[X,J]of Object.entries($.data))Z.push(`data-${X}="${p0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function q6($,Z){let X=[];if($)X.push($);if(Z)X.push("stx-img-blur");return X.join(" ")||""}function z3($,Z,X,J){let Y=[];if(Z)Y.push(`object-fit: ${Z}`);if(X)Y.push(`object-position: ${X}`);if(J)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 W6($){return`
1778
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${N} ${A} />`}function kX($){let{src:Z,alt:X,width:J,height:Y,loading:Q=a5,decoding:G=r5,fetchpriority:q,objectFit:W,objectPosition:U,crossorigin:z,referrerpolicy:K,priority:H=!1}=$,B=$.class,j=$.style,_=$.id,F=$.data||{};return{html:`<img ${z3({src:Z,alt:X,width:J,height:Y,loading:H?"eager":Q,decoding:G,fetchpriority:H?"high":q,objectFit:W,objectPosition:U,crossorigin:z,referrerpolicy:K,className:B,style:K3(j,W,U),id:_,data:F})} />`}}function z3($){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[X,J]of Object.entries($.data))Z.push(`data-${X}="${p0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function U6($,Z){let X=[];if($)X.push($);if(Z)X.push("stx-img-blur");return X.join(" ")||""}function K3($,Z,X,J){let Y=[];if(Z)Y.push(`object-fit: ${Z}`);if(X)Y.push(`object-position: ${X}`);if(J)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 z6($){return`
1779
1779
  (function() {
1780
1780
  const container = document.getElementById('${$}');
1781
1781
  if (!container) return;
@@ -1812,7 +1812,7 @@ ${A.join(`
1812
1812
 
1813
1813
  observer.observe(container);
1814
1814
  })();
1815
- `.trim()}function RX($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let X=Z[1],J={},Y=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=Y.exec(X))!==null){let[,G,q,W,K,U]=Q,z=W??K??U??!0;if(G===":"&&typeof z==="string")try{J[q]=JSON.parse(z)}catch{J[q]=z}else switch(q){case"src":J.src=String(z);break;case"alt":J.alt=String(z);break;case"width":J.width=Number(z)||z;break;case"height":J.height=Number(z)||z;break;case"sizes":J.sizes=String(z);break;case"quality":J.quality=Number(z);break;case"placeholder":J.placeholder=z;break;case"lazy":J.lazy=z===!0||z==="true";break;case"priority":J.priority=z===!0||z==="true";break;case"class":J.class=String(z);break;case"style":J.style=String(z);break;case"id":J.id=String(z);break;case"loading":J.loading=z;break;case"decoding":J.decoding=z;break;case"fetchpriority":J.fetchpriority=z;break;case"objectFit":J.objectFit=z;break;case"objectPosition":J.objectPosition=String(z);break;case"crossorigin":J.crossorigin=z;break}}if(!J.src||!J.alt)return null;return J}async function gK($,Z={}){let X=/<Img\s+[^>]*?\/?>/g,J=[],Y=[],Q=[],G=$,q=[],W;while((W=X.exec($))!==null)q.push({match:W[0],index:W.index});for(let K=q.length-1;K>=0;K--){let{match:U}=q[K],z=RX(U);if(z){let H=await V5(z,Z);if(G=G.replace(U,H.html),H.preloadLink)J.push(H.preloadLink);if(H.css)Y.push(H.css);if(H.script)Q.push(H.script)}}return{html:G,preloadLinks:J,styles:Y,scripts:Q}}async function DX($,Z){let X=await OX();if(!X)return V5({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await X.generateResponsiveVariants($.src,$,J);if(Q)return K6($,Q,Z)}else{let Q=await X.processImage($.src,$,J);if(Q.processed)return H3($,Q,Z)}return V5({...$,process:!1},Z)}async function H3($,Z,X){let{alt:J,width:Y,height:Q,lazy:G=!0,priority:q=!1,objectFit:W,objectPosition:K,crossorigin:U,referrerpolicy:z}=$,H=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},L=Z.variants||[],V=L.find((y)=>y.format==="jpeg")||L.find((y)=>y.format==="webp")||L[0],O=V?.url||$.src,F=L.filter((y)=>y.format===(V?.format||"jpeg")).map((y)=>`${y.url} ${y.width}w`).join(", "),w=new Map;for(let y of L){if(!w.has(y.format))w.set(y.format,[]);w.get(y.format).push(y)}let R=[],D=["avif","webp","jpeg","png"];for(let y of D){let P=w.get(y);if(P&&P.length>0){let f=P.map((g)=>`${g.url} ${g.width}w`).join(", "),d=G3(y);if(G&&!q)R.push(` <source type="${d}" data-srcset="${f}" />`);else R.push(` <source type="${d}" srcset="${f}" />`)}}let M=[];if(G&&!q){if(M.push(`data-src="${p0(O)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)M.push(`data-srcset="${F}"`)}else if(M.push(`src="${p0(O)}"`),F)M.push(`srcset="${F}"`);M.push(`alt="${p0(J)}"`);let k=Y||Z.originalWidth,N=Q||Z.originalHeight;if(k)M.push(`width="${k}"`);if(N)M.push(`height="${N}"`);if(!q)M.push(`loading="${G?"lazy":"eager"}"`);if(M.push('decoding="async"'),q)M.push('fetchpriority="high"');if(U)M.push(`crossorigin="${U}"`);if(z)M.push(`referrerpolicy="${z}"`);let A=[];if(W)A.push(`object-fit: ${W}`);if(K)A.push(`object-position: ${K}`);if(Z.placeholder&&G)A.push("opacity: 0; transition: opacity 300ms ease-out");if(B)A.push(B);if(A.length>0)M.push(`style="${A.join("; ")}"`);let T=[];if(H)T.push(H);if(Z.placeholder)T.push("stx-img-blur");if(T.length>0)M.push(`class="${T.join(" ")}"`);if(G&&!q)M.push("data-stx-lazy");for(let[y,P]of Object.entries(_))M.push(`data-${y}="${p0(P)}"`);let I;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let y=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;I=`<div id="${j}" class="stx-img-placeholder" style="${y}">
1815
+ `.trim()}function IX($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let X=Z[1],J={},Y=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=Y.exec(X))!==null){let[,G,q,W,U,z]=Q,K=W??U??z??!0;if(G===":"&&typeof K==="string")try{J[q]=JSON.parse(K)}catch{J[q]=K}else switch(q){case"src":J.src=String(K);break;case"alt":J.alt=String(K);break;case"width":J.width=Number(K)||K;break;case"height":J.height=Number(K)||K;break;case"sizes":J.sizes=String(K);break;case"quality":J.quality=Number(K);break;case"placeholder":J.placeholder=K;break;case"lazy":J.lazy=K===!0||K==="true";break;case"priority":J.priority=K===!0||K==="true";break;case"class":J.class=String(K);break;case"style":J.style=String(K);break;case"id":J.id=String(K);break;case"loading":J.loading=K;break;case"decoding":J.decoding=K;break;case"fetchpriority":J.fetchpriority=K;break;case"objectFit":J.objectFit=K;break;case"objectPosition":J.objectPosition=String(K);break;case"crossorigin":J.crossorigin=K;break}}if(!J.src||!J.alt)return null;return J}async function iU($,Z={}){let X=/<Img\s+[^>]*?\/?>/g,J=[],Y=[],Q=[],G=$,q=[],W;while((W=X.exec($))!==null)q.push({match:W[0],index:W.index});for(let U=q.length-1;U>=0;U--){let{match:z}=q[U],K=IX(z);if(K){let H=await _5(K,Z);if(G=G.replace(z,H.html),H.preloadLink)J.push(H.preloadLink);if(H.css)Y.push(H.css);if(H.script)Q.push(H.script)}}return{html:G,preloadLinks:J,styles:Y,scripts:Q}}async function TX($,Z){let X=await NX();if(!X)return _5({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await X.generateResponsiveVariants($.src,$,J);if(Q)return K6($,Q,Z)}else{let Q=await X.processImage($.src,$,J);if(Q.processed)return H3($,Q,Z)}return _5({...$,process:!1},Z)}async function H3($,Z,X){let{alt:J,width:Y,height:Q,lazy:G=!0,priority:q=!1,objectFit:W,objectPosition:U,crossorigin:z,referrerpolicy:K}=$,H=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},F=Z.variants||[],V=F.find((y)=>y.format==="jpeg")||F.find((y)=>y.format==="webp")||F[0],O=V?.url||$.src,L=F.filter((y)=>y.format===(V?.format||"jpeg")).map((y)=>`${y.url} ${y.width}w`).join(", "),w=new Map;for(let y of F){if(!w.has(y.format))w.set(y.format,[]);w.get(y.format).push(y)}let R=[],D=["avif","webp","jpeg","png"];for(let y of D){let P=w.get(y);if(P&&P.length>0){let f=P.map((g)=>`${g.url} ${g.width}w`).join(", "),d=G3(y);if(G&&!q)R.push(` <source type="${d}" data-srcset="${f}" />`);else R.push(` <source type="${d}" srcset="${f}" />`)}}let M=[];if(G&&!q){if(M.push(`data-src="${p0(O)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)M.push(`data-srcset="${L}"`)}else if(M.push(`src="${p0(O)}"`),L)M.push(`srcset="${L}"`);M.push(`alt="${p0(J)}"`);let k=Y||Z.originalWidth,N=Q||Z.originalHeight;if(k)M.push(`width="${k}"`);if(N)M.push(`height="${N}"`);if(!q)M.push(`loading="${G?"lazy":"eager"}"`);if(M.push('decoding="async"'),q)M.push('fetchpriority="high"');if(z)M.push(`crossorigin="${z}"`);if(K)M.push(`referrerpolicy="${K}"`);let A=[];if(W)A.push(`object-fit: ${W}`);if(U)A.push(`object-position: ${U}`);if(Z.placeholder&&G)A.push("opacity: 0; transition: opacity 300ms ease-out");if(B)A.push(B);if(A.length>0)M.push(`style="${A.join("; ")}"`);let T=[];if(H)T.push(H);if(Z.placeholder)T.push("stx-img-blur");if(T.length>0)M.push(`class="${T.join(" ")}"`);if(G&&!q)M.push("data-stx-lazy");for(let[y,P]of Object.entries(_))M.push(`data-${y}="${p0(P)}"`);let I;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let y=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;I=`<div id="${j}" class="stx-img-placeholder" style="${y}">
1816
1816
  <picture>
1817
1817
  ${R.join(`
1818
1818
  `)}
@@ -1822,11 +1822,11 @@ ${R.join(`
1822
1822
  ${R.join(`
1823
1823
  `)}
1824
1824
  <img ${M.join(" ")} />
1825
- </picture>`;let S=[];if(Z.placeholder)S.push(q3);let E=G?W6(j):void 0,b;if(q&&F)b=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:b,css:S.length>0?S.join(`
1826
- `):void 0,script:E}}async function K6($,Z,X){let J={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)J.variants.push(...Q);return H3($,J,X)}function NX(){return t5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,X,J)=>{let{src:Y,alt:Q,options:G}=MX($,Z,X);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let q={src:Y,alt:Q||"",widths:G.widths||F1,formats:G.formats||f1,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},W=X.__isDev||!1,K=await V5(q,{isDev:W}),U=K.html;if(K.preloadLink)U=K.preloadLink+`
1827
- `+U;if(K.css)U+=`
1828
- <style>${K.css}</style>`;if(K.script)U+=`
1829
- <script>${K.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function MX($,Z,X){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=AX(J),Q=B3(Y[0],X)||"",G=B3(Y[1],X)||"",q={};if(Y[2]){let W=B3(Y[2],X);if(typeof W==="object"&&W!==null)q=W;else if(typeof Y[2]==="string")try{q=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:q}}function AX($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let q=0;q<$.length;q++){let W=$[q],K=q>0?$[q-1]:"";if((W==='"'||W==="'"||W==="`")&&K!=="\\"){if(!J)J=!0,Y=W;else if(W===Y)J=!1,Y="";else X+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=W}if(X.trim())Z.push(X.trim());return Z}function B3($,Z){if(typeof $!=="string")return $;let X=$.trim();if(X.startsWith('"')&&X.endsWith('"')||X.startsWith("'")&&X.endsWith("'"))return X.slice(1,-1);if(!X.startsWith("/")&&!X.startsWith(".")&&!X.startsWith("http")&&!X.startsWith("{")){let J=Z[X];if(J!==void 0)return J}if(X.startsWith("{")||X.startsWith("["))try{return JSON.parse(X)}catch{}return X}var U6=NX();async function H6(){try{return await import("./chunk-w1zde8wp.js")}catch($){if(!z6)console.warn("[stx-media] Video processor not available, some features disabled:",$),z6=!0;return null}}var z6=!1,B6=!0,j6="metadata",kX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function e5($,Z={}){let X=Z,J=$;if(J.process&&!J.skipProcessing){if(X.tsVideosConfig?.enabled&&!X.isDev)return yX(J,X)}if(X.processedResult?.processed)return V6($,X.processedResult,Z);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await SX(J,X);let{src:Q,sources:G=[],poster:q,posterPlaceholder:W,controls:K=B6,autoplay:U=!1,muted:z=!1,loop:H=!1,preload:B=j6,playsinline:j=!0,lazy:_=!0,player:L="native",type:V,width:O,height:F,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:D=!1}=$,M=Y||q,k=$.class,N=$.style,A=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return TX($,Z);if(V&&V!=="video")return IX(Q||"",V,$);let T=G.length>0?G:Q?[{src:Q,type:_6(Q)}]:[],I=[`id="${A}"`];if(K)I.push("controls");if(U)I.push("autoplay");if(z)I.push("muted");if(H)I.push("loop");if(j)I.push("playsinline");if(R)I.push("disablepictureinpicture");if(D)I.push("disableremoteplayback");if(w)I.push(`crossorigin="${w}"`);if(_){if(I.push(`data-preload="${B}"`),I.push('preload="none"'),M)I.push(`data-poster="${D0(M)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),M)I.push(`poster="${D0(M)}"`);if(O)I.push(`width="${O}"`);if(F)I.push(`height="${F}"`);if(k)I.push(`class="${D0(k)}"`);if(N)I.push(`style="${D0(N)}"`);let S=T.map((y)=>{return` <source ${_?`data-src="${D0(y.src)}"`:`src="${D0(y.src)}"`} type="${y.type}"${y.media?` media="${y.media}"`:""} />`}).join(`
1825
+ </picture>`;let S=[];if(Z.placeholder)S.push(q3);let E=G?z6(j):void 0,b;if(q&&L)b=`<link rel="preload" as="image" imagesrcset="${L}" />`;return{html:I,preloadLink:b,css:S.length>0?S.join(`
1826
+ `):void 0,script:E}}async function K6($,Z,X){let J={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)J.variants.push(...Q);return H3($,J,X)}function EX(){return t5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,X,J)=>{let{src:Y,alt:Q,options:G}=bX($,Z,X);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let q={src:Y,alt:Q||"",widths:G.widths||F1,formats:G.formats||f1,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},W=X.__isDev||!1,U=await _5(q,{isDev:W}),z=U.html;if(U.preloadLink)z=U.preloadLink+`
1827
+ `+z;if(U.css)z+=`
1828
+ <style>${U.css}</style>`;if(U.script)z+=`
1829
+ <script>${U.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function bX($,Z,X){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=yX(J),Q=B3(Y[0],X)||"",G=B3(Y[1],X)||"",q={};if(Y[2]){let W=B3(Y[2],X);if(typeof W==="object"&&W!==null)q=W;else if(typeof Y[2]==="string")try{q=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:q}}function yX($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let q=0;q<$.length;q++){let W=$[q],U=q>0?$[q-1]:"";if((W==='"'||W==="'"||W==="`")&&U!=="\\"){if(!J)J=!0,Y=W;else if(W===Y)J=!1,Y="";else X+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=W}if(X.trim())Z.push(X.trim());return Z}function B3($,Z){if(typeof $!=="string")return $;let X=$.trim();if(X.startsWith('"')&&X.endsWith('"')||X.startsWith("'")&&X.endsWith("'"))return X.slice(1,-1);if(!X.startsWith("/")&&!X.startsWith(".")&&!X.startsWith("http")&&!X.startsWith("{")){let J=Z[X];if(J!==void 0)return J}if(X.startsWith("{")||X.startsWith("["))try{return JSON.parse(X)}catch{}return X}var H6=EX();async function j6(){try{return await import("./chunk-w1zde8wp.js")}catch($){if(!B6)console.warn("[stx-media] Video processor not available, some features disabled:",$),B6=!0;return null}}var B6=!1,_6=!0,V6="metadata",SX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function e5($,Z={}){let X=Z,J=$;if(J.process&&!J.skipProcessing){if(X.tsVideosConfig?.enabled&&!X.isDev)return xX(J,X)}if(X.processedResult?.processed)return F6($,X.processedResult,Z);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await gX(J,X);let{src:Q,sources:G=[],poster:q,posterPlaceholder:W,controls:U=_6,autoplay:z=!1,muted:K=!1,loop:H=!1,preload:B=V6,playsinline:j=!0,lazy:_=!0,player:F="native",type:V,width:O,height:L,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:D=!1}=$,M=Y||q,k=$.class,N=$.style,A=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return PX($,Z);if(V&&V!=="video")return CX(Q||"",V,$);let T=G.length>0?G:Q?[{src:Q,type:O6(Q)}]:[],I=[`id="${A}"`];if(U)I.push("controls");if(z)I.push("autoplay");if(K)I.push("muted");if(H)I.push("loop");if(j)I.push("playsinline");if(R)I.push("disablepictureinpicture");if(D)I.push("disableremoteplayback");if(w)I.push(`crossorigin="${w}"`);if(_){if(I.push(`data-preload="${B}"`),I.push('preload="none"'),M)I.push(`data-poster="${D0(M)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),M)I.push(`poster="${D0(M)}"`);if(O)I.push(`width="${O}"`);if(L)I.push(`height="${L}"`);if(k)I.push(`class="${D0(k)}"`);if(N)I.push(`style="${D0(N)}"`);let S=T.map((y)=>{return` <source ${_?`data-src="${D0(y.src)}"`:`src="${D0(y.src)}"`} type="${y.type}"${y.media?` media="${y.media}"`:""} />`}).join(`
1830
1830
  `),E=`<video ${I.join(" ")}>
1831
1831
  ${S}
1832
1832
  Your browser does not support the video tag.
@@ -1865,16 +1865,16 @@ ${S}
1865
1865
 
1866
1866
  observer.observe(video);
1867
1867
  })();
1868
- `.trim();return{html:E,script:b}}function IX($,Z,X){let{width:J=640,height:Y=360}=X,Q=X.class,G=X.style,q=X.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,K=null;switch(Z){case"youtube":K=EX($),W=K?`https://www.youtube-nocookie.com/embed/${K}`:$;break;case"vimeo":K=bX($),W=K?`https://player.vimeo.com/video/${K}`:$;break;case"dailymotion":K=$.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${K}`;break;case"twitch":K=$.split("/").pop()||"",W=`https://player.twitch.tv/?video=${K}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=$}let U=[`id="${q}"`,`src="${D0(W)}"`,`width="${J}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)U.push(`class="${D0(Q)}"`);if(G)U.push(`style="${D0(G)}"`);if(X.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1869
- <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1870
- </div>`}}function TX($,Z={}){let{src:X,sources:J=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:q=!1,loop:W=!1,preload:K="metadata",playsinline:U=!0,lazy:z=!0,width:H,height:B}=$,j=$.class,_=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,V={src:J.length>0?J:X,autoplay:G,loop:W,muted:q,playsinline:U,preload:K,poster:Y,controls:Q,title:$.title},O=["position: relative",H?`width: ${typeof H==="number"?H+"px":H}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",_||""].filter(Boolean).join("; "),F=`
1868
+ `.trim();return{html:E,script:b}}function CX($,Z,X){let{width:J=640,height:Y=360}=X,Q=X.class,G=X.style,q=X.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,U=null;switch(Z){case"youtube":U=vX($),W=U?`https://www.youtube-nocookie.com/embed/${U}`:$;break;case"vimeo":U=fX($),W=U?`https://player.vimeo.com/video/${U}`:$;break;case"dailymotion":U=$.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${U}`;break;case"twitch":U=$.split("/").pop()||"",W=`https://player.twitch.tv/?video=${U}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=$}let z=[`id="${q}"`,`src="${D0(W)}"`,`width="${J}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)z.push(`class="${D0(Q)}"`);if(G)z.push(`style="${D0(G)}"`);if(X.lazy)z.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1869
+ <iframe ${z.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1870
+ </div>`}}function PX($,Z={}){let{src:X,sources:J=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:q=!1,loop:W=!1,preload:U="metadata",playsinline:z=!0,lazy:K=!0,width:H,height:B}=$,j=$.class,_=$.style,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,V={src:J.length>0?J:X,autoplay:G,loop:W,muted:q,playsinline:z,preload:U,poster:Y,controls:Q,title:$.title},O=["position: relative",H?`width: ${typeof H==="number"?H+"px":H}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",_||""].filter(Boolean).join("; "),L=`
1871
1871
  <div
1872
- id="${L}"
1872
+ id="${F}"
1873
1873
  class="ts-video-player${j?" "+D0(j):""}"
1874
1874
  style="${O}"
1875
1875
  data-ts-video-player
1876
1876
  data-config='${JSON.stringify(V)}'
1877
- ${z?"data-lazy":""}
1877
+ ${K?"data-lazy":""}
1878
1878
  >
1879
1879
  <div class="ts-video-player__container">
1880
1880
  ${Y?`
@@ -1890,7 +1890,7 @@ ${S}
1890
1890
  </div>
1891
1891
  `.trim(),w=`
1892
1892
  (function() {
1893
- var container = document.getElementById('${L}');
1893
+ var container = document.getElementById('${F}');
1894
1894
  if (!container) return;
1895
1895
 
1896
1896
  var config = JSON.parse(container.dataset.config || '{}');
@@ -1904,7 +1904,7 @@ ${S}
1904
1904
 
1905
1905
  // Load ts-video-player from CDN
1906
1906
  var script = document.createElement('script');
1907
- script.src = '${kX}';
1907
+ script.src = '${SX}';
1908
1908
  script.onload = initPlayer;
1909
1909
  script.onerror = function() {
1910
1910
  console.error('[stx] Failed to load ts-video-player');
@@ -2034,12 +2034,12 @@ else {
2034
2034
  .ts-video-player__play-button svg {
2035
2035
  margin-left: 4px;
2036
2036
  }
2037
- `.trim();return{html:F,script:w,css:R}}function _6($){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 EX($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let X of Z){let J=$.match(X);if(J)return J[1]}return null}function bX($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function D0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function cK($,Z,X){if(Z.src)return{src:String(Z.src),...Z};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=J.indexOf(",");if(Y===-1)return{src:J.replace(/^['"]|['"]$/g,"")};let Q=J.slice(0,Y).trim().replace(/^['"]|['"]$/g,""),G=J.slice(Y+1).trim();try{let q=JSON.parse(G);return{src:Q,...q}}catch{return{src:Q}}}async function yX($,Z){let X=await H6();if(!X)return e5({...$,process:!1},Z);let J=Z.tsVideosConfig,Y=await X.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return V6($,Y,Z);return e5({...$,process:!1},Z)}async function SX($,Z){let X=await H6();if(!X||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await X.generatePoster($.src,J,Y.outputDir,Y.baseUrl||"/videos"))?.url}function V6($,Z,X){let{controls:J=B6,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:q=j6,playsinline:W=!0,lazy:K=!0,width:U,height:z,crossorigin:H,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,_=$.class,L=$.style,V=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,F=_6(O);if(Z.transcoded)O=Z.transcoded.url,F="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,F="application/dash+xml"}let R=Z.poster?.url||$.poster,D=[`id="${V}"`];if(J)D.push("controls");if(Y)D.push("autoplay");if(Q)D.push("muted");if(G)D.push("loop");if(W)D.push("playsinline");if(B)D.push("disablepictureinpicture");if(j)D.push("disableremoteplayback");if(H)D.push(`crossorigin="${H}"`);if(K){if(D.push(`data-preload="${q}"`),D.push('preload="none"'),R)D.push(`data-poster="${D0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${q}"`),R)D.push(`poster="${D0(R)}"`);let M=U||Z.metadata?.width,k=z||Z.metadata?.height;if(M)D.push(`width="${M}"`);if(k)D.push(`height="${k}"`);if(_)D.push(`class="${D0(_)}"`);if(L)D.push(`style="${D0(L)}"`);let A=` <source ${K?`data-src="${D0(O)}"`:`src="${D0(O)}"`} type="${F}" />`,T=`<video ${D.join(" ")}>
2037
+ `.trim();return{html:L,script:w,css:R}}function O6($){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 vX($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let X of Z){let J=$.match(X);if(J)return J[1]}return null}function fX($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function D0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function tU($,Z,X){if(Z.src)return{src:String(Z.src),...Z};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=J.indexOf(",");if(Y===-1)return{src:J.replace(/^['"]|['"]$/g,"")};let Q=J.slice(0,Y).trim().replace(/^['"]|['"]$/g,""),G=J.slice(Y+1).trim();try{let q=JSON.parse(G);return{src:Q,...q}}catch{return{src:Q}}}async function xX($,Z){let X=await j6();if(!X)return e5({...$,process:!1},Z);let J=Z.tsVideosConfig,Y=await X.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return F6($,Y,Z);return e5({...$,process:!1},Z)}async function gX($,Z){let X=await j6();if(!X||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await X.generatePoster($.src,J,Y.outputDir,Y.baseUrl||"/videos"))?.url}function F6($,Z,X){let{controls:J=_6,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:q=V6,playsinline:W=!0,lazy:U=!0,width:z,height:K,crossorigin:H,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,_=$.class,F=$.style,V=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,L=O6(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="${V}"`];if(J)D.push("controls");if(Y)D.push("autoplay");if(Q)D.push("muted");if(G)D.push("loop");if(W)D.push("playsinline");if(B)D.push("disablepictureinpicture");if(j)D.push("disableremoteplayback");if(H)D.push(`crossorigin="${H}"`);if(U){if(D.push(`data-preload="${q}"`),D.push('preload="none"'),R)D.push(`data-poster="${D0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${q}"`),R)D.push(`poster="${D0(R)}"`);let M=z||Z.metadata?.width,k=K||Z.metadata?.height;if(M)D.push(`width="${M}"`);if(k)D.push(`height="${k}"`);if(_)D.push(`class="${D0(_)}"`);if(F)D.push(`style="${D0(F)}"`);let A=` <source ${U?`data-src="${D0(O)}"`:`src="${D0(O)}"`} type="${L}" />`,T=`<video ${D.join(" ")}>
2038
2038
  ${A}
2039
2039
  Your browser does not support the video tag.
2040
2040
  </video>`;if(Z.spriteSheet)T=`<div class="stx-video-wrapper" data-sprite-sheet="${D0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
2041
2041
  ${T}
2042
- </div>`;let I;if(K)I=`
2042
+ </div>`;let I;if(U)I=`
2043
2043
  (function() {
2044
2044
  var video = document.getElementById('${V}');
2045
2045
  if (!video) return;
@@ -2083,64 +2083,64 @@ ${T}
2083
2083
  width: 100%;
2084
2084
  height: auto;
2085
2085
  }
2086
- `.trim();return{html:T,script:I,css:S}}function O6(){return t5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,X,J)=>{let{src:Y,options:Q}=CX($,Z,X);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},W={isDev:X.__isDev||!1,tsVideosConfig:X.__tsVideosConfig},K=await e5(G,W),U=K.html;if(K.css)U+=`
2087
- <style>${K.css}</style>`;if(K.script)U+=`
2088
- <script>${K.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function CX($,Z,X){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=PX(J),Q=F6(Y[0],X)||"",G={};if(Y[1]){let q=F6(Y[1],X);if(typeof q==="object"&&q!==null)G=q;else if(typeof Y[1]==="string")try{G=JSON.parse(Y[1])}catch{}}return{src:Q,options:G}}function PX($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let q=0;q<$.length;q++){let W=$[q],K=q>0?$[q-1]:"";if((W==='"'||W==="'"||W==="`")&&K!=="\\"){if(!J)J=!0,Y=W;else if(W===Y)J=!1,Y="";else X+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=W}if(X.trim())Z.push(X.trim());return Z}function F6($,Z){if(typeof $!=="string")return $;let X=$.trim();if(X.startsWith('"')&&X.endsWith('"')||X.startsWith("'")&&X.endsWith("'"))return X.slice(1,-1);if(!X.startsWith("/")&&!X.startsWith(".")&&!X.startsWith("http")&&!X.startsWith("{")){let J=Z[X];if(J!==void 0)return J}if(X.startsWith("{")||X.startsWith("["))try{return JSON.parse(X)}catch{}return X}var j3=O6();var vX={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},$$={},L6="en";function fX($){L6=$}function xX(){return L6}function gX($){$$={...$$,...$}}function hX(){$$={}}function w6($,Z={}){let X=$$[$]||vX[$]||{message:`Unknown error (code: ${$})`},J=X.message,Y=X.help;for(let[Q,G]of Object.entries(Z)){let q=`{{${Q}}}`;if(J=J.replace(new RegExp(q,"g"),G),Y)Y=Y.replace(new RegExp(q,"g"),G)}return{message:J,help:Y}}function uX($,Z={}){let{message:X,help:J}=w6($,Z);return J?`${X}
2089
- Help: ${J}`:X}var l={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function _3($){for(let[Z,X]of Object.entries(l))if(X===$)return Z;return}import dX from"path";function O5(){return!1}function F5(){return!O5()||process.env.STX_DEBUG==="true"}function Z$(){return!1}var R6={showRelativePaths:!1,enableAutoRecovery:F5(),logRecoveryWarnings:!0},g1={...R6};function mX($){g1={...g1,...$}}function X$(){return{...g1}}function lX(){g1={...R6}}function J$($){if(!g1.showRelativePaths||!$)return $;let Z=g1.baseDir||process.cwd();try{let X=dX.relative(Z,$);return X.startsWith("..")?$:X}catch{return $}}class L1 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,X,J,Y,Q,G){super($);this.code=Z;this.filePath=X;this.line=J;this.column=Y;this.context=Q;if(this.name="StxError",this.numericCode=G||l.EVALUATION_ERROR,this.filePath)this.filePath=J$(this.filePath)}}class D6 extends L1{constructor($,Z,X,J,Y,Q){super($,"stx_SYNTAX_ERROR",Z,X,J,Y,Q||l.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}}class w1 extends L1{constructor($,Z,X,J,Y,Q){super($,"stx_RUNTIME_ERROR",Z,X,J,Y,Q||l.EVALUATION_ERROR);this.name="StxRuntimeError"}}class N6 extends L1{constructor($,Z,X,J,Y,Q){super($,"stx_SECURITY_ERROR",Z,X,J,Y,Q||l.UNSAFE_EXPRESSION);this.name="StxSecurityError"}}class M6 extends L1{constructor($,Z,X,J,Y,Q){super($,"stx_FILE_ERROR",Z,X,J,Y,Q||l.FILE_NOT_FOUND);this.name="StxFileError"}}class Y$ extends L1{isFatal=!0;constructor($,Z,X,J,Y,Q){super($,"stx_VALIDATION_ERROR",Z,X,J,Y,Q||l.DOM_API_VIOLATION);this.name="StxValidationError"}}function V3($){let{type:Z,message:X,code:J,filePath:Y,line:Q,column:G,template:q,offset:W,snippet:K,suggestion:U,format:z="text"}=$,H=Q,B=G;if(!H&&q&&W!==void 0){let O=k6(q,W);H=O.line,B=O.column}let j=Y?J$(Y):void 0,_=J?_3(J):void 0,L={type:Z,code:J,codeName:_,message:X,filePath:j,line:H,column:B,snippet:K,suggestion:U,timestamp:new Date().toISOString()},V;switch(z){case"html":V=pX(L);break;case"json":V=JSON.stringify(L,null,2);break;case"console":V=iX(L,q,W);break;case"text":default:V=cX(L,q,W);break}return{formatted:V,data:L}}function cX($,Z,X){let J=[],Y=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${Y}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
2090
- ${$.message}`),Z&&$.line){let Q=nX(Z,$.line,2);if(Q)J.push(`
2086
+ `.trim();return{html:T,script:I,css:S}}function L6(){return t5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,X,J)=>{let{src:Y,options:Q}=hX($,Z,X);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},W={isDev:X.__isDev||!1,tsVideosConfig:X.__tsVideosConfig},U=await e5(G,W),z=U.html;if(U.css)z+=`
2087
+ <style>${U.css}</style>`;if(U.script)z+=`
2088
+ <script>${U.script}</script>`;return z},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function hX($,Z,X){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=uX(J),Q=w6(Y[0],X)||"",G={};if(Y[1]){let q=w6(Y[1],X);if(typeof q==="object"&&q!==null)G=q;else if(typeof Y[1]==="string")try{G=JSON.parse(Y[1])}catch{}}return{src:Q,options:G}}function uX($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let q=0;q<$.length;q++){let W=$[q],U=q>0?$[q-1]:"";if((W==='"'||W==="'"||W==="`")&&U!=="\\"){if(!J)J=!0,Y=W;else if(W===Y)J=!1,Y="";else X+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=W}if(X.trim())Z.push(X.trim());return Z}function w6($,Z){if(typeof $!=="string")return $;let X=$.trim();if(X.startsWith('"')&&X.endsWith('"')||X.startsWith("'")&&X.endsWith("'"))return X.slice(1,-1);if(!X.startsWith("/")&&!X.startsWith(".")&&!X.startsWith("http")&&!X.startsWith("{")){let J=Z[X];if(J!==void 0)return J}if(X.startsWith("{")||X.startsWith("["))try{return JSON.parse(X)}catch{}return X}var j3=L6();var dX={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},$$={},R6="en";function mX($){R6=$}function lX(){return R6}function cX($){$$={...$$,...$}}function pX(){$$={}}function D6($,Z={}){let X=$$[$]||dX[$]||{message:`Unknown error (code: ${$})`},J=X.message,Y=X.help;for(let[Q,G]of Object.entries(Z)){let q=`{{${Q}}}`;if(J=J.replace(new RegExp(q,"g"),G),Y)Y=Y.replace(new RegExp(q,"g"),G)}return{message:J,help:Y}}function iX($,Z={}){let{message:X,help:J}=D6($,Z);return J?`${X}
2089
+ Help: ${J}`:X}var l={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function _3($){for(let[Z,X]of Object.entries(l))if(X===$)return Z;return}import nX from"path";function V5(){return!1}function O5(){return!V5()||process.env.STX_DEBUG==="true"}function Z$(){return!1}var N6={showRelativePaths:!1,enableAutoRecovery:O5(),logRecoveryWarnings:!0},g1={...N6};function sX($){g1={...g1,...$}}function X$(){return{...g1}}function oX(){g1={...N6}}function J$($){if(!g1.showRelativePaths||!$)return $;let Z=g1.baseDir||process.cwd();try{let X=nX.relative(Z,$);return X.startsWith("..")?$:X}catch{return $}}class L1 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,X,J,Y,Q,G){super($);this.code=Z;this.filePath=X;this.line=J;this.column=Y;this.context=Q;if(this.name="StxError",this.numericCode=G||l.EVALUATION_ERROR,this.filePath)this.filePath=J$(this.filePath)}}class M6 extends L1{constructor($,Z,X,J,Y,Q){super($,"stx_SYNTAX_ERROR",Z,X,J,Y,Q||l.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}}class w1 extends L1{constructor($,Z,X,J,Y,Q){super($,"stx_RUNTIME_ERROR",Z,X,J,Y,Q||l.EVALUATION_ERROR);this.name="StxRuntimeError"}}class A6 extends L1{constructor($,Z,X,J,Y,Q){super($,"stx_SECURITY_ERROR",Z,X,J,Y,Q||l.UNSAFE_EXPRESSION);this.name="StxSecurityError"}}class k6 extends L1{constructor($,Z,X,J,Y,Q){super($,"stx_FILE_ERROR",Z,X,J,Y,Q||l.FILE_NOT_FOUND);this.name="StxFileError"}}class Y$ extends L1{isFatal=!0;constructor($,Z,X,J,Y,Q){super($,"stx_VALIDATION_ERROR",Z,X,J,Y,Q||l.DOM_API_VIOLATION);this.name="StxValidationError"}}function V3($){let{type:Z,message:X,code:J,filePath:Y,line:Q,column:G,template:q,offset:W,snippet:U,suggestion:z,format:K="text"}=$,H=Q,B=G;if(!H&&q&&W!==void 0){let O=T6(q,W);H=O.line,B=O.column}let j=Y?J$(Y):void 0,_=J?_3(J):void 0,F={type:Z,code:J,codeName:_,message:X,filePath:j,line:H,column:B,snippet:U,suggestion:z,timestamp:new Date().toISOString()},V;switch(K){case"html":V=aX(F);break;case"json":V=JSON.stringify(F,null,2);break;case"console":V=tX(F,q,W);break;case"text":default:V=rX(F,q,W);break}return{formatted:V,data:F}}function rX($,Z,X){let J=[],Y=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${Y}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
2090
+ ${$.message}`),Z&&$.line){let Q=eX(Z,$.line,2);if(Q)J.push(`
2091
2091
  ${Q}`)}if($.snippet)J.push(`
2092
2092
  Snippet: ${$.snippet}`);if($.suggestion)J.push(`
2093
- Suggestion: ${$.suggestion}`);return J.join(" ")}function pX($){let Z=$.code?` [${$.code}]`:"",X=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${X}: ${A6($.message)}`;if($.suggestion)J+=` | Suggestion: ${A6($.suggestion)}`;return J+=" -->",J}function iX($,Z,X){let K=[],U=$.code?` [${$.codeName||$.code}]`:"";if(K.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}K.push(`
2094
- \x1B[90mat\x1B[0m ${z}`)}if(K.push(`
2093
+ Suggestion: ${$.suggestion}`);return J.join(" ")}function aX($){let Z=$.code?` [${$.code}]`:"",X=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${X}: ${I6($.message)}`;if($.suggestion)J+=` | Suggestion: ${I6($.suggestion)}`;return J+=" -->",J}function tX($,Z,X){let U=[],z=$.code?` [${$.codeName||$.code}]`:"";if(U.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${z} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let K=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(K+=`\x1B[90m:${$.line}\x1B[0m`,$.column)K+=`\x1B[90m:${$.column}\x1B[0m`}U.push(`
2094
+ \x1B[90mat\x1B[0m ${K}`)}if(U.push(`
2095
2095
 
2096
- ${$.message}`),Z&&$.line){let z=sX(Z,$.line,2);if(z)K.push(`
2096
+ ${$.message}`),Z&&$.line){let K=$J(Z,$.line,2);if(K)U.push(`
2097
2097
 
2098
2098
  \x1B[90mContext:\x1B[0m
2099
- ${z}`)}if($.suggestion)K.push(`
2099
+ ${K}`)}if($.suggestion)U.push(`
2100
2100
 
2101
- \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return K.push(`
2102
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),K.join("")}function nX($,Z,X){let J=$.split(`
2103
- `),Y=Math.max(0,Z-X-1),Q=Math.min(J.length-1,Z+X-1),G=[];for(let q=Y;q<=Q;q++){let W=(q+1).toString().padStart(4),K=q===Z-1?">":" ";G.push(`${K}${W} | ${J[q]}`)}return G.join(`
2104
- `)}function sX($,Z,X){let J=$.split(`
2105
- `),Y=Math.max(0,Z-X-1),Q=Math.min(J.length-1,Z+X-1),G="\x1B[90m",q="\x1B[31m",W="\x1B[0m",K=[];for(let U=Y;U<=Q;U++){let z=(U+1).toString().padStart(4),H=U===Z-1,B=H?"\x1B[31m>\x1B[0m":" ",j=H?`\x1B[31m${J[U]}\x1B[0m`:`\x1B[90m${J[U]}\x1B[0m`;K.push(`${B}\x1B[90m${z}\x1B[0m | ${j}`)}return K.join(`
2106
- `)}function A6($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function k6($,Z){let J=$.substring(0,Z).split(`
2107
- `);return{line:J.length,column:J[J.length-1].length}}function $0($,Z,X){return V3({type:$,message:Z,code:X,format:"html"}).formatted}function oX($,Z,X,J,Y){return V3({type:$,message:Z,code:Y,filePath:X,line:J,format:"console"}).formatted}function rX($,Z,X){let J=X.template.split(`
2108
- `),Y=k6(X.template,X.offset),Q=`[${$} Error at line ${Y.line} in ${X.filePath}]: ${Z}
2101
+ \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return U.push(`
2102
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),U.join("")}function eX($,Z,X){let J=$.split(`
2103
+ `),Y=Math.max(0,Z-X-1),Q=Math.min(J.length-1,Z+X-1),G=[];for(let q=Y;q<=Q;q++){let W=(q+1).toString().padStart(4),U=q===Z-1?">":" ";G.push(`${U}${W} | ${J[q]}`)}return G.join(`
2104
+ `)}function $J($,Z,X){let J=$.split(`
2105
+ `),Y=Math.max(0,Z-X-1),Q=Math.min(J.length-1,Z+X-1),G="\x1B[90m",q="\x1B[31m",W="\x1B[0m",U=[];for(let z=Y;z<=Q;z++){let K=(z+1).toString().padStart(4),H=z===Z-1,B=H?"\x1B[31m>\x1B[0m":" ",j=H?`\x1B[31m${J[z]}\x1B[0m`:`\x1B[90m${J[z]}\x1B[0m`;U.push(`${B}\x1B[90m${K}\x1B[0m | ${j}`)}return U.join(`
2106
+ `)}function I6($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function T6($,Z){let J=$.substring(0,Z).split(`
2107
+ `);return{line:J.length,column:J[J.length-1].length}}function $0($,Z,X){return V3({type:$,message:Z,code:X,format:"html"}).formatted}function ZJ($,Z,X,J,Y){return V3({type:$,message:Z,code:Y,filePath:X,line:J,format:"console"}).formatted}function XJ($,Z,X){let J=X.template.split(`
2108
+ `),Y=T6(X.template,X.offset),Q=`[${$} Error at line ${Y.line} in ${X.filePath}]: ${Z}
2109
2109
 
2110
2110
  `,G=Math.max(0,Y.line-3),q=Math.min(J.length-1,Y.line+2);Q+=`Context:
2111
- `;for(let W=G;W<=q;W++){let K=W+1,U=J[W]||"",z=W===Y.line-1?">":" ";Q+=`${z} ${K.toString().padStart(3)}: ${U}
2111
+ `;for(let W=G;W<=q;W++){let U=W+1,z=J[W]||"",K=W===Y.line-1?">":" ";Q+=`${K} ${U.toString().padStart(3)}: ${z}
2112
2112
  `}if(Y.line-1<J.length){let W=" ".repeat(Y.column+5);Q+=`${W}^
2113
- `}return Q}function aX($,Z,X){try{return $()}catch(J){if(X&&J instanceof Error)X(J);return Z}}async function h1($,Z,X){try{return await $()}catch(J){if(X&&J instanceof Error)X(J);return Z}}var O3={isEnabled(){return X$().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=X$();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let X=$,J=[],Y=(X.match(/\{\{/g)||[]).length,Q=(X.match(/\}\}/g)||[]).length;if(Y>Q){let q=Y-Q;X+="}}".repeat(q),J.push(`Added ${q} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let q of G){let W=(X.match(new RegExp(`@${q}\\b`,"g"))||[]).length,K=(X.match(new RegExp(`@end${q}\\b`,"g"))||[]).length;if(W>K){let U=W-K;for(let z=0;z<U;z++)X+=`
2114
- @end${q}`;J.push(`Added ${U} missing @end${q}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((q)=>console.warn(` - ${q}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:X,fixes:J}},createFallbackContent($,Z){if(F5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};class F3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,X="error"){let J={timestamp:new Date,error:$,context:Z,level:X};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(X))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
2113
+ `}return Q}function JJ($,Z,X){try{return $()}catch(J){if(X&&J instanceof Error)X(J);return Z}}async function h1($,Z,X){try{return await $()}catch(J){if(X&&J instanceof Error)X(J);return Z}}var O3={isEnabled(){return X$().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=X$();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let X=$,J=[],Y=(X.match(/\{\{/g)||[]).length,Q=(X.match(/\}\}/g)||[]).length;if(Y>Q){let q=Y-Q;X+="}}".repeat(q),J.push(`Added ${q} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let q of G){let W=(X.match(new RegExp(`@${q}\\b`,"g"))||[]).length,U=(X.match(new RegExp(`@end${q}\\b`,"g"))||[]).length;if(W>U){let z=W-U;for(let K=0;K<z;K++)X+=`
2114
+ @end${q}`;J.push(`Added ${z} missing @end${q}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((q)=>console.warn(` - ${q}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:X,fixes:J}},createFallbackContent($,Z){if(O5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};class F3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,X="error"){let J={timestamp:new Date,error:$,context:Z,level:X};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(X))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
2115
2115
  `).slice(1).join(`
2116
2116
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
2117
2117
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),J=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});await this.rotateIfNeeded(Z);let Y=`${this.formatEntry($)}
2118
2118
  `;Z.appendFileSync(this.logFilePath,Y,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let X=this.maxLogFiles-1;X>=1;X--){let J=`${this.logFilePath}.${X}`,Y=`${this.logFilePath}.${X+1}`;if($.existsSync(J))if(X>=this.maxLogFiles-1)$.unlinkSync(J);else $.renameSync(J,Y)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let X of this.errors){let J=X.error.constructor.name;$[J]=($[J]||0)+1;let Y=X.level||"error";Z[Y]=(Z[Y]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let X=await import("fs"),Y=(await import("path")).dirname($);if(!X.existsSync(Y))X.mkdirSync(Y,{recursive:!0});if(Z==="json"){let Q=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));X.writeFileSync($,JSON.stringify(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));X.writeFileSync($,Q.join(`
2119
2119
 
2120
- `),"utf-8")}}async flush(){await this.writeQueue}}var i0=new F3,L3={isDevelopment(){return F5()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let X=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)X.push(`Context: ${JSON.stringify(Z,null,2)}`);return X.push("========================"),X.join(`
2121
- `)}};import w3 from"path";var R3={isValidFilePath($,Z){let X=$.replace(/\\/g,"/");if(X.includes("\x00"))return!1;if(X.includes("../")||X.includes("..\\")||X===".."||X.startsWith("../")||X.endsWith("/..")||X.includes("/..\\")||X.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(X))return!1;if(X.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((Q)=>X===Q.slice(0,-1)||X.startsWith(Q)))return!1}if(/^[a-z]:/i.test(X)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((Q)=>X.includes(Q)))return!1}if(Z){let Y=w3.resolve(Z,$),Q=w3.resolve(Z);if(!Y.startsWith(Q+w3.sep)&&Y!==Q)return!1}return!0},isValidVariableName($){return/^[a-z_$]\w*$/i.test($)},isValidDirectiveName($){return/^[a-z][\w-]*$/i.test($)},isSafeContent($){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((X)=>X.test($))}};function tX($){let Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return $.replace(/[&<>"']/g,(X)=>Z[X]||X)}function Q$($,Z={}){let{allowHtml:X=!1,maxLength:J=1e4,allowSpecialChars:Y=!0,customSanitizer:Q}=Z,G=[],q=$,W=!1;if(Q){let U=Q(q);if(U!==q)q=U,W=!0}if(q.includes("\x00"))q=q.replace(/\0/g,""),W=!0,G.push("Null bytes removed from parameter");if(q.length>J)q=q.substring(0,J),W=!0,G.push(`Parameter truncated to ${J} characters`);if(!X&&/<[^>]+>/.test(q))q=tX(q),W=!0,G.push("HTML content was escaped");let K=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:U,replacement:z,name:H}of K)if(U.test(q))q=q.replace(U,z),W=!0,G.push(`Removed ${H} from parameter`);if(!Y){let U=q;if(q=q.split("").filter((z)=>{let H=z.charCodeAt(0);return H>=32&&H!==127}).join(""),q!==U)W=!0,G.push("Control characters removed")}return{value:q,modified:W,warnings:G}}function eX($,Z){let X=$.replace(/\0/g,"");X=X.replace(/\\/g,"/"),X=X.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(X.includes("../")||X.includes("./"))X=X.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!R3.isValidFilePath(X,Z))return null;return X}function $J($){let Z=[],X=$.trim(),J=X!==$,Y=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:Q,name:G}of Y)if(Q.test(X))Z.push(`Potentially dangerous pattern detected: ${G}`);if(X.includes("\x00"))X=X.replace(/\0/g,""),J=!0,Z.push("Null bytes removed from expression");return{value:X,modified:J,warnings:Z}}function ZJ($,Z={}){return $.map((X)=>Q$(X,Z))}function I6($){let Z={};for(let[X,J]of Object.entries($)){if(!R3.isValidVariableName(X))continue;if(typeof J==="string"){let Y=Q$(J);Z[X]=Y.value}else if(Array.isArray(J))Z[X]=J.map((Y)=>typeof Y==="string"?Q$(Y).value:Y);else if(typeof J==="object"&&J!==null)Z[X]=I6(J);else Z[X]=J}return Z}function E6($,Z,X,J){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(q,W,K)=>{if(!K&&W.includes(":")){let U=W.split(":"),z=W,H=U.length>1?U[1]:"";if(H&&Z[H])K=Z[H];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])K=Z.openGraph[U[1]];else K="";return K?`<meta property="${c(z)}" content="${c(K)}">`:""}return K?`<meta name="${c(W)}" content="${c(K)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(Y))!==null){let q=G.index,W=q+G[0].length-1,K=1,U=W+1;while(U<Y.length&&K>0){if(Y[U]==="(")K++;else if(Y[U]===")"){if(K--,K===0)break}U++}if(K!==0)break;let z=Y.substring(W+1,U).trim(),H=U+1,B=(()=>{try{let j=R0(z,Z);if(!j)return"";let _="<meta";if(j.name)_+=` name="${c(String(j.name))}"`;if(j.property)_+=` property="${c(String(j.property))}"`;if(j.httpEquiv)_+=` http-equiv="${c(String(j.httpEquiv))}"`;if(j.content)_+=` content="${c(String(j.content))}"`;return _+=">",_}catch(j){let _=j instanceof Error?j.message:String(j);return $0("MetaTag",_,l.EVALUATION_ERROR)}})();Y=Y.substring(0,q)+B+Y.substring(H),Q.lastIndex=0}return Y}function b6($,Z,X){let J=$,Y=/@structuredData\s*\(/g,Q;while((Q=Y.exec(J))!==null){let G=Q.index,q=G+Q[0].length-1,W=1,K=q+1;while(K<J.length&&W>0){if(J[K]==="(")W++;else if(J[K]===")"){if(W--,W===0)break}K++}if(W!==0)break;let U=J.substring(q+1,K).trim(),z=K+1,H=(()=>{try{let B=R0(U,Z);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return $0("StructuredData",j,l.EVALUATION_ERROR)}})();J=J.substring(0,G)+H+J.substring(z),Y.lastIndex=0}return J}function y6($,Z,X,J){let Y=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(Y))!==null){let q=Y.indexOf("{",G.index+4),W=1,K=q+1,U=null,z=!1;while(K<Y.length&&W>0){let V=Y[K];if(z){z=!1,K++;continue}if(V==="\\"&&U){z=!0,K++;continue}if(U){if(V===U)U=null;K++;continue}if(V==='"'||V==="'"||V==="`"){U=V,K++;continue}if(V==="{")W++;else if(V==="}")W--;K++}if(W!==0)break;let H=Y.substring(K).match(/^\s*\)/);if(!H)break;let B=K+H[0].length,j=Y.substring(q,K),_=Y.substring(G.index,B),L=((V)=>{try{let O=R0(V,Z);if(!O)return"";let F="";if(O.title)F+=`<title>${c(O.title)}</title>
2122
- `,F+=`<meta name="title" content="${c(O.title)}">
2123
- `;if(O.description)F+=`<meta name="description" content="${c(O.description)}">
2124
- `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;F+=`<meta name="keywords" content="${c(w)}">
2125
- `}if(O.robots)F+=`<meta name="robots" content="${c(O.robots)}">
2126
- `;if(O.canonical)F+=`<link rel="canonical" href="${c(O.canonical)}">
2127
- `;if(O.openGraph){let w=O.openGraph;if(F+=`<meta property="og:type" content="${c(w.type||"website")}">
2128
- `,w.title||O.title){let R=w.title||O.title||"";F+=`<meta property="og:title" content="${c(R)}">
2129
- `}if(w.description||O.description){let R=w.description||O.description||"";F+=`<meta property="og:description" content="${c(R)}">
2130
- `}if(w.url||O.canonical){let R=w.url||O.canonical||"";F+=`<meta property="og:url" content="${c(R)}">
2131
- `}if(w.image){if(F+=`<meta property="og:image" content="${c(w.image)}">
2132
- `,w.imageAlt)F+=`<meta property="og:image:alt" content="${c(w.imageAlt)}">
2133
- `;if(w.imageWidth)F+=`<meta property="og:image:width" content="${c(String(w.imageWidth))}">
2134
- `;if(w.imageHeight)F+=`<meta property="og:image:height" content="${c(String(w.imageHeight))}">
2135
- `}if(w.siteName)F+=`<meta property="og:site_name" content="${c(w.siteName)}">
2136
- `}if(O.twitter){let w=O.twitter;if(F+=`<meta name="twitter:card" content="${c(w.card||"summary_large_image")}">
2137
- `,w.title||O.title){let R=w.title||O.title||"";F+=`<meta name="twitter:title" content="${c(R)}">
2138
- `}if(w.description||O.description){let R=w.description||O.description||"";F+=`<meta name="twitter:description" content="${c(R)}">
2139
- `}if(w.image||O.openGraph&&O.openGraph.image){let R=w.image||(O.openGraph?O.openGraph.image:"")||"";F+=`<meta name="twitter:image" content="${c(R)}">
2140
- `}if(w.site)F+=`<meta name="twitter:site" content="${c(w.site)}">
2141
- `;if(w.creator)F+=`<meta name="twitter:creator" content="${c(w.creator)}">
2142
- `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${w}</script>
2143
- `}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return $0("SEO",`Error processing @seo directive: ${F}`,l.EVALUATION_ERROR)}})(j);Y=Y.substring(0,G.index)+L+Y.substring(B),Q.lastIndex=G.index+L.length}return Y}function S6($,Z,X){if(X.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||X.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.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(X.seo?.defaultConfig?.title)G=X.seo.defaultConfig.title;else G=X.defaultTitle||"stx Project";let q="";if(Z.description)q=Z.description;else if(Z.meta&&Z.meta.description)q=Z.meta.description;else if(X.seo?.defaultConfig?.description)q=X.seo.defaultConfig.description;else q=X.defaultDescription||"A website built with stx templating engine";let W="";if(Z.image)W=Z.image;else if(Z.meta&&Z.meta.image)W=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)W=Z.openGraph.image;else if(X.seo?.defaultImage)W=X.seo.defaultImage;else if(X.defaultImage)W=X.defaultImage;let K=`
2120
+ `),"utf-8")}}async flush(){await this.writeQueue}}var i0=new F3,L3={isDevelopment(){return O5()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let X=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)X.push(`Context: ${JSON.stringify(Z,null,2)}`);return X.push("========================"),X.join(`
2121
+ `)}};import w3 from"path";var R3={isValidFilePath($,Z){let X=$.replace(/\\/g,"/");if(X.includes("\x00"))return!1;if(X.includes("../")||X.includes("..\\")||X===".."||X.startsWith("../")||X.endsWith("/..")||X.includes("/..\\")||X.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(X))return!1;if(X.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((Q)=>X===Q.slice(0,-1)||X.startsWith(Q)))return!1}if(/^[a-z]:/i.test(X)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((Q)=>X.includes(Q)))return!1}if(Z){let Y=w3.resolve(Z,$),Q=w3.resolve(Z);if(!Y.startsWith(Q+w3.sep)&&Y!==Q)return!1}return!0},isValidVariableName($){return/^[a-z_$]\w*$/i.test($)},isValidDirectiveName($){return/^[a-z][\w-]*$/i.test($)},isSafeContent($){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((X)=>X.test($))}};function YJ($){let Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return $.replace(/[&<>"']/g,(X)=>Z[X]||X)}function Q$($,Z={}){let{allowHtml:X=!1,maxLength:J=1e4,allowSpecialChars:Y=!0,customSanitizer:Q}=Z,G=[],q=$,W=!1;if(Q){let z=Q(q);if(z!==q)q=z,W=!0}if(q.includes("\x00"))q=q.replace(/\0/g,""),W=!0,G.push("Null bytes removed from parameter");if(q.length>J)q=q.substring(0,J),W=!0,G.push(`Parameter truncated to ${J} characters`);if(!X&&/<[^>]+>/.test(q))q=YJ(q),W=!0,G.push("HTML content was escaped");let U=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:z,replacement:K,name:H}of U)if(z.test(q))q=q.replace(z,K),W=!0,G.push(`Removed ${H} from parameter`);if(!Y){let z=q;if(q=q.split("").filter((K)=>{let H=K.charCodeAt(0);return H>=32&&H!==127}).join(""),q!==z)W=!0,G.push("Control characters removed")}return{value:q,modified:W,warnings:G}}function QJ($,Z){let X=$.replace(/\0/g,"");X=X.replace(/\\/g,"/"),X=X.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(X.includes("../")||X.includes("./"))X=X.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!R3.isValidFilePath(X,Z))return null;return X}function GJ($){let Z=[],X=$.trim(),J=X!==$,Y=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:Q,name:G}of Y)if(Q.test(X))Z.push(`Potentially dangerous pattern detected: ${G}`);if(X.includes("\x00"))X=X.replace(/\0/g,""),J=!0,Z.push("Null bytes removed from expression");return{value:X,modified:J,warnings:Z}}function qJ($,Z={}){return $.map((X)=>Q$(X,Z))}function E6($){let Z={};for(let[X,J]of Object.entries($)){if(!R3.isValidVariableName(X))continue;if(typeof J==="string"){let Y=Q$(J);Z[X]=Y.value}else if(Array.isArray(J))Z[X]=J.map((Y)=>typeof Y==="string"?Q$(Y).value:Y);else if(typeof J==="object"&&J!==null)Z[X]=E6(J);else Z[X]=J}return Z}function y6($,Z,X,J){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(q,W,U)=>{if(!U&&W.includes(":")){let z=W.split(":"),K=W,H=z.length>1?z[1]:"";if(H&&Z[H])U=Z[H];else if(K.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])U=Z.openGraph[z[1]];else U="";return U?`<meta property="${c(K)}" content="${c(U)}">`:""}return U?`<meta name="${c(W)}" content="${c(U)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(Y))!==null){let q=G.index,W=q+G[0].length-1,U=1,z=W+1;while(z<Y.length&&U>0){if(Y[z]==="(")U++;else if(Y[z]===")"){if(U--,U===0)break}z++}if(U!==0)break;let K=Y.substring(W+1,z).trim(),H=z+1,B=(()=>{try{let j=R0(K,Z);if(!j)return"";let _="<meta";if(j.name)_+=` name="${c(String(j.name))}"`;if(j.property)_+=` property="${c(String(j.property))}"`;if(j.httpEquiv)_+=` http-equiv="${c(String(j.httpEquiv))}"`;if(j.content)_+=` content="${c(String(j.content))}"`;return _+=">",_}catch(j){let _=j instanceof Error?j.message:String(j);return $0("MetaTag",_,l.EVALUATION_ERROR)}})();Y=Y.substring(0,q)+B+Y.substring(H),Q.lastIndex=0}return Y}function S6($,Z,X){let J=$,Y=/@structuredData\s*\(/g,Q;while((Q=Y.exec(J))!==null){let G=Q.index,q=G+Q[0].length-1,W=1,U=q+1;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=J.substring(q+1,U).trim(),K=U+1,H=(()=>{try{let B=R0(z,Z);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return $0("StructuredData",j,l.EVALUATION_ERROR)}})();J=J.substring(0,G)+H+J.substring(K),Y.lastIndex=0}return J}function C6($,Z,X,J){let Y=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(Y))!==null){let q=Y.indexOf("{",G.index+4),W=1,U=q+1,z=null,K=!1;while(U<Y.length&&W>0){let V=Y[U];if(K){K=!1,U++;continue}if(V==="\\"&&z){K=!0,U++;continue}if(z){if(V===z)z=null;U++;continue}if(V==='"'||V==="'"||V==="`"){z=V,U++;continue}if(V==="{")W++;else if(V==="}")W--;U++}if(W!==0)break;let H=Y.substring(U).match(/^\s*\)/);if(!H)break;let B=U+H[0].length,j=Y.substring(q,U),_=Y.substring(G.index,B),F=((V)=>{try{let O=R0(V,Z);if(!O)return"";let L="";if(O.title)L+=`<title>${c(O.title)}</title>
2122
+ `,L+=`<meta name="title" content="${c(O.title)}">
2123
+ `;if(O.description)L+=`<meta name="description" content="${c(O.description)}">
2124
+ `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;L+=`<meta name="keywords" content="${c(w)}">
2125
+ `}if(O.robots)L+=`<meta name="robots" content="${c(O.robots)}">
2126
+ `;if(O.canonical)L+=`<link rel="canonical" href="${c(O.canonical)}">
2127
+ `;if(O.openGraph){let w=O.openGraph;if(L+=`<meta property="og:type" content="${c(w.type||"website")}">
2128
+ `,w.title||O.title){let R=w.title||O.title||"";L+=`<meta property="og:title" content="${c(R)}">
2129
+ `}if(w.description||O.description){let R=w.description||O.description||"";L+=`<meta property="og:description" content="${c(R)}">
2130
+ `}if(w.url||O.canonical){let R=w.url||O.canonical||"";L+=`<meta property="og:url" content="${c(R)}">
2131
+ `}if(w.image){if(L+=`<meta property="og:image" content="${c(w.image)}">
2132
+ `,w.imageAlt)L+=`<meta property="og:image:alt" content="${c(w.imageAlt)}">
2133
+ `;if(w.imageWidth)L+=`<meta property="og:image:width" content="${c(String(w.imageWidth))}">
2134
+ `;if(w.imageHeight)L+=`<meta property="og:image:height" content="${c(String(w.imageHeight))}">
2135
+ `}if(w.siteName)L+=`<meta property="og:site_name" content="${c(w.siteName)}">
2136
+ `}if(O.twitter){let w=O.twitter;if(L+=`<meta name="twitter:card" content="${c(w.card||"summary_large_image")}">
2137
+ `,w.title||O.title){let R=w.title||O.title||"";L+=`<meta name="twitter:title" content="${c(R)}">
2138
+ `}if(w.description||O.description){let R=w.description||O.description||"";L+=`<meta name="twitter:description" content="${c(R)}">
2139
+ `}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)}">
2140
+ `}if(w.site)L+=`<meta name="twitter:site" content="${c(w.site)}">
2141
+ `;if(w.creator)L+=`<meta name="twitter:creator" content="${c(w.creator)}">
2142
+ `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");L+=`<script type="application/ld+json">${w}</script>
2143
+ `}return L.trim()}catch(O){let L=O instanceof Error?O.message:String(O);return $0("SEO",`Error processing @seo directive: ${L}`,l.EVALUATION_ERROR)}})(j);Y=Y.substring(0,G.index)+F+Y.substring(B),Q.lastIndex=G.index+F.length}return Y}function P6($,Z,X){if(X.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Z.__stx_seo_staged===!0||X.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.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(X.seo?.defaultConfig?.title)G=X.seo.defaultConfig.title;else G=X.defaultTitle||"stx Project";let q="";if(Z.description)q=Z.description;else if(Z.meta&&Z.meta.description)q=Z.meta.description;else if(X.seo?.defaultConfig?.description)q=X.seo.defaultConfig.description;else q=X.defaultDescription||"A website built with stx templating engine";let W="";if(Z.image)W=Z.image;else if(Z.meta&&Z.meta.image)W=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)W=Z.openGraph.image;else if(X.seo?.defaultImage)W=X.seo.defaultImage;else if(X.defaultImage)W=X.defaultImage;let U=`
2144
2144
  <!-- stx SEO Tags -->
2145
2145
  <meta name="title" content="${c(G)}">
2146
2146
  <meta name="description" content="${c(q)}">
@@ -2150,21 +2150,23 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
2150
2150
  <meta name="twitter:card" content="summary_large_image">
2151
2151
  <meta name="twitter:title" content="${c(G)}">
2152
2152
  <meta name="twitter:description" content="${c(q)}">
2153
- `;if(W)K+=`
2153
+ `;if(W)U+=`
2154
2154
  <meta property="og:image" content="${c(W)}">
2155
2155
  <meta name="twitter:image" content="${c(W)}">
2156
- `;let U=$;if(!Q)U=U.replace(/<head[^>]*>/,`$&
2157
- <title>${c(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
2158
- ${K}
2159
- `)}function c($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var XJ=["og:","article:","book:","profile:","fb:","music:","video:"];function T6($){let Z=$.trim(),X=Z[0];if((X==="'"||X==='"'||X==="`")&&Z.length>1&&Z.at(-1)===X)return{value:Z.slice(1,-1),quoted:!0};return{value:Z,quoted:!1}}var D3={name:"meta",handler:($,Z,X,J)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",l.INVALID_DIRECTIVE_SYNTAX);let Y=T6(Z[0]).value,Q;if(Z.length>1){let W=T6(Z[1]);Q=W.quoted?W.value:String(X?.[W.value]??W.value)}else{let W=Y.includes(":")?Y.slice(Y.indexOf(":")+1):Y,K=X?.openGraph;Q=String(X?.[W]??K?.[W]??"")}if(!Q)return"";let q=XJ.some((W)=>Y.startsWith(W))?{property:Y,content:Q}:{name:Y,content:Q};if(X)X.__stx_runtime_head=G$(X.__stx_runtime_head??{},{meta:[q]});return""},hasEndTag:!1},N3={name:"structuredData",handler:($,Z,X,J)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",l.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return $0("StructuredData","structuredData requires @type property",l.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 $0("StructuredData",Q,l.EVALUATION_ERROR)}},hasEndTag:!0};function RU(){return[D3,N3]}function DU($,Z){let X=Z.replace(/\/$/,""),J=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
2156
+ `;let z=$;if(!Q)z=z.replace(/<head[^>]*>/,`$&
2157
+ <title>${c(G)}</title>`);let K=Z.__stx_head_injections;if(K)return Z.__stx_seo_staged=!0,K.afterOpen.push(`
2158
+ ${U}
2159
+ `),z;return z.replace(/<head[^>]*>/,`$&
2160
+ ${U}
2161
+ `)}function c($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var WJ=["og:","article:","book:","profile:","fb:","music:","video:"];function b6($){let Z=$.trim(),X=Z[0];if((X==="'"||X==='"'||X==="`")&&Z.length>1&&Z.at(-1)===X)return{value:Z.slice(1,-1),quoted:!0};return{value:Z,quoted:!1}}var D3={name:"meta",handler:($,Z,X,J)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",l.INVALID_DIRECTIVE_SYNTAX);let Y=b6(Z[0]).value,Q;if(Z.length>1){let W=b6(Z[1]);Q=W.quoted?W.value:String(X?.[W.value]??W.value)}else{let W=Y.includes(":")?Y.slice(Y.indexOf(":")+1):Y,U=X?.openGraph;Q=String(X?.[W]??U?.[W]??"")}if(!Q)return"";let q=WJ.some((W)=>Y.startsWith(W))?{property:Y,content:Q}:{name:Y,content:Q};if(X)X.__stx_runtime_head=G$(X.__stx_runtime_head??{},{meta:[q]});return""},hasEndTag:!1},N3={name:"structuredData",handler:($,Z,X,J)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",l.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return $0("StructuredData","structuredData requires @type property",l.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 $0("StructuredData",Q,l.EVALUATION_ERROR)}},hasEndTag:!0};function Ez(){return[D3,N3]}function bz($,Z){let X=Z.replace(/\/$/,""),J=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
2160
2162
  <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
2161
2163
  ${$.map((Q)=>{let G=Q.startsWith("http")?Q:`${X}${Q.startsWith("/")?"":"/"}${Q}`;return` <sitemap>
2162
- <loc>${YJ(G)}</loc>
2164
+ <loc>${zJ(G)}</loc>
2163
2165
  <lastmod>${J}</lastmod>
2164
2166
  </sitemap>`}).join(`
2165
2167
  `)}
2166
- </sitemapindex>`}async function NU($,Z){let{extensions:X=[".stx",".html",".htm"],ignore:J=["_*",".*","node_modules","components","partials","layouts"]}=Z,Y=[],Q=X.length===1?`*${X[0]}`:`*{${X.join(",")}}`,G=new Bun.Glob(`**/${Q}`);for await(let q of G.scan($)){if(J.some((H)=>{if(H.startsWith("*"))return q.includes(H.slice(1));return q.startsWith(H)||q.includes(`/${H}`)}))continue;let K=q.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 U=`${$}/${q}`,z;try{let H=await Bun.file(U).stat();if(H)z=new Date(H.mtime).toISOString().split("T")[0]}catch{}Y.push({loc:K||"/",lastmod:z,priority:K==="/"?1:0.5})}return Y.sort((q,W)=>q.loc.localeCompare(W.loc)),Y}function JJ($){let Z=[];for(let X of $.rules){if(Z.push(`User-agent: ${X.userAgent}`),X.allow)for(let J of X.allow)Z.push(`Allow: ${J}`);if(X.disallow)for(let J of X.disallow)Z.push(`Disallow: ${J}`);if(X.crawlDelay!==void 0)Z.push(`Crawl-delay: ${X.crawlDelay}`);Z.push("")}if($.sitemap){let X=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let J of X)Z.push(`Sitemap: ${J}`)}if($.host)Z.push(`Host: ${$.host}`);return Z.join(`
2167
- `).trim()}function MU($){return JJ({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function YJ($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}import QJ from"fs";import h0 from"path";async function bU($,Z){if(!$.webComponents?.enabled)return[];let X=$.webComponents.components||[],J=[];if(X.length>0){if($.debug)console.log(`Building ${X.length} web components...`);for(let Y of X)try{let Q=await GJ(Y,$,Z);if(Q)J.push(Q)}catch(Q){if(console.error(`Error building web component ${Y.name}:`,Q),$.debug)throw Q}}return J}async function GJ($,Z,X){let{name:J,file:Y,tag:Q,extends:G}=$;if(!J||!Y||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let q=null;if(h0.isAbsolute(Y)&&await t(Y))q=Y;else if(Z.componentsDir){let _=h0.join(Z.componentsDir,Y);if(await t(_))q=_}if(!q)q=await q$(Y,process.cwd(),Z,X);if(!q)return console.error(`Web component source file not found: ${Y}`),null;let W=await Bun.file(q).text();X.add(q);let U=($.outputFormat||"js")==="ts",z=U?WJ({name:J,tag:Q,baseElement:G,source:W,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):qJ({name:J,tag:Q,baseElement:G,source:W,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),H=Z.webComponents?.outputDir||"dist/web-components";await QJ.promises.mkdir(H,{recursive:!0});let B=U?"ts":"js",j=h0.join(H,`${Q}.${B}`);if(await Bun.write(j,z),Z.debug)console.log(`Built web component ${J} -> ${j}`);return j}function qJ($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:q,attributes:W=[]}=$,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 U="";if(q)U=`<link rel="stylesheet" href="${q}">`;return`/**
2168
+ </sitemapindex>`}async function yz($,Z){let{extensions:X=[".stx",".html",".htm"],ignore:J=["_*",".*","node_modules","components","partials","layouts"]}=Z,Y=[],Q=X.length===1?`*${X[0]}`:`*{${X.join(",")}}`,G=new Bun.Glob(`**/${Q}`);for await(let q of G.scan($)){if(J.some((H)=>{if(H.startsWith("*"))return q.includes(H.slice(1));return q.startsWith(H)||q.includes(`/${H}`)}))continue;let U=q.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!U.startsWith("/"))U=`/${U}`;if(U!=="/"&&U.endsWith("/"))U=U.slice(0,-1);let z=`${$}/${q}`,K;try{let H=await Bun.file(z).stat();if(H)K=new Date(H.mtime).toISOString().split("T")[0]}catch{}Y.push({loc:U||"/",lastmod:K,priority:U==="/"?1:0.5})}return Y.sort((q,W)=>q.loc.localeCompare(W.loc)),Y}function UJ($){let Z=[];for(let X of $.rules){if(Z.push(`User-agent: ${X.userAgent}`),X.allow)for(let J of X.allow)Z.push(`Allow: ${J}`);if(X.disallow)for(let J of X.disallow)Z.push(`Disallow: ${J}`);if(X.crawlDelay!==void 0)Z.push(`Crawl-delay: ${X.crawlDelay}`);Z.push("")}if($.sitemap){let X=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let J of X)Z.push(`Sitemap: ${J}`)}if($.host)Z.push(`Host: ${$.host}`);return Z.join(`
2169
+ `).trim()}function Sz($){return UJ({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function zJ($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}import KJ from"fs";import h0 from"path";async function gz($,Z){if(!$.webComponents?.enabled)return[];let X=$.webComponents.components||[],J=[];if(X.length>0){if($.debug)console.log(`Building ${X.length} web components...`);for(let Y of X)try{let Q=await HJ(Y,$,Z);if(Q)J.push(Q)}catch(Q){if(console.error(`Error building web component ${Y.name}:`,Q),$.debug)throw Q}}return J}async function HJ($,Z,X){let{name:J,file:Y,tag:Q,extends:G}=$;if(!J||!Y||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let q=null;if(h0.isAbsolute(Y)&&await t(Y))q=Y;else if(Z.componentsDir){let _=h0.join(Z.componentsDir,Y);if(await t(_))q=_}if(!q)q=await q$(Y,process.cwd(),Z,X);if(!q)return console.error(`Web component source file not found: ${Y}`),null;let W=await Bun.file(q).text();X.add(q);let z=($.outputFormat||"js")==="ts",K=z?jJ({name:J,tag:Q,baseElement:G,source:W,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):BJ({name:J,tag:Q,baseElement:G,source:W,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),H=Z.webComponents?.outputDir||"dist/web-components";await KJ.promises.mkdir(H,{recursive:!0});let B=z?"ts":"js",j=h0.join(H,`${Q}.${B}`);if(await Bun.write(j,K),Z.debug)console.log(`Built web component ${J} -> ${j}`);return j}function BJ($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:q,attributes:W=[]}=$,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>");let z="";if(q)z=`<link rel="stylesheet" href="${q}">`;return`/**
2168
2170
  * ${Z} Web Component
2169
2171
  * Auto-generated from stx component
2170
2172
  */
@@ -2179,13 +2181,13 @@ class ${Z.replace(/\W/g,"")} extends ${J} {
2179
2181
  ${G?`
2180
2182
  _createTemplate() {
2181
2183
  const template = document.createElement('template')
2182
- template.innerHTML = \`${U}${K}\`
2184
+ template.innerHTML = \`${z}${U}\`
2183
2185
  ${Q?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
2184
2186
  this._processSlots()
2185
2187
  }
2186
2188
  `:`
2187
2189
  _render() {
2188
- ${Q?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${U}${K}\`
2190
+ ${Q?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${z}${U}\`
2189
2191
  this._processSlots()
2190
2192
  }
2191
2193
  `}
@@ -2231,7 +2233,7 @@ class ${Z.replace(/\W/g,"")} extends ${J} {
2231
2233
 
2232
2234
  ${W.length>0?`
2233
2235
  static get observedAttributes() {
2234
- return [${W.map((z)=>`'${z}'`).join(", ")}]
2236
+ return [${W.map((K)=>`'${K}'`).join(", ")}]
2235
2237
  }
2236
2238
 
2237
2239
  attributeChangedCallback(name, oldValue, newValue) {
@@ -2256,8 +2258,8 @@ class ${Z.replace(/\W/g,"")} extends ${J} {
2256
2258
 
2257
2259
  // Register the web component
2258
2260
  customElements.define('${X}', ${Z.replace(/\W/g,"")})
2259
- `}function WJ($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:q,attributes:W=[],attributeTypes:K={}}=$,U=Z.replace(/\W/g,""),z=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)z=z.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),z=z.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),z=z.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),z=z.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");z=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let H=q?`<link rel="stylesheet" href="${q}">`:"",B=(R)=>{switch(K[R]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},j=(R)=>R.replace(/-([a-z])/g,(D,M)=>M.toUpperCase()),_=W.map((R)=>` private _${j(R)}: ${B(R)} | null = null;`).join(`
2260
- `),L=W.map((R)=>{let D=B(R),M=j(R);return`
2261
+ `}function jJ($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:q,attributes:W=[],attributeTypes:U={}}=$,z=Z.replace(/\W/g,""),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>");K=K.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let H=q?`<link rel="stylesheet" href="${q}">`:"",B=(R)=>{switch(U[R]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},j=(R)=>R.replace(/-([a-z])/g,(D,M)=>M.toUpperCase()),_=W.map((R)=>` private _${j(R)}: ${B(R)} | null = null;`).join(`
2262
+ `),F=W.map((R)=>{let D=B(R),M=j(R);return`
2261
2263
  get ${M}(): ${D} | null {
2262
2264
  return this._${M};
2263
2265
  }
@@ -2274,7 +2276,7 @@ else {
2274
2276
  `),V=W.length>0?`/**
2275
2277
  * Props interface for ${Z}
2276
2278
  */
2277
- export interface ${U}Props {
2279
+ export interface ${z}Props {
2278
2280
  ${W.map((R)=>{let D=B(R);return` ${j(R)}?: ${D};`}).join(`
2279
2281
  `)}
2280
2282
  }
@@ -2293,7 +2295,7 @@ ${W.map((R)=>{let D=B(R);return` ${j(R)}?: ${D};`}).join(`
2293
2295
 
2294
2296
  private _parseAttributeValue(name: string, value: string | null): unknown {
2295
2297
  if (value === null) return null;
2296
- const typeMap: Record<string, string> = ${JSON.stringify(K)};
2298
+ const typeMap: Record<string, string> = ${JSON.stringify(U)};
2297
2299
  const type = typeMap[name] || 'string';
2298
2300
  switch (type) {
2299
2301
  case 'number': return Number(value);
@@ -2303,15 +2305,15 @@ catch { return value; }
2303
2305
  default: return value;
2304
2306
  }
2305
2307
  }
2306
- `:"",F=G?`
2308
+ `:"",L=G?`
2307
2309
  private _createTemplate(): void {
2308
2310
  const template = document.createElement('template');
2309
- template.innerHTML = \`${H}${z}\`;
2311
+ template.innerHTML = \`${H}${K}\`;
2310
2312
  ${Q?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
2311
2313
  this._processSlots();
2312
2314
  }`:`
2313
2315
  private _render(): void {
2314
- ${Q?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${H}${z}\`;
2316
+ ${Q?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${H}${K}\`;
2315
2317
  this._processSlots();
2316
2318
  }`;return`/**
2317
2319
  * ${Z} Web Component
@@ -2336,7 +2338,7 @@ ${V}
2336
2338
  * ${Z} custom element class
2337
2339
  * @customElement ${X}
2338
2340
  */
2339
- export class ${U} extends ${J} {
2341
+ export class ${z} extends ${J} {
2340
2342
  ${_}
2341
2343
  private _initialized = false;
2342
2344
  ${Q?"":"private _slotContent: Node[] = [];"}
@@ -2345,7 +2347,7 @@ ${_}
2345
2347
  super();
2346
2348
  ${Q?'this.attachShadow({ mode: "open" });':""}
2347
2349
  }
2348
- ${F}
2350
+ ${L}
2349
2351
  ${Q?`
2350
2352
  private _processSlots(): void {
2351
2353
  const slots = this.shadowRoot!.querySelectorAll('slot');
@@ -2384,7 +2386,7 @@ ${Q?`
2384
2386
  }
2385
2387
  }`}
2386
2388
  ${O}
2387
- ${L}
2389
+ ${F}
2388
2390
 
2389
2391
  connectedCallback(): void {
2390
2392
  if (this._initialized) return;
@@ -2405,16 +2407,16 @@ ${L}
2405
2407
  // Type augmentation for HTMLElementTagNameMap
2406
2408
  declare global {
2407
2409
  interface HTMLElementTagNameMap {
2408
- '${X}': ${U};
2410
+ '${X}': ${z};
2409
2411
  }
2410
2412
  }
2411
2413
 
2412
2414
  // Register the web component
2413
- customElements.define('${X}', ${U});
2414
- `}var M3={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function A3($){let Z=$.split("").reduce((X,J)=>(X<<5)-X+J.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function KJ($,Z,X={}){let J={...M3,...X},Y=A3(Z);switch(J.strategy){case"shadow":return $;case"prefix":return zJ($,J.prefix||Z,J.preserveOriginal);case"attribute":return UJ($,Y,J.attributeName||"data-v",J.preserveOriginal);case"bem":return HJ($,Z,J.preserveOriginal);default:return $}}function UJ($,Z,X,J){let Y=`[${X}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,q)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${J?`${G}${Y}`:`${G}${Y}`}${q}`})}function zJ($,Z,X){return $.replace(/\.([a-z_][\w-]*)/gi,(J,Y)=>{if(Y.startsWith(Z))return J;let Q=`${Z}__${Y}`;return X?`.${Q}`:`.${Q}`})}function HJ($,Z,X){let J=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Y,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(J))return`.${J}__${Q}`;return Y}let G=`${J}__${Q}`;return X?`.${G}`:`.${G}`})}function BJ($,Z,X={}){let J={...M3,...X};if(J.strategy==="shadow")return $;if(J.strategy==="attribute"){let Y=A3(Z),G=`${J.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(q,W,K)=>{if(/^(?:script|style|!--)$/i.test(W))return q;let U=K.trimEnd().endsWith("/"),z=U?K.slice(0,-1):K;return`<${W}${z} ${G}${U?"/":""}>`})}if(J.strategy==="prefix"||J.strategy==="bem"){let Y=J.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):J.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((W)=>{if(!W)return W;if(W.startsWith(Y))return W;return`${Y}__${W}`}).join(" ")}"`})}return $}function yU($,Z={}){let X={...M3,...Z},J=A3($);return`${X.attributeName||"data-v"}-${J}`}function SU($,Z,X={}){let J="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,q,W)=>{if(/\bscoped\b/i.test(q)||X.strategy!=="shadow")J+=`${KJ(W,Z,X)}
2415
+ customElements.define('${X}', ${z});
2416
+ `}var M3={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function A3($){let Z=$.split("").reduce((X,J)=>(X<<5)-X+J.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function _J($,Z,X={}){let J={...M3,...X},Y=A3(Z);switch(J.strategy){case"shadow":return $;case"prefix":return OJ($,J.prefix||Z,J.preserveOriginal);case"attribute":return VJ($,Y,J.attributeName||"data-v",J.preserveOriginal);case"bem":return FJ($,Z,J.preserveOriginal);default:return $}}function VJ($,Z,X,J){let Y=`[${X}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,q)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${J?`${G}${Y}`:`${G}${Y}`}${q}`})}function OJ($,Z,X){return $.replace(/\.([a-z_][\w-]*)/gi,(J,Y)=>{if(Y.startsWith(Z))return J;let Q=`${Z}__${Y}`;return X?`.${Q}`:`.${Q}`})}function FJ($,Z,X){let J=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Y,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(J))return`.${J}__${Q}`;return Y}let G=`${J}__${Q}`;return X?`.${G}`:`.${G}`})}function LJ($,Z,X={}){let J={...M3,...X};if(J.strategy==="shadow")return $;if(J.strategy==="attribute"){let Y=A3(Z),G=`${J.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(q,W,U)=>{if(/^(?:script|style|!--)$/i.test(W))return q;let z=U.trimEnd().endsWith("/"),K=z?U.slice(0,-1):U;return`<${W}${K} ${G}${z?"/":""}>`})}if(J.strategy==="prefix"||J.strategy==="bem"){let Y=J.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):J.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((W)=>{if(!W)return W;if(W.startsWith(Y))return W;return`${Y}__${W}`}).join(" ")}"`})}return $}function hz($,Z={}){let X={...M3,...Z},J=A3($);return`${X.attributeName||"data-v"}-${J}`}function uz($,Z,X={}){let J="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,q,W)=>{if(/\bscoped\b/i.test(q)||X.strategy!=="shadow")J+=`${_J(W,Z,X)}
2415
2417
  `;else J+=`${W}
2416
- `;return""});return{html:BJ(Y,Z,X),css:J.trim()}}function u1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function CU($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:q={},lifecycle:W={},events:K={},methods:U={},state:z={}}=$,H=Z.replace(/\W/g,""),B=Object.keys(q),j=B.filter((k)=>q[k].attribute!==!1).map((k)=>q[k].attribute||u1(k)),_=B.map((k)=>{let N=q[k],A=N.default!==void 0?JSON.stringify(N.default):N.type==="string"?'""':N.type==="number"?"0":N.type==="boolean"?"false":N.type==="array"?"[]":"{}";return` this._${k} = ${A};`}).join(`
2417
- `),L=B.map((k)=>{let N=q[k],A=N.attribute!==!1?N.attribute||u1(k):null,T=N.reflect&&A?`
2418
+ `;return""});return{html:LJ(Y,Z,X),css:J.trim()}}function u1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function dz($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:q={},lifecycle:W={},events:U={},methods:z={},state:K={}}=$,H=Z.replace(/\W/g,""),B=Object.keys(q),j=B.filter((k)=>q[k].attribute!==!1).map((k)=>q[k].attribute||u1(k)),_=B.map((k)=>{let N=q[k],A=N.default!==void 0?JSON.stringify(N.default):N.type==="string"?'""':N.type==="number"?"0":N.type==="boolean"?"false":N.type==="array"?"[]":"{}";return` this._${k} = ${A};`}).join(`
2419
+ `),F=B.map((k)=>{let N=q[k],A=N.attribute!==!1?N.attribute||u1(k):null,T=N.reflect&&A?`
2418
2420
  if (value !== null && value !== undefined) {
2419
2421
  ${N.type==="boolean"?`if (value) { this.setAttribute('${A}', ''); }
2420
2422
  else { this.removeAttribute('${A}'); }`:`this.setAttribute('${A}', ${N.type==="object"||N.type==="array"?"JSON.stringify(value)":"String(value)"});`}
@@ -2450,8 +2452,8 @@ else {
2450
2452
  this[propName] = this._deserializeAttribute(newValue, propDef.type);
2451
2453
  }
2452
2454
  ${W.attributeChanged||""}
2453
- }`:"",O=Object.entries(K).map(([k,N])=>{return`this._root.addEventListener('${k}', (e) => { ${N} });`}).join(`
2454
- `),F=Object.entries(U).map(([k,N])=>{return`
2455
+ }`:"",O=Object.entries(U).map(([k,N])=>{return`this._root.addEventListener('${k}', (e) => { ${N} });`}).join(`
2456
+ `),L=Object.entries(z).map(([k,N])=>{return`
2455
2457
  ${k}() {
2456
2458
  ${N}
2457
2459
  }`}).join(`
@@ -2467,7 +2469,7 @@ class ${H} extends ${J} {
2467
2469
  _attrToProp = ${R};
2468
2470
 
2469
2471
  // Internal state
2470
- _state = ${JSON.stringify(z)};
2472
+ _state = ${JSON.stringify(K)};
2471
2473
  _renderPending = false;
2472
2474
  _isConnected = false;
2473
2475
 
@@ -2486,7 +2488,7 @@ ${_}
2486
2488
  // =========================================================================
2487
2489
  // Reactive Properties
2488
2490
  // =========================================================================
2489
- ${L}
2491
+ ${F}
2490
2492
 
2491
2493
  // =========================================================================
2492
2494
  // State Management
@@ -2606,7 +2608,7 @@ ${V}
2606
2608
  // =========================================================================
2607
2609
  // Custom Methods
2608
2610
  // =========================================================================
2609
- ${F}
2611
+ ${L}
2610
2612
  }
2611
2613
 
2612
2614
  // Register the custom element
@@ -2615,7 +2617,7 @@ customElements.define('${X}', ${H});
2615
2617
  // Export for module usage
2616
2618
  export { ${H} };
2617
2619
  export default ${H};
2618
- `}function PU($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:q={},lifecycle:W={},events:K={},methods:U={},state:z={}}=$,H=Z.replace(/\W/g,""),B=Object.keys(q),j=B.filter((N)=>q[N].attribute!==!1).map((N)=>q[N].attribute||u1(N)),_=(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"}},L=B.length>0?`
2620
+ `}function mz($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:q={},lifecycle:W={},events:U={},methods:z={},state:K={}}=$,H=Z.replace(/\W/g,""),B=Object.keys(q),j=B.filter((N)=>q[N].attribute!==!1).map((N)=>q[N].attribute||u1(N)),_=(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=B.length>0?`
2619
2621
  /**
2620
2622
  * Props interface for ${Z}
2621
2623
  */
@@ -2623,12 +2625,12 @@ export interface ${H}Props {
2623
2625
  ${B.map((N)=>` ${N}?: ${_(q[N].type)};`).join(`
2624
2626
  `)}
2625
2627
  }
2626
- `:"",V=Object.keys(z).length>0?`
2628
+ `:"",V=Object.keys(K).length>0?`
2627
2629
  /**
2628
2630
  * State interface for ${Z}
2629
2631
  */
2630
2632
  export interface ${H}State {
2631
- ${Object.entries(z).map(([N,A])=>` ${N}: ${typeof A};`).join(`
2633
+ ${Object.entries(K).map(([N,A])=>` ${N}: ${typeof A};`).join(`
2632
2634
  `)}
2633
2635
  }
2634
2636
  `:`
@@ -2636,7 +2638,7 @@ export interface ${H}State {
2636
2638
  [key: string]: unknown;
2637
2639
  }
2638
2640
  `,O=B.map((N)=>{let A=q[N],T=_(A.type);return` private _${N}: ${T};`}).join(`
2639
- `),F=B.map((N)=>{let A=q[N],T=_(A.type),I=A.attribute!==!1?A.attribute||u1(N):null,S=A.default!==void 0?JSON.stringify(A.default):A.type==="string"?'""':A.type==="number"?"0":A.type==="boolean"?"false":A.type==="array"?"[]":"{}",E=A.reflect&&I?`
2641
+ `),L=B.map((N)=>{let A=q[N],T=_(A.type),I=A.attribute!==!1?A.attribute||u1(N):null,S=A.default!==void 0?JSON.stringify(A.default):A.type==="string"?'""':A.type==="number"?"0":A.type==="boolean"?"false":A.type==="array"?"[]":"{}",E=A.reflect&&I?`
2640
2642
  if (value !== null && value !== undefined) {
2641
2643
  ${A.type==="boolean"?`if (value) { this.setAttribute('${I}', ''); }
2642
2644
  else { this.removeAttribute('${I}'); }`:`this.setAttribute('${I}', ${A.type==="object"||A.type==="array"?"JSON.stringify(value)":"String(value)"});`}
@@ -2674,8 +2676,8 @@ else {
2674
2676
  (this as unknown as Record<string, unknown>)[propName] = this._deserializeAttribute(newValue, propDef.type);
2675
2677
  }
2676
2678
  ${W.attributeChanged||""}
2677
- }`:"",R=Object.entries(K).map(([N,A])=>{return`this._root.addEventListener('${N}', (e: Event) => { ${A} });`}).join(`
2678
- `),D=Object.entries(U).map(([N,A])=>{return`
2679
+ }`:"",R=Object.entries(U).map(([N,A])=>{return`this._root.addEventListener('${N}', (e: Event) => { ${A} });`}).join(`
2680
+ `),D=Object.entries(z).map(([N,A])=>{return`
2679
2681
  ${N}(): void {
2680
2682
  ${A}
2681
2683
  }`}).join(`
@@ -2686,7 +2688,7 @@ else {
2686
2688
  * @customElement ${X}
2687
2689
  */
2688
2690
 
2689
- ${L}
2691
+ ${F}
2690
2692
  ${V}
2691
2693
 
2692
2694
  /**
@@ -2710,7 +2712,7 @@ export class ${H} extends ${J} {
2710
2712
  private _attrToProp: Record<string, string> = ${JSON.stringify(Object.fromEntries(B.filter((N)=>q[N].attribute!==!1).map((N)=>[q[N].attribute||u1(N),N])))};
2711
2713
 
2712
2714
  // Internal state
2713
- private _state: ${H}State = ${JSON.stringify(z)};
2715
+ private _state: ${H}State = ${JSON.stringify(K)};
2714
2716
  private _renderPending = false;
2715
2717
  private _isConnected = false;
2716
2718
  private _root: ShadowRoot | HTMLElement;
@@ -2734,7 +2736,7 @@ ${B.map((N)=>{let A=q[N],T=A.default!==void 0?JSON.stringify(A.default):A.type==
2734
2736
  // =========================================================================
2735
2737
  // Reactive Properties
2736
2738
  // =========================================================================
2737
- ${F}
2739
+ ${L}
2738
2740
 
2739
2741
  // =========================================================================
2740
2742
  // State Management
@@ -2867,7 +2869,7 @@ declare global {
2867
2869
  customElements.define('${X}', ${H});
2868
2870
 
2869
2871
  export default ${H};
2870
- `}function vU(){return`/**
2872
+ `}function lz(){return`/**
2871
2873
  * ReactiveElement Mixin
2872
2874
  * Adds reactive properties and lifecycle management to web components
2873
2875
  */
@@ -2989,7 +2991,7 @@ else {
2989
2991
 
2990
2992
  export { ReactiveElement };
2991
2993
  export default ReactiveElement;
2992
- `}function fU(){return`/**
2994
+ `}function cz(){return`/**
2993
2995
  * stx Reactive Web Components Runtime
2994
2996
  * Provides base classes and utilities for reactive web components
2995
2997
  */
@@ -3206,16 +3208,16 @@ else {
3206
3208
  };
3207
3209
 
3208
3210
  })(typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this);
3209
- `}function jJ($,Z){let X=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=X?X[1].trim():"",Y=Z,Q=[],G=!0;if(J){let z=J.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let H=z[1],B=H.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)Y=B[1];let j=H.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)Q=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let _=H.match(/shadowDOM\s*:\s*(true|false)/);if(_)G=_[1]==="true"}catch{}}let q=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),W=q?q[1].trim():"",K=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=K?K[1].trim():"";return{tag:Y,props:Q,template:W,styles:U,script:J,shadowDOM:G}}function _J($){let{tag:Z,props:X,template:J,styles:Y,shadowDOM:Q}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),q=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),W=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),K=X.map((z)=>`'${z}'`).join(", "),U=X.map((z)=>`
3210
- get ${z}() {
3211
- return this.getAttribute('${z}') || '';
3211
+ `}function wJ($,Z){let X=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=X?X[1].trim():"",Y=Z,Q=[],G=!0;if(J){let K=J.match(/export\s+default\s+({[\s\S]*})/);if(K)try{let H=K[1],B=H.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)Y=B[1];let j=H.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)Q=j[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let _=H.match(/shadowDOM\s*:\s*(true|false)/);if(_)G=_[1]==="true"}catch{}}let q=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),W=q?q[1].trim():"",U=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),z=U?U[1].trim():"";return{tag:Y,props:Q,template:W,styles:z,script:J,shadowDOM:G}}function RJ($){let{tag:Z,props:X,template:J,styles:Y,shadowDOM:Q}=$,G=Z.split("-").map((K)=>K.charAt(0).toUpperCase()+K.slice(1)).join(""),q=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),W=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),U=X.map((K)=>`'${K}'`).join(", "),z=X.map((K)=>`
3212
+ get ${K}() {
3213
+ return this.getAttribute('${K}') || '';
3212
3214
  }
3213
- set ${z}(value) {
3215
+ set ${K}(value) {
3214
3216
  if (value) {
3215
- this.setAttribute('${z}', value);
3217
+ this.setAttribute('${K}', value);
3216
3218
  }
3217
3219
  else {
3218
- this.removeAttribute('${z}');
3220
+ this.removeAttribute('${K}');
3219
3221
  }
3220
3222
  }`).join(`
3221
3223
  `);return`/**
@@ -3230,7 +3232,7 @@ class ${G} extends HTMLElement {
3230
3232
  }
3231
3233
 
3232
3234
  static get observedAttributes() {
3233
- return [${K}];
3235
+ return [${U}];
3234
3236
  }
3235
3237
 
3236
3238
  attributeChangedCallback(name, oldValue, newValue) {
@@ -3238,7 +3240,7 @@ class ${G} extends HTMLElement {
3238
3240
  this._render();
3239
3241
  }
3240
3242
  }
3241
- ${U}
3243
+ ${z}
3242
3244
 
3243
3245
  _render() {
3244
3246
  const template = \`${W?`<style>${W}</style>`:""}${q}\`;
@@ -3257,14 +3259,14 @@ ${U}
3257
3259
  }
3258
3260
 
3259
3261
  customElements.define('${Z}', ${G});
3260
- `}async function C6($,Z,X,J){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",l.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(X.__stx_options||{}).componentsDir||"components",q=h0.isAbsolute(G)?[h0.join(G,`${Y}.stx`),h0.join(h0.dirname(J),`${Y}.stx`)]:[h0.join(h0.dirname(J),G,`${Y}.stx`),h0.join(process.cwd(),G,`${Y}.stx`),h0.join(h0.dirname(J),`${Y}.stx`)],W=null;for(let z of q)if(await t(z)){W=await Bun.file(z).text();break}if(!W)return $0("WebComponent",`Component file not found: ${Y}.stx`,l.FILE_NOT_FOUND);let K=jJ(W,Y);return`<script type="module">
3261
- ${_J(K)}
3262
- </script>`}var m6={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:g6,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:t7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:C6,hasEndTag:!1,description:"Include a web component in the template"},f6,x6,D3,N3,a$,e$,$3,t$,s7,x7,U6,j3,...d6],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 OJ($,Z,X){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=X||process.cwd(),Q=T0.join(Y,"resources","views"),G=T0.join(Y,"resources","layouts");if(W$.existsSync(Q)&&W$.existsSync(G))return{root:"resources",pagesDir:"views"};let q=T0.join(Y,"resources","views","pages");if(W$.existsSync(q))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}var P6=new Set,K$=["partialsDir","componentsDir","layoutsDir"],k3=new WeakMap;function FJ($,Z){let X=Z.replace(/[\\/]+$/,"");if(!X||X===".")return!0;let J=$.replace(/\\/g,"/"),Y=X.replace(/\\/g,"/");return J===Y||J.startsWith(`${Y}/`)}function LJ($,Z){let X=!$.root,J=OJ($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,X&&J.root!=="."){let Y=`${Z}::${J.root}`;if(!P6.has(Y))P6.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!k3.has($)){let Y={};for(let Q of K$){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}k3.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of K$){let G=$[Q];if(typeof G!=="string"||!G)continue;if(T0.isAbsolute(G)||FJ(G,Y))continue;$[Q]=T0.join(Y,G)}}for(let Y of K$){let Q=$[Y];if(typeof Q!=="string"||!Q||T0.isAbsolute(Q))continue;$[Y]=T0.resolve(Z,Q)}return $}function wJ($,Z){let X=k3.get($);for(let J of K$){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let Q=T0.isAbsolute(Y)?Y:T0.join(Z,Y);if(W$.existsSync(Q))continue;let G=X?.[J]??Y,q=$.root,W=!!q&&q!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(W?`, resolved under root "${q}".`:"."))}}function RJ($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function DJ($){if(h6($.stateDir),$.stateDir=u6(),$.cachePath=L5($.cachePath),$.build)$.build.cacheDir=L5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=L5($.media.cache.directory);if($.story)$.story.outDir=L5($.story.outDir)}var d1=null,v6=new Map,U$=null;async function I3($){if(!$){if(d1)return d1;if(U$)return U$}let Z=$?T0.resolve($):process.cwd(),X=v6.get(Z);if(X)return X;let J=(async()=>{let Q=(await VJ({name:"stx",alias:"ui",cwd:Z,defaultConfig:m6,verbose:!1})).config;if(RJ(Q),DJ(Q),LJ(Q,Z),wJ(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await import("./chunk-4xbakvp1.js"),q=[],W=[];for(let K of Q.plugins){let U=typeof K==="string"?K:K[0],z=typeof K==="string"?{}:K[1]||{};try{let H,B;try{H=await import(U),B=T0.dirname(x.resolve(U))}catch{let _=T0.resolve(process.cwd(),U);H=await import(_),B=T0.dirname(_)}let j=H.default||H;if(!G.has(j.name))await G.register(j,Q);if(j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let L of _)q.push(T0.resolve(B,L))}if(j.pages){let _=T0.resolve(B,j.pages),L=z.path||"/";W.push({dir:_,prefix:L})}if(j.setup){let _={addDirective:(L)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(L)},addRoute:(L,V)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[L]=V},addMiddleware:(L)=>{Q.middleware=Q.middleware||[],Q.middleware.push(L)},pluginDir:B,config:Q};await j.setup(z,_)}console.log(`[stx] Plugin loaded: ${j.name||U}`)}catch(H){console.warn(`[stx] Failed to load plugin ${U}:`,H.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=W}return Q})();if(v6.set(Z,J),!$)U$=J,J.then((Y)=>{d1=Y}).catch(()=>{});return J}var l6=new Proxy(m6,{get($,Z){if(d1&&Z in d1)return d1[Z];if(!U$)I3().catch((X)=>{console.warn("[stx] Failed to load config file:",X?.message||X)});return $[Z]}});function tU($){return $}function eU($){let Z=[],X=[];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 J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.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 J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.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((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)X.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)X.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 J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["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(!J.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.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 J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)X.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)X.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:X}}var E3=new Map;async function AJ($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let J=(await NJ.promises.stat($)).mtime.getTime();if(Z.cache&&E3.has($)){let z=E3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=r7(Y),q=Z.markdown||l6.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},K=j5(G,{gfm:!0});if(q.syntaxHighlighting?.enabled&&q.syntaxHighlighting?.serverSide)K=await kJ(K,q.syntaxHighlighting?.defaultTheme||"github-dark",q.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:K,data:Q||{}};if(Z.cache)E3.set($,{...U,updatedAt:J});return U}catch(X){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,X);let J=X instanceof Error?X.message:String(X);return{content:B0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}var z$=null;async function kJ($,Z,X){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!z$)try{z$=await MJ({theme:Z||"github-dark",cache:!0})}catch(q){return console.error("Failed to initialize ts-syntax-highlighter:",q),$}let Y=async(q,W,K,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),H=K||(X?"text":"");if(!H)return q;try{if(!z$.getSupportedLanguages().includes(H))return q;return(await z$.highlight(z,H,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${K}:`,B)}return q},Q=$,G=$.matchAll(J);for(let q of G){let[W,K,U,z]=q,H=await Y(W,K,U,z);Q=Q.replace(W,H)}return Q}async function c6($,Z,X="",J={}){return await IJ($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,q,W,K)=>{try{let U=q;if(!T3.isAbsolute(q))U=T3.resolve(T3.dirname(X),q);let z={};if(W)try{try{z=JSON.parse(W)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let w=F.indexOf(":");if(w>0){let R=F.substring(0,w).trim(),D=F.substring(w+1).trim(),M=D.startsWith('"')&&D.endsWith('"'),k=D.startsWith("'")&&D.endsWith("'");if(M||k)D=D.substring(1,D.length-1);z[R]=D}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:H,data:B}=await AJ(U,J),j={...Z,...B,...z},_=H,L=/\{\{([^}]+)\}\}/g;return _=_.replace(L,(V,O)=>{let F=O.trim();return j[F]!==void 0?String(j[F]):V}),_}catch(U){let z=U instanceof Error?U.message:String(U);return B0("Markdown File",`Error including markdown file: ${z}`,X,$,K,G)}})}async function IJ($,Z,X){let J=[],Y;while((Y=Z.exec($))!==null){let q=Y[0],W=Y.index,K=Y;J.push(X(...K).then((U)=>({match:q,replacement:U,index:W})))}let Q=await Promise.all(J);Q.sort((q,W)=>W.index-q.index);let G=$;for(let{match:q,replacement:W}of Q)G=G.replace(q,()=>W);return G}function U1($,Z){try{let X=$.trim();if(q0(X))return W0(X,Object.keys(Z))(...Object.values(Z));else return e(X,Z)}catch{return!1}}class H${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,X=this.column,J=this.source[this.pos];if(/\s/.test(J))return this.readWhitespace($,Z,X);if(J==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,X);if(J==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,X);if(J==='"'||J==="'")return this.readString(J,$,Z,X);if(J==="`")return this.readTemplateString($,Z,X);if(/\d/.test(J)||J==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,X);if(/[a-z_$]/i.test(J))return this.readIdentifier($,Z,X);if(J==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:X}}if(J==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:X}}if(J==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:X};if(J==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,X);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:X};if(/[+\-*/%<>=!&|^~?:]/.test(J))return this.advance(),{type:"OPERATOR",value:J,start:$,end:this.pos,line:Z,column:X};if(/[()[\]{},;.]/.test(J))return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X};return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X}}readWhitespace($,Z,X){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:X}}readLineComment($,Z,X){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
3262
+ `}async function v6($,Z,X,J){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",l.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(X.__stx_options||{}).componentsDir||"components",q=h0.isAbsolute(G)?[h0.join(G,`${Y}.stx`),h0.join(h0.dirname(J),`${Y}.stx`)]:[h0.join(h0.dirname(J),G,`${Y}.stx`),h0.join(process.cwd(),G,`${Y}.stx`),h0.join(h0.dirname(J),`${Y}.stx`)],W=null;for(let K of q)if(await t(K)){W=await Bun.file(K).text();break}if(!W)return $0("WebComponent",`Component file not found: ${Y}.stx`,l.FILE_NOT_FOUND);let U=wJ(W,Y);return`<script type="module">
3263
+ ${RJ(U)}
3264
+ </script>`}var c6={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:u6,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:$6,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:v6,hasEndTag:!1,description:"Include a web component in the template"},g6,h6,D3,N3,a$,e$,$3,t$,r7,h7,H6,j3,...l6],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 NJ($,Z,X){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=X||process.cwd(),Q=T0.join(Y,"resources","views"),G=T0.join(Y,"resources","layouts");if(W$.existsSync(Q)&&W$.existsSync(G))return{root:"resources",pagesDir:"views"};let q=T0.join(Y,"resources","views","pages");if(W$.existsSync(q))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}var f6=new Set,U$=["partialsDir","componentsDir","layoutsDir"],k3=new WeakMap;function MJ($,Z){let X=Z.replace(/[\\/]+$/,"");if(!X||X===".")return!0;let J=$.replace(/\\/g,"/"),Y=X.replace(/\\/g,"/");return J===Y||J.startsWith(`${Y}/`)}function AJ($,Z){let X=!$.root,J=NJ($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,X&&J.root!=="."){let Y=`${Z}::${J.root}`;if(!f6.has(Y))f6.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!k3.has($)){let Y={};for(let Q of U$){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}k3.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of U$){let G=$[Q];if(typeof G!=="string"||!G)continue;if(T0.isAbsolute(G)||MJ(G,Y))continue;$[Q]=T0.join(Y,G)}}for(let Y of U$){let Q=$[Y];if(typeof Q!=="string"||!Q||T0.isAbsolute(Q))continue;$[Y]=T0.resolve(Z,Q)}return $}function kJ($,Z){let X=k3.get($);for(let J of U$){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let Q=T0.isAbsolute(Y)?Y:T0.join(Z,Y);if(W$.existsSync(Q))continue;let G=X?.[J]??Y,q=$.root,W=!!q&&q!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(W?`, resolved under root "${q}".`:"."))}}function IJ($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function TJ($){if(d6($.stateDir),$.stateDir=m6(),$.cachePath=F5($.cachePath),$.build)$.build.cacheDir=F5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=F5($.media.cache.directory);if($.story)$.story.outDir=F5($.story.outDir)}var d1=null,x6=new Map,z$=null;async function I3($){if(!$){if(d1)return d1;if(z$)return z$}let Z=$?T0.resolve($):process.cwd(),X=x6.get(Z);if(X)return X;let J=(async()=>{let Q=(await DJ({name:"stx",alias:"ui",cwd:Z,defaultConfig:c6,verbose:!1})).config;if(IJ(Q),TJ(Q),AJ(Q,Z),kJ(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await import("./chunk-4xbakvp1.js"),q=[],W=[];for(let U of Q.plugins){let z=typeof U==="string"?U:U[0],K=typeof U==="string"?{}:U[1]||{};try{let H,B;try{H=await import(z),B=T0.dirname(x.resolve(z))}catch{let _=T0.resolve(process.cwd(),z);H=await import(_),B=T0.dirname(_)}let j=H.default||H;if(!G.has(j.name))await G.register(j,Q);if(j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let F of _)q.push(T0.resolve(B,F))}if(j.pages){let _=T0.resolve(B,j.pages),F=K.path||"/";W.push({dir:_,prefix:F})}if(j.setup){let _={addDirective:(F)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(F)},addRoute:(F,V)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[F]=V},addMiddleware:(F)=>{Q.middleware=Q.middleware||[],Q.middleware.push(F)},pluginDir:B,config:Q};await j.setup(K,_)}console.log(`[stx] Plugin loaded: ${j.name||z}`)}catch(H){console.warn(`[stx] Failed to load plugin ${z}:`,H.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=W}return Q})();if(x6.set(Z,J),!$)z$=J,J.then((Y)=>{d1=Y}).catch(()=>{});return J}var p6=new Proxy(c6,{get($,Z){if(d1&&Z in d1)return d1[Z];if(!z$)I3().catch((X)=>{console.warn("[stx] Failed to load config file:",X?.message||X)});return $[Z]}});function GK($){return $}function qK($){let Z=[],X=[];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 J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.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 J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.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((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)X.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)X.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 J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["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(!J.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.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 J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)X.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)X.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:X}}var E3=new Map;async function yJ($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let J=(await EJ.promises.stat($)).mtime.getTime();if(Z.cache&&E3.has($)){let K=E3.get($);if(K.updatedAt>=J)return{content:K.content,data:K.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=t7(Y),q=Z.markdown||p6.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=B5(G,{gfm:!0});if(q.syntaxHighlighting?.enabled&&q.syntaxHighlighting?.serverSide)U=await SJ(U,q.syntaxHighlighting?.defaultTheme||"github-dark",q.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:U,data:Q||{}};if(Z.cache)E3.set($,{...z,updatedAt:J});return z}catch(X){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,X);let J=X instanceof Error?X.message:String(X);return{content:B0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}var K$=null;async function SJ($,Z,X){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!K$)try{K$=await bJ({theme:Z||"github-dark",cache:!0})}catch(q){return console.error("Failed to initialize ts-syntax-highlighter:",q),$}let Y=async(q,W,U,z)=>{let K=z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),H=U||(X?"text":"");if(!H)return q;try{if(!K$.getSupportedLanguages().includes(H))return q;return(await K$.highlight(K,H,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${U}:`,B)}return q},Q=$,G=$.matchAll(J);for(let q of G){let[W,U,z,K]=q,H=await Y(W,U,z,K);Q=Q.replace(W,H)}return Q}async function i6($,Z,X="",J={}){return await CJ($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,q,W,U)=>{try{let z=q;if(!T3.isAbsolute(q))z=T3.resolve(T3.dirname(X),q);let K={};if(W)try{try{K=JSON.parse(W)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=W.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(),M=D.startsWith('"')&&D.endsWith('"'),k=D.startsWith("'")&&D.endsWith("'");if(M||k)D=D.substring(1,D.length-1);K[R]=D}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:H,data:B}=await yJ(z,J),j={...Z,...B,...K},_=H,F=/\{\{([^}]+)\}\}/g;return _=_.replace(F,(V,O)=>{let L=O.trim();return j[L]!==void 0?String(j[L]):V}),_}catch(z){let K=z instanceof Error?z.message:String(z);return B0("Markdown File",`Error including markdown file: ${K}`,X,$,U,G)}})}async function CJ($,Z,X){let J=[],Y;while((Y=Z.exec($))!==null){let q=Y[0],W=Y.index,U=Y;J.push(X(...U).then((z)=>({match:q,replacement:z,index:W})))}let Q=await Promise.all(J);Q.sort((q,W)=>W.index-q.index);let G=$;for(let{match:q,replacement:W}of Q)G=G.replace(q,()=>W);return G}function z1($,Z){try{let X=$.trim();if(q0(X))return W0(X,Object.keys(Z))(...Object.values(Z));else return e(X,Z)}catch{return!1}}class H${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,X=this.column,J=this.source[this.pos];if(/\s/.test(J))return this.readWhitespace($,Z,X);if(J==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,X);if(J==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,X);if(J==='"'||J==="'")return this.readString(J,$,Z,X);if(J==="`")return this.readTemplateString($,Z,X);if(/\d/.test(J)||J==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,X);if(/[a-z_$]/i.test(J))return this.readIdentifier($,Z,X);if(J==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:X}}if(J==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:X}}if(J==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:X};if(J==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,X);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:X};if(/[+\-*/%<>=!&|^~?:]/.test(J))return this.advance(),{type:"OPERATOR",value:J,start:$,end:this.pos,line:Z,column:X};if(/[()[\]{},;.]/.test(J))return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X};return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X}}readWhitespace($,Z,X){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:X}}readLineComment($,Z,X){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
3263
3265
  `)this.advance();return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readBlockComment($,Z,X){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:X}}readString($,Z,X,J){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:X,column:J}}readTemplateString($,Z,X){this.advance();let J=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(J>=Y){this.pos=this.source.length;break}this.advance(2),J++;continue}if(Q==="{"&&J>0){J++,this.advance();continue}if(Q==="}"&&J>0){J--,this.advance();continue}if(Q==="`"&&J===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readNumber($,Z,X){if(this.source[this.pos]==="0"){let J=this.peek(1)?.toLowerCase();if(J==="x"||J==="o"||J==="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:X}}}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:X}}readIdentifier($,Z,X){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:X}}readDirective($,Z,X){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:X}}advance($=1){for(let Z=0;Z<$&&this.pos<this.source.length;Z++){if(this.source[this.pos]===`
3264
- `)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 j0($,Z,X,J=0){let Y=0,Q=J,G=null,q=0,W=!1;while(Q<$.length){let K=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&K==="\\"){W=!0,Q++;continue}if(W=!1,(K==='"'||K==="'"||K==="`")&&!G){G=K,Q++;continue}if(K===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&K==="$"&&$[Q+1]==="{"){q++,Q+=2;continue}if(q>0&&K==="}"){q--,Q++;continue}if(K==="`"&&G==="`"&&q===0){G=null,Q++;continue}if(G){Q++;continue}if(K===Z)Y++;else if(K===X){if(Y--,Y===0)return Q}Q++}return-1}function p6($,Z){let X=Z,J={paren:0,bracket:0,brace:0},Y=null,Q=0;while(X<$.length){let G=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((G==='"'||G==="'")&&!Y){Y=G,X++;continue}if(G===Y&&Y!=="`"){Y=null,X++;continue}if(G==="`"&&!Y){Y="`",X++;continue}if(G==="`"&&Y==="`"&&Q===0){Y=null,X++;continue}if(Y==="`"&&G==="$"&&$[X+1]==="{"){Q++,X+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;X++;continue}if(Y){X++;continue}if(J.paren===0&&J.bracket===0&&J.brace===0){if($.slice(X,X+2)==="}}"||$.slice(X,X+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")J.paren++;else if(G===")"){if(J.paren--,J.paren<0)break}else if(G==="[")J.bracket++;else if(G==="]"){if(J.bracket--,J.bracket<0)break}else if(G==="{")J.brace++;else if(G==="}"){if(J.brace--,J.brace<0)break}X++}return{expression:$.slice(Z,X),endPos:X}}function b3($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=q;continue}if((q==='"'||q==="'")&&!Y){Y=q,X+=q;continue}if(q===Y&&Y!=="`"){Y=null,X+=q;continue}if(q==="`"&&!Y){Y="`",X+=q;continue}if(q==="`"&&Y==="`"&&Q===0){Y=null,X+=q;continue}if(Y==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+=q+$[G+1],G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(Y){X+=q;continue}if(q==="(")J.paren++;else if(q===")")J.paren--;else if(q==="[")J.bracket++;else if(q==="]")J.bracket--;else if(q==="{")J.brace++;else if(q==="}")J.brace--;if(q==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}if(q==="|"&&$[G-1]==="\\"&&!Y){X=X.slice(0,-1)+q;continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function z1($,Z){let X=TJ($,Z);return X.ok?{expression:X.expression,endPos:X.endPos}:null}function TJ($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return{ok:!1,reason:"missing-open-paren",pos:X};let J=j0($,"(",")",X);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:X};return{ok:!0,expression:$.slice(X+1,J),endPos:J+1}}function EJ($,Z){let X=$.lastIndexOf("<",Z);if(X===-1)return!1;return X>$.lastIndexOf(">",Z)}function R1($,Z,X,J){let Y=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),q=new RegExp(`@${X}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,q.lastIndex=Q;let W=G.exec($),K=q.exec($),U=W?W.index:1/0,z=K?K.index:1/0;if(U<z)Y++,Q=U+W[0].length;else if(z<1/0){if(Y--,Y===0)return z;Q=z+K[0].length}else break}return-1}function i6($,Z){let X=$.slice(Z).match(/^@if\s*/);if(!X)return null;let J=Z+X[0].length,Y=z1($,J);if(!Y)return null;let Q=Y.endPos,G=R1($,"if","endif",Q);if(G===-1)return null;let q=$.slice(Q,G),W=[],K=0,U="if",z=Y.expression,H=0,B=0;while(K<q.length){let j=q.indexOf("@",K);if(j===-1)break;K=j;let _=q.substring(j);if(EJ(q,j)){K++;continue}if(/^@if\s*\(/.test(_)){B++,K++;continue}if(/^@endif(?![a-z])/.test(_)){B--,K+=6;continue}if(B===0){let L=_.match(/^@elseif\s*/);if(L){W.push({type:U,condition:z,content:q.substring(H,K),start:Q+H,end:Q+K});let V=K+L[0].length,O=z1(q,V);if(!O){K++;continue}U="elseif",z=O.expression,K=O.endPos,H=K;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:U,condition:z,content:q.substring(H,K),start:Q+H,end:Q+K}),U="else",z=void 0,K+=5,H=K;continue}}K++}return W.push({type:U,condition:z,content:q.slice(H),start:Q+H,end:Q+q.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function w5($){let Z=[],X=/@if\s*\(/g,J=X.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=X.exec($);continue}let Q=i6($,J.index);if(Q)Z.push(Q),X.lastIndex=Q.end;J=X.exec($)}return Z}function B$($,Z,X){let J=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(J.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=Y.exec($);continue}let q=Q.index,W=q+Q[0].length-1,K=j0($,"(",")",W);if(K===-1){Q=Y.exec($);continue}let U=$.slice(W+1,K),z=K+1,H=R1($,Z,X,z);if(H===-1){Q=Y.exec($);continue}let B=$.slice(z,H),j=H+`@${X}`.length;J.push({fullMatch:$.slice(q,j),name:Z,params:U,content:B,start:q,end:j}),Y.lastIndex=j,Q=Y.exec($)}return J}function y3($,Z){let X=$.slice(Z).match(/^@switch\s*/);if(!X)return null;let J=Z+X[0].length,Y=z1($,J);if(!Y)return null;let Q=Y.endPos,G=R1($,"switch","endswitch",Q);if(G===-1)return null;let q=$.slice(Q,G),W=[],K=0,U=null,z=0;while(K<q.length){let H=q.slice(K),B=H.match(/^@switch\s*\(/),j=H.match(/^@endswitch(?![a-z])/);if(B){if(z++,U)U.content+=B[0];K+=B[0].length;continue}if(j){if(z--,U)U.content+=j[0];K+=j[0].length;continue}if(z>0){if(U)U.content+=q[K];K++;continue}let _=H.match(/^@case\s*/),L=H.match(/^@default(?![a-z])/),V=H.match(/^@break(?![a-z])/);if(_&&H.startsWith("@case")){if(U)W.push(U);let O=K+_[0].length,F=z1(q,O);if(!F){K++;continue}U={type:"case",value:F.expression,content:""},K=F.endPos}else if(L&&H.startsWith("@default")){if(U)W.push(U);U={type:"default",content:""},K+=L[0].length}else if(V&&H.startsWith("@break"))K+=V[0].length;else{if(U)U.content+=q[K];K++}}if(U)W.push(U);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:W,start:Z,end:G+10}}function bJ($){let Z=[],X=0;while(X<$.length){let J=$.indexOf("{{",X),Y=$.indexOf("{!!",X),Q=!1,G;if(J===-1&&Y===-1)break;else if(J===-1)G=Y,Q=!0;else if(Y===-1)G=J,Q=!1;else if(Y<J)G=Y,Q=!0;else G=J,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let q=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",W=Q?q==="{{{"?"}}}":"!!}":"}}",K=G+q.length,U=yJ($,K,W);if(U===-1){X=G+1;continue}let z=$.slice(K,U).trim(),H=U+W.length;Z.push({fullMatch:$.slice(G,H),expression:z,start:G,end:H,isRaw:Q}),X=H}return Z}function yJ($,Z,X){let J=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(J<$.length){let q=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((q==='"'||q==="'")&&!Y){Y=q,J++;continue}if(q===Y&&Y!=="`"){Y=null,J++;continue}if(q==="`"&&!Y){Y="`",J++;continue}if(q==="`"&&Y==="`"&&G===0){Y=null,J++;continue}if(Y==="`"&&q==="$"&&$[J+1]==="{"){G++,J+=2;continue}if(G>0){if(q==="{")G++;else if(q==="}")G--;J++;continue}if(Y){J++;continue}if(q==="(")Q.paren++;else if(q===")")Q.paren--;else if(q==="[")Q.bracket++;else if(q==="]")Q.bracket--;else if(q==="{")Q.brace++;else if(q==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(J,J+X.length)===X)return J}J++}return-1}function SJ($){let Z=b3($);if(Z.length===0)return{baseExpression:"",filters:[]};let X=Z[0],J=[];for(let Y=1;Y<Z.length;Y++){let Q=CJ(Z[Y]);if(Q)J.push(Q)}return{baseExpression:X,filters:J}}function CJ($){let Z=$.trim();if(!Z)return null;let X=Z.indexOf("(");if(X===-1)return{name:Z,args:[]};let J=Z.slice(0,X).trim(),Y=X+1,Q=j0(Z,"(",")",X);if(Q===-1)return{name:J,args:[]};let G=Z.slice(Y,Q),q=o6(G);return{name:J,args:q}}function o6($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=q;continue}if((q==='"'||q==="'")&&!Y){Y=q,X+=q;continue}if(q===Y&&Y!=="`"){Y=null,X+=q;continue}if(q==="`"&&!Y){Y="`",X+=q;continue}if(q==="`"&&Y==="`"&&Q===0){Y=null,X+=q;continue}if(Y==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+="${",G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(Y){X+=q;continue}if(q==="(")J.paren++;else if(q===")")J.paren--;else if(q==="[")J.bracket++;else if(q==="]")J.bracket--;else if(q==="{")J.brace++;else if(q==="}")J.brace--;if(q===","&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function PJ($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;let J=j0($,"(",")",X);if(J===-1)return null;return{params:$.slice(X+1,J),endPos:J+1}}function vJ($){let Z=[],J=new H$($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<J.length){let Q=J[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=J.length)break}let q=J[Y];if(q.type==="IDENTIFIER"&&(q.value==="const"||q.value==="let"||q.value==="var")){let W=q.value;if(Y++,Y>=J.length)break;let K=J[Y];if(K.type==="IDENTIFIER"){let U=K.value;if(Y++,Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let z=Y<J.length?J[Y].start:$.length,H=n6(J,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:U,value:$.slice(z,H.endPos),exported:G,start:q.start,end:H.endPos})}}else if(K.type==="PUNCTUATION"&&(K.value==="{"||K.value==="[")){let U=K.start,z=K.value==="{"?"}":"]",H=j0($,K.value,z,U);if(H!==-1){let B=$.slice(U,H+1);if(Y=s6(J,H+1),Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let j=Y<J.length?J[Y].start:$.length,_=n6(J,Y,$);Y=_.nextIndex;let L=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:L,value:`${$.slice(j,_.endPos)}; ${W} ${B} = ${L}`,exported:G,start:q.start,end:_.endPos})}}}}else if(q.type==="IDENTIFIER"&&q.value==="function"){let W=G?J[Y-1].start:q.start;if(Y++,Y>=J.length)break;let K=J[Y];if(K.type==="IDENTIFIER"){let U=K.value;Y++;let z=-1;while(Y<J.length){if(J[Y].type==="PUNCTUATION"&&J[Y].value==="{"){z=J[Y].start;break}Y++}if(z!==-1){let H=j0($,"{","}",z);if(H!==-1)Z.push({type:"function",name:U,value:$.slice(W,H+1).replace(/^export\s+/,""),exported:G,start:W,end:H+1}),Y=s6(J,H+1)}}}else Y++}return Z}function n6($,Z,X){let J=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:X.length;while(J<$.length){let G=$[J];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,J++;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=$[J-1]?.end??G.start;break}}Q=G.end,J++}return{nextIndex:J,endPos:Q}}function s6($,Z){for(let X=0;X<$.length;X++)if($[X].start>=Z)return X;return $.length}function fJ($,Z,X){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,q=y3(J,G);if(!q)break;try{let W;if(q0(q.expression))W=W0(q.expression,Object.keys(Z))(...Object.values(Z));else W=e(q.expression,Z);let K="",U=!1;for(let z of q.cases)if(z.type==="default"){if(!U)K=z.content.trim()}else try{let H;if(z.value&&q0(z.value))H=W0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)H=e(z.value,Z);if(W===H){K=z.content.trim(),U=!0;break}}catch{continue}J=J.substring(0,G)+K+J.substring(q.end),Y=!0}catch(W){let K=W instanceof Error?W.message:String(W),U=$0("Switch",`Error evaluating @switch expression: ${K}`,l.EVALUATION_ERROR);J=J.substring(0,G)+U+J.substring(q.end);break}}return J}function xJ($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return Z.push(J),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function gJ($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(X,J)=>Z[Number(J)]??X)}function X1($,Z,X){let{masked:J,scripts:Y}=xJ($);return gJ(hJ(J,Z,X),Y)}function hJ($,Z,X){let J=$;J=fJ(J,Z,X);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let q=G.index,W=z1(J,q+7);if(!W)break;let K=W.endPos,U=R1(J,"unless","endunless",K);if(U===-1){console.warn(`[stx] @unless directive at position ${q} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=J.slice(K,U),H=W.expression,B=-1;{let _=0,L=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],w;while((w=L.exec(z))!==null)F.push({pos:w.index,type:"open"});while((w=V.exec(z))!==null)F.push({pos:w.index,type:"close"});while((w=O.exec(z))!==null)F.push({pos:w.index,type:"else"});F.sort((R,D)=>R.pos-D.pos);for(let R of F)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){B=R.pos;break}}let j;if(B!==-1){let _=z.slice(0,B),L=z.slice(B+5);j=`@if (${H})${L}@else ${_}@endif`}else j=`@if (!(${H}))${z}@endif`;J=J.substring(0,q)+j+J.substring(U+10),Q=!0}}J=C3(J,Z,X),J=P3(J,Z,X),J=S3(J,Z);let Y=()=>{let Q=w5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let q=Q[G];try{let W="",K=!1;for(let U of q.branches){if(K)break;if(U.type==="else")W=U.content,K=!0;else try{let z;if(U.condition&&q0(U.condition))z=W0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=e(U.condition,Z);if(z)W=U.content,K=!0}catch(z){W=$0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,l.EVALUATION_ERROR),K=!0}}J=J.substring(0,q.start)+W+J.substring(q.end)}catch(W){let K=W instanceof Error?W.message:String(W),U=$0("If",`Error processing @if block: ${K}`,l.EVALUATION_ERROR);J=J.substring(0,q.start)+U+J.substring(q.end)}}return!0};while(!0){let Q=J;if(!Y())break;if(J===Q)break}return J}function r6($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let X=$[Z];if(X!=="'"&&X!=='"')return null;Z++;let J=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(Y===X){Z++;break}J.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function S3($,Z){let X=$;function J(q,W,K,U){let z=1,H=U,B=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${K}(?![a-z])`,"g");while(H<q.length&&z>0){B.lastIndex=H,j.lastIndex=H;let _=B.exec(q),L=j.exec(q),V=_?_.index:1/0,O=L?L.index:1/0;if(V<O)z++,H=V+_[0].length;else if(O<1/0){if(z--,z===0)return O;H=O+L[0].length}else break}return-1}function Y(q,W,K){let U=0,z=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=z.exec(q))!==null)j.push({pos:_.index,type:"open"});while((_=H.exec(q))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(q))!==null)j.push({pos:_.index,type:"else"});j.sort((L,V)=>L.pos-V.pos);for(let L of j)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let q=!0;while(q){q=!1;let W=X.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let K=W.index,U,z,H=X.slice(K+5),B=r6(H);if(B)U=B.value,z=K+5+B.consumed;else z=K+5;let j=J(X,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${K} has no matching @endauth \u2014 the block was skipped.`);break}let _=X.slice(z,j),L=Y(_,"auth","endauth"),V;if(!Z.auth)V=!1;else V=U?U1(`auth?.check && auth?.user?.[${U}]`,Z):U1("auth?.check",Z);let O;if(L!==-1){let F=_.slice(0,L),w=_.slice(L+5);O=V?F:w}else O=V?_:"";X=X.substring(0,K)+O+X.substring(j+8),q=!0}}{let q=!0;while(q){q=!1;let W=X.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let K=W.index,U,z,H=X.slice(K+6),B=r6(H);if(B)U=B.value,z=K+6+B.consumed;else z=K+6;let j=J(X,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${K} has no matching @endguest \u2014 the block was skipped.`);break}let _=X.slice(z,j),L=Y(_,"guest","endguest"),V;if(!Z.auth)V=!0;else V=U?U1(`!auth?.check || !auth?.user?.[${U}]`,Z):U1("!auth?.check",Z);let O;if(L!==-1){let F=_.slice(0,L),w=_.slice(L+5);O=V?F:w}else O=V?_:"";X=X.substring(0,K)+O+X.substring(j+9),q=!0}}function Q(q,W,K){if(Z.userCan&&typeof Z.userCan[q]==="boolean")return Z.userCan[q];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[q];if(W)U.push(W);if(K){let z=U1(K,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(q){let W=q.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let q of["can","cannot"]){let W=`end${q}`,K=q==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=X.match(new RegExp(`@${q}\\s*\\(`));if(!z||z.index===void 0)break;let H=z.index,B=X.slice(H+`@${q}`.length),j=G(B);if(!j)break;let _=H+`@${q}`.length+j.paramsEnd,L=J(X,q,W,_);if(L===-1){console.warn(`[stx] @${q} directive at position ${H} has no matching @${W} \u2014 the block was skipped.`);break}let V=X.slice(_,L),O=[],F=0,w=new RegExp(`@${q}\\s*\\(`,"g"),R=new RegExp(`@${W}(?![a-z])`,"g"),D=new RegExp(`@${K}\\s*\\(`,"g"),M=/@else(?![a-z])/g,k=[],N;while((N=w.exec(V))!==null)k.push({pos:N.index,type:"open"});while((N=R.exec(V))!==null)k.push({pos:N.index,type:"close"});while((N=D.exec(V))!==null)k.push({pos:N.index,type:"elseDirective"});while((N=M.exec(V))!==null)k.push({pos:N.index,type:"else"});k.sort((b,y)=>b.pos-y.pos);for(let b of k){if(b.type==="open"){F++;continue}if(b.type==="close"){F--;continue}if(F===0)O.push(b)}let A=[],T=0;for(let b=0;b<O.length;b++){let y=O[b];if(A.push({content:V.slice(T,y.pos),ability:void 0}),y.type==="elseDirective"){let P=V.slice(y.pos+`@${K}`.length),f=G(P);if(f){A[A.length-1]={content:V.slice(T,y.pos)},T=y.pos+`@${K}`.length+f.paramsEnd,A.push({content:"",ability:f.ability,type:f.type,id:f.id}),A.pop();let d=O[b+1],g=d?d.pos:V.length;A.push({content:V.slice(T,g),ability:f.ability,type:f.type,id:f.id}),T=g}}else T=y.pos+5}if(T<V.length){let b=A[A.length-1];if(O.length>0&&O[O.length-1].type==="else")A.push({content:V.slice(T),isFinalElse:!0});else if(A.length===0)A.push({content:V.slice(T)})}let I=Q(j.ability,j.type,j.id),S=q==="can"?I:!I,E="";if(S)E=A[0]?.content||"";else{let b=!1;for(let y=1;y<A.length;y++){let P=A[y];if(P.isFinalElse){E=P.content,b=!0;break}if(P.ability){let f=Q(P.ability,P.type,P.id);if(q==="can"?f:!f){E=P.content,b=!0;break}}}if(!b&&A.length>0){let y=A[A.length-1];if(y.isFinalElse)E=y.content}}X=X.substring(0,H)+E+X.substring(L+`@${W}`.length),U=!0}}return X}function C3($,Z,X){let J=$;function Y(Q,G,q,W,K){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),H=Q.match(z);if(!H||H.index===void 0)break;let B=H.index,j=z1(Q,B+`@${G}`.length);if(!j)break;let _=j.endPos,L=R1(Q,G,q,_);if(L===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let V=Q.slice(_,L),O=j.expression,F=-1,w=0,R=0;while(R<V.length){let D=V.indexOf("@",R);if(D===-1)break;let M=V.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){F=D;break}R=D+1}try{let D=W(O.trim()),M;if(F!==-1){let k=V.slice(0,F),N=V.slice(F+5);M=D?k:N}else M=D?V:"";Q=Q.substring(0,B)+M+Q.substring(L+`@${q}`.length),U=!0}catch(D){let M=D instanceof Error?D.message:String(D),k=$0(K,`Error processing @${G} directive: ${M}`,l.EVALUATION_ERROR);Q=Q.substring(0,B)+k+Q.substring(L+`@${q}`.length);break}}return Q}return J=Y(J,"isset","endisset",(Q)=>{let G=U1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=Y(J,"empty","endempty",(Q)=>{let G=U1(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"),J}function P3($,Z,X){let J=$,Y="development";function Q(G,q,W,K){let U=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`@${W}(?![a-z])`,"g"),H=new RegExp(`^@${q}(?![a-z])`),B=new RegExp(`^@${W}(?![a-z])`),j=G,_=!0;while(_){_=!1,U.lastIndex=0;let L=U.exec(j);if(!L)break;let V=L.index,O=V+L[0].length;if(q==="env"){let I=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;O+=I[0].length,K=Y===I[2]}let F=1,w=O,R=-1;while(F>0&&w<j.length){U.lastIndex=w,z.lastIndex=w;let I=U.exec(j),S=z.exec(j),E=I?I.index:1/0,b=S?S.index:1/0;if(E<b)F++,w=E+I[0].length;else if(b<1/0){if(F--,F===0){R=b;break}w=b+S[0].length}else break}if(R===-1){console.warn(`[stx] @${q} directive at position ${V} has no matching @${W} \u2014 the block was skipped.`);break}let D=j.substring(O,R),M=-1,k=0,N=0;while(N<D.length){let I=D.indexOf("@",N);if(I===-1)break;let S=D.substring(I);if(H.test(S)){k++,N=I+1;continue}if(B.test(S)){k--,N=I+1;continue}if(k===0&&/^@else(?![a-z])/.test(S)){M=I;break}N=I+1}let A;if(M!==-1){let I=D.slice(0,M),S=D.slice(M+5);A=K?I:S}else A=K?D:"";let T=`@${W}`.length;j=j.substring(0,V)+A+j.substring(R+T),_=!0}return j}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",Y==="production"),J=Q(J,"development","enddevelopment",Y==="development"),J=Q(J,"staging","endstaging",Y==="staging"),J=Q(J,"testing","endtesting",Y==="testing"),J}var v3=new WeakMap;function a6($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function D1($,Z){if(!$)return Z?.nonceGenerator?.()??a6();let X=v3.get($);if(!X)X=Z?.nonceGenerator?.()??a6(),v3.set($,X);return X}function kz($){v3.delete($)}function t6($,Z){let X=[];for(let[J,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)X.push(J);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)X.push(`${J} ${Q.join(" ")}`)}}return X.join("; ")}function x3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${t6($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var uJ={"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},f3={"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},dJ={"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'"]},mJ={"default-src":["'none'"],"frame-ancestors":["'none'"]};function Iz($){return{enabled:!0,directives:{strict:uJ,moderate:f3,relaxed:dJ,api:mJ}[$]||f3,useNonce:$==="strict",addMetaTag:!0}}function Tz($,Z){let X={...$};for(let[J,Y]of Object.entries(Z)){let Q=J,G=X[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")X[Q]=G||Y;else if(Array.isArray(Y)){let q=Array.isArray(G)?G:[],W=[...new Set([...q,...Y])];X[Q]=W}}return X}function e6($,Z,X){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?D1(X,Z):void 0,Y=x3(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
3265
- ${Y}`)}function $8($,Z){let X=$;return X=X.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<script nonce="${Z}"${Y}>`}),X=X.replace(/<style([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<style nonce="${Z}"${Y}>`}),X}function Z8($,Z,X,J){let Y=$,Q=J.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?D1(Z,Q):void 0;return x3(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return D1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=D1(Z,Q);return Y}var lJ={name:"csp",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?D1(X,Q):void 0;return x3(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},cJ={name:"cspNonce",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return D1(X,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function Ez(){return[lJ,cJ]}function bz($){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[X,J]of Object.entries($))if(Array.isArray(J)&&J.includes("http:"))Z.push(`CSP: Using http: in ${X} allows insecure resources`);return Z}function pJ($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function yz($,Z){if(!$.enabled)return{};let X=$.useNonce?D1(Z,$):void 0,J=t6($.directives,X);return{[pJ($.reportOnly)]:J}}var Sz={enabled:!1,reportOnly:!1,directives:f3,useNonce:!1,addMetaTag:!0};import iJ from"crypto";var nJ=40,X8="_token",g3=null;function sJ($=nJ){let Z=iJ.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return g3=Z,Z}function oJ(){if(!g3)sJ();return g3}function rJ($=X8){let Z=oJ();return`<input type="hidden" name="${$}" value="${Z}">`}function J8($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,X,J)=>{return rJ(J||X8)})}async function Y8($,Z,X,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Y=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await aJ(Y,Q,Z,X,J);else Y=await tJ(Y,Q,Z,X,J)}return Y}async function aJ($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=`@${Q}`,W=`@end${Q}`,K=$,U=m1(`${q}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),z=[],H=U.exec(K);while(H!==null){let[B,j="",_=""]=H,L=H.index||0;try{let V=j?Q8(j):[],O=_.trim(),F=await G(O,V,X,J);z.push({original:B,processed:F,startIndex:L})}catch(V){let O=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);z.push({original:B,processed:$0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${O}`,l.EVALUATION_ERROR),startIndex:L})}H=U.exec(K)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:_}=z[B];K=K.replace(j,_)}return K}async function tJ($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=$,W=m1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),K=[],U=W.exec(q);while(U!==null){let[B,j=""]=U,_=U.index||0;try{let L=Q8(j),V=await G("",L,X,J);K.push({original:B,processed:V,startIndex:_})}catch(L){let V=L instanceof Error?L.message:String(L);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,L);K.push({original:B,processed:$0("CustomDirective",`Error in @${Q}(${j}): ${V}`,l.EVALUATION_ERROR),startIndex:_})}U=W.exec(q)}let z=m1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=z.exec(q);while(H!==null){let[B]=H,j=H.index||0;try{let _=await G("",[],X,J);K.push({original:B,processed:_,startIndex:j})}catch(_){let L=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);K.push({original:B,processed:$0("CustomDirective",`Error in @${Q}: ${L}`,l.EVALUATION_ERROR),startIndex:j})}H=z.exec(q)}for(let B=K.length-1;B>=0;B--){let{original:j,processed:_}=K[B];q=q.replace(j,_)}return q}function Q8($){if(!$.trim())return[];let Z=[],X="",J=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,Y=G;else if(G===Y)J=!1;else X+=G;else if(G===","&&!J)Z.push(X.trim()),X="";else X+=G}if(X.trim())Z.push(X.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 G8=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,q8=/^[A-Za-z_$][\w$]*$/,eJ=new Set(["light","dark","system"]);function N1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function $Y($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,X=Z.appearance,J=Z.colorMode;if(N1(Z.storageKey,"storageKey"),!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(N1(X.key,"appearance.key"),N1(X.attribute,"appearance.attribute"),N1(X.default,"appearance.default"),N1(J.key,"colorMode.key"),N1(J.attribute,"colorMode.attribute"),N1(J.default,"colorMode.default"),!q8.test(X.key)||!q8.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!G8.test(X.attribute)||!G8.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(X.allowed)||X.allowed.length===0||X.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!X.allowed.includes(X.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!eJ.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:X.key,attribute:X.attribute,allowed:[...new Set(X.allowed)],default:X.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function ZY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function XY($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${ZY($)};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 JY($,Z){let X=1,J=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(J){if(G==="\\")Y=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")X++;else if(G===")"&&--X===0)return Q}return-1}function W8($,Z){let X=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index+Y[0].length-1,G=JY(X,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let q=X.slice(Q+1,G).trim(),W=e(`(${q})`,Z),K=XY($Y(W));X=X.slice(0,Y.index)+K+X.slice(G+1),J.lastIndex=Y.index+K.length}return X}import YY from"crypto";function _0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var u3={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function QY($){return{...u3,...$.forms?.classes}}function j$($,Z,X,J){let Y=$||Z;return X?`${Y} ${J}`:Y}function u0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function l1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${_0(Z)}"`}function h3($,Z,X){if(!Z)return"";let J="";if(!/\baria-invalid\s*=/i.test(X))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(X))J+=` aria-describedby="${_0(`${u0($)}-error`)}"`;return J}function GY(){return YY.randomUUID()}function lz($,Z,X,J){let Y=QY(J),Q=$;return Q=WY(Q,Z),Q=N5(Q,Z),Q=d3(Q,Z,Y),Q=m3(Q,Z,Y),Q}function N5($,Z){let X=$;return X=X.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=GY();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${_0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),X=X.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${_0(Q)}">`;return J}),X}function d3($,Z,X=u3){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,q,W,K="")=>{let U=Q||G||"POST",z=q||W||"",H=H1(K),B=U.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${_0(j)}" action="${_0(z)}"${H?` ${H}`:""}>`;if(_+=`
3266
- ${N5("@csrf",Z)}`,!["GET","POST"].includes(B))_+=`
3267
- ${N5(`@method('${B}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,q,W,K="")=>{let U=Q||G||"",z=q||W||"",H=H1(K),B=R5(U,Z),j=B!==void 0&&B!==null?B:z||"",_=H.match(/type=['"]([^'"]+)['"]/i),L=_?_[1]:"text",V=D5(U,Z),O=H.match(/class=['"]([^'"]+)['"]/i),F=j$(O?O[1]:"",X.input,V,X.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${_0(L)}" name="${_0(U)}"${l1(H,u0(U))} value="${_0(j)}" class="${F}"${h3(U,V,H)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",q="")=>{let W=H1(G),K=R5(Q,Z)||q.trim(),U=D5(Q,Z),z=W.match(/class=['"]([^'"]+)['"]/i),H=j$(z?z[1]:"",X.input,U,X.inputError),B=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${_0(Q)}"${l1(W,u0(Q))} class="${H}"${h3(Q,U,W)}${B?` ${B}`:""}>${_0(K)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",q)=>{let W=H1(G),K=R5(Q,Z),U=D5(Q,Z),z=W.match(/class=['"]([^'"]+)['"]/i),H=j$(z?z[1]:"",X.input,U,X.inputError),B=W.replace(/class=['"][^'"]+['"]/i,""),j=q;if(K!==void 0)j=q.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,L,V)=>{if((Array.isArray(K)?K.some((F)=>String(F)===V):String(K)===V)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return _});return`<select name="${_0(Q)}"${l1(W,u0(Q))} class="${H}"${h3(Q,U,W)}${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let W=G===void 0?"1":G,K=G===void 0?u0(Q):`${u0(Q)}-${u0(W)}`,U=H1(q),z=R5(Q,Z),H=z!==void 0&&(Array.isArray(z)?z.some((L)=>String(L)===W):z===!0||String(z)===W),B=U.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:X.checkInput,_=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${_0(Q)}"${l1(U,K)} value="${_0(W)}" class="${j}"${H?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let W=H1(q),K=R5(Q,Z),U=K!==void 0&&K===G,z=W.match(/class=['"]([^'"]+)['"]/i),H=z?z[1]:X.checkInput,B=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${_0(Q)}"${l1(W,`${u0(Q)}-${u0(G)}`)} value="${_0(G)}" class="${H}"${U?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let q=H1(G),W=q.match(/accept=['"]([^'"]+)['"]/i),K=W?W[1]:"",U=q.includes("multiple"),z=D5(Q,Z),H=q.match(/class=['"]([^'"]+)['"]/i),B=j$(H?H[1]:"",X.input,z,X.inputError),j=q.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${_0(Q)}"${l1(q,u0(Q))}`,`class="${B}"`];if(K)_.push(`accept="${_0(K)}"`);if(U)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",q)=>{let W=H1(G),K=W.match(/class=['"]([^'"]+)['"]/i),U=K?K[1]:X.label,z=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${_0(u0(Q))}" class="${U}"${z?` ${z}`:""}>${q}</label>`}),J}function m3($,Z,X=u3){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,Q)=>{try{if(D5(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(q,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return K8(Y,Z);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return K8(Y,Z)}let K=W.trim();if(q0(K)){let U=e(K,Z);return U!==void 0?String(U):K}return K}catch{return W}});return`<div id="${_0(`${u0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function D5($,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 K8($,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 X=Z.errors[$];return Array.isArray(X)?X[0]:String(X)}return""}function R5($,Z){let X;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(X=Z[J],X!==void 0)return X}return Z[$]}function H1($){if(!$.trim())return"";let Z=[],X=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=J.exec(X))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var U8={required:($,Z,X)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${X} field is required.`;return null},email:($,Z,X)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${X} field must be a valid email address.`;return null},min:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length<J)return`The ${X} field must be at least ${J} characters.`;if(typeof $==="number"&&$<J)return`The ${X} field must be at least ${J}.`;if(Array.isArray($)&&$.length<J)return`The ${X} field must have at least ${J} items.`;return null},max:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length>J)return`The ${X} field must not exceed ${J} characters.`;if(typeof $==="number"&&$>J)return`The ${X} field must not exceed ${J}.`;if(Array.isArray($)&&$.length>J)return`The ${X} field must not have more than ${J} items.`;return null},confirmed:($,Z,X)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${X} confirmation does not match.`;return null},numeric:($,Z,X)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${X} field must be a number.`;return null},integer:($,Z,X)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${X} field must be an integer.`;return null},alpha:($,Z,X)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${X} field must only contain letters.`;return null},alphanumeric:($,Z,X)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${X} field must only contain letters and numbers.`;return null},url:($,Z,X)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${X} field must be a valid URL.`}},regex:($,Z,X)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${X} field format is invalid.`;return null}catch{return`The ${X} field has an invalid validation pattern.`}},in:($,Z,X)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${X} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,X)=>{if(!$)return null;if(Z.includes(String($)))return`The ${X} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,X)=>{if(!$)return null;let J=new Date($);if(Number.isNaN(J.getTime()))return`The ${X} field must be a valid date.`;return null},before:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J>=Y)return`The ${X} field must be before ${Z[0]}.`;return null},after:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J<=Y)return`The ${X} field must be after ${Z[0]}.`;return null}};function cz($,Z){U8[$]=Z}function l3($){let[Z,...X]=$.split(":"),J=X.length>0?X.join(":").split(","):[];return{name:Z.trim(),params:J}}function qY($,Z,X,J={}){let Y=[],Q=X.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let q=l3(G),W=U8[q.name];if(!W){console.warn(`Unknown validation rule: ${q.name}`);continue}if(q.name==="confirmed"){let U=`${$}_confirmation`;q.params=[J[U]]}let K=W(Z,q.params||[],$);if(K)Y.push(q.message||K)}return{field:$,valid:Y.length===0,errors:Y}}function pz($,Z){let X={};for(let[J,Y]of Object.entries(Z)){let Q=qY(J,$[J],Y,$);if(!Q.valid)X[J]=Q.errors}return X}function WY($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(X,J,Y,Q)=>{let G=Y.split("|").map((W)=>W.trim()),q=[];for(let W of G){let K=l3(W);switch(K.name){case"required":q.push("required");break;case"email":q.push('type="email"');break;case"url":q.push('type="url"');break;case"numeric":case"integer":if(q.push('type="number"'),K.name==="integer")q.push('step="1"');break;case"min":if(K.params?.[0])q.push(`minlength="${K.params[0]}"`);break;case"max":if(K.params?.[0])q.push(`maxlength="${K.params[0]}"`);break;case"regex":if(K.params?.[0])q.push(`pattern="${K.params[0]}"`);break}}return`<!-- @validate:${J}:${Y} -->${q.length>0?`<!-- attrs:${q.join(" ")} -->`:""}`})}var z8={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 X=Number(Z[0]);if(typeof $==="string")return $.length>=X||`Must be at least ${X} characters`;if(typeof $==="number")return $>=X||`Must be at least ${X}`;if(Array.isArray($))return $.length>=X||`Must have at least ${X} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length<=X||`Must be no more than ${X} characters`;if(typeof $==="number")return $<=X||`Must be no more than ${X}`;if(Array.isArray($))return $.length<=X||`Must have no more than ${X} 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[X,J]=Z.map(Number);if(typeof $==="string")return $.length>=X&&$.length<=J||`Must be between ${X} and ${J} characters`;if(typeof $==="number")return $>=X&&$<=J||`Must be between ${X} and ${J}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,X)=>{let J=Object.keys(X);for(let Y of J)if(Y.endsWith("_confirmation")&&X[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 X=new Date(String($)),J=new Date(Z[0]);return X<J||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let X=new Date(String($)),J=new Date(Z[0]);return X>J||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length===X||`Must be exactly ${X} characters`;if(Array.isArray($))return $.length===X||`Must have exactly ${X} 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 iz($){z8[$.name]=$}function KY($,Z,X={}){let J=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=l3(Q),q=z8[G.name];if(!q){console.warn(`Unknown validation rule: ${G.name}`);continue}let W=q.validate($,G.params||[],X);if(W!==!0)J.push(W)}return{valid:J.length===0,errors:J}}function nz($,Z){let X={},J=!0;for(let[Y,Q]of Object.entries(Z)){let G=KY($[Y],Q,$);if(!G.valid)J=!1,X[Y]=G.errors}return{valid:J,errors:X}}function sz($,Z){let X=JSON.stringify(Z);return`
3266
+ `)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 j0($,Z,X,J=0){let Y=0,Q=J,G=null,q=0,W=!1;while(Q<$.length){let U=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&U==="\\"){W=!0,Q++;continue}if(W=!1,(U==='"'||U==="'"||U==="`")&&!G){G=U,Q++;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&U==="$"&&$[Q+1]==="{"){q++,Q+=2;continue}if(q>0&&U==="}"){q--,Q++;continue}if(U==="`"&&G==="`"&&q===0){G=null,Q++;continue}if(G){Q++;continue}if(U===Z)Y++;else if(U===X){if(Y--,Y===0)return Q}Q++}return-1}function n6($,Z){let X=Z,J={paren:0,bracket:0,brace:0},Y=null,Q=0;while(X<$.length){let G=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((G==='"'||G==="'")&&!Y){Y=G,X++;continue}if(G===Y&&Y!=="`"){Y=null,X++;continue}if(G==="`"&&!Y){Y="`",X++;continue}if(G==="`"&&Y==="`"&&Q===0){Y=null,X++;continue}if(Y==="`"&&G==="$"&&$[X+1]==="{"){Q++,X+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;X++;continue}if(Y){X++;continue}if(J.paren===0&&J.bracket===0&&J.brace===0){if($.slice(X,X+2)==="}}"||$.slice(X,X+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")J.paren++;else if(G===")"){if(J.paren--,J.paren<0)break}else if(G==="[")J.bracket++;else if(G==="]"){if(J.bracket--,J.bracket<0)break}else if(G==="{")J.brace++;else if(G==="}"){if(J.brace--,J.brace<0)break}X++}return{expression:$.slice(Z,X),endPos:X}}function b3($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=q;continue}if((q==='"'||q==="'")&&!Y){Y=q,X+=q;continue}if(q===Y&&Y!=="`"){Y=null,X+=q;continue}if(q==="`"&&!Y){Y="`",X+=q;continue}if(q==="`"&&Y==="`"&&Q===0){Y=null,X+=q;continue}if(Y==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+=q+$[G+1],G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(Y){X+=q;continue}if(q==="(")J.paren++;else if(q===")")J.paren--;else if(q==="[")J.bracket++;else if(q==="]")J.bracket--;else if(q==="{")J.brace++;else if(q==="}")J.brace--;if(q==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}if(q==="|"&&$[G-1]==="\\"&&!Y){X=X.slice(0,-1)+q;continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function K1($,Z){let X=PJ($,Z);return X.ok?{expression:X.expression,endPos:X.endPos}:null}function PJ($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return{ok:!1,reason:"missing-open-paren",pos:X};let J=j0($,"(",")",X);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:X};return{ok:!0,expression:$.slice(X+1,J),endPos:J+1}}function vJ($,Z){let X=$.lastIndexOf("<",Z);if(X===-1)return!1;return X>$.lastIndexOf(">",Z)}function R1($,Z,X,J){let Y=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),q=new RegExp(`@${X}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,q.lastIndex=Q;let W=G.exec($),U=q.exec($),z=W?W.index:1/0,K=U?U.index:1/0;if(z<K)Y++,Q=z+W[0].length;else if(K<1/0){if(Y--,Y===0)return K;Q=K+U[0].length}else break}return-1}function s6($,Z){let X=$.slice(Z).match(/^@if\s*/);if(!X)return null;let J=Z+X[0].length,Y=K1($,J);if(!Y)return null;let Q=Y.endPos,G=R1($,"if","endif",Q);if(G===-1)return null;let q=$.slice(Q,G),W=[],U=0,z="if",K=Y.expression,H=0,B=0;while(U<q.length){let j=q.indexOf("@",U);if(j===-1)break;U=j;let _=q.substring(j);if(vJ(q,j)){U++;continue}if(/^@if\s*\(/.test(_)){B++,U++;continue}if(/^@endif(?![a-z])/.test(_)){B--,U+=6;continue}if(B===0){let F=_.match(/^@elseif\s*/);if(F){W.push({type:z,condition:K,content:q.substring(H,U),start:Q+H,end:Q+U});let V=U+F[0].length,O=K1(q,V);if(!O){U++;continue}z="elseif",K=O.expression,U=O.endPos,H=U;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:z,condition:K,content:q.substring(H,U),start:Q+H,end:Q+U}),z="else",K=void 0,U+=5,H=U;continue}}U++}return W.push({type:z,condition:K,content:q.slice(H),start:Q+H,end:Q+q.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function L5($){let Z=[],X=/@if\s*\(/g,J=X.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=X.exec($);continue}let Q=s6($,J.index);if(Q)Z.push(Q),X.lastIndex=Q.end;J=X.exec($)}return Z}function B$($,Z,X){let J=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(J.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=Y.exec($);continue}let q=Q.index,W=q+Q[0].length-1,U=j0($,"(",")",W);if(U===-1){Q=Y.exec($);continue}let z=$.slice(W+1,U),K=U+1,H=R1($,Z,X,K);if(H===-1){Q=Y.exec($);continue}let B=$.slice(K,H),j=H+`@${X}`.length;J.push({fullMatch:$.slice(q,j),name:Z,params:z,content:B,start:q,end:j}),Y.lastIndex=j,Q=Y.exec($)}return J}function y3($,Z){let X=$.slice(Z).match(/^@switch\s*/);if(!X)return null;let J=Z+X[0].length,Y=K1($,J);if(!Y)return null;let Q=Y.endPos,G=R1($,"switch","endswitch",Q);if(G===-1)return null;let q=$.slice(Q,G),W=[],U=0,z=null,K=0;while(U<q.length){let H=q.slice(U),B=H.match(/^@switch\s*\(/),j=H.match(/^@endswitch(?![a-z])/);if(B){if(K++,z)z.content+=B[0];U+=B[0].length;continue}if(j){if(K--,z)z.content+=j[0];U+=j[0].length;continue}if(K>0){if(z)z.content+=q[U];U++;continue}let _=H.match(/^@case\s*/),F=H.match(/^@default(?![a-z])/),V=H.match(/^@break(?![a-z])/);if(_&&H.startsWith("@case")){if(z)W.push(z);let O=U+_[0].length,L=K1(q,O);if(!L){U++;continue}z={type:"case",value:L.expression,content:""},U=L.endPos}else if(F&&H.startsWith("@default")){if(z)W.push(z);z={type:"default",content:""},U+=F[0].length}else if(V&&H.startsWith("@break"))U+=V[0].length;else{if(z)z.content+=q[U];U++}}if(z)W.push(z);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:W,start:Z,end:G+10}}function fJ($){let Z=[],X=0;while(X<$.length){let J=$.indexOf("{{",X),Y=$.indexOf("{!!",X),Q=!1,G;if(J===-1&&Y===-1)break;else if(J===-1)G=Y,Q=!0;else if(Y===-1)G=J,Q=!1;else if(Y<J)G=Y,Q=!0;else G=J,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let q=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",W=Q?q==="{{{"?"}}}":"!!}":"}}",U=G+q.length,z=xJ($,U,W);if(z===-1){X=G+1;continue}let K=$.slice(U,z).trim(),H=z+W.length;Z.push({fullMatch:$.slice(G,H),expression:K,start:G,end:H,isRaw:Q}),X=H}return Z}function xJ($,Z,X){let J=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(J<$.length){let q=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((q==='"'||q==="'")&&!Y){Y=q,J++;continue}if(q===Y&&Y!=="`"){Y=null,J++;continue}if(q==="`"&&!Y){Y="`",J++;continue}if(q==="`"&&Y==="`"&&G===0){Y=null,J++;continue}if(Y==="`"&&q==="$"&&$[J+1]==="{"){G++,J+=2;continue}if(G>0){if(q==="{")G++;else if(q==="}")G--;J++;continue}if(Y){J++;continue}if(q==="(")Q.paren++;else if(q===")")Q.paren--;else if(q==="[")Q.bracket++;else if(q==="]")Q.bracket--;else if(q==="{")Q.brace++;else if(q==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(J,J+X.length)===X)return J}J++}return-1}function gJ($){let Z=b3($);if(Z.length===0)return{baseExpression:"",filters:[]};let X=Z[0],J=[];for(let Y=1;Y<Z.length;Y++){let Q=hJ(Z[Y]);if(Q)J.push(Q)}return{baseExpression:X,filters:J}}function hJ($){let Z=$.trim();if(!Z)return null;let X=Z.indexOf("(");if(X===-1)return{name:Z,args:[]};let J=Z.slice(0,X).trim(),Y=X+1,Q=j0(Z,"(",")",X);if(Q===-1)return{name:J,args:[]};let G=Z.slice(Y,Q),q=a6(G);return{name:J,args:q}}function a6($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=q;continue}if((q==='"'||q==="'")&&!Y){Y=q,X+=q;continue}if(q===Y&&Y!=="`"){Y=null,X+=q;continue}if(q==="`"&&!Y){Y="`",X+=q;continue}if(q==="`"&&Y==="`"&&Q===0){Y=null,X+=q;continue}if(Y==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+="${",G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(Y){X+=q;continue}if(q==="(")J.paren++;else if(q===")")J.paren--;else if(q==="[")J.bracket++;else if(q==="]")J.bracket--;else if(q==="{")J.brace++;else if(q==="}")J.brace--;if(q===","&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function uJ($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;let J=j0($,"(",")",X);if(J===-1)return null;return{params:$.slice(X+1,J),endPos:J+1}}function dJ($){let Z=[],J=new H$($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<J.length){let Q=J[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=J.length)break}let q=J[Y];if(q.type==="IDENTIFIER"&&(q.value==="const"||q.value==="let"||q.value==="var")){let W=q.value;if(Y++,Y>=J.length)break;let U=J[Y];if(U.type==="IDENTIFIER"){let z=U.value;if(Y++,Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let K=Y<J.length?J[Y].start:$.length,H=o6(J,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:z,value:$.slice(K,H.endPos),exported:G,start:q.start,end:H.endPos})}}else if(U.type==="PUNCTUATION"&&(U.value==="{"||U.value==="[")){let z=U.start,K=U.value==="{"?"}":"]",H=j0($,U.value,K,z);if(H!==-1){let B=$.slice(z,H+1);if(Y=r6(J,H+1),Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let j=Y<J.length?J[Y].start:$.length,_=o6(J,Y,$);Y=_.nextIndex;let F=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:F,value:`${$.slice(j,_.endPos)}; ${W} ${B} = ${F}`,exported:G,start:q.start,end:_.endPos})}}}}else if(q.type==="IDENTIFIER"&&q.value==="function"){let W=G?J[Y-1].start:q.start;if(Y++,Y>=J.length)break;let U=J[Y];if(U.type==="IDENTIFIER"){let z=U.value;Y++;let K=-1;while(Y<J.length){if(J[Y].type==="PUNCTUATION"&&J[Y].value==="{"){K=J[Y].start;break}Y++}if(K!==-1){let H=j0($,"{","}",K);if(H!==-1)Z.push({type:"function",name:z,value:$.slice(W,H+1).replace(/^export\s+/,""),exported:G,start:W,end:H+1}),Y=r6(J,H+1)}}}else Y++}return Z}function o6($,Z,X){let J=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:X.length;while(J<$.length){let G=$[J];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,J++;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=$[J-1]?.end??G.start;break}}Q=G.end,J++}return{nextIndex:J,endPos:Q}}function r6($,Z){for(let X=0;X<$.length;X++)if($[X].start>=Z)return X;return $.length}function mJ($,Z,X){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,q=y3(J,G);if(!q)break;try{let W;if(q0(q.expression))W=W0(q.expression,Object.keys(Z))(...Object.values(Z));else W=e(q.expression,Z);let U="",z=!1;for(let K of q.cases)if(K.type==="default"){if(!z)U=K.content.trim()}else try{let H;if(K.value&&q0(K.value))H=W0(K.value,Object.keys(Z))(...Object.values(Z));else if(K.value)H=e(K.value,Z);if(W===H){U=K.content.trim(),z=!0;break}}catch{continue}J=J.substring(0,G)+U+J.substring(q.end),Y=!0}catch(W){let U=W instanceof Error?W.message:String(W),z=$0("Switch",`Error evaluating @switch expression: ${U}`,l.EVALUATION_ERROR);J=J.substring(0,G)+z+J.substring(q.end);break}}return J}function lJ($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return Z.push(J),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function cJ($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(X,J)=>Z[Number(J)]??X)}function X1($,Z,X){let{masked:J,scripts:Y}=lJ($);return cJ(pJ(J,Z,X),Y)}function pJ($,Z,X){let J=$;J=mJ(J,Z,X);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let q=G.index,W=K1(J,q+7);if(!W)break;let U=W.endPos,z=R1(J,"unless","endunless",U);if(z===-1){console.warn(`[stx] @unless directive at position ${q} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let K=J.slice(U,z),H=W.expression,B=-1;{let _=0,F=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,L=[],w;while((w=F.exec(K))!==null)L.push({pos:w.index,type:"open"});while((w=V.exec(K))!==null)L.push({pos:w.index,type:"close"});while((w=O.exec(K))!==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")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){B=R.pos;break}}let j;if(B!==-1){let _=K.slice(0,B),F=K.slice(B+5);j=`@if (${H})${F}@else ${_}@endif`}else j=`@if (!(${H}))${K}@endif`;J=J.substring(0,q)+j+J.substring(z+10),Q=!0}}J=C3(J,Z,X),J=P3(J,Z,X),J=S3(J,Z);let Y=()=>{let Q=L5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let q=Q[G];try{let W="",U=!1;for(let z of q.branches){if(U)break;if(z.type==="else")W=z.content,U=!0;else try{let K;if(z.condition&&q0(z.condition))K=W0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)K=e(z.condition,Z);if(K)W=z.content,U=!0}catch(K){W=$0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${K instanceof Error?K.message:String(K)}`,l.EVALUATION_ERROR),U=!0}}J=J.substring(0,q.start)+W+J.substring(q.end)}catch(W){let U=W instanceof Error?W.message:String(W),z=$0("If",`Error processing @if block: ${U}`,l.EVALUATION_ERROR);J=J.substring(0,q.start)+z+J.substring(q.end)}}return!0};while(!0){let Q=J;if(!Y())break;if(J===Q)break}return J}function t6($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let X=$[Z];if(X!=="'"&&X!=='"')return null;Z++;let J=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(Y===X){Z++;break}J.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function S3($,Z){let X=$;function J(q,W,U,z){let K=1,H=z,B=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${U}(?![a-z])`,"g");while(H<q.length&&K>0){B.lastIndex=H,j.lastIndex=H;let _=B.exec(q),F=j.exec(q),V=_?_.index:1/0,O=F?F.index:1/0;if(V<O)K++,H=V+_[0].length;else if(O<1/0){if(K--,K===0)return O;H=O+F[0].length}else break}return-1}function Y(q,W,U){let z=0,K=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${U}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=K.exec(q))!==null)j.push({pos:_.index,type:"open"});while((_=H.exec(q))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(q))!==null)j.push({pos:_.index,type:"else"});j.sort((F,V)=>F.pos-V.pos);for(let F of j)if(F.type==="open")z++;else if(F.type==="close")z--;else if(F.type==="else"&&z===0)return F.pos;return-1}{let q=!0;while(q){q=!1;let W=X.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let U=W.index,z,K,H=X.slice(U+5),B=t6(H);if(B)z=B.value,K=U+5+B.consumed;else K=U+5;let j=J(X,"auth","endauth",K);if(j===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let _=X.slice(K,j),F=Y(_,"auth","endauth"),V;if(!Z.auth)V=!1;else V=z?z1(`auth?.check && auth?.user?.[${z}]`,Z):z1("auth?.check",Z);let O;if(F!==-1){let L=_.slice(0,F),w=_.slice(F+5);O=V?L:w}else O=V?_:"";X=X.substring(0,U)+O+X.substring(j+8),q=!0}}{let q=!0;while(q){q=!1;let W=X.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let U=W.index,z,K,H=X.slice(U+6),B=t6(H);if(B)z=B.value,K=U+6+B.consumed;else K=U+6;let j=J(X,"guest","endguest",K);if(j===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let _=X.slice(K,j),F=Y(_,"guest","endguest"),V;if(!Z.auth)V=!0;else V=z?z1(`!auth?.check || !auth?.user?.[${z}]`,Z):z1("!auth?.check",Z);let O;if(F!==-1){let L=_.slice(0,F),w=_.slice(F+5);O=V?L:w}else O=V?_:"";X=X.substring(0,U)+O+X.substring(j+9),q=!0}}function Q(q,W,U){if(Z.userCan&&typeof Z.userCan[q]==="boolean")return Z.userCan[q];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[q];if(W)z.push(W);if(U){let K=z1(U,Z);z.push(K)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(q){let W=q.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let q of["can","cannot"]){let W=`end${q}`,U=q==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let K=X.match(new RegExp(`@${q}\\s*\\(`));if(!K||K.index===void 0)break;let H=K.index,B=X.slice(H+`@${q}`.length),j=G(B);if(!j)break;let _=H+`@${q}`.length+j.paramsEnd,F=J(X,q,W,_);if(F===-1){console.warn(`[stx] @${q} directive at position ${H} has no matching @${W} \u2014 the block was skipped.`);break}let V=X.slice(_,F),O=[],L=0,w=new RegExp(`@${q}\\s*\\(`,"g"),R=new RegExp(`@${W}(?![a-z])`,"g"),D=new RegExp(`@${U}\\s*\\(`,"g"),M=/@else(?![a-z])/g,k=[],N;while((N=w.exec(V))!==null)k.push({pos:N.index,type:"open"});while((N=R.exec(V))!==null)k.push({pos:N.index,type:"close"});while((N=D.exec(V))!==null)k.push({pos:N.index,type:"elseDirective"});while((N=M.exec(V))!==null)k.push({pos:N.index,type:"else"});k.sort((b,y)=>b.pos-y.pos);for(let b of k){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)O.push(b)}let A=[],T=0;for(let b=0;b<O.length;b++){let y=O[b];if(A.push({content:V.slice(T,y.pos),ability:void 0}),y.type==="elseDirective"){let P=V.slice(y.pos+`@${U}`.length),f=G(P);if(f){A[A.length-1]={content:V.slice(T,y.pos)},T=y.pos+`@${U}`.length+f.paramsEnd,A.push({content:"",ability:f.ability,type:f.type,id:f.id}),A.pop();let d=O[b+1],g=d?d.pos:V.length;A.push({content:V.slice(T,g),ability:f.ability,type:f.type,id:f.id}),T=g}}else T=y.pos+5}if(T<V.length){let b=A[A.length-1];if(O.length>0&&O[O.length-1].type==="else")A.push({content:V.slice(T),isFinalElse:!0});else if(A.length===0)A.push({content:V.slice(T)})}let I=Q(j.ability,j.type,j.id),S=q==="can"?I:!I,E="";if(S)E=A[0]?.content||"";else{let b=!1;for(let y=1;y<A.length;y++){let P=A[y];if(P.isFinalElse){E=P.content,b=!0;break}if(P.ability){let f=Q(P.ability,P.type,P.id);if(q==="can"?f:!f){E=P.content,b=!0;break}}}if(!b&&A.length>0){let y=A[A.length-1];if(y.isFinalElse)E=y.content}}X=X.substring(0,H)+E+X.substring(F+`@${W}`.length),z=!0}}return X}function C3($,Z,X){let J=$;function Y(Q,G,q,W,U){let z=!0;while(z){z=!1;let K=new RegExp(`@${G}\\s*\\(`),H=Q.match(K);if(!H||H.index===void 0)break;let B=H.index,j=K1(Q,B+`@${G}`.length);if(!j)break;let _=j.endPos,F=R1(Q,G,q,_);if(F===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let V=Q.slice(_,F),O=j.expression,L=-1,w=0,R=0;while(R<V.length){let D=V.indexOf("@",R);if(D===-1)break;let M=V.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){L=D;break}R=D+1}try{let D=W(O.trim()),M;if(L!==-1){let k=V.slice(0,L),N=V.slice(L+5);M=D?k:N}else M=D?V:"";Q=Q.substring(0,B)+M+Q.substring(F+`@${q}`.length),z=!0}catch(D){let M=D instanceof Error?D.message:String(D),k=$0(U,`Error processing @${G} directive: ${M}`,l.EVALUATION_ERROR);Q=Q.substring(0,B)+k+Q.substring(F+`@${q}`.length);break}}return Q}return J=Y(J,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=Y(J,"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"),J}function P3($,Z,X){let J=$,Y="development";function Q(G,q,W,U){let z=new RegExp(`@${q}(?![a-z])`,"g"),K=new RegExp(`@${W}(?![a-z])`,"g"),H=new RegExp(`^@${q}(?![a-z])`),B=new RegExp(`^@${W}(?![a-z])`),j=G,_=!0;while(_){_=!1,z.lastIndex=0;let F=z.exec(j);if(!F)break;let V=F.index,O=V+F[0].length;if(q==="env"){let I=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;O+=I[0].length,U=Y===I[2]}let L=1,w=O,R=-1;while(L>0&&w<j.length){z.lastIndex=w,K.lastIndex=w;let I=z.exec(j),S=K.exec(j),E=I?I.index:1/0,b=S?S.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+S[0].length}else break}if(R===-1){console.warn(`[stx] @${q} directive at position ${V} has no matching @${W} \u2014 the block was skipped.`);break}let D=j.substring(O,R),M=-1,k=0,N=0;while(N<D.length){let I=D.indexOf("@",N);if(I===-1)break;let S=D.substring(I);if(H.test(S)){k++,N=I+1;continue}if(B.test(S)){k--,N=I+1;continue}if(k===0&&/^@else(?![a-z])/.test(S)){M=I;break}N=I+1}let A;if(M!==-1){let I=D.slice(0,M),S=D.slice(M+5);A=U?I:S}else A=U?D:"";let T=`@${W}`.length;j=j.substring(0,V)+A+j.substring(R+T),_=!0}return j}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",Y==="production"),J=Q(J,"development","enddevelopment",Y==="development"),J=Q(J,"staging","endstaging",Y==="staging"),J=Q(J,"testing","endtesting",Y==="testing"),J}var v3=new WeakMap;function e6($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function D1($,Z){if(!$)return Z?.nonceGenerator?.()??e6();let X=v3.get($);if(!X)X=Z?.nonceGenerator?.()??e6(),v3.set($,X);return X}function PK($){v3.delete($)}function $8($,Z){let X=[];for(let[J,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)X.push(J);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)X.push(`${J} ${Q.join(" ")}`)}}return X.join("; ")}function x3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${$8($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var iJ={"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},f3={"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},nJ={"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'"]},sJ={"default-src":["'none'"],"frame-ancestors":["'none'"]};function vK($){return{enabled:!0,directives:{strict:iJ,moderate:f3,relaxed:nJ,api:sJ}[$]||f3,useNonce:$==="strict",addMetaTag:!0}}function fK($,Z){let X={...$};for(let[J,Y]of Object.entries(Z)){let Q=J,G=X[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")X[Q]=G||Y;else if(Array.isArray(Y)){let q=Array.isArray(G)?G:[],W=[...new Set([...q,...Y])];X[Q]=W}}return X}function Z8($,Z,X){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?D1(X,Z):void 0,Y=x3(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
3267
+ ${Y}`)}function X8($,Z){let X=$;return X=X.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<script nonce="${Z}"${Y}>`}),X=X.replace(/<style([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<style nonce="${Z}"${Y}>`}),X}function J8($,Z,X,J){let Y=$,Q=J.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?D1(Z,Q):void 0;return x3(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return D1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=D1(Z,Q);return Y}var oJ={name:"csp",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?D1(X,Q):void 0;return x3(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},rJ={name:"cspNonce",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return D1(X,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function xK(){return[oJ,rJ]}function gK($){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[X,J]of Object.entries($))if(Array.isArray(J)&&J.includes("http:"))Z.push(`CSP: Using http: in ${X} allows insecure resources`);return Z}function aJ($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function hK($,Z){if(!$.enabled)return{};let X=$.useNonce?D1(Z,$):void 0,J=$8($.directives,X);return{[aJ($.reportOnly)]:J}}var uK={enabled:!1,reportOnly:!1,directives:f3,useNonce:!1,addMetaTag:!0};import tJ from"crypto";var eJ=40,Y8="_token",g3=null;function $Y($=eJ){let Z=tJ.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return g3=Z,Z}function ZY(){if(!g3)$Y();return g3}function XY($=Y8){let Z=ZY();return`<input type="hidden" name="${$}" value="${Z}">`}function Q8($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,X,J)=>{return XY(J||Y8)})}async function G8($,Z,X,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Y=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await JY(Y,Q,Z,X,J);else Y=await YY(Y,Q,Z,X,J)}return Y}async function JY($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=`@${Q}`,W=`@end${Q}`,U=$,z=m1(`${q}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),K=[],H=z.exec(U);while(H!==null){let[B,j="",_=""]=H,F=H.index||0;try{let V=j?q8(j):[],O=_.trim(),L=await G(O,V,X,J);K.push({original:B,processed:L,startIndex:F})}catch(V){let O=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);K.push({original:B,processed:$0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${O}`,l.EVALUATION_ERROR),startIndex:F})}H=z.exec(U)}for(let B=K.length-1;B>=0;B--){let{original:j,processed:_}=K[B];U=U.replace(j,_)}return U}async function YY($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=$,W=m1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),U=[],z=W.exec(q);while(z!==null){let[B,j=""]=z,_=z.index||0;try{let F=q8(j),V=await G("",F,X,J);U.push({original:B,processed:V,startIndex:_})}catch(F){let V=F instanceof Error?F.message:String(F);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,F);U.push({original:B,processed:$0("CustomDirective",`Error in @${Q}(${j}): ${V}`,l.EVALUATION_ERROR),startIndex:_})}z=W.exec(q)}let K=m1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=K.exec(q);while(H!==null){let[B]=H,j=H.index||0;try{let _=await G("",[],X,J);U.push({original:B,processed:_,startIndex:j})}catch(_){let F=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);U.push({original:B,processed:$0("CustomDirective",`Error in @${Q}: ${F}`,l.EVALUATION_ERROR),startIndex:j})}H=K.exec(q)}for(let B=U.length-1;B>=0;B--){let{original:j,processed:_}=U[B];q=q.replace(j,_)}return q}function q8($){if(!$.trim())return[];let Z=[],X="",J=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,Y=G;else if(G===Y)J=!1;else X+=G;else if(G===","&&!J)Z.push(X.trim()),X="";else X+=G}if(X.trim())Z.push(X.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 W8=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,U8=/^[A-Za-z_$][\w$]*$/,QY=new Set(["light","dark","system"]);function N1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function GY($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,X=Z.appearance,J=Z.colorMode;if(N1(Z.storageKey,"storageKey"),!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(N1(X.key,"appearance.key"),N1(X.attribute,"appearance.attribute"),N1(X.default,"appearance.default"),N1(J.key,"colorMode.key"),N1(J.attribute,"colorMode.attribute"),N1(J.default,"colorMode.default"),!U8.test(X.key)||!U8.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!W8.test(X.attribute)||!W8.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(X.allowed)||X.allowed.length===0||X.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!X.allowed.includes(X.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!QY.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:X.key,attribute:X.attribute,allowed:[...new Set(X.allowed)],default:X.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function qY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function WY($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${qY($)};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 UY($,Z){let X=1,J=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(J){if(G==="\\")Y=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")X++;else if(G===")"&&--X===0)return Q}return-1}function z8($,Z){let X=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index+Y[0].length-1,G=UY(X,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let q=X.slice(Q+1,G).trim(),W=e(`(${q})`,Z),U=WY(GY(W));X=X.slice(0,Y.index)+U+X.slice(G+1),J.lastIndex=Y.index+U.length}return X}import zY from"crypto";function _0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var u3={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function KY($){return{...u3,...$.forms?.classes}}function j$($,Z,X,J){let Y=$||Z;return X?`${Y} ${J}`:Y}function u0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function l1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${_0(Z)}"`}function h3($,Z,X){if(!Z)return"";let J="";if(!/\baria-invalid\s*=/i.test(X))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(X))J+=` aria-describedby="${_0(`${u0($)}-error`)}"`;return J}function HY(){return zY.randomUUID()}function aK($,Z,X,J){let Y=KY(J),Q=$;return Q=jY(Q,Z),Q=D5(Q,Z),Q=d3(Q,Z,Y),Q=m3(Q,Z,Y),Q}function D5($,Z){let X=$;return X=X.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=HY();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${_0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),X=X.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${_0(Q)}">`;return J}),X}function d3($,Z,X=u3){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,q,W,U="")=>{let z=Q||G||"POST",K=q||W||"",H=H1(U),B=z.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${_0(j)}" action="${_0(K)}"${H?` ${H}`:""}>`;if(_+=`
3268
+ ${D5("@csrf",Z)}`,!["GET","POST"].includes(B))_+=`
3269
+ ${D5(`@method('${B}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,q,W,U="")=>{let z=Q||G||"",K=q||W||"",H=H1(U),B=w5(z,Z),j=B!==void 0&&B!==null?B:K||"",_=H.match(/type=['"]([^'"]+)['"]/i),F=_?_[1]:"text",V=R5(z,Z),O=H.match(/class=['"]([^'"]+)['"]/i),L=j$(O?O[1]:"",X.input,V,X.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${_0(F)}" name="${_0(z)}"${l1(H,u0(z))} value="${_0(j)}" class="${L}"${h3(z,V,H)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",q="")=>{let W=H1(G),U=w5(Q,Z)||q.trim(),z=R5(Q,Z),K=W.match(/class=['"]([^'"]+)['"]/i),H=j$(K?K[1]:"",X.input,z,X.inputError),B=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${_0(Q)}"${l1(W,u0(Q))} class="${H}"${h3(Q,z,W)}${B?` ${B}`:""}>${_0(U)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",q)=>{let W=H1(G),U=w5(Q,Z),z=R5(Q,Z),K=W.match(/class=['"]([^'"]+)['"]/i),H=j$(K?K[1]:"",X.input,z,X.inputError),B=W.replace(/class=['"][^'"]+['"]/i,""),j=q;if(U!==void 0)j=q.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,F,V)=>{if((Array.isArray(U)?U.some((L)=>String(L)===V):String(U)===V)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return _});return`<select name="${_0(Q)}"${l1(W,u0(Q))} class="${H}"${h3(Q,z,W)}${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let W=G===void 0?"1":G,U=G===void 0?u0(Q):`${u0(Q)}-${u0(W)}`,z=H1(q),K=w5(Q,Z),H=K!==void 0&&(Array.isArray(K)?K.some((F)=>String(F)===W):K===!0||String(K)===W),B=z.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:X.checkInput,_=z.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${_0(Q)}"${l1(z,U)} value="${_0(W)}" class="${j}"${H?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let W=H1(q),U=w5(Q,Z),z=U!==void 0&&U===G,K=W.match(/class=['"]([^'"]+)['"]/i),H=K?K[1]:X.checkInput,B=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${_0(Q)}"${l1(W,`${u0(Q)}-${u0(G)}`)} value="${_0(G)}" class="${H}"${z?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let q=H1(G),W=q.match(/accept=['"]([^'"]+)['"]/i),U=W?W[1]:"",z=q.includes("multiple"),K=R5(Q,Z),H=q.match(/class=['"]([^'"]+)['"]/i),B=j$(H?H[1]:"",X.input,K,X.inputError),j=q.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${_0(Q)}"${l1(q,u0(Q))}`,`class="${B}"`];if(U)_.push(`accept="${_0(U)}"`);if(z)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",q)=>{let W=H1(G),U=W.match(/class=['"]([^'"]+)['"]/i),z=U?U[1]:X.label,K=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${_0(u0(Q))}" class="${z}"${K?` ${K}`:""}>${q}</label>`}),J}function m3($,Z,X=u3){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,Q)=>{try{if(R5(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(q,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return K8(Y,Z);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return K8(Y,Z)}let U=W.trim();if(q0(U)){let z=e(U,Z);return z!==void 0?String(z):U}return U}catch{return W}});return`<div id="${_0(`${u0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function R5($,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 K8($,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 X=Z.errors[$];return Array.isArray(X)?X[0]:String(X)}return""}function w5($,Z){let X;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(X=Z[J],X!==void 0)return X}return Z[$]}function H1($){if(!$.trim())return"";let Z=[],X=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=J.exec(X))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var H8={required:($,Z,X)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${X} field is required.`;return null},email:($,Z,X)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${X} field must be a valid email address.`;return null},min:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length<J)return`The ${X} field must be at least ${J} characters.`;if(typeof $==="number"&&$<J)return`The ${X} field must be at least ${J}.`;if(Array.isArray($)&&$.length<J)return`The ${X} field must have at least ${J} items.`;return null},max:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length>J)return`The ${X} field must not exceed ${J} characters.`;if(typeof $==="number"&&$>J)return`The ${X} field must not exceed ${J}.`;if(Array.isArray($)&&$.length>J)return`The ${X} field must not have more than ${J} items.`;return null},confirmed:($,Z,X)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${X} confirmation does not match.`;return null},numeric:($,Z,X)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${X} field must be a number.`;return null},integer:($,Z,X)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${X} field must be an integer.`;return null},alpha:($,Z,X)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${X} field must only contain letters.`;return null},alphanumeric:($,Z,X)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${X} field must only contain letters and numbers.`;return null},url:($,Z,X)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${X} field must be a valid URL.`}},regex:($,Z,X)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${X} field format is invalid.`;return null}catch{return`The ${X} field has an invalid validation pattern.`}},in:($,Z,X)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${X} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,X)=>{if(!$)return null;if(Z.includes(String($)))return`The ${X} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,X)=>{if(!$)return null;let J=new Date($);if(Number.isNaN(J.getTime()))return`The ${X} field must be a valid date.`;return null},before:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J>=Y)return`The ${X} field must be before ${Z[0]}.`;return null},after:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J<=Y)return`The ${X} field must be after ${Z[0]}.`;return null}};function tK($,Z){H8[$]=Z}function l3($){let[Z,...X]=$.split(":"),J=X.length>0?X.join(":").split(","):[];return{name:Z.trim(),params:J}}function BY($,Z,X,J={}){let Y=[],Q=X.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let q=l3(G),W=H8[q.name];if(!W){console.warn(`Unknown validation rule: ${q.name}`);continue}if(q.name==="confirmed"){let z=`${$}_confirmation`;q.params=[J[z]]}let U=W(Z,q.params||[],$);if(U)Y.push(q.message||U)}return{field:$,valid:Y.length===0,errors:Y}}function eK($,Z){let X={};for(let[J,Y]of Object.entries(Z)){let Q=BY(J,$[J],Y,$);if(!Q.valid)X[J]=Q.errors}return X}function jY($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(X,J,Y,Q)=>{let G=Y.split("|").map((W)=>W.trim()),q=[];for(let W of G){let U=l3(W);switch(U.name){case"required":q.push("required");break;case"email":q.push('type="email"');break;case"url":q.push('type="url"');break;case"numeric":case"integer":if(q.push('type="number"'),U.name==="integer")q.push('step="1"');break;case"min":if(U.params?.[0])q.push(`minlength="${U.params[0]}"`);break;case"max":if(U.params?.[0])q.push(`maxlength="${U.params[0]}"`);break;case"regex":if(U.params?.[0])q.push(`pattern="${U.params[0]}"`);break}}return`<!-- @validate:${J}:${Y} -->${q.length>0?`<!-- attrs:${q.join(" ")} -->`:""}`})}var B8={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 X=Number(Z[0]);if(typeof $==="string")return $.length>=X||`Must be at least ${X} characters`;if(typeof $==="number")return $>=X||`Must be at least ${X}`;if(Array.isArray($))return $.length>=X||`Must have at least ${X} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length<=X||`Must be no more than ${X} characters`;if(typeof $==="number")return $<=X||`Must be no more than ${X}`;if(Array.isArray($))return $.length<=X||`Must have no more than ${X} 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[X,J]=Z.map(Number);if(typeof $==="string")return $.length>=X&&$.length<=J||`Must be between ${X} and ${J} characters`;if(typeof $==="number")return $>=X&&$<=J||`Must be between ${X} and ${J}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,X)=>{let J=Object.keys(X);for(let Y of J)if(Y.endsWith("_confirmation")&&X[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 X=new Date(String($)),J=new Date(Z[0]);return X<J||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let X=new Date(String($)),J=new Date(Z[0]);return X>J||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length===X||`Must be exactly ${X} characters`;if(Array.isArray($))return $.length===X||`Must have exactly ${X} 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 $H($){B8[$.name]=$}function _Y($,Z,X={}){let J=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=l3(Q),q=B8[G.name];if(!q){console.warn(`Unknown validation rule: ${G.name}`);continue}let W=q.validate($,G.params||[],X);if(W!==!0)J.push(W)}return{valid:J.length===0,errors:J}}function ZH($,Z){let X={},J=!0;for(let[Y,Q]of Object.entries(Z)){let G=_Y($[Y],Q,$);if(!G.valid)J=!1,X[Y]=G.errors}return{valid:J,errors:X}}function XH($,Z){let X=JSON.stringify(Z);return`
3268
3270
  <script>
3269
3271
  (function() {
3270
3272
  const form = document.getElementById('${$}');
@@ -3316,9 +3318,9 @@ catch { return 'Please enter a valid URL'; } },
3316
3318
  }
3317
3319
  });
3318
3320
  })();
3319
- </script>`.trim()}import p3 from"path";var M5;async function UY(){if(M5!==void 0)return M5;try{M5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{M5=null}return M5}var s3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},y0={},n0={},J1={};function ez($){if($)delete y0[$];else for(let Z of Object.keys(y0))delete y0[Z]}function $H(){let $=Object.entries(y0).map(([Z,X])=>({locale:Z,loadedAt:new Date(X.loadedAt),keyCount:B8(X.translations)}));return{size:Object.keys(y0).length,locales:Object.keys(y0),entries:$}}function B8($,Z=0){for(let X of Object.values($))if(Z++,X&&typeof X==="object"&&!Array.isArray(X))Z=B8(X,Z);return Z}function zY($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}function ZH($){if(y0[$])return"loaded";return J1[$]||"idle"}function XH($){return J1[$]==="loading"}function JH($){return!!y0[$]}async function HY($,Z){let{locales:X,parallel:J=!0,priority:Y={},onLocaleLoaded:Q,onComplete:G,onError:q}=$,W=J?X:[...X].sort((K,U)=>(Y[U]||0)-(Y[K]||0));if(J){let K=W.map(async(U)=>{try{await _$(U,Z),Q?.(U)}catch(z){q?.(U,z instanceof Error?z:Error(String(z)))}});await Promise.all(K)}else for(let K of W)try{await _$(K,Z),Q?.(K)}catch(U){q?.(K,U instanceof Error?U:Error(String(U)))}G?.()}function YH($,Z){queueMicrotask(()=>{HY($,Z).catch((X)=>{if(Z.debug)console.error("Background preload error:",X)})})}async function _$($,Z){if({...s3,...Z.i18n}.cache&&y0[$]){let Y=y0[$],Q=Z.i18n?.cacheMaxAge??0;if(!zY(Y,Q))return Y.translations}if(n0[$]?.state==="loading")return n0[$].promise;J1[$]="loading";let J=i3($,Z).then((Y)=>{return J1[$]="loaded",delete n0[$],Y}).catch((Y)=>{throw J1[$]="error",n0[$]={promise:J,state:"error",error:Y instanceof Error?Y:Error(String(Y))},Y});return n0[$]={promise:J,state:"loading"},J}function BY($){return y0[$]?.translations}async function QH($,Z){let X=BY($);if(X)return X;return _$($,Z)}async function GH($,Z){if(y0[$])return y0[$].translations;if(n0[$]){if(Z)return Promise.race([n0[$].promise,new Promise((X,J)=>setTimeout(()=>J(Error(`Timeout waiting for locale: ${$}`)),Z))]);return n0[$].promise}throw Error(`Locale "${$}" is not loading. Call loadTranslationLazy first.`)}function qH(){return Object.entries(J1).filter(([$,Z])=>Z==="loading").map(([$])=>$)}function WH($){if($)delete n0[$],delete J1[$];else{for(let Z of Object.keys(n0))delete n0[Z];for(let Z of Object.keys(J1))delete J1[Z]}}async function i3($,Z){let X={...s3,...Z.i18n},J=p3.isAbsolute(X.translationsDir)?X.translationsDir:p3.resolve(Z.root||process.cwd(),X.translationsDir);try{let Y=await UY(),Q=Y?await Y($,{translationsDir:J,defaultLocale:X.defaultLocale,sources:FY(X.format)}):await jY($,X,J);if(Q===void 0){if($!==X.defaultLocale)return i3(X.defaultLocale,Z);return{}}let G=Q;if(X.cache)y0[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Y){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Y);if($!==X.defaultLocale)return i3(X.defaultLocale,Z);return{}}}async function jY($,Z,X){let J=p3.join(X,`${$}${_Y(Z.format)}`);try{let Y=await import(J);return Y.default||Y}catch(Y){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return VY(Q);if(Z.format==="json")return JSON.parse(Q);throw Y}catch{return}}}function _Y($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function VY($){let Z={},X=$.split(`
3320
- `),J=[{obj:Z,indent:-1}];for(let Y of X){let Q=Y.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let q=J[J.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,K,U]=W,z=K.trim(),H=U.trim();if(H==="")q[z]={},J.push({obj:q[z],indent:G});else q[z]=OY(H)}}return Z}function OY($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let X=Number($);if(!Number.isNaN(X)&&$!=="")return X;return $}function FY($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function LY($,Z){return _$($,Z)}function wY($,Z){for(let X of $){let J=X.trim(),Y=J.match(/^\{(\d+)\}\s*(.*)$/);if(Y){let G=Number.parseInt(Y[1],10);if(Z===G)return Y[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),q=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=q)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function RY($,Z={}){return j8($,Z)}function j8($,Z){let X="",J=0;while(J<$.length)if($[J]==="{"){let Y=DY($,J);if(Y===-1){X+=$[J],J++;continue}let Q=$.slice(J+1,Y);X+=NY(Q,Z),J=Y+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")X+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")X+=$[J+1],J+=2;else X+=$[J],J++;else X+=$[J],J++;return X}function DY($,Z){let X=0;for(let J=Z;J<$.length;J++)if($[J]==="{")X++;else if($[J]==="}"){if(X--,X===0)return J}return-1}function NY($,Z){let X=MY($);if(X.length===0)return`{${$}}`;let J=X[0].trim(),Y=Z[J];if(X.length===1)return Y!==void 0?String(Y):`{${J}}`;switch(X[1].trim().toLowerCase()){case"plural":return AY(Y,X.slice(2).join(","),Z);case"select":return IY(Y,X.slice(2).join(","));case"selectordinal":return TY(Y,X.slice(2).join(","));case"number":return bY(Y,X[2]?.trim());case"date":return yY(Y,X[2]?.trim());case"time":return SY(Y,X[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function MY($){let Z=[],X="",J=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if(Q==="{")J++,X+=Q;else if(Q==="}")J--,X+=Q;else if(Q===","&&J===0)Z.push(X),X="";else X+=Q}if(X)Z.push(X);return Z}function AY($,Z,X){let J=Number($)||0,Y=o3(Z),Q=`=${J}`;if(Y[Q])return c3(Y[Q],J,X);let G=kY(J);if(Y[G])return c3(Y[G],J,X);if(Y.other)return c3(Y.other,J,X);return String(J)}function c3($,Z,X){let J=$.replace(/#/g,String(Z));return j8(J,X)}function kY($){let Z=Math.abs($),X=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(X===1&&J===0)return"one";return"other"}function IY($,Z){let X=String($||""),J=o3(Z);if(J[X])return J[X];return J.other||String($)}function TY($,Z){let X=Number($)||0,J=o3(Z),Y=EY(X);if(J[Y])return J[Y].replace(/#/g,String(X));if(J.other)return J.other.replace(/#/g,String(X));return String(X)}function EY($){let Z=Math.abs($),X=Z%10,J=Z%100;if(X===1&&J!==11)return"one";if(X===2&&J!==12)return"two";if(X===3&&J!==13)return"few";return"other"}function o3($){let Z={},X=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=X.exec($);while(J!==null)Z[J[1]]=J[2],J=X.exec($);return Z}function bY($,Z){let X=Number($);if(Number.isNaN(X))return String($);switch(Z){case"integer":return Math.floor(X).toLocaleString();case"percent":return`${(X*100).toFixed(0)}%`;case"currency":return X.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return X.toLocaleString()}}function yY($,Z){let X=$ instanceof Date?$:new Date(String($));if(Number.isNaN(X.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return X.toLocaleDateString(void 0,J)}function SY($,Z){let X=$ instanceof Date?$:new Date(String($));if(Number.isNaN(X.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return X.toLocaleTimeString(void 0,J)}function CY($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function n3($,Z,X=!0,J={}){let Y=$.split("."),Q=Z;for(let q of Y){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return X?$:"";let G=String(Q);if(CY(G))return RY(G,J);if(G.includes("|")&&"count"in J){let q=Number(J.count),W=G.split("|");G=wY(W,q)}for(let[q,W]of Object.entries(J)){let K=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${K}`,"g"),String(W))}return G}async function _8($,Z,X,J){let Y=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...s3,...J.i18n},q=await LY(G.locale,J);Z.__translations=q,Z.__locale=G.locale,Z.__i18nConfig=G,Y=await H8(Y,Q,async(U,z,H,B,j)=>{try{let _={};if(H)try{let V=[()=>JSON.parse(H),()=>{let O=`{"data":${H}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return R0(H,Z)}];for(let O of V)try{if(_=O(),Object.keys(_).length>0)break}catch{}}catch(V){if(J.debug)console.error("Error parsing parameters for @translate directive:",V)}return n3(z,q,G.fallbackToKey,_)||B.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,l.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${Y.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Y.matchAll(W)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,H)=>console.warn(`Match ${H}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Y=await H8(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,H,B)=>{try{let j={};if(H)try{let _=[()=>JSON.parse(H),()=>{let L=`{"data":${H}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return R0(H,Z)}];for(let L of _)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return n3(z,q,G.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,l.EVALUATION_ERROR)}}),Y}async function H8($,Z,X){let J=[];return $.replace(Z,(Q,...G)=>{let q=X(Q,...G).then((W)=>({match:Q,replacement:W}));return J.push(q),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:q})=>Q.replace(G,q),$)}function KH($,Z=!0){return(X,J={})=>{return n3(X,$,Z,J)}}var A5=/<\/?template\b[^>]*>/gi,PY=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function vY($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return PY.test(Z)}function V$($){A5.lastIndex=0;let Z;while((Z=A5.exec($))!==null){if(Z[0].startsWith("</")||vY(Z[0]))continue;let X=Z.index,J=A5.lastIndex,Y=1,Q;while((Q=A5.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:X,openEnd:J,closeStart:G,end:A5.lastIndex,content:$.slice(J,G)}}}else Y++;return null}return null}import z0 from"path";function r3($,Z){let X=0;for(let J=Z;J<$.length;J++){let Y=$[J];if(Y==="("||Y==="["||Y==="{")X++;else if(Y===")"||Y==="]"||Y==="}")X--;else if(Y===","&&X===0)return J}return-1}function fY($,Z,X){let J=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(J);while(Q){let G=Q.index,q=G+Q[0].length-1,W=1,K=q+1;while(K<J.length&&W>0){if(J[K]==="(")W++;else if(J[K]===")")W--;K++}if(W!==0)break;let U=J.substring(q+1,K-1),z=`${X}(${U})`;J=J.substring(0,G)+z+J.substring(K),Y.lastIndex=G+z.length,Q=Y.exec(J)}return J}function xY($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function O8($){let Z=$,X=[],J=new Set,Y=0,Q=0,G=Z.length,q=(z)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===z){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let z=1;while(Q<G&&z>0)if(Z[Q]==="{")z++,Q++;else if(Z[Q]==="}")z--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')q(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},K=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3321
- `)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},U=()=>{if(Y!==0)return;let z=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!J.has(j))X.push(j),J.add(j);return}let H=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!J.has(j))X.push(j),J.add(j);return}let B=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!J.has(j))X.push(j),J.add(j)}};while(Q<G){if(K())continue;if(Z[Q]==="'"||Z[Q]==='"'){q(Z[Q]);continue}if(Z[Q]==="`"){W();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])))U();Q++}return X.join(", ")}function F8($,Z=""){let X=O8($).split(",").map((J)=>J.trim()).filter(Boolean);return`
3321
+ </script>`.trim()}import p3 from"path";var N5;async function VY(){if(N5!==void 0)return N5;try{N5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{N5=null}return N5}var s3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},y0={},n0={},J1={};function qH($){if($)delete y0[$];else for(let Z of Object.keys(y0))delete y0[Z]}function WH(){let $=Object.entries(y0).map(([Z,X])=>({locale:Z,loadedAt:new Date(X.loadedAt),keyCount:_8(X.translations)}));return{size:Object.keys(y0).length,locales:Object.keys(y0),entries:$}}function _8($,Z=0){for(let X of Object.values($))if(Z++,X&&typeof X==="object"&&!Array.isArray(X))Z=_8(X,Z);return Z}function OY($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}function UH($){if(y0[$])return"loaded";return J1[$]||"idle"}function zH($){return J1[$]==="loading"}function KH($){return!!y0[$]}async function FY($,Z){let{locales:X,parallel:J=!0,priority:Y={},onLocaleLoaded:Q,onComplete:G,onError:q}=$,W=J?X:[...X].sort((U,z)=>(Y[z]||0)-(Y[U]||0));if(J){let U=W.map(async(z)=>{try{await _$(z,Z),Q?.(z)}catch(K){q?.(z,K instanceof Error?K:Error(String(K)))}});await Promise.all(U)}else for(let U of W)try{await _$(U,Z),Q?.(U)}catch(z){q?.(U,z instanceof Error?z:Error(String(z)))}G?.()}function HH($,Z){queueMicrotask(()=>{FY($,Z).catch((X)=>{if(Z.debug)console.error("Background preload error:",X)})})}async function _$($,Z){if({...s3,...Z.i18n}.cache&&y0[$]){let Y=y0[$],Q=Z.i18n?.cacheMaxAge??0;if(!OY(Y,Q))return Y.translations}if(n0[$]?.state==="loading")return n0[$].promise;J1[$]="loading";let J=i3($,Z).then((Y)=>{return J1[$]="loaded",delete n0[$],Y}).catch((Y)=>{throw J1[$]="error",n0[$]={promise:J,state:"error",error:Y instanceof Error?Y:Error(String(Y))},Y});return n0[$]={promise:J,state:"loading"},J}function LY($){return y0[$]?.translations}async function BH($,Z){let X=LY($);if(X)return X;return _$($,Z)}async function jH($,Z){if(y0[$])return y0[$].translations;if(n0[$]){if(Z)return Promise.race([n0[$].promise,new Promise((X,J)=>setTimeout(()=>J(Error(`Timeout waiting for locale: ${$}`)),Z))]);return n0[$].promise}throw Error(`Locale "${$}" is not loading. Call loadTranslationLazy first.`)}function _H(){return Object.entries(J1).filter(([$,Z])=>Z==="loading").map(([$])=>$)}function VH($){if($)delete n0[$],delete J1[$];else{for(let Z of Object.keys(n0))delete n0[Z];for(let Z of Object.keys(J1))delete J1[Z]}}async function i3($,Z){let X={...s3,...Z.i18n},J=p3.isAbsolute(X.translationsDir)?X.translationsDir:p3.resolve(Z.root||process.cwd(),X.translationsDir);try{let Y=await VY(),Q=Y?await Y($,{translationsDir:J,defaultLocale:X.defaultLocale,sources:MY(X.format)}):await wY($,X,J);if(Q===void 0){if($!==X.defaultLocale)return i3(X.defaultLocale,Z);return{}}let G=Q;if(X.cache)y0[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Y){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Y);if($!==X.defaultLocale)return i3(X.defaultLocale,Z);return{}}}async function wY($,Z,X){let J=p3.join(X,`${$}${RY(Z.format)}`);try{let Y=await import(J);return Y.default||Y}catch(Y){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return DY(Q);if(Z.format==="json")return JSON.parse(Q);throw Y}catch{return}}}function RY($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function DY($){let Z={},X=$.split(`
3322
+ `),J=[{obj:Z,indent:-1}];for(let Y of X){let Q=Y.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let q=J[J.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,U,z]=W,K=U.trim(),H=z.trim();if(H==="")q[K]={},J.push({obj:q[K],indent:G});else q[K]=NY(H)}}return Z}function NY($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let X=Number($);if(!Number.isNaN(X)&&$!=="")return X;return $}function MY($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function AY($,Z){return _$($,Z)}function kY($,Z){for(let X of $){let J=X.trim(),Y=J.match(/^\{(\d+)\}\s*(.*)$/);if(Y){let G=Number.parseInt(Y[1],10);if(Z===G)return Y[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),q=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=q)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function IY($,Z={}){return V8($,Z)}function V8($,Z){let X="",J=0;while(J<$.length)if($[J]==="{"){let Y=TY($,J);if(Y===-1){X+=$[J],J++;continue}let Q=$.slice(J+1,Y);X+=EY(Q,Z),J=Y+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")X+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")X+=$[J+1],J+=2;else X+=$[J],J++;else X+=$[J],J++;return X}function TY($,Z){let X=0;for(let J=Z;J<$.length;J++)if($[J]==="{")X++;else if($[J]==="}"){if(X--,X===0)return J}return-1}function EY($,Z){let X=bY($);if(X.length===0)return`{${$}}`;let J=X[0].trim(),Y=Z[J];if(X.length===1)return Y!==void 0?String(Y):`{${J}}`;switch(X[1].trim().toLowerCase()){case"plural":return yY(Y,X.slice(2).join(","),Z);case"select":return CY(Y,X.slice(2).join(","));case"selectordinal":return PY(Y,X.slice(2).join(","));case"number":return fY(Y,X[2]?.trim());case"date":return xY(Y,X[2]?.trim());case"time":return gY(Y,X[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function bY($){let Z=[],X="",J=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if(Q==="{")J++,X+=Q;else if(Q==="}")J--,X+=Q;else if(Q===","&&J===0)Z.push(X),X="";else X+=Q}if(X)Z.push(X);return Z}function yY($,Z,X){let J=Number($)||0,Y=o3(Z),Q=`=${J}`;if(Y[Q])return c3(Y[Q],J,X);let G=SY(J);if(Y[G])return c3(Y[G],J,X);if(Y.other)return c3(Y.other,J,X);return String(J)}function c3($,Z,X){let J=$.replace(/#/g,String(Z));return V8(J,X)}function SY($){let Z=Math.abs($),X=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(X===1&&J===0)return"one";return"other"}function CY($,Z){let X=String($||""),J=o3(Z);if(J[X])return J[X];return J.other||String($)}function PY($,Z){let X=Number($)||0,J=o3(Z),Y=vY(X);if(J[Y])return J[Y].replace(/#/g,String(X));if(J.other)return J.other.replace(/#/g,String(X));return String(X)}function vY($){let Z=Math.abs($),X=Z%10,J=Z%100;if(X===1&&J!==11)return"one";if(X===2&&J!==12)return"two";if(X===3&&J!==13)return"few";return"other"}function o3($){let Z={},X=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=X.exec($);while(J!==null)Z[J[1]]=J[2],J=X.exec($);return Z}function fY($,Z){let X=Number($);if(Number.isNaN(X))return String($);switch(Z){case"integer":return Math.floor(X).toLocaleString();case"percent":return`${(X*100).toFixed(0)}%`;case"currency":return X.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return X.toLocaleString()}}function xY($,Z){let X=$ instanceof Date?$:new Date(String($));if(Number.isNaN(X.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return X.toLocaleDateString(void 0,J)}function gY($,Z){let X=$ instanceof Date?$:new Date(String($));if(Number.isNaN(X.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return X.toLocaleTimeString(void 0,J)}function hY($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function n3($,Z,X=!0,J={}){let Y=$.split("."),Q=Z;for(let q of Y){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return X?$:"";let G=String(Q);if(hY(G))return IY(G,J);if(G.includes("|")&&"count"in J){let q=Number(J.count),W=G.split("|");G=kY(W,q)}for(let[q,W]of Object.entries(J)){let U=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${U}`,"g"),String(W))}return G}async function O8($,Z,X,J){let Y=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...s3,...J.i18n},q=await AY(G.locale,J);Z.__translations=q,Z.__locale=G.locale,Z.__i18nConfig=G,Y=await j8(Y,Q,async(z,K,H,B,j)=>{try{let _={};if(H)try{let V=[()=>JSON.parse(H),()=>{let O=`{"data":${H}}`,L=JSON.parse(O);return typeof L.data==="object"?L.data:{}},()=>{return R0(H,Z)}];for(let O of V)try{if(_=O(),Object.keys(_).length>0)break}catch{}}catch(V){if(J.debug)console.error("Error parsing parameters for @translate directive:",V)}return n3(K,q,G.fallbackToKey,_)||B.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${K}'): ${_ instanceof Error?_.message:String(_)}`,l.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${Y.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...Y.matchAll(W)];console.warn(`Found ${z.length} @translate matches`),z.forEach((K,H)=>console.warn(`Match ${H}: ${K[0]}, Key: ${K[1]}, Params: ${K[2]||"none"}`))}return Y=await j8(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,K,H,B)=>{try{let j={};if(H)try{let _=[()=>JSON.parse(H),()=>{let F=`{"data":${H}}`,V=JSON.parse(F);return typeof V.data==="object"?V.data:{}},()=>{return R0(H,Z)}];for(let F of _)try{if(j=F(),Object.keys(j).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return n3(K,q,G.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${K}'): ${j instanceof Error?j.message:String(j)}`,l.EVALUATION_ERROR)}}),Y}async function j8($,Z,X){let J=[];return $.replace(Z,(Q,...G)=>{let q=X(Q,...G).then((W)=>({match:Q,replacement:W}));return J.push(q),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:q})=>Q.replace(G,q),$)}function OH($,Z=!0){return(X,J={})=>{return n3(X,$,Z,J)}}var M5=/<\/?template\b[^>]*>/gi,uY=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function dY($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return uY.test(Z)}function V$($){M5.lastIndex=0;let Z;while((Z=M5.exec($))!==null){if(Z[0].startsWith("</")||dY(Z[0]))continue;let X=Z.index,J=M5.lastIndex,Y=1,Q;while((Q=M5.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:X,openEnd:J,closeStart:G,end:M5.lastIndex,content:$.slice(J,G)}}}else Y++;return null}return null}import K0 from"path";function r3($,Z){let X=0;for(let J=Z;J<$.length;J++){let Y=$[J];if(Y==="("||Y==="["||Y==="{")X++;else if(Y===")"||Y==="]"||Y==="}")X--;else if(Y===","&&X===0)return J}return-1}function mY($,Z,X){let J=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(J);while(Q){let G=Q.index,q=G+Q[0].length-1,W=1,U=q+1;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")")W--;U++}if(W!==0)break;let z=J.substring(q+1,U-1),K=`${X}(${z})`;J=J.substring(0,G)+K+J.substring(U),Y.lastIndex=G+K.length,Q=Y.exec(J)}return J}function lY($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function L8($){let Z=$,X=[],J=new Set,Y=0,Q=0,G=Z.length,q=(K)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===K){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let K=1;while(Q<G&&K>0)if(Z[Q]==="{")K++,Q++;else if(Z[Q]==="}")K--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')q(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},U=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3323
+ `)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},z=()=>{if(Y!==0)return;let K=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let j=K[2];if(!J.has(j))X.push(j),J.add(j);return}let H=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!J.has(j))X.push(j),J.add(j);return}let B=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!J.has(j))X.push(j),J.add(j)}};while(Q<G){if(U())continue;if(Z[Q]==="'"||Z[Q]==='"'){q(Z[Q]);continue}if(Z[Q]==="`"){W();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])))z();Q++}return X.join(", ")}function w8($,Z=""){let X=L8($).split(",").map((J)=>J.trim()).filter(Boolean);return`
3322
3324
  (function() {
3323
3325
  ${c1("var",X)}
3324
3326
  var __destroyHooks = [];
@@ -3327,11 +3329,11 @@ catch { return 'Please enter a valid URL'; } },
3327
3329
 
3328
3330
  ${$}
3329
3331
  ${Z}})();
3330
- `}function L8($,Z){return`
3332
+ `}function R8($,Z){return`
3331
3333
  // Register scope variables for STX runtime
3332
3334
  if (!window.stx._scopes) window.stx._scopes = {};
3333
3335
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
3334
- ${O8($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
3336
+ ${L8($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
3335
3337
  `)}
3336
3338
  // #1767: when the bundler renamed a component const that collided with an
3337
3339
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -3339,7 +3341,7 @@ ${O8($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
3339
3341
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
3340
3342
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
3341
3343
  window.stx._scopes['${Z}'] = __scopeRegistration;
3342
- `}function gY($,Z){let X=L8($,Z),J=`
3344
+ `}function cY($,Z){let X=R8($,Z),J=`
3343
3345
  (function() {
3344
3346
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
3345
3347
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -3348,33 +3350,33 @@ ${O8($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
3348
3350
  } finally {
3349
3351
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3350
3352
  }
3351
- })();`;return J+F8($,X)+`
3353
+ })();`;return J+w8($,X)+`
3352
3354
  } finally {
3353
3355
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3354
3356
  }
3355
- })();`}function hY($,Z){if(q1($)){let Y=q1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};return{html:v1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0}}let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null,stamped:!0}}return{html:$,mergedIntoExisting:null,stamped:!1}}var V8=0,NH=new p1(500),w8=new Set;function MH(){w8.clear()}function uY($){if($.__onceStore instanceof Set)return $.__onceStore;return w8}async function a3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||z0.join(z0.dirname(X),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let q=fY($,"@partial","@include"),W=uY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,L,V)=>{let O=L.trim(),F=`${X}:${O}`;if(W.has(F))return"";return W.add(F),L});{let _=/@includeIf\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")")F--;w++}if(F!==0)break;let R=q.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let M=D[1],k=K(M,G,X),N="";if(k&&await Bun.file(k).exists())Y.add(k),N=`@include(${R})`;q=q.substring(0,V)+N+q.substring(w),_.lastIndex=0}}for(let[_,L]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=V.exec(q))!==null){let F=O.index,w=F+O[0].length-1,R=1,D=w+1;while(D<q.length&&R>0){if(q[D]==="(")R++;else if(q[D]===")")R--;D++}if(R!==0)break;let M=q.substring(w+1,D-1),k=r3(M,0);if(k===-1){V.lastIndex=D;continue}let N=M.substring(0,k).trim(),A=M.substring(k+1).trim(),T=A.match(/^\s*['"]([^'"]+)['"]/);if(!T){V.lastIndex=D;continue}let I=T[1],S=A.substring(T[0].length),E,b=r3(S,0);if(b!==-1)E=S.substring(b+1).trim();try{let y=`Boolean(${N})`,P;if(q0(y)){let g=W0(y,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(e(y,Z));let f=L?!P:P,d="";if(f){let g=K(I,G,X);if(g&&await Bun.file(g).exists())Y.add(g);d=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,F)+d+q.substring(D),V.lastIndex=0}catch(y){let P=y instanceof Error?y.message:String(y),f=B0("Include",`Error evaluating ${_} condition: ${P}`,X,$,F);q=q.substring(0,F)+f+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),M=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){_.lastIndex=0,q=q.replace(D,"");continue}let[,k,N,A,T]=M;try{let I,S=N.trim();if(q0(S))I=W0(S,Object.keys(Z))(...Object.values(Z));else I=e(S,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let y={...Z,[A]:b},P=await H(k,y,$,V);E+=P}else if(T)E=await H(T,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(I){let S=I instanceof Error?I.message:String(I);q=q.substring(0,V)+B0("Each",`Error in @each: ${S}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,L;while((L=_.exec(q))!==null){let V=L.index,O=V+L[0].length-1,F=1,w=O+1;while(w<q.length&&F>0){if(q[w]==="(")F++;else if(q[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),M=R.match(/^\s*(\[[^\]]+\])/);if(!M){_.lastIndex=0,q=q.replace(D,"");continue}let k=M[1],N=R.slice(M[0].length),A,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[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++}A=N.substring(0,b+1),N=N.slice(b+1)}let I,S=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(S)I=S[1];try{let E=JSON.parse(k.replace(/'/g,'"')),b={};if(A)try{b=R0(A,Z)}catch(P){let f=P instanceof Error?P.message:String(P);if(J.debug){let d=B0("Include",`Error parsing includeFirst variables: ${f}`,X,$,V,D);q=q.replace(D,()=>d)}else q=q.replace(D,()=>I||"");continue}let y=!1;for(let P of E){let f=K(P,G,X);if(!f)continue;if(await t(f)){let d=await H(P,b,$,V);q=q.replace(D,()=>d),y=!0;break}}if(!y)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let P=B0("Include",`None of the includeFirst paths exist: ${k}`,X,$,V,D);q=q.replace(D,()=>P)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),y=B0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>y)}_.lastIndex=0}}function K(_,L,V){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let F=z0.resolve(L),w=z0.resolve(z0.dirname(V)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=z0.resolve(L,O);else R=z0.resolve(w,O);let D=z0.normalize(R),M=D.startsWith(F+z0.sep)||D===F,k=D.startsWith(w+z0.sep)||D===w,N=!1,A=z0.dirname(w);if(D.startsWith(A+z0.sep)){if(!z0.relative(A,D).split(z0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))N=!0}if(!M&&!k&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${F}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let U=z0.resolve(X);Q.add(U);function z(_,L,V,O){return J.onIncludeError?.({includePath:_,templatePath:X,message:L,partialsDir:G}),B0("Include",L,X,V,O)}async function H(_,L={},V,O){let F=K(_,G,X);if(!F)return z(_,`Could not resolve path for include: ${_}`,V,O);let w=z0.resolve(F);if(Q.has(w)){let R=[...Q,w].map((D)=>z0.basename(D)).join(" -> ");return z(_,`Circular include detected: ${R}`,V,O)}try{Y.add(F);let R;if(!R)try{R=await Bun.file(F).text()}catch(f){let d=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${d}`,V,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-wz87behc.js");R=f(R,Z)}if(R&&(J.debug||!O5()&&!Z$()))try{let{warnUnbalancedTags:f}=await import("./chunk-ragz3hr7.js");f(R,F)}catch{}let D=R;try{let{processESImports:f}=await import("./chunk-34d33f18.js");await f(R,Z,F,J,Y)}catch(f){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,f instanceof Error?f.message:f)}let M=V$(D);if(M)D=M.content.trim();let N=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),A="";if(N)A=`<style${N[1]}>${N[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=G1(R,F);for(let[f,d]of Object.entries(L))T[f]=d;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...R.matchAll(I)],E="",b=null;for(let f of S){let d=f[1]||"",g=f[2]||"",Q0=d.includes("server"),e0=M1(d);if(!Q0&&g.trim()){let{interpolateScriptExpressions:X0}=await import("./chunk-kr2q64k9.js");g=X0(g,T)}let k0="";try{let{extractAndStripCssImports:X0,renderVendorStyleTags:H0}=await import("./chunk-4afj0w1m.js"),I0=X0(g,{filePath:F,projectRoot:process.cwd()});g=I0.code,k0=H0(I0.styles)}catch(X0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,X0 instanceof Error?X0.message:X0)}if(e0&&g.trim())g=A1(g);if(!Q0){try{let{injectBrowserCoreAutoImports:H0}=await import("./chunk-4afj0w1m.js");g=H0(g).code;let{hasUserImports:I0,bundleClientScript:E0}=await import("./chunk-s0v2g53x.js");if(I0(g))g=await E0(g,F,{projectRoot:process.cwd()})}catch(H0){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,H0 instanceof Error?H0.message:H0)}let{stripStxRuntimeImports:X0}=await import("./chunk-3cqwrprg.js");g=X0(g)}let C0=xY(g);if(C0&&!Q0){b=`stx_scope_${z0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++V8}`;let X0=$1(g),H0=gY(X0,b);E+=`${k0}<script data-stx-scoped data-stx-run="always">${H0}</script>
3356
- `;continue}if(Q0)try{let{extractVariables:X0}=await import("./chunk-f0f8pne1.js");await X0(g,T,F)}catch(X0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,X0)}if(!Q0&&!C0){let X0=d.replace(/\bclient\b/i,"").trim();b=`stx_scope_${z0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++V8}`;let H0=$1(g),I0=L8(H0,b),E0=F8(H0,I0);E+=`${k0}<script data-stx-scoped data-stx-run="always"${X0?` ${X0}`:""}>${E0}</script>
3357
- `}}if(b){let f=hY(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting;else if(!f.stamped)console.warn(`[stx] ${z0.relative(process.cwd(),F)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`)}if(D.includes("@include")||D.includes("@partial"))D=await a3(D,T,F,J,Y,Q);let{processLoops:y}=await import("./chunk-rqx69p0n.js"),P=y(D,T,F);if(P=X1(P,T,F),P=O1(P,T,F),A)P+=`
3357
+ })();`}function pY($,Z){if(q1($)){let Y=q1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};return{html:v1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0}}let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};let Q=X[1],G=X[2],q=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${q}${$.slice(X[0].length)}`,mergedIntoExisting:null,stamped:!0}}return{html:$,mergedIntoExisting:null,stamped:!1}}var F8=0,yH=new p1(500),D8=new Set;function SH(){D8.clear()}function iY($){if($.__onceStore instanceof Set)return $.__onceStore;return D8}async function a3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||K0.join(K0.dirname(X),"partials");if(G&&!K0.isAbsolute(G))G=K0.resolve(process.cwd(),G);let q=mY($,"@partial","@include"),W=iY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,F,V)=>{let O=F.trim(),L=`${X}:${O}`;if(W.has(L))return"";return W.add(L),F});{let _=/@includeIf\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")")L--;w++}if(L!==0)break;let R=q.substring(O+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let M=D[1],k=U(M,G,X),N="";if(k&&await Bun.file(k).exists())Y.add(k),N=`@include(${R})`;q=q.substring(0,V)+N+q.substring(w),_.lastIndex=0}}for(let[_,F]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=V.exec(q))!==null){let L=O.index,w=L+O[0].length-1,R=1,D=w+1;while(D<q.length&&R>0){if(q[D]==="(")R++;else if(q[D]===")")R--;D++}if(R!==0)break;let M=q.substring(w+1,D-1),k=r3(M,0);if(k===-1){V.lastIndex=D;continue}let N=M.substring(0,k).trim(),A=M.substring(k+1).trim(),T=A.match(/^\s*['"]([^'"]+)['"]/);if(!T){V.lastIndex=D;continue}let I=T[1],S=A.substring(T[0].length),E,b=r3(S,0);if(b!==-1)E=S.substring(b+1).trim();try{let y=`Boolean(${N})`,P;if(q0(y)){let g=W0(y,Object.keys(Z));P=Boolean(g(...Object.values(Z)))}else P=Boolean(e(y,Z));let f=F?!P:P,d="";if(f){let g=U(I,G,X);if(g&&await Bun.file(g).exists())Y.add(g);d=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+d+q.substring(D),V.lastIndex=0}catch(y){let P=y instanceof Error?y.message:String(y),f=B0("Include",`Error evaluating ${_} condition: ${P}`,X,$,L);q=q.substring(0,L)+f+q.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),M=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!M){_.lastIndex=0,q=q.replace(D,"");continue}let[,k,N,A,T]=M;try{let I,S=N.trim();if(q0(S))I=W0(S,Object.keys(Z))(...Object.values(Z));else I=e(S,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let y={...Z,[A]:b},P=await H(k,y,$,V);E+=P}else if(T)E=await H(T,{},$,V);q=q.substring(0,V)+E+q.substring(w+1),_.lastIndex=0}catch(I){let S=I instanceof Error?I.message:String(I);q=q.substring(0,V)+B0("Each",`Error in @each: ${S}`,X,$,V)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,F;while((F=_.exec(q))!==null){let V=F.index,O=V+F[0].length-1,L=1,w=O+1;while(w<q.length&&L>0){if(q[w]==="(")L++;else if(q[w]===")"){if(L--,L===0)break}w++}if(L!==0)break;let R=q.substring(O+1,w),D=q.substring(V,w+1),M=R.match(/^\s*(\[[^\]]+\])/);if(!M){_.lastIndex=0,q=q.replace(D,"");continue}let k=M[1],N=R.slice(M[0].length),A,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[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++}A=N.substring(0,b+1),N=N.slice(b+1)}let I,S=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(S)I=S[1];try{let E=JSON.parse(k.replace(/'/g,'"')),b={};if(A)try{b=R0(A,Z)}catch(P){let f=P instanceof Error?P.message:String(P);if(J.debug){let d=B0("Include",`Error parsing includeFirst variables: ${f}`,X,$,V,D);q=q.replace(D,()=>d)}else q=q.replace(D,()=>I||"");continue}let y=!1;for(let P of E){let f=U(P,G,X);if(!f)continue;if(await t(f)){let d=await H(P,b,$,V);q=q.replace(D,()=>d),y=!0;break}}if(!y)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let P=B0("Include",`None of the includeFirst paths exist: ${k}`,X,$,V,D);q=q.replace(D,()=>P)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),y=B0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);q=q.replace(D,()=>y)}_.lastIndex=0}}function U(_,F,V){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let L=K0.resolve(F),w=K0.resolve(K0.dirname(V)),R;if(!O.startsWith("./")&&!O.startsWith("../"))R=K0.resolve(F,O);else R=K0.resolve(w,O);let D=K0.normalize(R),M=D.startsWith(L+K0.sep)||D===L,k=D.startsWith(w+K0.sep)||D===w,N=!1,A=K0.dirname(w);if(D.startsWith(A+K0.sep)){if(!K0.relative(A,D).split(K0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))N=!0}if(!M&&!k&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${L}, ${w}`),null;return D}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let z=K0.resolve(X);Q.add(z);function K(_,F,V,O){return J.onIncludeError?.({includePath:_,templatePath:X,message:F,partialsDir:G}),B0("Include",F,X,V,O)}async function H(_,F={},V,O){let L=U(_,G,X);if(!L)return K(_,`Could not resolve path for include: ${_}`,V,O);let w=K0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>K0.basename(D)).join(" -> ");return K(_,`Circular include detected: ${R}`,V,O)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(f){let d=f instanceof Error?f.message:String(f);return K(_,`Error loading include file ${_}: ${d}`,V,O)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-3p2w5dag.js");R=f(R,Z)}if(R&&(J.debug||!V5()&&!Z$()))try{let{warnUnbalancedTags:f}=await import("./chunk-ragz3hr7.js");f(R,L)}catch{}let D=R;try{let{processESImports:f}=await import("./chunk-hcjmvwnt.js");await f(R,Z,L,J,Y)}catch(f){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,f instanceof Error?f.message:f)}let M=V$(D);if(M)D=M.content.trim();let N=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),A="";if(N)A=`<style${N[1]}>${N[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=G1(R,L);for(let[f,d]of Object.entries(F))T[f]=d;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...R.matchAll(I)],E="",b=null;for(let f of S){let d=f[1]||"",g=f[2]||"",Q0=d.includes("server"),e0=M1(d);if(!Q0&&g.trim()){let{interpolateScriptExpressions:X0}=await import("./chunk-pgvskhg2.js");g=X0(g,T)}let k0="";try{let{extractAndStripCssImports:X0,renderVendorStyleTags:H0}=await import("./chunk-86d1vte8.js"),I0=X0(g,{filePath:L,projectRoot:process.cwd()});g=I0.code,k0=H0(I0.styles)}catch(X0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,X0 instanceof Error?X0.message:X0)}if(e0&&g.trim())g=A1(g);if(!Q0){try{let{injectBrowserCoreAutoImports:H0}=await import("./chunk-86d1vte8.js");g=H0(g).code;let{hasUserImports:I0,bundleClientScript:E0}=await import("./chunk-hysmnz0q.js");if(I0(g))g=await E0(g,L,{projectRoot:process.cwd()})}catch(H0){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,H0 instanceof Error?H0.message:H0)}let{stripStxRuntimeImports:X0}=await import("./chunk-edctags2.js");g=X0(g)}let C0=lY(g);if(C0&&!Q0){b=`stx_scope_${K0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++F8}`;let X0=$1(g),H0=cY(X0,b);E+=`${k0}<script data-stx-scoped data-stx-run="always">${H0}</script>
3358
+ `;continue}if(Q0)try{let{extractVariables:X0}=await import("./chunk-rvmt27kv.js");await X0(g,T,L)}catch(X0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,X0)}if(!Q0&&!C0){let X0=d.replace(/\bclient\b/i,"").trim();b=`stx_scope_${K0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++F8}`;let H0=$1(g),I0=R8(H0,b),E0=w8(H0,I0);E+=`${k0}<script data-stx-scoped data-stx-run="always"${X0?` ${X0}`:""}>${E0}</script>
3359
+ `}}if(b){let f=pY(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting;else if(!f.stamped)console.warn(`[stx] ${K0.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.`)}if(D.includes("@include")||D.includes("@partial"))D=await a3(D,T,L,J,Y,Q);let{processLoops:y}=await import("./chunk-3rbdvrp0.js"),P=y(D,T,L);if(P=X1(P,T,L),P=O1(P,T,L),A)P+=`
3358
3360
  `+A;if(E)P+=`
3359
- `+E;return P}catch(R){let D=R instanceof Error?R.message:String(R);return z(_,`Error processing include ${_}: ${D}`,V,O)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,L=_+j[0].length-1,V=1,O=L+1;while(O<q.length&&V>0){if(q[O]==="(")V++;else if(q[O]===")")V--;O++}if(V!==0)break;let F=q.substring(_,O),w=q.substring(L+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=O;continue}let D=R[1],M,k=w.substring(R[0].length),N=r3(k,0);if(N!==-1)M=k.substring(N+1).trim();let A={};if(M)try{A=R0(M,Z)}catch(I){let S=I instanceof Error?I.message:String(I);q=q.replace(F,B0("Include",`Error parsing include variables for ${D}: ${S}`,X,$,_)),B.lastIndex=0;continue}let T=await H(D,A,$,_);q=q.substring(0,_)+T+q.substring(O),B.lastIndex=0}return q}function t3($,Z){let X=$;function J(Y,Q,G,q){let W=Y,K=!0;while(K){K=!1;let U=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=W.match(U);if(!z||z.index===void 0)break;let H=z.index,B=z[1],j=H+z[0].length,_=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),V=1,O=j,F=-1;while(V>0&&O<W.length){let R=W.slice(O),D=R.match(_),M=R.match(L),k=D?O+D.index:1/0,N=M?O+M.index:1/0;if(k<N)V++,O=k+(D[0].length||1);else if(N<1/0){if(V--,V===0){F=N;break}O=N+G.length+1}else break}if(F===-1)break;let w=W.slice(j,F);if(!Z[B])Z[B]=[];if(q)Z[B].unshift(w);else Z[B].push(w);W=W.substring(0,H)+W.substring(F+`@${G}`.length),K=!0}return W}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function e3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
3360
- `)})}import*as $4 from"path";async function R8($,Z,X=""){if($4.basename(X)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return N8($,Z,X,"@js","@endjs")}async function D8($,Z,X=""){if($4.basename(X)==="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 N8($,Z,X,"@ts","@endts")}async function N8($,Z,X,J,Y){let Q=$,G=m1(`${J}([\\s\\S]*?)${Y}`,"g"),q=[],W;while((W=G.exec($))!==null)q.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:K,content:U,index:z}of q)try{let H={...Z,global:Z},B=Object.keys(H),j=Object.values(H),_=U.trim();if(J==="@ts")_=_.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=V.length>0?`return { ${V.join(", ")} };`:"return {};",F=`
3361
+ `+E;return P}catch(R){let D=R instanceof Error?R.message:String(R);return K(_,`Error processing include ${_}: ${D}`,V,O)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,F=_+j[0].length-1,V=1,O=F+1;while(O<q.length&&V>0){if(q[O]==="(")V++;else if(q[O]===")")V--;O++}if(V!==0)break;let L=q.substring(_,O),w=q.substring(F+1,O-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=O;continue}let D=R[1],M,k=w.substring(R[0].length),N=r3(k,0);if(N!==-1)M=k.substring(N+1).trim();let A={};if(M)try{A=R0(M,Z)}catch(I){let S=I instanceof Error?I.message:String(I);q=q.replace(L,B0("Include",`Error parsing include variables for ${D}: ${S}`,X,$,_)),B.lastIndex=0;continue}let T=await H(D,A,$,_);q=q.substring(0,_)+T+q.substring(O),B.lastIndex=0}return q}function t3($,Z){let X=$;function J(Y,Q,G,q){let W=Y,U=!0;while(U){U=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),K=W.match(z);if(!K||K.index===void 0)break;let H=K.index,B=K[1],j=H+K[0].length,_=new RegExp(`@${Q}\\(`),F=new RegExp(`@${G}(?![a-z])`),V=1,O=j,L=-1;while(V>0&&O<W.length){let R=W.slice(O),D=R.match(_),M=R.match(F),k=D?O+D.index:1/0,N=M?O+M.index:1/0;if(k<N)V++,O=k+(D[0].length||1);else if(N<1/0){if(V--,V===0){L=N;break}O=N+G.length+1}else break}if(L===-1)break;let w=W.slice(j,L);if(!Z[B])Z[B]=[];if(q)Z[B].unshift(w);else Z[B].push(w);W=W.substring(0,H)+W.substring(L+`@${G}`.length),U=!0}return W}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function e3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
3362
+ `)})}import*as $4 from"path";async function N8($,Z,X=""){if($4.basename(X)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return A8($,Z,X,"@js","@endjs")}async function M8($,Z,X=""){if($4.basename(X)==="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 A8($,Z,X,"@ts","@endts")}async function A8($,Z,X,J,Y){let Q=$,G=m1(`${J}([\\s\\S]*?)${Y}`,"g"),q=[],W;while((W=G.exec($))!==null)q.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:U,content:z,index:K}of q)try{let H={...Z,global:Z},B=Object.keys(H),j=Object.values(H),_=z.trim();if(J==="@ts")_=_.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=V.length>0?`return { ${V.join(", ")} };`:"return {};",L=`
3361
3363
  ${_}
3362
3364
  ${O}
3363
- `,R=Function(...B,F)(...j);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(K,"")}catch(H){console.error(`Error executing ${J} code block in ${X}:`,H);let B=H instanceof Error?H.message:String(H),j=B0(`${J} Directive`,`Error executing code: ${B}`,X,$,z,K);console.error(j),Q=Q.replace(K,"")}return Q}var dY=1000,mY=!1;function lY($,Z){let X=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",Y=0,Q;while((Q=X.exec($))!==null){let G=Q.index+Q[0].length,q=Q.index+Q[0].indexOf("("),W=j0($,"(",")",q);if(W===-1)continue;let K=$.slice(G,W).trim();if(!K)continue;if(!Object.keys(Z).some((H)=>new RegExp(`(?:^|[^\\w$.])${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(K)))continue;let z;try{let H=R0(K,Z);if(!H||typeof H!=="object")continue;z=JSON.stringify(H)}catch{continue}J+=$.slice(Y,G)+z,Y=W,X.lastIndex=W}return Y===0?$:J+$.slice(Y)}function cY($,Z){let X=/@component\s*\(/g,J=$,Y,Q=[];while((Y=X.exec(J))!==null){let G=Y.index,q=G+Y[0].length-1,W=1,K=q+1;while(K<J.length&&W>0){if(J[K]==="(")W++;else if(J[K]===")"){if(W--,W===0)break}K++}if(W!==0)continue;let U=J.substring(q+1,K),z=K+1,H=U.match(/^\s*['"]([^'"]+)['"]/);if(!H)continue;let B=H[1],j=U.slice(H[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let L=j.slice(_[0].length).trim();if(!L)continue;try{let V=R0(L,Z),O=JSON.stringify(V),F=`@component('${B}', ${O})`;Q.push({start:G,end:z,replacement:F})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:q,end:W,replacement:K}=Q[G];J=J.substring(0,q)+K+J.substring(W)}return J}function O$($,Z,X){let J=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=Y.exec(J))!==null){let G=Q.index,q=G+Q[0].length-1,W=1,K=q+1,U=null,z=!1;while(K<J.length&&W>0){let j=J[K];if(z){z=!1,K++;continue}if(j==="\\"&&U){z=!0,K++;continue}if(U){if(j===U)U=null;K++;continue}if(j==='"'||j==="'"||j==="`"){U=j,K++;continue}if(j==="(")W++;else if(j===")"){if(W--,W===0)break}K++}if(W!==0)break;let H=J.substring(q+1,K),B=X(H);J=J.substring(0,G)+B+J.substring(K+1)}return J}function pY($,Z){let X=$;return X=X.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Y)=>{if(Y in Z)return`:${Y}="${Y}"`;return J}),X=X.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Y,Q)=>{try{let G=Object.keys(Z),q=Object.values(Z);m5(Q);let K=W0(Q,G)(...q),U=JSON.stringify(K);if(U===void 0){if(!l5(Q).some((B)=>!(B in Z)))return"";return J}let z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Y}="${z}"`}catch(G){return J}}),X}var F$="<!--__STX_BREAK__-->",L$="<!--__STX_CONTINUE__-->";function iY($,Z){let X=$;return X=O$(X,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(q0(Q)){let q=W0(Q,Object.keys(Z));G=Boolean(q(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?F$:""}catch{return""}}),X=O$(X,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(q0(Q)){let q=W0(Q,Object.keys(Z));G=Boolean(q(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?L$:""}catch{return""}}),X}function nY($){let Z=$;return Z=Z.replace(/@break(?!\()/g,F$),Z=Z.replace(/@continue(?!\()/g,L$),Z}function M8($){let Z=$.includes(F$),X=Z?$.substring(0,$.indexOf(F$)):$;return{hasBreak:Z,content:X}}function A8($){let Z=$.includes(L$),X=Z?$.substring(0,$.indexOf(L$)):$;return{hasContinue:Z,content:X}}function I8($){let Z=$;return Z=O$(Z,"@break",(X)=>{let J=X.trim();if(!c5(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=O$(Z,"@continue",(X)=>{let J=X.trim();if(!c5(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function sY($){let Z=/@forelse\s*\(/g,X,J=[],Y=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=Y.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((U,z)=>U.pos-z.pos);let q=[],W=0;for(let U of J)W+=U.delta,q.push({pos:U.pos,depth:W});function K(U){let z=0,H=q.length-1,B=0;while(z<=H){let j=z+H>>1;if(q[j].pos<=U)B=q[j].depth,z=j+1;else H=j-1}return B}while((X=Z.exec($))!==null){if(K(X.index)>0)continue;let U=X.index,z=X.index+X[0].length-1,H=1,B=z+1,j=-1;while(B<$.length&&H>0){if($[B]==="(")H++;else if($[B]===")"){if(H--,H===0){j=B;break}}B++}if(j===-1)continue;let _=$.substring(z+1,j),L=T8(_);if(!L)continue;let{arrayExpr:V,itemVar:O}=L,F=j+1,w=1,R=F,D=/@forelse\s*\(/g,M=/@endforelse/g,k=-1;while(w>0&&R<$.length){D.lastIndex=R,M.lastIndex=R;let E=D.exec($),b=M.exec($);if(!b)break;if(E&&E.index<b.index)w++,R=E.index+E[0].length;else{if(w--,w===0){k=b.index;break}R=b.index+11}}if(k===-1)continue;let N=$.substring(F,k),A=k+11,T=-1,I=0,S=0;while(S<N.length){let E=N.indexOf("@",S);if(E===-1)break;let b=N.substring(E);if(/^@forelse\s*\(/.test(b))I++,S=E+1;else if(b.startsWith("@endforelse"))I--,S=E+11;else if(I===0&&b.startsWith("@empty")){if(N.length<=E+6||!/[a-z]/i.test(N[E+6])){T=E;break}S=E+1}else S=E+1}if(T===-1)continue;return{start:U,end:A,arrayExpr:V,itemVar:O,foreachContent:N.substring(0,T),emptyContent:N.substring(T+6)}}return null}function k8($,Z){let X=$;while(!0){let J=sY(X);if(!J)break;let{start:Y,end:Q,arrayExpr:G,itemVar:q,foreachContent:W,emptyContent:K}=J;try{let U;if(q0(G))U=W0(G,Object.keys(Z))(...Object.values(Z));else U=e(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=K;else z=`@foreach (${G} as ${q})${W}@endforeach`;X=X.substring(0,Y)+z+X.substring(Q)}catch(U){let z=U instanceof Error?U.message:String(U),H=$0("Forelse",`Error in @forelse(${G} as ${q}): ${z}`,l.EVALUATION_ERROR);X=X.substring(0,Y)+H+X.substring(Q)}}return X}function T8($){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 X=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!X)return null;let J=X[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=X[2].trim();return J&&Y?{arrayExpr:Y,itemVar:J}:null}function E8($,Z,X,J){let Y=$;Y=k8(Y,Z);function Q(W){let K=/@foreach\s*\(/g,U;while((U=K.exec(W))!==null){let z=U.index,H=U.index+U[0].length-1,B=1,j=H+1,_=-1;while(j<W.length&&B>0){if(W[j]==="(")B++;else if(W[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let L=W.substring(H+1,_),V=T8(L);if(!V)continue;let O=z,{arrayExpr:F,itemVar:w}=V,R=_+1,D=1,M=R,k=/@foreach\s*\(/g,N=/@endforeach/g;while(D>0&&M<W.length){k.lastIndex=M,N.lastIndex=M;let A=k.exec(W),T=N.exec(W);if(!T)break;if(A&&A.index<T.index)D++,M=A.index+A[0].length;else{if(D--,D===0){let I=W.substring(R,T.index),S=T.index+11;return{start:O,end:S,arrayExpr:F,itemVar:w,content:I}}M=T.index+11}}}return null}function G(W,K){let U=W;while(!0){let z=Q(U);if(!z)break;let{start:H,end:B,arrayExpr:j,itemVar:_,content:L}=z;try{let V=j.trim(),O;if(q0(V))O=W0(V,Object.keys(K))(...Object.values(K));else O=e(V,K);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!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),F=!0;else{console.warn(`[stx] @foreach(${V}) in ${X}: ${V} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let T=$0("Foreach",`Error in @foreach: ${V} is not iterable`,l.TYPE_ERROR);U=U.substring(0,H)+T+U.substring(B);continue}let w=J?.loops?.useAltLoopVariable??mY,R=_.trim(),D=null,M,k=!1;if(R.includes("=>")){let T=R.split("=>").map((I)=>I.trim());if(T.length===2&&T[0]&&T[1])D=T[0],M=T[1];else M=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let T=R.split(",").map((I)=>I.trim());if(T.length===2&&T[0]&&T[1])M=T[0],D=T[1],k=!0;else M=R}else M=R;let N="",A=O;for(let T=0;T<A.length;T++){let I=A[T],S={index:T,iteration:T+1,first:T===0,last:T===A.length-1,count:A.length},E={...K,loop:S,$loop:S};if(M.startsWith("[")&&M.endsWith("]")){let f=M.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(I))f.forEach((d,g)=>{if(d)E[d]=I[g]});else E[M]=I}else E[M]=I;if(D)if(!k&&F&&Array.isArray(I)&&I.length===2)E[D]=I[0],E[M]=I[1];else E[D]=T;let b=iY(L,E),y=A8(b);if(y.hasContinue){N+=y.content;continue}let P=M8(b);if(P.hasBreak){N+=P.content;break}if(b=k8(b,E),b=G(b,E),b=X1(b,E,X),b=nY(b),P=M8(b),P.hasBreak){N+=P.content;break}if(y=A8(b),y.hasContinue){N+=y.content;continue}b=O1(b,E,X),b=pY(b,E),b=cY(b,E),b=lY(b,E),N+=b}U=U.substring(0,H)+N+U.substring(B)}catch(V){let O=$0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${V instanceof Error?V.message:String(V)}`,l.EVALUATION_ERROR);U=U.substring(0,H)+O+U.substring(B)}}return U}Y=G(Y,Z),Y=y8(Y,Z,X,J);let q=J?.loops?.maxWhileIterations??dY;return Y=aY(Y,Z,q),Y}function b8($){return c5($)}function y8($,Z,X,J){let Y=$,Q=!0;while(Q){Q=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let q=G.index,W=q+G[0].length-1,K=j0(Y,"(",")",W);if(K===-1)break;let U=Y.slice(W+1,K),z=K+1,H=B$(Y.slice(q),"for","endfor");if(H.length===0)break;let B=H[0].content,j=q+H[0].end;if(!b8(U)){let _=$0("For",`Unsafe expression in @for: ${U}`,l.UNSAFE_EXPRESSION);Y=Y.substring(0,q)+_+Y.substring(j),Q=!0;continue}try{let _=oY(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&L){let D=rY({forExpr:U,content:B,iterVarNames:_,context:Z,filePath:X,options:J});Y=Y.substring(0,q)+D+Y.substring(j),Q=!0;continue}let V=Object.keys(Z),O=Object.values(Z),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(D,M)=>{return`\${${M}}`});F=I8(F);let R=Function(...V,`
3365
+ `,R=Function(...B,L)(...j);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(U,"")}catch(H){console.error(`Error executing ${J} code block in ${X}:`,H);let B=H instanceof Error?H.message:String(H),j=B0(`${J} Directive`,`Error executing code: ${B}`,X,$,K,U);console.error(j),Q=Q.replace(U,"")}return Q}var nY=1000,sY=!1;function oY($,Z){let X=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",Y=0,Q;while((Q=X.exec($))!==null){let G=Q.index+Q[0].length,q=Q.index+Q[0].indexOf("("),W=j0($,"(",")",q);if(W===-1)continue;let U=$.slice(G,W).trim();if(!U)continue;if(!Object.keys(Z).some((H)=>new RegExp(`(?:^|[^\\w$.])${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(U)))continue;let K;try{let H=R0(U,Z);if(!H||typeof H!=="object")continue;K=JSON.stringify(H)}catch{continue}J+=$.slice(Y,G)+K,Y=W,X.lastIndex=W}return Y===0?$:J+$.slice(Y)}function rY($,Z){let X=/@component\s*\(/g,J=$,Y,Q=[];while((Y=X.exec(J))!==null){let G=Y.index,q=G+Y[0].length-1,W=1,U=q+1;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")"){if(W--,W===0)break}U++}if(W!==0)continue;let z=J.substring(q+1,U),K=U+1,H=z.match(/^\s*['"]([^'"]+)['"]/);if(!H)continue;let B=H[1],j=z.slice(H[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let F=j.slice(_[0].length).trim();if(!F)continue;try{let V=R0(F,Z),O=JSON.stringify(V),L=`@component('${B}', ${O})`;Q.push({start:G,end:K,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:q,end:W,replacement:U}=Q[G];J=J.substring(0,q)+U+J.substring(W)}return J}function O$($,Z,X){let J=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=Y.exec(J))!==null){let G=Q.index,q=G+Q[0].length-1,W=1,U=q+1,z=null,K=!1;while(U<J.length&&W>0){let j=J[U];if(K){K=!1,U++;continue}if(j==="\\"&&z){K=!0,U++;continue}if(z){if(j===z)z=null;U++;continue}if(j==='"'||j==="'"||j==="`"){z=j,U++;continue}if(j==="(")W++;else if(j===")"){if(W--,W===0)break}U++}if(W!==0)break;let H=J.substring(q+1,U),B=X(H);J=J.substring(0,G)+B+J.substring(U+1)}return J}function aY($,Z){let X=$;return X=X.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Y)=>{if(Y in Z)return`:${Y}="${Y}"`;return J}),X=X.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Y,Q)=>{try{let G=Object.keys(Z),q=Object.values(Z);m5(Q);let U=W0(Q,G)(...q),z=JSON.stringify(U);if(z===void 0){if(!l5(Q).some((B)=>!(B in Z)))return"";return J}let K=Buffer.from(z,"utf8").toString("base64");return`__stx_${Y}="${K}"`}catch(G){return J}}),X}var F$="<!--__STX_BREAK__-->",L$="<!--__STX_CONTINUE__-->";function tY($,Z){let X=$;return X=O$(X,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(q0(Q)){let q=W0(Q,Object.keys(Z));G=Boolean(q(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?F$:""}catch{return""}}),X=O$(X,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(q0(Q)){let q=W0(Q,Object.keys(Z));G=Boolean(q(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?L$:""}catch{return""}}),X}function eY($){let Z=$;return Z=Z.replace(/@break(?!\()/g,F$),Z=Z.replace(/@continue(?!\()/g,L$),Z}function k8($){let Z=$.includes(F$),X=Z?$.substring(0,$.indexOf(F$)):$;return{hasBreak:Z,content:X}}function I8($){let Z=$.includes(L$),X=Z?$.substring(0,$.indexOf(L$)):$;return{hasContinue:Z,content:X}}function E8($){let Z=$;return Z=O$(Z,"@break",(X)=>{let J=X.trim();if(!c5(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=O$(Z,"@continue",(X)=>{let J=X.trim();if(!c5(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function $Q($){let Z=/@forelse\s*\(/g,X,J=[],Y=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=Y.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((z,K)=>z.pos-K.pos);let q=[],W=0;for(let z of J)W+=z.delta,q.push({pos:z.pos,depth:W});function U(z){let K=0,H=q.length-1,B=0;while(K<=H){let j=K+H>>1;if(q[j].pos<=z)B=q[j].depth,K=j+1;else H=j-1}return B}while((X=Z.exec($))!==null){if(U(X.index)>0)continue;let z=X.index,K=X.index+X[0].length-1,H=1,B=K+1,j=-1;while(B<$.length&&H>0){if($[B]==="(")H++;else if($[B]===")"){if(H--,H===0){j=B;break}}B++}if(j===-1)continue;let _=$.substring(K+1,j),F=b8(_);if(!F)continue;let{arrayExpr:V,itemVar:O}=F,L=j+1,w=1,R=L,D=/@forelse\s*\(/g,M=/@endforelse/g,k=-1;while(w>0&&R<$.length){D.lastIndex=R,M.lastIndex=R;let E=D.exec($),b=M.exec($);if(!b)break;if(E&&E.index<b.index)w++,R=E.index+E[0].length;else{if(w--,w===0){k=b.index;break}R=b.index+11}}if(k===-1)continue;let N=$.substring(L,k),A=k+11,T=-1,I=0,S=0;while(S<N.length){let E=N.indexOf("@",S);if(E===-1)break;let b=N.substring(E);if(/^@forelse\s*\(/.test(b))I++,S=E+1;else if(b.startsWith("@endforelse"))I--,S=E+11;else if(I===0&&b.startsWith("@empty")){if(N.length<=E+6||!/[a-z]/i.test(N[E+6])){T=E;break}S=E+1}else S=E+1}if(T===-1)continue;return{start:z,end:A,arrayExpr:V,itemVar:O,foreachContent:N.substring(0,T),emptyContent:N.substring(T+6)}}return null}function T8($,Z){let X=$;while(!0){let J=$Q(X);if(!J)break;let{start:Y,end:Q,arrayExpr:G,itemVar:q,foreachContent:W,emptyContent:U}=J;try{let z;if(q0(G))z=W0(G,Object.keys(Z))(...Object.values(Z));else z=e(G,Z);let K;if(!Array.isArray(z)||z.length===0)K=U;else K=`@foreach (${G} as ${q})${W}@endforeach`;X=X.substring(0,Y)+K+X.substring(Q)}catch(z){let K=z instanceof Error?z.message:String(z),H=$0("Forelse",`Error in @forelse(${G} as ${q}): ${K}`,l.EVALUATION_ERROR);X=X.substring(0,Y)+H+X.substring(Q)}}return X}function b8($){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 X=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!X)return null;let J=X[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=X[2].trim();return J&&Y?{arrayExpr:Y,itemVar:J}:null}function y8($,Z,X,J){let Y=$;Y=T8(Y,Z);function Q(W){let U=/@foreach\s*\(/g,z;while((z=U.exec(W))!==null){let K=z.index,H=z.index+z[0].length-1,B=1,j=H+1,_=-1;while(j<W.length&&B>0){if(W[j]==="(")B++;else if(W[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let F=W.substring(H+1,_),V=b8(F);if(!V)continue;let O=K,{arrayExpr:L,itemVar:w}=V,R=_+1,D=1,M=R,k=/@foreach\s*\(/g,N=/@endforeach/g;while(D>0&&M<W.length){k.lastIndex=M,N.lastIndex=M;let A=k.exec(W),T=N.exec(W);if(!T)break;if(A&&A.index<T.index)D++,M=A.index+A[0].length;else{if(D--,D===0){let I=W.substring(R,T.index),S=T.index+11;return{start:O,end:S,arrayExpr:L,itemVar:w,content:I}}M=T.index+11}}}return null}function G(W,U){let z=W;while(!0){let K=Q(z);if(!K)break;let{start:H,end:B,arrayExpr:j,itemVar:_,content:F}=K;try{let V=j.trim(),O;if(q0(V))O=W0(V,Object.keys(U))(...Object.values(U));else O=e(V,U);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(${V}) in ${X}: ${V} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let T=$0("Foreach",`Error in @foreach: ${V} is not iterable`,l.TYPE_ERROR);z=z.substring(0,H)+T+z.substring(B);continue}let w=J?.loops?.useAltLoopVariable??sY,R=_.trim(),D=null,M,k=!1;if(R.includes("=>")){let T=R.split("=>").map((I)=>I.trim());if(T.length===2&&T[0]&&T[1])D=T[0],M=T[1];else M=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let T=R.split(",").map((I)=>I.trim());if(T.length===2&&T[0]&&T[1])M=T[0],D=T[1],k=!0;else M=R}else M=R;let N="",A=O;for(let T=0;T<A.length;T++){let I=A[T],S={index:T,iteration:T+1,first:T===0,last:T===A.length-1,count:A.length},E={...U,loop:S,$loop:S};if(M.startsWith("[")&&M.endsWith("]")){let f=M.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(I))f.forEach((d,g)=>{if(d)E[d]=I[g]});else E[M]=I}else E[M]=I;if(D)if(!k&&L&&Array.isArray(I)&&I.length===2)E[D]=I[0],E[M]=I[1];else E[D]=T;let b=tY(F,E),y=I8(b);if(y.hasContinue){N+=y.content;continue}let P=k8(b);if(P.hasBreak){N+=P.content;break}if(b=T8(b,E),b=G(b,E),b=X1(b,E,X),b=eY(b),P=k8(b),P.hasBreak){N+=P.content;break}if(y=I8(b),y.hasContinue){N+=y.content;continue}b=O1(b,E,X),b=aY(b,E),b=rY(b,E),b=oY(b,E),N+=b}z=z.substring(0,H)+N+z.substring(B)}catch(V){let O=$0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${V instanceof Error?V.message:String(V)}`,l.EVALUATION_ERROR);z=z.substring(0,H)+O+z.substring(B)}}return z}Y=G(Y,Z),Y=C8(Y,Z,X,J);let q=J?.loops?.maxWhileIterations??nY;return Y=JQ(Y,Z,q),Y}function S8($){return c5($)}function C8($,Z,X,J){let Y=$,Q=!0;while(Q){Q=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let q=G.index,W=q+G[0].length-1,U=j0(Y,"(",")",W);if(U===-1)break;let z=Y.slice(W+1,U),K=U+1,H=B$(Y.slice(q),"for","endfor");if(H.length===0)break;let B=H[0].content,j=q+H[0].end;if(!S8(z)){let _=$0("For",`Unsafe expression in @for: ${z}`,l.UNSAFE_EXPRESSION);Y=Y.substring(0,q)+_+Y.substring(j),Q=!0;continue}try{let _=ZQ(z),F=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&F){let D=XQ({forExpr:z,content:B,iterVarNames:_,context:Z,filePath:X,options:J});Y=Y.substring(0,q)+D+Y.substring(j),Q=!0;continue}let V=Object.keys(Z),O=Object.values(Z),L=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(D,M)=>{return`\${${M}}`});L=E8(L);let R=Function(...V,`
3364
3366
  let result = '';
3365
- for (${U}) {
3366
- result += \`${F}\`;
3367
+ for (${z}) {
3368
+ result += \`${L}\`;
3367
3369
  }
3368
3370
  return result;
3369
- `)(...O);Y=Y.substring(0,q)+R+Y.substring(j),Q=!0}catch(_){let L=$0("For",`Error in @for(${U}): ${_ instanceof Error?_.message:String(_)}`,l.EVALUATION_ERROR);Y=Y.substring(0,q)+L+Y.substring(j),Q=!0}}return Y}function oY($){let Z=$.trim(),X=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(X){let Q=X[1];return Q.slice(1,-1).split(",").map((q)=>{let W=q.trim();if(!W)return"";let K=W.indexOf(":");if(K>=0&&Q.startsWith("{")){let H=W.slice(K+1).trim(),B=H.indexOf("=");return(B>=0?H.slice(0,B):H).trim()}let U=W.indexOf("="),z=(U>=0?W.slice(0,U):W).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function rY($){let{forExpr:Z,content:X,iterVarNames:J,context:Y,filePath:Q,options:G}=$,q=Object.keys(Y),W=Object.values(Y),K=Function(...q,"__pushIter",`
3371
+ `)(...O);Y=Y.substring(0,q)+R+Y.substring(j),Q=!0}catch(_){let F=$0("For",`Error in @for(${z}): ${_ instanceof Error?_.message:String(_)}`,l.EVALUATION_ERROR);Y=Y.substring(0,q)+F+Y.substring(j),Q=!0}}return Y}function ZQ($){let Z=$.trim(),X=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(X){let Q=X[1];return Q.slice(1,-1).split(",").map((q)=>{let W=q.trim();if(!W)return"";let U=W.indexOf(":");if(U>=0&&Q.startsWith("{")){let H=W.slice(U+1).trim(),B=H.indexOf("=");return(B>=0?H.slice(0,B):H).trim()}let z=W.indexOf("="),K=(z>=0?W.slice(0,z):W).trim();return/^[A-Za-z_$][\w$]*$/.test(K)?K:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function XQ($){let{forExpr:Z,content:X,iterVarNames:J,context:Y,filePath:Q,options:G}=$,q=Object.keys(Y),W=Object.values(Y),U=Function(...q,"__pushIter",`
3370
3372
  for (${Z}) {
3371
3373
  __pushIter([${J.join(", ")}])
3372
3374
  }
3373
- `),U=[];K(...W,(B)=>{U.push(B)});let z=Q??"inline.stx",H="";for(let B of U){let j={...Y};J.forEach((L,V)=>{j[L]=B[V]});let _=y8(X,j,Q,G);_=X1(_,j,z),_=O1(_,j,z),H+=_}return H}function aY($,Z,X){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,q=G+Q[0].length-1,W=j0(J,"(",")",q);if(W===-1)break;let K=J.slice(q+1,W),U=B$(J.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,H=G+U[0].end;if(!b8(K)){let B=$0("While",`Unsafe expression in @while: ${K}`,l.UNSAFE_EXPRESSION);J=J.substring(0,G)+B+J.substring(H),Y=!0;continue}try{let B=Object.keys(Z),j=Object.values(Z),_=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});_=I8(_);let V=Function(...B,`
3375
+ `),z=[];U(...W,(B)=>{z.push(B)});let K=Q??"inline.stx",H="";for(let B of z){let j={...Y};J.forEach((F,V)=>{j[F]=B[V]});let _=C8(X,j,Q,G);_=X1(_,j,K),_=O1(_,j,K),H+=_}return H}function JQ($,Z,X){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,q=G+Q[0].length-1,W=j0(J,"(",")",q);if(W===-1)break;let U=J.slice(q+1,W),z=B$(J.slice(G),"while","endwhile");if(z.length===0)break;let K=z[0].content,H=G+z[0].end;if(!S8(U)){let B=$0("While",`Unsafe expression in @while: ${U}`,l.UNSAFE_EXPRESSION);J=J.substring(0,G)+B+J.substring(H),Y=!0;continue}try{let B=Object.keys(Z),j=Object.values(Z),_=K.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,L)=>{return`\${${L}}`});_=E8(_);let V=Function(...B,`
3374
3376
  let result = '';
3375
3377
  let maxIterations = ${X}; // Configurable safety limit
3376
3378
  let counter = 0;
3377
- while (${K} && counter < maxIterations) {
3379
+ while (${U} && counter < maxIterations) {
3378
3380
  counter++;
3379
3381
  result += \`${_}\`;
3380
3382
  }
@@ -3382,32 +3384,32 @@ ${O8($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
3382
3384
  result += '<!-- [While Error [1104]]: Maximum iterations (${X}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3383
3385
  }
3384
3386
  return result;
3385
- `)(...j);J=J.substring(0,G)+V+J.substring(H),Y=!0}catch(B){let j=$0("While",`Error in @while(${K}): ${B instanceof Error?B.message:String(B)}`,l.EVALUATION_ERROR);J=J.substring(0,G)+j+J.substring(H),Y=!0}}return J}function tY($,Z="_method"){let X=$.toUpperCase();if(X==="GET"||X==="POST")return"";return`<input type="hidden" name="${Z}" value="${X}">`}function S8($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,X,J,Y,Q)=>{return tY(J,Q||"_method")})}async function C8($,Z,X,J,Y){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((q)=>q.timing===Y);if(G.length===0)return Q;for(let q of G){if(!q.name||typeof q.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",q);continue}try{let W=await q.handler(Q,Z,X,J);if(typeof W==="string")Q=W;else if(J.debug)console.warn(`Middleware ${q.name} did not return a string`)}catch(W){if(J.debug)console.error(`Error in middleware ${q.name}:`,W);if(J.debug){let K=B0("Middleware",`Error in middleware '${q.name}': ${W instanceof Error?W.message:String(W)}`,X,$);Q=Q.replace(/<body[^>]*>/,`$&
3386
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${n$(K)}</div>
3387
- `)}}}return Q}async function P8($,Z,X,J){return C8($,Z,X,J,"before")}async function v8($,Z,X,J){return C8($,Z,X,J,"after")}B5();B5();function f8($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,X,J,Y,Q)=>{try{let G=Y?R0(Y,{}):{};return Z4(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var s0={patterns:[],exact:{}};function nH($,Z){if(!s0.exact[$])s0.exact[$]=[];s0.exact[$].push(Z)}function sH($,Z){let X=typeof $==="string"?new RegExp($):$;s0.patterns.push({pattern:X,callback:Z})}async function x8($,Z){let X=$.split("/").pop()?.split(".")[0]||"";if(s0.exact[$])for(let J of s0.exact[$])await Promise.resolve(J(Z,$));if(s0.exact[X])for(let J of s0.exact[X])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:Y}of s0.patterns)if(J.test($)||J.test(X))await Promise.resolve(Y(Z,$))}function oH(){s0.patterns=[],s0.exact={}}var eY=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),$Q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function X4($){let Z=[],X=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,J;while((J=X.exec($))!==null){let Y=J[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=J.index,G=Q+J[0].length,q=J[1].toLowerCase();if(J[0].endsWith("/>")||$Q.has(q)){Z.push([Q,G]);continue}let W=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`<\\/?${W}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");K.lastIndex=G;let U=1,z=G,H;while((H=K.exec($))!==null)if(H[0].startsWith("</")){if(U--,U===0){z=H.index+H[0].length;break}}else if(!H[0].endsWith("/>"))U++;Z.push([Q,z])}return Z}function h8($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>h8(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function u8($,Z){if(!/:[\w-]+=/.test($))return $;let X=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=J.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...X4($));function G(K){return Y.some(([U,z])=>K>=U&&K<z)}let q=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,W=[];while((Q=q.exec(X))!==null){if(G(Q.index))continue;let K=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,H,B=U,j=!1;while((H=z.exec(U))!==null){let _=H[1],L=H[2];if(g8(_))continue;if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let V=Object.keys(Z),O=Object.values(Z),F=L.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!V.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let R=Function(...V,`return (${L})`)(...O);if(_==="class"){let D=h8(R);if(D){let M=B.match(/\sclass="([^"]*)"/);if(M)B=B.replace(M[0],` class="${M[1]} ${D}"`);else B=B.replace(H[0],` class="${D}"`)}else B=B.replace(H[0],"");j=!0;continue}if(eY.has(_)){if(R)B=B.replace(H[0],` ${_}`);else B=B.replace(H[0],"");j=!0;continue}if(R===null||R===void 0||R===!1)B=B.replace(H[0],"");else{let D=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(H[0],` ${_}="${D}"`)}j=!0}catch{continue}}if(j){let _=K.endsWith("/>")?" /":"",V=`<${Q[1]}${B}${_}>`;W.push({start:Q.index,end:Q.index+K.length,replacement:V})}}for(let K=W.length-1;K>=0;K--){let{start:U,end:z,replacement:H}=W[K];X=X.slice(0,U)+H+X.slice(z)}return X}var ZQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),XQ=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 k1($,Z){let X=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;X.lastIndex=Z;let J=X.exec($);if(!J)return null;let Y=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&ZQ.has(J[1]),Q=Y?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:Y,start:J.index,end:J.index+J[0].length}}function JQ($,Z,X){let J=1,Y=X,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y;let q=Q.exec($),W=G.exec($);if(!W)return-1;if(q&&q.index<W.index)J++,Y=q.index+q[0].length;else{if(J--,J===0)return W.index+W[0].length;Y=W.index+W[0].length}}return-1}function a0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let X=JQ($,Z.tag,Z.end);if(X===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:X,innerHTML:$.slice(Z.end,X-`</${Z.tag}>`.length)}}function d8($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function i1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${X}="([^"]*)"`,"s"))||$.match(new RegExp(`${X}='([^']*)'`,"s"));return J?J[1]:null}function B1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${X}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${X}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${X}(?=\\s|$|>|/)`,"g"),"")}function j1($,Z,X){let J=Z.selfClosing?" /":"",Y=`<${Z.tag}${X}${J}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function YQ($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function QQ($){let Z=$,X=0;while(X<Z.length){let J=k1(Z,X);if(!J)break;let Y=i1(J.attrs,"v-for");if(Y===null){X=J.end;continue}let Q=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){X=J.end;continue}let G=Q[1].trim(),q=Q[2].trim(),W;if(G.includes(",")){let L=G.split(",").map((F)=>F.trim()),V=L[0],O=L[1];W=`${q} as ${O} => ${V}`}else W=`${q} as ${G}`;let K=B1(J.attrs,"v-for"),U=B1(K,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=a0(Z,J),H=Z.slice(z.outerStart,z.outerEnd),B=j1(H,{...J,start:0,end:J.end-J.start},U),j=`@foreach(${W})
3387
+ `)(...j);J=J.substring(0,G)+V+J.substring(H),Y=!0}catch(B){let j=$0("While",`Error in @while(${U}): ${B instanceof Error?B.message:String(B)}`,l.EVALUATION_ERROR);J=J.substring(0,G)+j+J.substring(H),Y=!0}}return J}function YQ($,Z="_method"){let X=$.toUpperCase();if(X==="GET"||X==="POST")return"";return`<input type="hidden" name="${Z}" value="${X}">`}function P8($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,X,J,Y,Q)=>{return YQ(J,Q||"_method")})}async function v8($,Z,X,J,Y){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((q)=>q.timing===Y);if(G.length===0)return Q;for(let q of G){if(!q.name||typeof q.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",q);continue}try{let W=await q.handler(Q,Z,X,J);if(typeof W==="string")Q=W;else if(J.debug)console.warn(`Middleware ${q.name} did not return a string`)}catch(W){if(J.debug)console.error(`Error in middleware ${q.name}:`,W);if(J.debug){let U=B0("Middleware",`Error in middleware '${q.name}': ${W instanceof Error?W.message:String(W)}`,X,$);Q=Q.replace(/<body[^>]*>/,`$&
3388
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${n$(U)}</div>
3389
+ `)}}}return Q}async function f8($,Z,X,J){return v8($,Z,X,J,"before")}async function x8($,Z,X,J){return v8($,Z,X,J,"after")}H5();H5();function g8($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,X,J,Y,Q)=>{try{let G=Y?R0(Y,{}):{};return Z4(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var s0={patterns:[],exact:{}};function ZB($,Z){if(!s0.exact[$])s0.exact[$]=[];s0.exact[$].push(Z)}function XB($,Z){let X=typeof $==="string"?new RegExp($):$;s0.patterns.push({pattern:X,callback:Z})}async function h8($,Z){let X=$.split("/").pop()?.split(".")[0]||"";if(s0.exact[$])for(let J of s0.exact[$])await Promise.resolve(J(Z,$));if(s0.exact[X])for(let J of s0.exact[X])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:Y}of s0.patterns)if(J.test($)||J.test(X))await Promise.resolve(Y(Z,$))}function JB(){s0.patterns=[],s0.exact={}}var QQ=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),GQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function X4($){let Z=[],X=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,J;while((J=X.exec($))!==null){let Y=J[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=J.index,G=Q+J[0].length,q=J[1].toLowerCase();if(J[0].endsWith("/>")||GQ.has(q)){Z.push([Q,G]);continue}let W=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`<\\/?${W}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");U.lastIndex=G;let z=1,K=G,H;while((H=U.exec($))!==null)if(H[0].startsWith("</")){if(z--,z===0){K=H.index+H[0].length;break}}else if(!H[0].endsWith("/>"))z++;Z.push([Q,K])}return Z}function d8($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>d8(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function m8($,Z){if(!/:[\w-]+=/.test($))return $;let X=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=J.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...X4($));function G(U){return Y.some(([z,K])=>U>=z&&U<K)}let q=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,W=[];while((Q=q.exec(X))!==null){if(G(Q.index))continue;let U=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let K=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,H,B=z,j=!1;while((H=K.exec(z))!==null){let _=H[1],F=H[2];if(u8(_))continue;if(F.includes("()")&&!F.includes(".get(")||F.includes("$store")||F.includes("$ref"))continue;try{let V=Object.keys(Z),O=Object.values(Z),L=F.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!V.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let R=Function(...V,`return (${F})`)(...O);if(_==="class"){let D=d8(R);if(D){let M=B.match(/\sclass="([^"]*)"/);if(M)B=B.replace(M[0],` class="${M[1]} ${D}"`);else B=B.replace(H[0],` class="${D}"`)}else B=B.replace(H[0],"");j=!0;continue}if(QQ.has(_)){if(R)B=B.replace(H[0],` ${_}`);else B=B.replace(H[0],"");j=!0;continue}if(R===null||R===void 0||R===!1)B=B.replace(H[0],"");else{let D=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(H[0],` ${_}="${D}"`)}j=!0}catch{continue}}if(j){let _=U.endsWith("/>")?" /":"",V=`<${Q[1]}${B}${_}>`;W.push({start:Q.index,end:Q.index+U.length,replacement:V})}}for(let U=W.length-1;U>=0;U--){let{start:z,end:K,replacement:H}=W[U];X=X.slice(0,z)+H+X.slice(K)}return X}var qQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),WQ=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 k1($,Z){let X=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;X.lastIndex=Z;let J=X.exec($);if(!J)return null;let Y=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&qQ.has(J[1]),Q=Y?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:Y,start:J.index,end:J.index+J[0].length}}function UQ($,Z,X){let J=1,Y=X,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y;let q=Q.exec($),W=G.exec($);if(!W)return-1;if(q&&q.index<W.index)J++,Y=q.index+q[0].length;else{if(J--,J===0)return W.index+W[0].length;Y=W.index+W[0].length}}return-1}function a0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let X=UQ($,Z.tag,Z.end);if(X===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:X,innerHTML:$.slice(Z.end,X-`</${Z.tag}>`.length)}}function l8($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function i1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${X}="([^"]*)"`,"s"))||$.match(new RegExp(`${X}='([^']*)'`,"s"));return J?J[1]:null}function B1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${X}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${X}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${X}(?=\\s|$|>|/)`,"g"),"")}function j1($,Z,X){let J=Z.selfClosing?" /":"",Y=`<${Z.tag}${X}${J}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function zQ($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function KQ($){let Z=$,X=0;while(X<Z.length){let J=k1(Z,X);if(!J)break;let Y=i1(J.attrs,"v-for");if(Y===null){X=J.end;continue}let Q=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){X=J.end;continue}let G=Q[1].trim(),q=Q[2].trim(),W;if(G.includes(",")){let F=G.split(",").map((L)=>L.trim()),V=F[0],O=F[1];W=`${q} as ${O} => ${V}`}else W=`${q} as ${G}`;let U=B1(J.attrs,"v-for"),z=B1(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),K=a0(Z,J),H=Z.slice(K.outerStart,K.outerEnd),B=j1(H,{...J,start:0,end:J.end-J.start},z),j=`@foreach(${W})
3388
3390
  `,_=`${j}${B}
3389
- @endforeach`;Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),X=z.outerStart+j.length}return Z}function GQ($){let Z=$,X=0;while(X<Z.length){let J=k1(Z,X);if(!J)break;let Y=i1(J.attrs,"v-if");if(Y===null){X=J.end;continue}let Q=[],G=a0(Z,J),q=B1(J.attrs,"v-if"),W=j1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},q);Q.push({type:"if",expr:Y,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:J});let K=G.outerEnd,U=!0;while(U){let _=Z.slice(K).match(/^\s*/),L=_?_[0].length:0,V=k1(Z,K+L);if(!V){U=!1;break}let O=i1(V.attrs,"v-else-if"),F=d8(V.attrs,"v-else");if(O!==null){let w=a0(Z,V),R=B1(V.attrs,"v-else-if"),D=j1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},R);Q.push({type:"else-if",expr:O,outerStart:K,outerEnd:w.outerEnd,element:D,parsedTag:V}),K=w.outerEnd}else if(F){let w=a0(Z,V),R=B1(V.attrs,"v-else"),D=j1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},R);Q.push({type:"else",outerStart:K,outerEnd:w.outerEnd,element:D,parsedTag:V}),U=!1}else U=!1}let z=[];for(let _ of Q)if(_.type==="if")z.push(`@if(${_.expr})
3390
- ${_.element}`);else if(_.type==="else-if")z.push(`@elseif(${_.expr})
3391
- ${_.element}`);else z.push(`@else
3392
- ${_.element}`);z.push("@endif");let H=z.join(`
3393
- `),B=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,B)+H+Z.slice(j),X=B+H.length}return Z}function qQ($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function WQ($){let Z=$,X=0;while(X<Z.length){let J=k1(Z,X);if(!J)break;let Y=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,q=Y.match(G);while(q){Q=!0;let U=q[1],z=q[2],H=q[3];Y=Y.replace(q[0],""),Y+=` :${U}="${H}" @update:${U}="${H} = $event"`,q=Y.match(G)}if(Q){let U=a0(Z,J),z=Z.slice(U.outerStart,U.outerEnd),H=j1(z,{...J,start:0,end:J.end-J.start},Y);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),X=U.outerStart+H.length;continue}let W=i1(J.attrs,"v-model");if(W===null){X=J.end;continue}if(XQ.has(J.tag)){let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,z=a0(Z,J),H=Z.slice(z.outerStart,z.outerEnd),B=j1(H,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),X=z.outerStart+B.length}else{let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let z=a0(Z,J),H=Z.slice(z.outerStart,z.outerEnd),B=j1(H,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),X=z.outerStart+B.length}}return Z}function KQ($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function UQ($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function zQ($){let Z=$,X=0;while(X<Z.length){let J=k1(Z,X);if(!J)break;let Y=i1(J.attrs,"v-html");if(Y===null){X=J.end;continue}if(J.selfClosing){X=J.end;continue}let Q=a0(Z,J),G=B1(J.attrs,"v-html"),q=J.selfClosing?" /":"",W=`<${J.tag}${G}${q}>{!! ${Y} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),X=Q.outerStart+W.length}return Z}function HQ($){let Z=$,X=0;while(X<Z.length){let J=k1(Z,X);if(!J)break;let Y=i1(J.attrs,"v-text");if(Y===null){X=J.end;continue}if(J.selfClosing){X=J.end;continue}let Q=a0(Z,J),G=B1(J.attrs,"v-text"),q=J.selfClosing?" /":"",W=`<${J.tag}${G}${q}>{{ ${Y} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),X=Q.outerStart+W.length}return Z}function BQ($){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 jQ($){let Z=$,X=0;while(X<Z.length){let J=k1(Z,X);if(!J)break;if(!d8(J.attrs,"v-once")){X=J.end;continue}let Y=B1(J.attrs,"v-once"),Q=a0(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
3391
+ @endforeach`;Z=Z.slice(0,K.outerStart)+_+Z.slice(K.outerEnd),X=K.outerStart+j.length}return Z}function HQ($){let Z=$,X=0;while(X<Z.length){let J=k1(Z,X);if(!J)break;let Y=i1(J.attrs,"v-if");if(Y===null){X=J.end;continue}let Q=[],G=a0(Z,J),q=B1(J.attrs,"v-if"),W=j1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},q);Q.push({type:"if",expr:Y,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:J});let U=G.outerEnd,z=!0;while(z){let _=Z.slice(U).match(/^\s*/),F=_?_[0].length:0,V=k1(Z,U+F);if(!V){z=!1;break}let O=i1(V.attrs,"v-else-if"),L=l8(V.attrs,"v-else");if(O!==null){let w=a0(Z,V),R=B1(V.attrs,"v-else-if"),D=j1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},R);Q.push({type:"else-if",expr:O,outerStart:U,outerEnd:w.outerEnd,element:D,parsedTag:V}),U=w.outerEnd}else if(L){let w=a0(Z,V),R=B1(V.attrs,"v-else"),D=j1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},R);Q.push({type:"else",outerStart:U,outerEnd:w.outerEnd,element:D,parsedTag:V}),z=!1}else z=!1}let K=[];for(let _ of Q)if(_.type==="if")K.push(`@if(${_.expr})
3392
+ ${_.element}`);else if(_.type==="else-if")K.push(`@elseif(${_.expr})
3393
+ ${_.element}`);else K.push(`@else
3394
+ ${_.element}`);K.push("@endif");let H=K.join(`
3395
+ `),B=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,B)+H+Z.slice(j),X=B+H.length}return Z}function BQ($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function jQ($){let Z=$,X=0;while(X<Z.length){let J=k1(Z,X);if(!J)break;let Y=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,q=Y.match(G);while(q){Q=!0;let z=q[1],K=q[2],H=q[3];Y=Y.replace(q[0],""),Y+=` :${z}="${H}" @update:${z}="${H} = $event"`,q=Y.match(G)}if(Q){let z=a0(Z,J),K=Z.slice(z.outerStart,z.outerEnd),H=j1(K,{...J,start:0,end:J.end-J.start},Y);Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),X=z.outerStart+H.length;continue}let W=i1(J.attrs,"v-model");if(W===null){X=J.end;continue}if(WQ.has(J.tag)){let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,K=a0(Z,J),H=Z.slice(K.outerStart,K.outerEnd),B=j1(H,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,K.outerStart)+B+Z.slice(K.outerEnd),X=K.outerStart+B.length}else{let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let K=a0(Z,J),H=Z.slice(K.outerStart,K.outerEnd),B=j1(H,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,K.outerStart)+B+Z.slice(K.outerEnd),X=K.outerStart+B.length}}return Z}function _Q($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function VQ($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function OQ($){let Z=$,X=0;while(X<Z.length){let J=k1(Z,X);if(!J)break;let Y=i1(J.attrs,"v-html");if(Y===null){X=J.end;continue}if(J.selfClosing){X=J.end;continue}let Q=a0(Z,J),G=B1(J.attrs,"v-html"),q=J.selfClosing?" /":"",W=`<${J.tag}${G}${q}>{!! ${Y} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),X=Q.outerStart+W.length}return Z}function FQ($){let Z=$,X=0;while(X<Z.length){let J=k1(Z,X);if(!J)break;let Y=i1(J.attrs,"v-text");if(Y===null){X=J.end;continue}if(J.selfClosing){X=J.end;continue}let Q=a0(Z,J),G=B1(J.attrs,"v-text"),q=J.selfClosing?" /":"",W=`<${J.tag}${G}${q}>{{ ${Y} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),X=Q.outerStart+W.length}return Z}function LQ($){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=$,X=0;while(X<Z.length){let J=k1(Z,X);if(!J)break;if(!l8(J.attrs,"v-once")){X=J.end;continue}let Y=B1(J.attrs,"v-once"),Q=a0(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
3394
3396
  ${j1(G,{...J,start:0,end:J.end-J.start},Y)}
3395
- @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),X=Q.outerStart+W.length}return Z}function _Q($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function VQ($){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 m8($){if(!YQ($))return $;let Z=$;return Z=QQ(Z),Z=GQ(Z),Z=jQ(Z),Z=KQ(Z),Z=UQ(Z),Z=WQ(Z),Z=qQ(Z),Z=VQ(Z),Z=zQ(Z),Z=HQ(Z),Z=BQ(Z),Z=_Q(Z),Z}function w$($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var J4=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"]),OQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function l8($,Z){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=X?X[1]:$,Y=e(J,Z);if(Y&&typeof Y==="string")return Y;let Q=J.trim();return J4.has(Q)?Q:null}function c8($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function p8($,Z,X){let J=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(OQ.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${X}</${$}>`}async function i8($,Z,X,J,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,q=[],W;while((W=G.exec(Q))!==null)q.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let K=q.length-1;K>=0;K--){let U=q[K];try{let z=l8(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${w$(c8(U.expr))}" -->`;Q=Q.slice(0,U.index)+O+Q.slice(U.index+U.full.length);continue}if(J4.has(z)){let O=p8(z,U.attrs,U.slotContent);Q=Q.slice(0,U.index)+O+Q.slice(U.index+U.full.length);continue}let H=U.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=j.exec(H))!==null){let O=_[1]||_[2],F=_[3];if(_[1])try{B[O]=e(F,Z)}catch{B[O]=F}else B[O]=F}let L=J.componentsDir||"components",V=await I1(z,B,U.slotContent,L,Z,X,J,new Set,Y??new Set);Q=Q.slice(0,U.index)+V+Q.slice(U.index+U.full.length)}catch(z){let H=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${w$(H)} -->`;Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length)}}return Q=await FQ(Q,Z,X,J,Y),Q}async function FQ($,Z,X,J,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,q=[],W;while((W=G.exec(Q))!==null)q.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let K=q.length-1;K>=0;K--){let U=q[K];try{let z=l8(U.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${w$(c8(U.expr))}" -->`;Q=Q.slice(0,U.index)+j+Q.slice(U.index+U.full.length);continue}if(J4.has(z)){let j=p8(z,U.attrs,"");Q=Q.slice(0,U.index)+j+Q.slice(U.index+U.full.length);continue}let H=J.componentsDir||"components",B=await I1(z,{},"",H,Z,X,J,new Set,Y??new Set);Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length)}catch(z){let H=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${w$(H)} -->`;Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length)}}return Q}function n8($,Z=""){let X=`${$}${Z}`,J=0;for(let Y=0;Y<X.length;Y++){let Q=X.charCodeAt(Y);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function s8($,Z,X={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=X;if(!$.trim())return"";let q=Y4($),W=[],K=new Map;if(Q)for(let U of q){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let H=z[1],B=`${Z}_${H}`;K.set(H,B)}}for(let U of q){let z=o8(U,Z,J,Y,K,G);W.push(z)}return W.join(`
3397
+ @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),X=Q.outerStart+W.length}return Z}function RQ($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function DQ($){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 c8($){if(!zQ($))return $;let Z=$;return Z=KQ(Z),Z=HQ(Z),Z=wQ(Z),Z=_Q(Z),Z=VQ(Z),Z=jQ(Z),Z=BQ(Z),Z=DQ(Z),Z=OQ(Z),Z=FQ(Z),Z=LQ(Z),Z=RQ(Z),Z}function w$($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var J4=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"]),NQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function p8($,Z){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=X?X[1]:$,Y=e(J,Z);if(Y&&typeof Y==="string")return Y;let Q=J.trim();return J4.has(Q)?Q:null}function i8($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function n8($,Z,X){let J=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(NQ.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${X}</${$}>`}async function s8($,Z,X,J,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,q=[],W;while((W=G.exec(Q))!==null)q.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let U=q.length-1;U>=0;U--){let z=q[U];try{let K=p8(z.expr,Z);if(!K||typeof K!=="string"){let O=`<!-- dynamic component: could not resolve "${w$(i8(z.expr))}" -->`;Q=Q.slice(0,z.index)+O+Q.slice(z.index+z.full.length);continue}if(J4.has(K)){let O=n8(K,z.attrs,z.slotContent);Q=Q.slice(0,z.index)+O+Q.slice(z.index+z.full.length);continue}let H=z.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=j.exec(H))!==null){let O=_[1]||_[2],L=_[3];if(_[1])try{B[O]=e(L,Z)}catch{B[O]=L}else B[O]=L}let F=J.componentsDir||"components",V=await I1(K,B,z.slotContent,F,Z,X,J,new Set,Y??new Set);Q=Q.slice(0,z.index)+V+Q.slice(z.index+z.full.length)}catch(K){let H=K instanceof Error?K.message:String(K),B=`<!-- dynamic component error: ${w$(H)} -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}}return Q=await MQ(Q,Z,X,J,Y),Q}async function MQ($,Z,X,J,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,q=[],W;while((W=G.exec(Q))!==null)q.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let U=q.length-1;U>=0;U--){let z=q[U];try{let K=p8(z.expr,Z);if(!K||typeof K!=="string"){let j=`<!-- dynamic component: could not resolve "${w$(i8(z.expr))}" -->`;Q=Q.slice(0,z.index)+j+Q.slice(z.index+z.full.length);continue}if(J4.has(K)){let j=n8(K,z.attrs,"");Q=Q.slice(0,z.index)+j+Q.slice(z.index+z.full.length);continue}let H=J.componentsDir||"components",B=await I1(K,{},"",H,Z,X,J,new Set,Y??new Set);Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}catch(K){let H=K instanceof Error?K.message:String(K),B=`<!-- dynamic component error: ${w$(H)} -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}}return Q}function o8($,Z=""){let X=`${$}${Z}`,J=0;for(let Y=0;Y<X.length;Y++){let Q=X.charCodeAt(Y);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function r8($,Z,X={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=X;if(!$.trim())return"";let q=Y4($),W=[],U=new Map;if(Q)for(let z of q){let K=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(K){let H=K[1],B=`${Z}_${H}`;U.set(H,B)}}for(let z of q){let K=a8(z,Z,J,Y,U,G);W.push(K)}return W.join(`
3396
3398
 
3397
- `)}function Y4($){let Z=[],X=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Y="",Q=!1,G="";for(let q=0;q<X.length;q++){let W=X[q];if(W==="@"&&J===0)Q=!0;if(W==="{")J++;else if(W==="}"){if(J--,J===0){if(Q){G+=W;let K=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(K){let[,U,z,H]=K;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:H.trim()});else if(U==="media"||U==="supports"||U==="container"){let B=Y4(H);Z.push({selector:`@${U} ${z.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
3398
- `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:H.trim()})}G="",Q=!1}else if(Y.trim()){Y+=W;let K=Y.match(/([^{]+)\{([^}]*)\}/);if(K)Z.push({selector:K[1].trim(),declarations:K[2].trim()});Y=""}continue}}if(Q)G+=W;else Y+=W}return Z}function o8($,Z,X,J,Y,Q){let{selector:G,declarations:q}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Y.get(U)||U} { ${q} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=Y4(`x { ${q} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>o8(H,Z,X,J,Y,Q)).join(`
3399
+ `)}function Y4($){let Z=[],X=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Y="",Q=!1,G="";for(let q=0;q<X.length;q++){let W=X[q];if(W==="@"&&J===0)Q=!0;if(W==="{")J++;else if(W==="}"){if(J--,J===0){if(Q){G+=W;let U=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(U){let[,z,K,H]=U;if(z==="keyframes")Z.push({selector:`@keyframes ${K.trim()}`,declarations:H.trim()});else if(z==="media"||z==="supports"||z==="container"){let B=Y4(H);Z.push({selector:`@${z} ${K.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
3400
+ `)})}else Z.push({selector:`@${z} ${K.trim()}`,declarations:H.trim()})}G="",Q=!1}else if(Y.trim()){Y+=W;let U=Y.match(/([^{]+)\{([^}]*)\}/);if(U)Z.push({selector:U[1].trim(),declarations:U[2].trim()});Y=""}continue}}if(Q)G+=W;else Y+=W}return Z}function a8($,Z,X,J,Y,Q){let{selector:G,declarations:q}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${Y.get(z)||z} { ${q} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let K=Y4(`x { ${q} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>a8(H,Z,X,J,Y,Q)).join(`
3399
3401
  `);return`${G} {
3400
- ${z}
3401
- }`}return`${G} { ${q} }`}let W=LQ(G,Z,X,J),K=q;for(let[U,z]of Y)K=K.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(Q)K=K.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${K} }`}function LQ($,Z,X,J){let Y=$.split(",").map((G)=>G.trim()),Q=[];for(let G of Y){if(G.startsWith(":host")){if(J)Q.push(G);else{let K=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(K)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let q=X?`${X} .${Z}`:`.${Z}`;Q.push(`${q} ${G}`);let W=wQ(G,Z);if(W)Q.push(X?`${X} ${W}`:W)}return Q.join(", ")}function wQ($,Z){let X=0,J=$.length;for(let W=0;W<$.length;W++){let K=$[W];if(K==="["||K==="(")X++;else if(K==="]"||K===")")X--;else if(X===0&&(K===" "||K===">"||K==="+"||K==="~")){J=W;break}}let Y=$.slice(0,J),Q=$.slice(J);if(!Y)return"";let G=Y.length,q=0;for(let W=0;W<Y.length;W++){let K=Y[W];if(K==="["||K==="(")q++;else if(K==="]"||K===")")q--;else if(X===0&&q===0&&K===":"){G=W;break}}return`${Y.slice(0,G)}.${Z}${Y.slice(G)}${Q}`}var t8=String.raw`(?<![\w-])scoped(?![\w-])`,Q4=/<style\s+([^>]*)>/gi,r8=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,e8=new RegExp(t8,"i"),RQ=new RegExp(t8,"gi");function DQ($){Q4.lastIndex=0;let Z=Q4.exec($);while(Z!==null){if(e8.test(Z[1]))return!0;Z=Q4.exec($)}return!1}function $9($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(X)=>{let J=X.trim();if(Z.has(J))return"";return Z.add(J),X})}function R$($,Z){if(!DQ($))return{html:$,hasScoped:!1};let X=n8(Z),J=`data-v-${X}`,Y=$,Q=!1;if(r8.lastIndex=0,Y=Y.replace(r8,(G,q,W)=>{if(!e8.test(q))return G;Q=!0;let K=NQ(W,J),U=q.replace(RQ,"").trim(),z=U?` ${U}`:"";return`<style data-stx-scoped="${X}"${z}>${K}</style>`}),!Q)return{html:$,hasScoped:!1};return Y=AQ(Y,J),{html:Y,hasScoped:!0}}function NQ($,Z){return s8($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}var MQ=($)=>`\x00stx-scope-mask-${$}\x00`,a8=/\u0000stx-scope-mask-(\d+)\u0000/g;function AQ($,Z){let X=o0($,(Y,Q)=>{let G=Q1(Y,Q);return G>Q?G:C1(Y,Q)},(Y,Q)=>MQ(Q)),J=kQ(X.output,Z);return a8.lastIndex=0,J.replace(a8,(Y,Q)=>X.tokens[Number(Q)])}function kQ($,Z){let X=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Y,Q)=>{if(X.has(Y.toLowerCase()))return J;if(J.includes(Z))return J;if(Y.toLowerCase()==="style"||Y.toLowerCase()==="script")return J;if(Q)return J.replace(`<${Y}${Q}`,`<${Y} ${Z}${Q}`);if(J.endsWith("/>"))return`<${Y} ${Z} />`;return`<${Y} ${Z}>`})}var WB="data-stx-color-mode-boot",KB="__STX_COLOR_MODE__",IQ=new Set(["light","dark","auto","system"]),TQ=new Set(["auto","system"]),EQ=/^[a-z][\w:-]*$/i,bQ=/^[\w-]+$/;function yQ($){let Z=$.storageKey??"stx-color-mode",X=$.initialMode??"auto",J=$.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(!IQ.has(X))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(X)}`);if(J!==null&&(typeof J!=="string"||!bQ.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(Y!==null&&(typeof Y!=="string"||!EQ.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!TQ.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(J===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:X==="system"?"auto":X,darkClass:J,attribute:Y,autoValue:Q}}function SQ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function q4($={}){let Z=yQ($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${SQ(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.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function J9($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let X=G4($);if(X===null)return $;let J=q4(Z);return`${$.slice(0,X)}
3402
- ${J}${$.slice(X)}`}function G4($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let X=Z.index+Z[0].length;Z9.lastIndex=X;let J=Z9.exec($);if(J)X+=J[0].length;return X}var CQ=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),PQ=/<meta\b[^>]*\bcharset\b[^>]*>/i,Z9=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy,X9=/<\/head>/gi;function vQ($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let X=Z.index+Z[0].length;X9.lastIndex=X;let J=X9.exec($),Y=J?J.index:-1,Q=$.slice(X,Y===-1?$.length:Y),G=PQ.exec(Q);if(!G||Q.slice(0,G.index).trim()==="")return $;let q=Q.slice(0,G.index)+Q.slice(G.index+G[0].length);return $.slice(0,X)+`
3403
- ${G[0]}`+q+$.slice(X+Q.length)}function Y9($){return fQ(vQ($))}function fQ($){let Z=CQ.exec($);if(!Z)return $;let X=G4($);if(X===null)return $;if(Z.index<=X||$.slice(X,Z.index).trim()==="")return $;let J=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),Y=G4(J);if(Y===null)return $;return`${J.slice(0,Y)}
3404
- ${Z[0]}${J.slice(Y)}`}var zB="stx-build",HB="X-STX-Build",D$=null;function Q9(){if(D$===null)D$=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return D$}function BB($){D$=$}function jB($,Z=Q9()){let X=W4($,Z);if(X===null)return $;let J=/<head\b[^>]*>/i.exec($),Y=J.index+J[0].length;return`${$.slice(0,Y)}${X}${$.slice(Y)}`}function W4($,Z=Q9()){if($.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test($))return null;return`
3405
- <meta name="stx-build" content="${Z}">`}function G9(){return{afterOpen:[],beforeClose:[]}}function xQ($){return $.afterOpen.length>0||$.beforeClose.length>0}function q9($,Z){if(!xQ(Z))return $;let X=Z.afterOpen.join(""),J=Z.beforeClose.join(""),Y=/<head\b[^>]*>/i.exec($),Q=$.lastIndexOf("</head>"),G=Y&&(!X?-1:Y.index+Y[0].length),q=Q===-1||!J?-1:Q;if(G===-1&&q===-1)return $;if(G===null)return q===-1?$:`${$.slice(0,q)}${J}${$.slice(q)}`;if(G!==-1&&q!==-1)return`${$.slice(0,G)}${X}${$.slice(G,q)}${J}${$.slice(q)}`;if(G!==-1)return`${$.slice(0,G)}${X}${$.slice(G)}`;return`${$.slice(0,q)}${J}${$.slice(q)}`}var W9="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",N$="data-stx-html-attrs",M$="data-stx-html-class",K9=/^[A-Za-z_:][\w:.-]*$/;function Y1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gQ($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s1($){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 n1($,Z){return Object.entries($).filter(([X])=>!Z?.(X)).map(([X,J])=>`${X}="${Y1(String(J))}"`).join(" ")}function hQ($={},Z="en"){let X=[],J=[],Y="",Q=Z;for(let[q,W]of Object.entries($||{})){if(W==null)continue;let K=q.trim();if(!K9.test(K))continue;let U=K.toLowerCase();if(U==="lang"){Q=String(W);continue}if(U==="class"){Y=String(W).trim();continue}X.push(` ${K}="${Y1(String(W))}"`),J.push(K)}let G=` lang="${Y1(Q)}"`;if(Y)G+=` class="${Y1(Y)}"`;if(G+=X.join(""),Y)G+=` ${M$}="${Y1(Y)}"`;if(J.length)G+=` ${N$}="${Y1(J.join(" "))}"`;return G}function U9($={},Z={}){let X={...$,...Z};if($.class&&Z.class){let J=$.class.split(/\s+/).filter(Boolean);for(let Y of Z.class.split(/\s+/).filter(Boolean))if(!J.includes(Y))J.push(Y);X.class=J.join(" ")}return X}function z9($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let X=$.match(/<html\b([^>]*)>/i);if(!X)return $;let J={},Y=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(X[1]))!==null){let U=G[1];if(!(U in J))Y.push(U);J[U]=G[2]??G[3]??G[4]??""}let q=[],W=[];for(let[U,z]of Object.entries(Z)){if(z==null)continue;let H=U.trim();if(!K9.test(H))continue;let B=H.toLowerCase();if(B==="class"){let j=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),q.push(_);if(!("class"in J))Y.push("class");J.class=j.join(" ");continue}if(!(H in J))Y.push(H);if(J[H]=String(z),B!=="lang")W.push(H)}if(q.length){if(!(M$ in J))Y.push(M$);J[M$]=q.join(" ")}if(W.length){if(!(N$ in J))Y.push(N$);J[N$]=W.join(" ")}let K=Y.map((U)=>` ${U}="${Y1(J[U])}"`).join("");return $.replace(X[0],()=>`<html${K}>`)}function FB($){let Z=K4($);if(Z===null)return $;let X=$.lastIndexOf("</head>");return`${$.slice(0,X)}${Z}${$.slice(X)}`}function K4($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${W9}
3406
- `}function uQ($){let Z=[],X=0;while(X<$.length){let Q=$.slice(X),G=Q.match(/^\s+/);if(G){X+=G[0].length;continue}if(Q.startsWith("<!--")){let z=$.indexOf("-->",X);if(z===-1)break;X=z+3;continue}let q=Q.match(/^<script\b[^>]*>/i);if(q){let z=$.toLowerCase().indexOf("</script>",X+q[0].length);if(z===-1)break;X=z+9;continue}let W=Q.match(/^<link\b[^>]*>/i);if(W){Z.push(W[0]),X+=W[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K){Z.push(K[0]),X+=K[0].length;continue}let U=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){Z.push(U[0]),X+=U[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",Y=0;while(Y<$.length&&Y<X){let Q=$.slice(Y),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Y+=G[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q&&Z.includes(q[0])){Y+=q[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W&&Z.includes(W[0])){Y+=W[0].length;continue}J+=$[Y],Y++}return J+=$.slice(X),{body:J,hoisted:Z}}function dQ($,Z={},X={}){let{title:J="stx App",lang:Y="en",meta:Q=[],link:G=[],script:q=[],headRaw:W="",htmlAttrs:K={},bodyClass:U="",bodyAttrs:z={}}=Z,H=X.title||J,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(Q.map(s1).filter(Boolean)),L=[...B.filter((A)=>!j.has(s1(A))),...Q].map((A)=>{return` <meta ${n1(A)}>`}).join(`
3402
+ ${K}
3403
+ }`}return`${G} { ${q} }`}let W=AQ(G,Z,X,J),U=q;for(let[z,K]of Y)U=U.replace(new RegExp(`\\b${z}\\b`,"g"),K);if(Q)U=U.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${U} }`}function AQ($,Z,X,J){let Y=$.split(",").map((G)=>G.trim()),Q=[];for(let G of Y){if(G.startsWith(":host")){if(J)Q.push(G);else{let U=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(U)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let q=X?`${X} .${Z}`:`.${Z}`;Q.push(`${q} ${G}`);let W=kQ(G,Z);if(W)Q.push(X?`${X} ${W}`:W)}return Q.join(", ")}function kQ($,Z){let X=0,J=$.length;for(let W=0;W<$.length;W++){let U=$[W];if(U==="["||U==="(")X++;else if(U==="]"||U===")")X--;else if(X===0&&(U===" "||U===">"||U==="+"||U==="~")){J=W;break}}let Y=$.slice(0,J),Q=$.slice(J);if(!Y)return"";let G=Y.length,q=0;for(let W=0;W<Y.length;W++){let U=Y[W];if(U==="["||U==="(")q++;else if(U==="]"||U===")")q--;else if(X===0&&q===0&&U===":"){G=W;break}}return`${Y.slice(0,G)}.${Z}${Y.slice(G)}${Q}`}var $9=String.raw`(?<![\w-])scoped(?![\w-])`,Q4=/<style\s+([^>]*)>/gi,t8=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Z9=new RegExp($9,"i"),IQ=new RegExp($9,"gi");function TQ($){Q4.lastIndex=0;let Z=Q4.exec($);while(Z!==null){if(Z9.test(Z[1]))return!0;Z=Q4.exec($)}return!1}function X9($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(X)=>{let J=X.trim();if(Z.has(J))return"";return Z.add(J),X})}function R$($,Z){if(!TQ($))return{html:$,hasScoped:!1};let X=o8(Z),J=`data-v-${X}`,Y=$,Q=!1;if(t8.lastIndex=0,Y=Y.replace(t8,(G,q,W)=>{if(!Z9.test(q))return G;Q=!0;let U=EQ(W,J),z=q.replace(IQ,"").trim(),K=z?` ${z}`:"";return`<style data-stx-scoped="${X}"${K}>${U}</style>`}),!Q)return{html:$,hasScoped:!1};return Y=yQ(Y,J),{html:Y,hasScoped:!0}}function EQ($,Z){return r8($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}var bQ=($)=>`\x00stx-scope-mask-${$}\x00`,e8=/\u0000stx-scope-mask-(\d+)\u0000/g;function yQ($,Z){let X=o0($,(Y,Q)=>{let G=Q1(Y,Q);return G>Q?G:C1(Y,Q)},(Y,Q)=>bQ(Q)),J=SQ(X.output,Z);return e8.lastIndex=0,J.replace(e8,(Y,Q)=>X.tokens[Number(Q)])}function SQ($,Z){let X=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Y,Q)=>{if(X.has(Y.toLowerCase()))return J;if(J.includes(Z))return J;if(Y.toLowerCase()==="style"||Y.toLowerCase()==="script")return J;if(Q)return J.replace(`<${Y}${Q}`,`<${Y} ${Z}${Q}`);if(J.endsWith("/>"))return`<${Y} ${Z} />`;return`<${Y} ${Z}>`})}function G4(){return{afterOpen:[],beforeClose:[]}}function CQ($){return $.afterOpen.length>0||$.beforeClose.length>0}function Y9($,Z){if(!CQ(Z))return $;let X=Z.afterOpen.join(""),J=Z.beforeClose.join(""),Y=$.lastIndexOf("</head>"),Q=X?A5($):null,G=J&&Y!==-1?Y:null;if(Q===null&&G===null)return $;if(Q!==null&&G!==null)return`${$.slice(0,Q)}${X}${$.slice(Q,G)}${J}${$.slice(G)}`;if(Q!==null)return`${$.slice(0,Q)}${X}${$.slice(Q)}`;return`${$.slice(0,G)}${J}${$.slice(G)}`}var J9=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function A5($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let X=Z.index+Z[0].length;J9.lastIndex=X;let J=J9.exec($);return J?X+J[0].length:X}var W4="data-stx-color-mode-boot",PQ="__STX_COLOR_MODE__",vQ=new Set(["light","dark","auto","system"]),fQ=new Set(["auto","system"]),xQ=/^[a-z][\w:-]*$/i,gQ=/^[\w-]+$/;function hQ($){let Z=$.storageKey??"stx-color-mode",X=$.initialMode??"auto",J=$.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(!vQ.has(X))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(X)}`);if(J!==null&&(typeof J!=="string"||!gQ.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(Y!==null&&(typeof Y!=="string"||!xQ.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!fQ.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(J===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:X==="system"?"auto":X,darkClass:J,attribute:Y,autoValue:Q}}function uQ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function U4($={}){let Z=hQ($),J=`(function(){"use strict";var c=${uQ(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.${PQ}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`;return`<script ${W4}>${J}</script>`}function G9($,Z={}){if($.includes(W4))return $;let X=q4($);if(X===null)return $;let J=U4(Z);return`${$.slice(0,X)}
3404
+ ${J}${$.slice(X)}`}var q4=A5,dQ=new RegExp(`<script\\b[^>]*\\b${W4}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),mQ=/<meta\b[^>]*\bcharset\b[^>]*>/i,Q9=/<\/head>/gi;function lQ($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let X=Z.index+Z[0].length;Q9.lastIndex=X;let J=Q9.exec($),Y=J?J.index:-1,Q=$.slice(X,Y===-1?$.length:Y),G=mQ.exec(Q);if(!G||Q.slice(0,G.index).trim()==="")return $;let q=Q.slice(0,G.index)+Q.slice(G.index+G[0].length);return $.slice(0,X)+`
3405
+ ${G[0]}`+q+$.slice(X+Q.length)}function q9($){return cQ(lQ($))}function cQ($){let Z=dQ.exec($);if(!Z)return $;let X=q4($);if(X===null)return $;if(Z.index<=X||$.slice(X,Z.index).trim()==="")return $;let J=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),Y=q4(J);if(Y===null)return $;return`${J.slice(0,Y)}
3406
+ ${Z[0]}${J.slice(Y)}`}var LB="stx-build",wB="X-STX-Build",D$=null;function W9(){if(D$===null)D$=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return D$}function RB($){D$=$}function DB($,Z=W9()){let X=z4($,Z);if(X===null)return $;let J=/<head\b[^>]*>/i.exec($),Y=J.index+J[0].length;return`${$.slice(0,Y)}${X}${$.slice(Y)}`}function z4($,Z=W9()){if($.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test($))return null;return`
3407
+ <meta name="stx-build" content="${Z}">`}var U9="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",N$="data-stx-html-attrs",M$="data-stx-html-class",z9=/^[A-Za-z_:][\w:.-]*$/;function Y1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pQ($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s1($){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 n1($,Z){return Object.entries($).filter(([X])=>!Z?.(X)).map(([X,J])=>`${X}="${Y1(String(J))}"`).join(" ")}function iQ($={},Z="en"){let X=[],J=[],Y="",Q=Z;for(let[q,W]of Object.entries($||{})){if(W==null)continue;let U=q.trim();if(!z9.test(U))continue;let z=U.toLowerCase();if(z==="lang"){Q=String(W);continue}if(z==="class"){Y=String(W).trim();continue}X.push(` ${U}="${Y1(String(W))}"`),J.push(U)}let G=` lang="${Y1(Q)}"`;if(Y)G+=` class="${Y1(Y)}"`;if(G+=X.join(""),Y)G+=` ${M$}="${Y1(Y)}"`;if(J.length)G+=` ${N$}="${Y1(J.join(" "))}"`;return G}function K9($={},Z={}){let X={...$,...Z};if($.class&&Z.class){let J=$.class.split(/\s+/).filter(Boolean);for(let Y of Z.class.split(/\s+/).filter(Boolean))if(!J.includes(Y))J.push(Y);X.class=J.join(" ")}return X}function H9($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let X=$.match(/<html\b([^>]*)>/i);if(!X)return $;let J={},Y=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(X[1]))!==null){let z=G[1];if(!(z in J))Y.push(z);J[z]=G[2]??G[3]??G[4]??""}let q=[],W=[];for(let[z,K]of Object.entries(Z)){if(K==null)continue;let H=z.trim();if(!z9.test(H))continue;let B=H.toLowerCase();if(B==="class"){let j=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(K).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),q.push(_);if(!("class"in J))Y.push("class");J.class=j.join(" ");continue}if(!(H in J))Y.push(H);if(J[H]=String(K),B!=="lang")W.push(H)}if(q.length){if(!(M$ in J))Y.push(M$);J[M$]=q.join(" ")}if(W.length){if(!(N$ in J))Y.push(N$);J[N$]=W.join(" ")}let U=Y.map((z)=>` ${z}="${Y1(J[z])}"`).join("");return $.replace(X[0],()=>`<html${U}>`)}function AB($){let Z=K4($);if(Z===null)return $;let X=$.lastIndexOf("</head>");return`${$.slice(0,X)}${Z}${$.slice(X)}`}function K4($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${U9}
3408
+ `}function nQ($){let Z=[],X=0;while(X<$.length){let Q=$.slice(X),G=Q.match(/^\s+/);if(G){X+=G[0].length;continue}if(Q.startsWith("<!--")){let K=$.indexOf("-->",X);if(K===-1)break;X=K+3;continue}let q=Q.match(/^<script\b[^>]*>/i);if(q){let K=$.toLowerCase().indexOf("</script>",X+q[0].length);if(K===-1)break;X=K+9;continue}let W=Q.match(/^<link\b[^>]*>/i);if(W){Z.push(W[0]),X+=W[0].length;continue}let U=Q.match(/^<meta\b[^>]*>/i);if(U){Z.push(U[0]),X+=U[0].length;continue}let z=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(z){Z.push(z[0]),X+=z[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",Y=0;while(Y<$.length&&Y<X){let Q=$.slice(Y),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Y+=G[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q&&Z.includes(q[0])){Y+=q[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W&&Z.includes(W[0])){Y+=W[0].length;continue}J+=$[Y],Y++}return J+=$.slice(X),{body:J,hoisted:Z}}function sQ($,Z={},X={}){let{title:J="stx App",lang:Y="en",meta:Q=[],link:G=[],script:q=[],headRaw:W="",htmlAttrs:U={},bodyClass:z="",bodyAttrs:K={}}=Z,H=X.title||J,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(Q.map(s1).filter(Boolean)),F=[...B.filter((A)=>!j.has(s1(A))),...Q].map((A)=>{return` <meta ${n1(A)}>`}).join(`
3407
3409
  `),V=G.map((A)=>{return` <link ${n1(A)}>`}).join(`
3408
3410
  `),O=q.map((A)=>{if(A.src)return` <script ${n1(A,(T)=>T==="content")}></script>`;if(A.content)return` <script>${A.content}</script>`;return""}).filter(Boolean).join(`
3409
- `),F=hQ(K,Y),w=Object.entries(z).map(([A,T])=>` ${A}="${Y1(String(T))}"`).join(""),R=U?` class="${Y1(U)}"`:"",{body:D,hoisted:M}=uQ($),k=[L,X.colorMode?` ${q4(X.colorMode)}`:"",` <title>${X.titleIsHtml?H:gQ(H)}</title>`,` ${W9}`,V,O,W?` ${W}`:"",...(X.styles||[]).map((A)=>` ${A}`),...M.map((A)=>` ${A}`),...(X.headScripts||[]).map((A)=>` ${A}`),X.headStack||""].filter(Boolean),N=[D,...(X.bodyScripts||[]).map((A)=>A),X.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3410
- <html${F}>
3411
+ `),L=iQ(U,Y),w=Object.entries(K).map(([A,T])=>` ${A}="${Y1(String(T))}"`).join(""),R=z?` class="${Y1(z)}"`:"",{body:D,hoisted:M}=nQ($),k=[F,X.colorMode?` ${U4(X.colorMode)}`:"",` <title>${X.titleIsHtml?H:pQ(H)}</title>`,` ${U9}`,V,O,W?` ${W}`:"",...(X.styles||[]).map((A)=>` ${A}`),...M.map((A)=>` ${A}`),...(X.headScripts||[]).map((A)=>` ${A}`),X.headStack||""].filter(Boolean),N=[D,...(X.bodyScripts||[]).map((A)=>A),X.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3412
+ <html${L}>
3411
3413
  <head>
3412
3414
  ${k.join(`
3413
3415
  `)}
@@ -3416,9 +3418,9 @@ ${k.join(`
3416
3418
  ${N.join(`
3417
3419
  `)}
3418
3420
  </body>
3419
- </html>`}function U4($){let Z=0;while(Z<$.length){let X=$.slice(Z),J=X.match(/^\s+/);if(J){Z+=J[0].length;continue}if(X.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let Y=X.match(/^<(script|style)\b[^>]*>/i);if(Y){let Q=`</${Y[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+Y[0].length);if(G===-1)return!1;Z=G+Q.length;continue}return/^<!DOCTYPE\b/i.test(X)||/^<html[\s>]/i.test(X)}return!1}function z4($){return U4($)}function H9($,Z={}){let X=$.lastIndexOf("</head>");if(X===-1)return $;let{meta:J=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,q=$.slice(0,X),W=[];for(let K of J){let U=s1(K);if(U&&q.includes(U))continue;W.push(` <meta ${n1(K)}>`)}for(let K of Y){if(K.href&&q.includes(`href="${K.href}"`))continue;W.push(` <link ${n1(K)}>`)}for(let K of Q)if(K.src){if(q.includes(`src="${K.src}"`))continue;W.push(` <script ${n1(K,(U)=>U==="content")}></script>`)}else if(K.content){if(q.includes(K.content))continue;W.push(` <script>${K.content}</script>`)}if(G&&!q.includes(G))W.push(` ${G}`);if(W.length===0)return $;return`${$.slice(0,X)}${W.join(`
3421
+ </html>`}function H4($){let Z=0;while(Z<$.length){let X=$.slice(Z),J=X.match(/^\s+/);if(J){Z+=J[0].length;continue}if(X.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let Y=X.match(/^<(script|style)\b[^>]*>/i);if(Y){let Q=`</${Y[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+Y[0].length);if(G===-1)return!1;Z=G+Q.length;continue}return/^<!DOCTYPE\b/i.test(X)||/^<html[\s>]/i.test(X)}return!1}function B4($){return H4($)}function B9($,Z={}){let X=$.lastIndexOf("</head>");if(X===-1)return $;let{meta:J=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,q=$.slice(0,X),W=[];for(let U of J){let z=s1(U);if(z&&q.includes(z))continue;W.push(` <meta ${n1(U)}>`)}for(let U of Y){if(U.href&&q.includes(`href="${U.href}"`))continue;W.push(` <link ${n1(U)}>`)}for(let U of Q)if(U.src){if(q.includes(`src="${U.src}"`))continue;W.push(` <script ${n1(U,(z)=>z==="content")}></script>`)}else if(U.content){if(q.includes(U.content))continue;W.push(` <script>${U.content}</script>`)}if(G&&!q.includes(G))W.push(` ${G}`);if(W.length===0)return $;return`${$.slice(0,X)}${W.join(`
3420
3422
  `)}
3421
- ${$.slice(X)}`}function B9($,Z={},X={}){if(z4($))return $;return dQ($,Z,X)}var mQ=/<\/(script)/gi;function o1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(mQ,"<\\/$1")}var k5=["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"];B5();B5();function _9($,Z={}){return new j9($,Z).routes}function IB($,Z){let X=H4($,Z);return X?X.params:null}var V9=new Map;async function O9($){let Z=$;if(!Z)try{Z=(await I3())?.pagesDir||"pages"}catch{Z="pages"}let X=Z,J=V9.get(X);if(J)return J;let Y=[];try{Y=_9(".",{pagesDir:X}).map((Q)=>Q.regex.source).filter(Boolean)}catch{Y=[]}return V9.set(X,Y),Y}function lQ($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function F9($){return lQ(JSON.stringify($))}function B4(){return`
3423
+ ${$.slice(X)}`}function j9($,Z={},X={}){if(B4($))return $;return sQ($,Z,X)}var oQ=/<\/(script)/gi;function o1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(oQ,"<\\/$1")}var k5=["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"];H5();H5();function V9($,Z={}){return new _9($,Z).routes}function PB($,Z){let X=j4($,Z);return X?X.params:null}var O9=new Map;async function F9($){let Z=$;if(!Z)try{Z=(await I3())?.pagesDir||"pages"}catch{Z="pages"}let X=Z,J=O9.get(X);if(J)return J;let Y=[];try{Y=V9(".",{pagesDir:X}).map((Q)=>Q.regex.source).filter(Boolean)}catch{Y=[]}return O9.set(X,Y),Y}function rQ($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function L9($){return rQ(JSON.stringify($))}function _4(){return`
3422
3424
  (function(){
3423
3425
  var tip=null,hideTimer=null,currentEl=null;
3424
3426
 
@@ -3521,48 +3523,48 @@ document.addEventListener("focusout",function(e){
3521
3523
  if(el) hideTip();
3522
3524
  });
3523
3525
  })();
3524
- `}function L9($){return $.includes("data-stx-runtime")}function w9($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let X=Z.exec($);X!==null;X=Z.exec($)){let J=$.slice(Math.max(0,X.index-80),X.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}function j4($,Z){let X=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(X!==-1&&(J===-1||X>J))return $.slice(0,X)+Z+`
3525
- `+$.slice(X);let Y=/<head\b[^>]*>/i.exec($);if(Y){let G=Y.index+Y[0].length;return`${$.slice(0,G)}
3526
- ${Z}${$.slice(G)}`}if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3526
+ `}function w9($){return $.includes("data-stx-runtime")}function R9($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let X=Z.exec($);X!==null;X=Z.exec($)){let J=$.slice(Math.max(0,X.index-80),X.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}function V4($,Z){let X=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(X!==-1&&(J===-1||X>J))return $.slice(0,X)+Z+`
3527
+ `+$.slice(X);let Y=A5($);if(Y!==null)return`${$.slice(0,Y)}
3528
+ ${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3527
3529
  `+$.slice(G)}if(q1($))return v1($,(G)=>`${G}
3528
3530
  ${Z}`);return`${Z}
3529
- ${$}`}async function A$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return j4($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return j4($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-08a9bfpq.js"),J=await X(Z.debug);return j4($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function cQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function R9($){if($.includes("data-stx-tooltip-runtime")||!cQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${B4()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
3531
+ ${$}`}async function A$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return V4($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return V4($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-0kexd0d9.js"),J=await X(Z.debug);return V4($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function aQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function D9($){if($.includes("data-stx-tooltip-runtime")||!aQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${_4()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
3530
3532
  ${Z}`;return`${$.slice(0,X)}${Z}
3531
- ${$.slice(X)}`}var pQ=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function iQ($){return pQ.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function nQ($,Z){if(!$.includes("</body>"))return $;if(iQ($))return $;let X=Z?.router,J="";{let q={};if(X){if(X.container)q.container=X.container;if(X.interceptAllLinks!==void 0)q.interceptAllLinks=X.interceptAllLinks;if(X.progress!==void 0)q.progress=X.progress;if(X.viewTransitions!==void 0)q.viewTransitions=X.viewTransitions;if(X.viewTransitionDuration!==void 0)q.viewTransitionDuration=X.viewTransitionDuration;if(X.viewTransitionEasing!==void 0)q.viewTransitionEasing=X.viewTransitionEasing;if(X.scrollToTop!==void 0)q.scrollToTop=X.scrollToTop;if(X.prefetch!==void 0)q.prefetch=X.prefetch;if(X.cache!==void 0)q.cache=X.cache;if(X.progressColor!==void 0)q.progressColor=X.progressColor;if(X.progressHeight!==void 0)q.progressHeight=X.progressHeight}try{let W=await O9(Z?.pagesDir);if(W.length>0)q.ownedRoutes=W}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${F9(q)};</script>
3532
- `}let{getCachedRouterScript:Y}=await import("./chunk-08a9bfpq.js"),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Y()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
3533
- </body>`+$.slice(G+7)}var D9=Symbol.for("stx.lazy-module-promises");function sQ(){let $=globalThis;return $[D9]??=new Map,$[D9]}function o($,Z){let X=sQ(),J=`${import.meta.url}\x00${$}`,Y=X.get(J);if(Y)return Y;let Q=Z();return X.set(J,Q),Q.catch(()=>{if(X.get(J)===Q)X.delete(J)}),Q}var V4=`(?:"[^"]*"|'[^']*'|[^>"'])*`,T9=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function oQ($,Z={}){let X=[];for(let J of n5($,Q1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=Y[0].length,W=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,W),start:J.start,end:J.end})}return X}function E9($){let Z=$.trim(),X=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:q}=N9(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:q}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:q}=N9(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function N9($){let Z=$.trim(),X=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(X)return{itemVar:X[2],indexVar:X[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[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 F4($,Z){return I9($,Z)}function rQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,X=0,J;while((J=Z.exec($))!==null){let Y=J[1];if(Y.startsWith("if"))X++;else if(Y==="endif")X--;else if(X===0)return!0}return!1}function aQ($){let Z=new Set,X=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=X.exec($))!==null){let Q=Y[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function tQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${V4})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=n5($,(Q,G)=>{Z.lastIndex=G;let q=Z.exec(Q);if(!q||q.index!==G||!X.test(q[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of J){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let q=G[2].match(X),W=E9(q?.[1]??q?.[2]??""),K=[W.itemVar,W.indexVar].filter(Boolean);if(K.length===0)continue;let U=G[1],H=/\/\s*>$/.test(Q.token)||I$.has(U.toLowerCase())?Q.end:y9($,Q.start,U,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(K)})}return Y}var M9=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 eQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function A9($,Z,X,J){if(!$)return!1;let Y=eQ($),Q=!1,G=!1,q=!1,W=/([a-zA-Z_$][\w$]*)/g,K;while((K=W.exec(Y))!==null){let B=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(M9.has(B))continue;if(Z.has(B)||J?.has(B))Q=!0;else if(X&&B in X)G=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=U.exec(Y))!==null){let B=z[1];if(Y.slice(0,z.index).trimEnd().endsWith("."))continue;if(M9.has(B)||X&&B in X)continue;q=!0}return(Q||q)&&!G}function k$($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(T9);if(Q&&$G(Q[3],Q[1])){let[,G,q,W]=Q;return`<${G}${q}${J}>${W}</${G}>`}return`<template${J}>${Y}</template>`}function $G($,Z){let X=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Y;while((Y=X.exec($))!==null)if(Y[1]){if(J--,J<0)return!1}else J++;return!0}function b9($,Z){let X=aQ($);function J(Y){let Q=Y,G=tQ(Y),q=(z)=>{let H=new Set;for(let B of G)if(z>B.start&&z<B.end)for(let j of B.vars)H.add(j);return H},W=/@if\s*\(/g,K,U=[];while((K=W.exec(Q))!==null){let z=K.index,H=z+K[0].length,B=1,j=H;while(j<Q.length&&B>0){if(Q[j]==="(")B++;else if(Q[j]===")")B--;j++}if(B!==0)continue;let _=Q.substring(H,j-1).trim(),L=j,V=1,O=L,F=/@(if\s*\(|endif)/g;F.lastIndex=L;let w;while((w=F.exec(Q))!==null)if(w[1].startsWith("if"))V++;else if(w[1]==="endif"){if(V--,V===0){O=w.index+w[0].length;break}}if(V!==0)continue;let R=Q.substring(L,O-6).trim(),D;if(rQ(R)){let M=w5(Q.substring(z,O));if(M.length===0)continue;let k=M[0].branches.filter((I)=>I.type!=="else"),N=q(z);if(!(k.length>0&&k.every((I)=>A9(I.condition,X,Z,N))))continue;D=M[0].branches.map((I)=>{let S=J(I.content);if(I.type==="elseif")return k$(S,"@else-if",I.condition??"");if(I.type==="else")return k$(S,"@else");return k$(S,"@if",I.condition??"")}).join(`
3534
- `)}else{if(!A9(_,X,Z,q(z)))continue;D=k$(J(R),"@if",_)}U.push({start:z,end:O,replacement:D}),W.lastIndex=O}for(let z=U.length-1;z>=0;z--){let{start:H,end:B,replacement:j}=U[z];Q=Q.substring(0,H)+j+Q.substring(B)}return Q}return J($)}function ZG($){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 X=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(X)return X[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}var I$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function y9($,Z,X,J){if(I$.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,W=J;while(W<G){let K=$.indexOf("<",W);if(K===-1)return-1;if(W=K,$.startsWith("<!--",W)){let B=$.indexOf("-->",W+4);if(B===-1)return-1;W=B+3;continue}let U=/^<(script|style)\b/i.exec($.slice(W,W+8));if(U){let B=$.indexOf(">",W);if(B===-1)return-1;if($[B-1]==="/"){W=B+1;continue}let j=Q.indexOf(`</${U[1].toLowerCase()}`,W);if(j===-1)return-1;let _=$.indexOf(">",j);if(_===-1)return-1;W=_+1;continue}if($[W+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!B){W++;continue}if(B[1].toLowerCase()===Y){if(q--,W+=B[0].length,q===0)return W;continue}W+=B[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!z){W++;continue}let H=$.indexOf(">",W);if(H===-1)return-1;if(z[1].toLowerCase()===Y){let B=$.slice(W,H+1);if(!(/\/\s*>$/.test(B)||I$.has(Y)))q++}W=H+1}return-1}var XG=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function JG($,Z){let X=Z,J=$.length;for(;;){while(X<J&&$[X]!=="<")X++;if(X>=J)return!1;if($.startsWith("<!--",X)){let G=$.indexOf("-->",X+4);if(G===-1)return!1;X=G+3;continue}break}if($[X+1]==="/")return!1;let Y=$.indexOf(">",X);if(Y===-1)return!1;let Q=$.slice(X,Y+1);return XG.test(Q)}function S9($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=X.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Y=(z)=>Z.some(([H,B])=>z>=H&&z<B),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=[],q;while((q=Q.exec($))!==null){if(Y(q.index))continue;let[z,H,B,j,_,L,V]=q,O=ZG(_);if(O===void 0)continue;let F=q.index,w=F+z.length,M=!!V||/\/\s*>$/.test(z)||I$.has(H.toLowerCase())?w:y9($,F,H,w);if(M===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&JG($,M)){Q.lastIndex=w;continue}if(O===!0){let N=`<${H}${B}${L}${V}>`;G.push({start:F,end:w,replacement:N});continue}G.push({start:F,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((z,H)=>z.start-H.start);let W=[],K=-1;for(let z of G){if(z.start<K)continue;W.push(z),K=z.end}let U=$;for(let z=W.length-1;z>=0;z--){let{start:H,end:B,replacement:j}=W[z];U=U.substring(0,H)+j+U.substring(B)}return U}function L4($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let q=Y[1],W=Y.index,K=W+Y[0].length,U=1,z=K;while(z<X.length&&U>0){if(X[z]==="(")U++;else if(X[z]===")")U--;z++}if(U!==0)continue;let H=X.substring(K,z-1).trim(),B=z,j=E9(H),_=q==="for"?"@endfor":"@endforeach",L=1,V=B,O=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");O.lastIndex=B;let F;while((F=O.exec(X))!==null)if(F[1].startsWith(q))L++;else if(L--,L===0){V=F.index+F[0].length;break}if(L!==0)continue;let w=()=>{let A=[j.itemVar,j.indexVar].filter(Boolean);if(A.length)G.push({start:W,end:V,vars:A})};if(j.iterable){let A=j.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A)){w();continue}let T=A.split(/[.[(]/)[0].trim(),I=Z?T in Z:!1,S=G.some((E)=>W>E.start&&W<E.end&&E.vars.includes(T));if(T&&(I||S)){w();continue}}if(j.style==="as")H=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let R=X.substring(B,V-_.length).trim(),D=Z?{...Z}:{};if(j.itemVar)delete D[j.itemVar];if(j.indexVar)delete D[j.indexVar];let M=L4(R,D),k=M.match(T9),N;if(k){let[,A,T,I]=k;N=`<${A}${T} @for="${H}">${I}</${A}>`}else N=`<template @for="${H}">${M}</template>`;Q.push({start:W,end:V,replacement:N}),J.lastIndex=V}for(let q=Q.length-1;q>=0;q--){let{start:W,end:K,replacement:U}=Q[q];X=X.substring(0,W)+U+X.substring(K)}return X}function YG($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(U)=>{let z=J+1;while(z<Q){let H=$[z];if(H==="\\"){z+=2;continue}if(H===U)return z+1;z++}return Q},q=()=>{let U=J+2;while(U<Q&&$[U]!==`
3535
- `)U++;return U},W=()=>{let U=J+2;while(U<Q-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return Q},K=(U)=>{let z=U,H=0;while(z<Q){let B=$[z];if(B==="/"&&$[z+1]==="/"){let j=z+2;while(j<Q&&$[j]!==`
3536
- `)j++;z=j;continue}if(B==="/"&&$[z+1]==="*"){let j=z+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=z+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}z=j;continue}if(B==="("||B==="["||B==="{"){H++,z++;continue}if(B===")"||B==="]"||B==="}"){H--,z++;continue}if(B===";"&&H===0)return z+1;z++}return Q};while(J<Q){let U=$[J];if(U==="/"&&$[J+1]==="/"){let z=q();X.push($.slice(J,z)),J=z;continue}if(U==="/"&&$[J+1]==="*"){let z=W();X.push($.slice(J,z)),J=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);X.push($.slice(J,z)),J=z;continue}if(U==="{"){Y++,X.push(U),J++;continue}if(U==="}"){Y--,X.push(U),J++;continue}if(Y===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=K(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(U),J++}return X.join("")}async function QG($,Z,X){let J=oQ($,{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|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:q}=await o("stx/client-script-bundler",()=>import("./chunk-s0v2g53x.js"));for(let V of J){let O=V.body;if(M1(V.attrs))O=A1(O);if(Y.test(O)){Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O});continue}if(!G(O))continue;try{let F=await q(r1(O).code,Z||"",{projectRoot:process.cwd()});if(Y.test(F))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O,bundled:F})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let W=`${Z??""}\x00${Q.map((V)=>V.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(W).toString(36).slice(0,10)}`,U=[];for(let V=0;V<Q.length;V++){let O=Q[V].bundled??r1(Q[V].content).code;if(!Q[V].bundled&&G(O))O=await q(O,Z||"",{projectRoot:process.cwd()});O=KG(O);let F=$1(O);U.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
3537
- ${F}`)}let z=U.join(`
3538
-
3539
- `);z=YG(z);let H=GG(z),B=H.split(",").map((V)=>V.trim()).filter(Boolean),j=O4(z,X),_=`
3533
+ ${$.slice(X)}`}var tQ=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function eQ($){return tQ.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function $G($,Z){if(!$.includes("</body>"))return $;if(eQ($))return $;let X=Z?.router,J="";{let q={};if(X){if(X.container)q.container=X.container;if(X.interceptAllLinks!==void 0)q.interceptAllLinks=X.interceptAllLinks;if(X.progress!==void 0)q.progress=X.progress;if(X.viewTransitions!==void 0)q.viewTransitions=X.viewTransitions;if(X.viewTransitionDuration!==void 0)q.viewTransitionDuration=X.viewTransitionDuration;if(X.viewTransitionEasing!==void 0)q.viewTransitionEasing=X.viewTransitionEasing;if(X.scrollToTop!==void 0)q.scrollToTop=X.scrollToTop;if(X.prefetch!==void 0)q.prefetch=X.prefetch;if(X.cache!==void 0)q.cache=X.cache;if(X.progressColor!==void 0)q.progressColor=X.progressColor;if(X.progressHeight!==void 0)q.progressHeight=X.progressHeight}try{let W=await F9(Z?.pagesDir);if(W.length>0)q.ownedRoutes=W}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${L9(q)};</script>
3534
+ `}let{getCachedRouterScript:Y}=await import("./chunk-0kexd0d9.js"),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Y()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
3535
+ </body>`+$.slice(G+7)}var N9=Symbol.for("stx.lazy-module-promises");function ZG(){let $=globalThis;return $[N9]??=new Map,$[N9]}function o($,Z){let X=ZG(),J=`${import.meta.url}\x00${$}`,Y=X.get(J);if(Y)return Y;let Q=Z();return X.set(J,Q),Q.catch(()=>{if(X.get(J)===Q)X.delete(J)}),Q}var F4=`(?:"[^"]*"|'[^']*'|[^>"'])*`,E9=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function XG($,Z={}){let X=[];for(let J of n5($,Q1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=Y[0].length,W=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,W),start:J.start,end:J.end})}return X}function b9($){let Z=$.trim(),X=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:q}=M9(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:q}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:q}=M9(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function M9($){let Z=$.trim(),X=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(X)return{itemVar:X[2],indexVar:X[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[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 w4($,Z){return T9($,Z)}function JG($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,X=0,J;while((J=Z.exec($))!==null){let Y=J[1];if(Y.startsWith("if"))X++;else if(Y==="endif")X--;else if(X===0)return!0}return!1}function YG($){let Z=new Set,X=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=X.exec($))!==null){let Q=Y[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function QG($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${F4})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=n5($,(Q,G)=>{Z.lastIndex=G;let q=Z.exec(Q);if(!q||q.index!==G||!X.test(q[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of J){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let q=G[2].match(X),W=b9(q?.[1]??q?.[2]??""),U=[W.itemVar,W.indexVar].filter(Boolean);if(U.length===0)continue;let z=G[1],H=/\/\s*>$/.test(Q.token)||I$.has(z.toLowerCase())?Q.end:S9($,Q.start,z,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(U)})}return Y}var A9=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 GG($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function k9($,Z,X,J){if(!$)return!1;let Y=GG($),Q=!1,G=!1,q=!1,W=/([a-zA-Z_$][\w$]*)/g,U;while((U=W.exec(Y))!==null){let B=U[1];if(Y.slice(0,U.index).trimEnd().endsWith("."))continue;if(A9.has(B))continue;if(Z.has(B)||J?.has(B))Q=!0;else if(X&&B in X)G=!0}let z=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,K;while((K=z.exec(Y))!==null){let B=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(A9.has(B)||X&&B in X)continue;q=!0}return(Q||q)&&!G}function k$($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(E9);if(Q&&qG(Q[3],Q[1])){let[,G,q,W]=Q;return`<${G}${q}${J}>${W}</${G}>`}return`<template${J}>${Y}</template>`}function qG($,Z){let X=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Y;while((Y=X.exec($))!==null)if(Y[1]){if(J--,J<0)return!1}else J++;return!0}function y9($,Z){let X=YG($);function J(Y){let Q=Y,G=QG(Y),q=(K)=>{let H=new Set;for(let B of G)if(K>B.start&&K<B.end)for(let j of B.vars)H.add(j);return H},W=/@if\s*\(/g,U,z=[];while((U=W.exec(Q))!==null){let K=U.index,H=K+U[0].length,B=1,j=H;while(j<Q.length&&B>0){if(Q[j]==="(")B++;else if(Q[j]===")")B--;j++}if(B!==0)continue;let _=Q.substring(H,j-1).trim(),F=j,V=1,O=F,L=/@(if\s*\(|endif)/g;L.lastIndex=F;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))V++;else if(w[1]==="endif"){if(V--,V===0){O=w.index+w[0].length;break}}if(V!==0)continue;let R=Q.substring(F,O-6).trim(),D;if(JG(R)){let M=L5(Q.substring(K,O));if(M.length===0)continue;let k=M[0].branches.filter((I)=>I.type!=="else"),N=q(K);if(!(k.length>0&&k.every((I)=>k9(I.condition,X,Z,N))))continue;D=M[0].branches.map((I)=>{let S=J(I.content);if(I.type==="elseif")return k$(S,"@else-if",I.condition??"");if(I.type==="else")return k$(S,"@else");return k$(S,"@if",I.condition??"")}).join(`
3536
+ `)}else{if(!k9(_,X,Z,q(K)))continue;D=k$(J(R),"@if",_)}z.push({start:K,end:O,replacement:D}),W.lastIndex=O}for(let K=z.length-1;K>=0;K--){let{start:H,end:B,replacement:j}=z[K];Q=Q.substring(0,H)+j+Q.substring(B)}return Q}return J($)}function WG($){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 X=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(X)return X[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}var I$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function S9($,Z,X,J){if(I$.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,W=J;while(W<G){let U=$.indexOf("<",W);if(U===-1)return-1;if(W=U,$.startsWith("<!--",W)){let B=$.indexOf("-->",W+4);if(B===-1)return-1;W=B+3;continue}let z=/^<(script|style)\b/i.exec($.slice(W,W+8));if(z){let B=$.indexOf(">",W);if(B===-1)return-1;if($[B-1]==="/"){W=B+1;continue}let j=Q.indexOf(`</${z[1].toLowerCase()}`,W);if(j===-1)return-1;let _=$.indexOf(">",j);if(_===-1)return-1;W=_+1;continue}if($[W+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!B){W++;continue}if(B[1].toLowerCase()===Y){if(q--,W+=B[0].length,q===0)return W;continue}W+=B[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!K){W++;continue}let H=$.indexOf(">",W);if(H===-1)return-1;if(K[1].toLowerCase()===Y){let B=$.slice(W,H+1);if(!(/\/\s*>$/.test(B)||I$.has(Y)))q++}W=H+1}return-1}var UG=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function zG($,Z){let X=Z,J=$.length;for(;;){while(X<J&&$[X]!=="<")X++;if(X>=J)return!1;if($.startsWith("<!--",X)){let G=$.indexOf("-->",X+4);if(G===-1)return!1;X=G+3;continue}break}if($[X+1]==="/")return!1;let Y=$.indexOf(">",X);if(Y===-1)return!1;let Q=$.slice(X,Y+1);return UG.test(Q)}function C9($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=X.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Y=(K)=>Z.some(([H,B])=>K>=H&&K<B),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=[],q;while((q=Q.exec($))!==null){if(Y(q.index))continue;let[K,H,B,j,_,F,V]=q,O=WG(_);if(O===void 0)continue;let L=q.index,w=L+K.length,M=!!V||/\/\s*>$/.test(K)||I$.has(H.toLowerCase())?w:S9($,L,H,w);if(M===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&zG($,M)){Q.lastIndex=w;continue}if(O===!0){let N=`<${H}${B}${F}${V}>`;G.push({start:L,end:w,replacement:N});continue}G.push({start:L,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((K,H)=>K.start-H.start);let W=[],U=-1;for(let K of G){if(K.start<U)continue;W.push(K),U=K.end}let z=$;for(let K=W.length-1;K>=0;K--){let{start:H,end:B,replacement:j}=W[K];z=z.substring(0,H)+j+z.substring(B)}return z}function R4($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let q=Y[1],W=Y.index,U=W+Y[0].length,z=1,K=U;while(K<X.length&&z>0){if(X[K]==="(")z++;else if(X[K]===")")z--;K++}if(z!==0)continue;let H=X.substring(U,K-1).trim(),B=K,j=b9(H),_=q==="for"?"@endfor":"@endforeach",F=1,V=B,O=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");O.lastIndex=B;let L;while((L=O.exec(X))!==null)if(L[1].startsWith(q))F++;else if(F--,F===0){V=L.index+L[0].length;break}if(F!==0)continue;let w=()=>{let A=[j.itemVar,j.indexVar].filter(Boolean);if(A.length)G.push({start:W,end:V,vars:A})};if(j.iterable){let A=j.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A)){w();continue}let T=A.split(/[.[(]/)[0].trim(),I=Z?T in Z:!1,S=G.some((E)=>W>E.start&&W<E.end&&E.vars.includes(T));if(T&&(I||S)){w();continue}}if(j.style==="as")H=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let R=X.substring(B,V-_.length).trim(),D=Z?{...Z}:{};if(j.itemVar)delete D[j.itemVar];if(j.indexVar)delete D[j.indexVar];let M=R4(R,D),k=M.match(E9),N;if(k){let[,A,T,I]=k;N=`<${A}${T} @for="${H}">${I}</${A}>`}else N=`<template @for="${H}">${M}</template>`;Q.push({start:W,end:V,replacement:N}),J.lastIndex=V}for(let q=Q.length-1;q>=0;q--){let{start:W,end:U,replacement:z}=Q[q];X=X.substring(0,W)+z+X.substring(U)}return X}function KG($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(z)=>{let K=J+1;while(K<Q){let H=$[K];if(H==="\\"){K+=2;continue}if(H===z)return K+1;K++}return Q},q=()=>{let z=J+2;while(z<Q&&$[z]!==`
3537
+ `)z++;return z},W=()=>{let z=J+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},U=(z)=>{let K=z,H=0;while(K<Q){let B=$[K];if(B==="/"&&$[K+1]==="/"){let j=K+2;while(j<Q&&$[j]!==`
3538
+ `)j++;K=j;continue}if(B==="/"&&$[K+1]==="*"){let j=K+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;K=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=K+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}K=j;continue}if(B==="("||B==="["||B==="{"){H++,K++;continue}if(B===")"||B==="]"||B==="}"){H--,K++;continue}if(B===";"&&H===0)return K+1;K++}return Q};while(J<Q){let z=$[J];if(z==="/"&&$[J+1]==="/"){let K=q();X.push($.slice(J,K)),J=K;continue}if(z==="/"&&$[J+1]==="*"){let K=W();X.push($.slice(J,K)),J=K;continue}if(z==='"'||z==="'"||z==="`"){let K=G(z);X.push($.slice(J,K)),J=K;continue}if(z==="{"){Y++,X.push(z),J++;continue}if(z==="}"){Y--,X.push(z),J++;continue}if(Y===0){let K=J>0?$[J-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=U(J+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),J=_;continue}Z.add(j),X.push($.slice(J,_)),J=_;continue}}}X.push(z),J++}return X.join("")}async function HG($,Z,X){let J=XG($,{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|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:q}=await o("stx/client-script-bundler",()=>import("./chunk-hysmnz0q.js"));for(let V of J){let O=V.body;if(M1(V.attrs))O=A1(O);if(Y.test(O)){Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O});continue}if(!G(O))continue;try{let L=await q(r1(O).code,Z||"",{projectRoot:process.cwd()});if(Y.test(L))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O,bundled:L})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let W=`${Z??""}\x00${Q.map((V)=>V.content).join("\x00")}`,U=`__stx_setup_${Bun.hash(W).toString(36).slice(0,10)}`,z=[];for(let V=0;V<Q.length;V++){let O=Q[V].bundled??r1(Q[V].content).code;if(!Q[V].bundled&&G(O))O=await q(O,Z||"",{projectRoot:process.cwd()});O=VG(O);let L=$1(O);z.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
3539
+ ${L}`)}let K=z.join(`
3540
+
3541
+ `);K=KG(K);let H=BG(K),B=H.split(",").map((V)=>V.trim()).filter(Boolean),j=L4(K,X),_=`
3540
3542
  <script data-stx-scoped>
3541
- function ${K}() {
3543
+ function ${U}() {
3542
3544
  ${c1("const",B)}
3543
- ${o1(`${j}${z}`)}
3545
+ ${o1(`${j}${K}`)}
3544
3546
  return { ${H} };
3545
3547
  }
3546
- window.__stx_latestSetup=${K};
3547
- if(window.stx)window.stx._latestSetup=${K};
3548
- </script>`,L=$;for(let V of Q)L=L.split(V.fullMatch).join("");if(L.includes("<body"))L=L.replace(new RegExp(`<body(${V4})>`),`<body$1 data-stx="${K}">`);else{let V=["script","style","html","head","meta","link","title","!doctype"],O=!1;L=L.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${V4})>`,"gi"),(F,w,R)=>{if(O||V.includes(w.toLowerCase()))return F;return O=!0,`<${w}${R} data-stx="${K}">`})}return{output:L,setupCode:_}}function GG($){let Z=$,X=[],J=new Set,Y=0,Q=0,G=Z.length,q="",W=()=>{Q++;let j=!1;while(Q<G){let _=Z[Q];if(_==="\\"){Q+=2;continue}if(_==="["&&!j){j=!0,Q++;continue}if(_==="]"&&j){j=!1,Q++;continue}if(_==="/"&&!j){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(_===`
3549
- `)return;Q++}},K=()=>{if(!q)return!0;if(/[\w)\]]/.test(q))return!1;return!0},U=(j)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===j){Q++;return}Q++}},z=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let j=1;while(Q<G&&j>0)if(Z[Q]==="{")j++,Q++;else if(Z[Q]==="}")j--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')U(Z[Q]);else if(Z[Q]==="`")z();else Q++;continue}Q++}},H=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3550
- `)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},B=()=>{if(Y!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(j){let F=j[2];if(!J.has(F))X.push(F),J.add(F);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((F)=>{let w=F.trim();if(!w)return;let R=w.indexOf(":"),M=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(M&&!J.has(M))X.push(M),J.add(M)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((F)=>{let w=F.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!J.has(R))X.push(R),J.add(R)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let F=V[1];if(!J.has(F))X.push(F),J.add(F);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!J.has(F))X.push(F),J.add(F)}};while(Q<G){if(H())continue;if(Z[Q]==="'"||Z[Q]==='"'){U(Z[Q]),q=Z[Q-1];continue}if(Z[Q]==="`"){z(),q="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&K()){W(),q="/";continue}if(Z[Q]==="{"){Y++,q="{",Q++;continue}if(Z[Q]==="}"){Y--,q="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))B();if(!/\s/.test(Z[Q]))q=Z[Q];Q++}return X.join(", ")}async function C9($,Z,X,J){if(!F4($,X))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await QG(Y,X,J);if(Y=Q,Y=await A$(Y,Z),G){let U=_4(Y,/<\/head>/i),z=U===-1?_4(Y,/<body[^>]*>/i):-1;if(U!==-1)Y=`${Y.slice(0,U)}${G}
3551
- ${Y.slice(U)}`;else if(z!==-1){let H=/<body[^>]*>/i.exec(Y.slice(z))[0],B=z+H.length;Y=`${Y.slice(0,B)}
3548
+ window.__stx_latestSetup=${U};
3549
+ if(window.stx)window.stx._latestSetup=${U};
3550
+ </script>`,F=$;for(let V of Q)F=F.split(V.fullMatch).join("");if(F.includes("<body"))F=F.replace(new RegExp(`<body(${F4})>`),`<body$1 data-stx="${U}">`);else{let V=["script","style","html","head","meta","link","title","!doctype"],O=!1;F=F.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${F4})>`,"gi"),(L,w,R)=>{if(O||V.includes(w.toLowerCase()))return L;return O=!0,`<${w}${R} data-stx="${U}">`})}return{output:F,setupCode:_}}function BG($){let Z=$,X=[],J=new Set,Y=0,Q=0,G=Z.length,q="",W=()=>{Q++;let j=!1;while(Q<G){let _=Z[Q];if(_==="\\"){Q+=2;continue}if(_==="["&&!j){j=!0,Q++;continue}if(_==="]"&&j){j=!1,Q++;continue}if(_==="/"&&!j){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(_===`
3551
+ `)return;Q++}},U=()=>{if(!q)return!0;if(/[\w)\]]/.test(q))return!1;return!0},z=(j)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===j){Q++;return}Q++}},K=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let j=1;while(Q<G&&j>0)if(Z[Q]==="{")j++,Q++;else if(Z[Q]==="}")j--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")K();else Q++;continue}Q++}},H=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3552
+ `)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},B=()=>{if(Y!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(j){let L=j[2];if(!J.has(L))X.push(L),J.add(L);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let R=w.indexOf(":"),M=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(M&&!J.has(M))X.push(M),J.add(M)});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&&!J.has(R))X.push(R),J.add(R)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let L=V[1];if(!J.has(L))X.push(L),J.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(!J.has(L))X.push(L),J.add(L)}};while(Q<G){if(H())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]),q=Z[Q-1];continue}if(Z[Q]==="`"){K(),q="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&U()){W(),q="/";continue}if(Z[Q]==="{"){Y++,q="{",Q++;continue}if(Z[Q]==="}"){Y--,q="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))B();if(!/\s/.test(Z[Q]))q=Z[Q];Q++}return X.join(", ")}async function P9($,Z,X,J){if(!w4($,X))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await HG(Y,X,J);if(Y=Q,Y=await A$(Y,Z),G){let z=O4(Y,/<\/head>/i),K=z===-1?O4(Y,/<body[^>]*>/i):-1;if(z!==-1)Y=`${Y.slice(0,z)}${G}
3553
+ ${Y.slice(z)}`;else if(K!==-1){let H=/<body[^>]*>/i.exec(Y.slice(K))[0],B=K+H.length;Y=`${Y.slice(0,B)}
3552
3554
  ${G}${Y.slice(B)}`}else Y=`${Y}
3553
- ${G}`}let W=Y.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),K=W&&/data-stx/.test(W[1]);if(!G&&!K&&W&&!/data-stx-auto/.test(W[1])){let U=/<body[^>]*>/i,z=_4(Y,U);if(z!==-1){let H=Y.slice(0,z),B=Y.slice(z).replace(U,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Y=H+B}}return Y}function _4($,Z){let X=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],Y;while((Y=X.exec($))!==null)J.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 q=Q.exec($.slice(G));if(!q)return-1;let W=G+q.index;if(!J.some(([U,z])=>W>=U&&W<z))return W;G=W+Math.max(q[0].length,1)}return-1}var k9="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function qG($){let Z=[];for(let X of $.split(",")){let J=X.trim();if(!J||J.startsWith("type "))continue;let Y=J.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 k9;return`var ${Z.join(", ")}; ${k9}`}var WG=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function KG($){return $.replace(WG,(Z,X)=>qG(X))}import d0 from"path";import w4 from"fs";function P9($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function v9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class f9{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,X,J){let Y=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let B=[Y,Y.toLowerCase(),P9(Y),v9(Y)];for(let j of B)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${Y}.stx`,`${P9(Y)}.stx`,`${v9(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let B=d0.resolve(d0.dirname(Z),`${Y}.stx`);if(await t(B))return B;return null}let q=[],W=X.componentsDir||"",K=J?.__originalFilePath;if(K)q.push(d0.join(d0.dirname(K),"components"));if(W)q.push(W);let U=d0.join(d0.dirname(Z),"components");if(!q.includes(U))q.push(U);let z=process.cwd(),H=[d0.resolve(z,"src/components"),d0.resolve(z,"components"),d0.resolve(import.meta.dir,"components")];for(let B of H)if(!q.includes(B))q.push(B);for(let B of q){if(!B)continue;for(let j of G){let _=d0.join(B,j);if(await t(_))return _}try{if(!w4.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let _=w4.readdirSync(B,{withFileTypes:!0});for(let L of _)if(L.isDirectory()){let V=d0.join(B,L.name);for(let O of G){let F=d0.join(V,O);if(await t(F))return F}}}catch{}}return null}}var S0=new f9;function w0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var T1="\x00stx-boolean-attribute";function R4($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function a1($,Z){let X=[];for(let[J,Y]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof Y==="boolean"){if(Y)X.push(w0(Q));continue}if(Y===T1){X.push(w0(Q));continue}X.push(`${w0(Q)}="${w0(R4(String(Y)))}"`)}return X}function t1($,Z){let X=[];for(let[J,Y]of Object.entries($.serverDynamic??{})){if(Z.has(J))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[J]??J;if(Y===!0){X.push(w0(Q));continue}if(typeof Y==="object")continue;X.push(`${w0(Q)}="${w0(R4(String(Y)))}"`)}return X}function I5($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function UG($){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 D4={name:"StxLink",aliases:["stx-link"],render($,Z,X){let J=UG($),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",q=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,W=[];if(J.reactive)W.push(`:href="${I5(J.value)}"`);else W.push(`href="${I5(J.value)}"`);if(Y)W.push(`class="${I5(Y)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${I5(Q)}"`),W.push(`data-stx-exact-active-class="${I5(G)}"`),q)W.push("data-stx-prefetch");let K=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...a1($,K)),W.push(...t1($,K)),`<a ${W.join(" ")}>${Z}</a>`}};import $5 from"fs";import N4 from"path";var zG=new Set([".jpg",".jpeg",".png",".webp",".avif"]),_1=new Map,e1=!1;function x9($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return _1.get(Z)}function Hj(){return e1}function Bj(){_1.clear(),e1=!1}function jj($,Z){_1.set($,Z),e1=!0}function HG($){let Z=0,X=0,J=0,Y=0;for(let G=0;G<$.length;G+=4)Z+=$[G],X+=$[G+1],J+=$[G+2],Y++;if(Y===0)return"#e5e7eb";let Q=(G)=>Math.round(G/Y).toString(16).padStart(2,"0");return`#${Q(Z)}${Q(X)}${Q(J)}`}function BG($,Z,X,J=4,Y=3){let Q=[];for(let G=0;G<Y;G++)for(let q=0;q<J;q++){let W=Math.floor(q*Z/J),K=Math.max(W+1,Math.floor((q+1)*Z/J)),U=Math.floor(G*X/Y),z=Math.max(U+1,Math.floor((G+1)*X/Y)),H=0,B=0,j=0,_=0;for(let V=U;V<z;V++)for(let O=W;O<K;O++){let F=(V*Z+O)*4;H+=$[F],B+=$[F+1],j+=$[F+2],_++}let L=(V)=>Math.round(V/_).toString(16).padStart(2,"0");Q.push(`<rect x="${q}" y="${G}" width="1" height="1" fill="#${L(H)}${L(B)}${L(j)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${J} ${Y}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Q.join("")}</g></svg>`}function jG($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function _G($){try{return JSON.parse($5.readFileSync($,"utf8"))}catch{return{}}}function VG($,Z){try{$5.mkdirSync(N4.dirname($),{recursive:!0}),$5.writeFileSync($,JSON.stringify(Z))}catch{}}function g9($,Z,X=[]){let J;try{J=$5.readdirSync($,{withFileTypes:!0})}catch{return X}for(let Y of J){let Q=N4.join($,Y.name);if(Y.isDirectory()){g9(Q,`${Z}/${Y.name}`,X);continue}if(!zG.has(N4.extname(Y.name).toLowerCase()))continue;X.push([`${Z}/${Y.name}`,Q])}return X}async function _j($,Z={}){let{cachePath:X,maxBytes:J=33554432,limit:Y=2000}=Z;if(!$||!$5.existsSync($))return e1=!0,_1.size;let Q;try{Q=await import("ts-images")}catch{return e1=!0,_1.size}let G=X?_G(X):{},q=!1,W=g9($,"").slice(0,Y),K=8,U=async([z,H])=>{let B;try{B=$5.statSync(H)}catch{return}if(B.size>J)return;let j=G[z];if(j&&j.mtimeMs===B.mtimeMs&&j.size===B.size){_1.set(z,{dataUrl:j.dataUrl,color:j.color});return}try{let{hash:_}=await Q.generateThumbHash(H);if(!_)return;let{rgba:L,w:V,h:O}=Q.thumbHashToRGBA(_),F={dataUrl:jG(BG(L,V,O)),color:HG(L)};_1.set(z,F),G[z]={mtimeMs:B.mtimeMs,size:B.size,...F},q=!0}catch{}};for(let z=0;z<W.length;z+=K)await Promise.all(W.slice(z,z+K).map(U));if(X&&q)VG(X,G);return e1=!0,_1.size}var OG={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},M4=[320,640,768,1024,1280,1536,1920];function V0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function M0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function T$($,Z,X=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return X}function FG($){let Z=(J)=>$.variants.filter((Y)=>Y.format===J).reduce((Y,Q)=>Y+Q.bytes,0),X=Z($.fallback.format);return["avif","webp"].map((J)=>({format:J,srcset:$.sources[J]||"",bytes:Z(J)})).filter((J)=>J.srcset&&J.bytes>0&&J.bytes<X).sort((J,Y)=>J.bytes-Y.bytes).map(({format:J,srcset:Y})=>({format:J,srcset:Y}))}function A4($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),X=[];for(let J of Z)if(J.includes(":")){let[Y,Q]=J.split(":"),G=OG[Y];if(G)X.push(`(max-width: ${G}px) ${Q}`);else{let q=Number.parseInt(Y);if(!Number.isNaN(q))X.push(`(max-width: ${q}px) ${Q}`)}}else X.push(J);return X.join(", ")}function k4($,Z,X,J){return Z.map((Y)=>`${T5($,Y,void 0,X,J)} ${Y}w`).join(", ")}function LG($,Z,X,J,Y){return Z.map((Q)=>{let G=X?X*Q:void 0;return`${T5($,G,void 0,J,Y)} ${Q}x`}).join(", ")}function T5($,Z,X,J,Y){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(X)Q.push(`h_${X}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(X)Q.set("h",String(X));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(X)Q.set("height",String(X));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function wG($,Z,X="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${X}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var I4={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,X){let J=M0($,"src")||"",Y=h9(J),Q=M0($,"alt")||"",G=M0($,"width")||(Y?String(Y.source.width):void 0),q=M0($,"height")||(Y?String(Y.source.height):void 0),W=M0($,"sizes"),K=M0($,"srcset"),U=M0($,"densities"),z=M0($,"format"),H=M0($,"placeholder")||(Y?"thumbhash":void 0),B=M0($,"placeholderColor")||"#e5e7eb",j=M0($,"provider"),_=M0($,"class")||M0($,"className")||"",L=M0($,"style")||"",V=M0($,"quality"),O=T$($,"lazy",!0),F=T$($,"preload",!1),w=T$($,"priority",!1),R=M0($,"loading"),D=M0($,"decoding")||"async",M=!!Y||T$($,"picture",!1)||!!z,k=G?Number.parseInt(G):void 0,N=q?Number.parseInt(q):void 0,A=K||"",T="";if(Y)A=Y.sources[Y.fallback.format]||"",T=W?A4(W):"100vw";else if(!A&&W&&j&&j!=="local"&&j!=="static")A=k4(J,M4,j,z),T=A4(W);else if(!A&&U){let d=U.split(/\s+/).map((g)=>Number.parseFloat(g.replace("x","")));A=LG(J,d,k,j,z)}else if(W)T=A4(W);let I=[];if(L)I.push(L);if(k&&N)I.push(`aspect-ratio:${k}/${N}`);if(H==="blur"||H==="color"||H==="thumbhash"){let d=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:B}:x9(J);if(d&&H==="color")I.push(`background-color:${d.color}`);else if(d)I.push(`background-color:${d.color}`),I.push(`background-image:url(${d.dataUrl})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");else{let g=wG(k||16,N||9,B);I.push(`background-image:url(${g})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat")}}else if(H&&H!=="empty"&&H!=="none")I.push(`background-image:url(${V0(H)})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");let S=Y?.fallback.url||T5(J,k,N,j,z),E=[];if(E.push(`src="${V0(S)}"`),E.push(`alt="${V0(Q)}"`),G)E.push(`width="${V0(G)}"`);if(q)E.push(`height="${V0(q)}"`);let b=R||(w||F?"eager":O?"lazy":"");if(b)E.push(`loading="${V0(b)}"`);if(w)E.push('fetchpriority="high"');if(E.push(`decoding="${V0(D)}"`),_)E.push(`class="${V0(_)}"`);if(I.length>0)E.push(`style="${V0(I.join(";"))}"`);if(A)E.push(`srcset="${V0(A)}"`);if(T)E.push(`sizes="${V0(T)}"`);let y=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(...a1($,y)),E.push(...t1($,y));let P=`<img ${E.join(" ")} />`,f="";if(F){let g=z==="webp"?"image/webp":z==="avif"?"image/avif":"";f=`<link rel="preload" as="image" href="${V0(S)}"${g?` type="${g}"`:""}${A?` imagesrcset="${V0(A)}"`:""}${T?` imagesizes="${V0(T)}"`:""} />
3554
- `}if(M){let d=[];if(Y)for(let g of FG(Y))d.push(`<source type="image/${g.format}" srcset="${V0(g.srcset)}"${T?` sizes="${V0(T)}"`:""} />`);if(!Y&&(z==="avif"||z==="auto")){let g=T5(J,k,N,j,"avif"),Q0=A?k4(J,M4,j,"avif"):`${g}`;d.push(`<source type="image/avif" srcset="${V0(Q0)}"${T?` sizes="${V0(T)}"`:""} />`)}if(!Y&&(z==="webp"||z==="auto")){let g=T5(J,k,N,j,"webp"),Q0=A?k4(J,M4,j,"webp"):`${g}`;d.push(`<source type="image/webp" srcset="${V0(Q0)}"${T?` sizes="${V0(T)}"`:""} />`)}return`${f}<picture>
3555
+ ${G}`}let W=Y.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),U=W&&/data-stx/.test(W[1]);if(!G&&!U&&W&&!/data-stx-auto/.test(W[1])){let z=/<body[^>]*>/i,K=O4(Y,z);if(K!==-1){let H=Y.slice(0,K),B=Y.slice(K).replace(z,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Y=H+B}}return Y}function O4($,Z){let X=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],Y;while((Y=X.exec($))!==null)J.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 q=Q.exec($.slice(G));if(!q)return-1;let W=G+q.index;if(!J.some(([z,K])=>W>=z&&W<K))return W;G=W+Math.max(q[0].length,1)}return-1}var I9="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function jG($){let Z=[];for(let X of $.split(",")){let J=X.trim();if(!J||J.startsWith("type "))continue;let Y=J.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 I9;return`var ${Z.join(", ")}; ${I9}`}var _G=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function VG($){return $.replace(_G,(Z,X)=>jG(X))}import d0 from"path";import D4 from"fs";function v9($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function f9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class x9{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,X,J){let Y=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let B=[Y,Y.toLowerCase(),v9(Y),f9(Y)];for(let j of B)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${Y}.stx`,`${v9(Y)}.stx`,`${f9(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let B=d0.resolve(d0.dirname(Z),`${Y}.stx`);if(await t(B))return B;return null}let q=[],W=X.componentsDir||"",U=J?.__originalFilePath;if(U)q.push(d0.join(d0.dirname(U),"components"));if(W)q.push(W);let z=d0.join(d0.dirname(Z),"components");if(!q.includes(z))q.push(z);let K=process.cwd(),H=[d0.resolve(K,"src/components"),d0.resolve(K,"components"),d0.resolve(import.meta.dir,"components")];for(let B of H)if(!q.includes(B))q.push(B);for(let B of q){if(!B)continue;for(let j of G){let _=d0.join(B,j);if(await t(_))return _}try{if(!D4.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let _=D4.readdirSync(B,{withFileTypes:!0});for(let F of _)if(F.isDirectory()){let V=d0.join(B,F.name);for(let O of G){let L=d0.join(V,O);if(await t(L))return L}}}catch{}}return null}}var S0=new x9;function w0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var T1="\x00stx-boolean-attribute";function N4($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function a1($,Z){let X=[];for(let[J,Y]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof Y==="boolean"){if(Y)X.push(w0(Q));continue}if(Y===T1){X.push(w0(Q));continue}X.push(`${w0(Q)}="${w0(N4(String(Y)))}"`)}return X}function t1($,Z){let X=[];for(let[J,Y]of Object.entries($.serverDynamic??{})){if(Z.has(J))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[J]??J;if(Y===!0){X.push(w0(Q));continue}if(typeof Y==="object")continue;X.push(`${w0(Q)}="${w0(N4(String(Y)))}"`)}return X}function I5($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function OG($){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 M4={name:"StxLink",aliases:["stx-link"],render($,Z,X){let J=OG($),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",q=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,W=[];if(J.reactive)W.push(`:href="${I5(J.value)}"`);else W.push(`href="${I5(J.value)}"`);if(Y)W.push(`class="${I5(Y)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${I5(Q)}"`),W.push(`data-stx-exact-active-class="${I5(G)}"`),q)W.push("data-stx-prefetch");let U=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...a1($,U)),W.push(...t1($,U)),`<a ${W.join(" ")}>${Z}</a>`}};import $5 from"fs";import A4 from"path";var FG=new Set([".jpg",".jpeg",".png",".webp",".avif"]),_1=new Map,e1=!1;function g9($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return _1.get(Z)}function wj(){return e1}function Rj(){_1.clear(),e1=!1}function Dj($,Z){_1.set($,Z),e1=!0}function LG($){let Z=0,X=0,J=0,Y=0;for(let G=0;G<$.length;G+=4)Z+=$[G],X+=$[G+1],J+=$[G+2],Y++;if(Y===0)return"#e5e7eb";let Q=(G)=>Math.round(G/Y).toString(16).padStart(2,"0");return`#${Q(Z)}${Q(X)}${Q(J)}`}function wG($,Z,X,J=4,Y=3){let Q=[];for(let G=0;G<Y;G++)for(let q=0;q<J;q++){let W=Math.floor(q*Z/J),U=Math.max(W+1,Math.floor((q+1)*Z/J)),z=Math.floor(G*X/Y),K=Math.max(z+1,Math.floor((G+1)*X/Y)),H=0,B=0,j=0,_=0;for(let V=z;V<K;V++)for(let O=W;O<U;O++){let L=(V*Z+O)*4;H+=$[L],B+=$[L+1],j+=$[L+2],_++}let F=(V)=>Math.round(V/_).toString(16).padStart(2,"0");Q.push(`<rect x="${q}" y="${G}" width="1" height="1" fill="#${F(H)}${F(B)}${F(j)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${J} ${Y}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Q.join("")}</g></svg>`}function RG($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function DG($){try{return JSON.parse($5.readFileSync($,"utf8"))}catch{return{}}}function NG($,Z){try{$5.mkdirSync(A4.dirname($),{recursive:!0}),$5.writeFileSync($,JSON.stringify(Z))}catch{}}function h9($,Z,X=[]){let J;try{J=$5.readdirSync($,{withFileTypes:!0})}catch{return X}for(let Y of J){let Q=A4.join($,Y.name);if(Y.isDirectory()){h9(Q,`${Z}/${Y.name}`,X);continue}if(!FG.has(A4.extname(Y.name).toLowerCase()))continue;X.push([`${Z}/${Y.name}`,Q])}return X}async function Nj($,Z={}){let{cachePath:X,maxBytes:J=33554432,limit:Y=2000}=Z;if(!$||!$5.existsSync($))return e1=!0,_1.size;let Q;try{Q=await import("ts-images")}catch{return e1=!0,_1.size}let G=X?DG(X):{},q=!1,W=h9($,"").slice(0,Y),U=8,z=async([K,H])=>{let B;try{B=$5.statSync(H)}catch{return}if(B.size>J)return;let j=G[K];if(j&&j.mtimeMs===B.mtimeMs&&j.size===B.size){_1.set(K,{dataUrl:j.dataUrl,color:j.color});return}try{let{hash:_}=await Q.generateThumbHash(H);if(!_)return;let{rgba:F,w:V,h:O}=Q.thumbHashToRGBA(_),L={dataUrl:RG(wG(F,V,O)),color:LG(F)};_1.set(K,L),G[K]={mtimeMs:B.mtimeMs,size:B.size,...L},q=!0}catch{}};for(let K=0;K<W.length;K+=U)await Promise.all(W.slice(K,K+U).map(z));if(X&&q)NG(X,G);return e1=!0,_1.size}var MG={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},k4=[320,640,768,1024,1280,1536,1920];function V0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function M0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function T$($,Z,X=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return X}function AG($){let Z=(J)=>$.variants.filter((Y)=>Y.format===J).reduce((Y,Q)=>Y+Q.bytes,0),X=Z($.fallback.format);return["avif","webp"].map((J)=>({format:J,srcset:$.sources[J]||"",bytes:Z(J)})).filter((J)=>J.srcset&&J.bytes>0&&J.bytes<X).sort((J,Y)=>J.bytes-Y.bytes).map(({format:J,srcset:Y})=>({format:J,srcset:Y}))}function I4($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),X=[];for(let J of Z)if(J.includes(":")){let[Y,Q]=J.split(":"),G=MG[Y];if(G)X.push(`(max-width: ${G}px) ${Q}`);else{let q=Number.parseInt(Y);if(!Number.isNaN(q))X.push(`(max-width: ${q}px) ${Q}`)}}else X.push(J);return X.join(", ")}function T4($,Z,X,J){return Z.map((Y)=>`${T5($,Y,void 0,X,J)} ${Y}w`).join(", ")}function kG($,Z,X,J,Y){return Z.map((Q)=>{let G=X?X*Q:void 0;return`${T5($,G,void 0,J,Y)} ${Q}x`}).join(", ")}function T5($,Z,X,J,Y){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(X)Q.push(`h_${X}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(X)Q.set("h",String(X));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(X)Q.set("height",String(X));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function IG($,Z,X="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${X}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var E4={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,X){let J=M0($,"src")||"",Y=u9(J),Q=M0($,"alt")||"",G=M0($,"width")||(Y?String(Y.source.width):void 0),q=M0($,"height")||(Y?String(Y.source.height):void 0),W=M0($,"sizes"),U=M0($,"srcset"),z=M0($,"densities"),K=M0($,"format"),H=M0($,"placeholder")||(Y?"thumbhash":void 0),B=M0($,"placeholderColor")||"#e5e7eb",j=M0($,"provider"),_=M0($,"class")||M0($,"className")||"",F=M0($,"style")||"",V=M0($,"quality"),O=T$($,"lazy",!0),L=T$($,"preload",!1),w=T$($,"priority",!1),R=M0($,"loading"),D=M0($,"decoding")||"async",M=!!Y||T$($,"picture",!1)||!!K,k=G?Number.parseInt(G):void 0,N=q?Number.parseInt(q):void 0,A=U||"",T="";if(Y)A=Y.sources[Y.fallback.format]||"",T=W?I4(W):"100vw";else if(!A&&W&&j&&j!=="local"&&j!=="static")A=T4(J,k4,j,K),T=I4(W);else if(!A&&z){let d=z.split(/\s+/).map((g)=>Number.parseFloat(g.replace("x","")));A=kG(J,d,k,j,K)}else if(W)T=I4(W);let I=[];if(F)I.push(F);if(k&&N)I.push(`aspect-ratio:${k}/${N}`);if(H==="blur"||H==="color"||H==="thumbhash"){let d=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:B}:g9(J);if(d&&H==="color")I.push(`background-color:${d.color}`);else if(d)I.push(`background-color:${d.color}`),I.push(`background-image:url(${d.dataUrl})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");else{let g=IG(k||16,N||9,B);I.push(`background-image:url(${g})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat")}}else if(H&&H!=="empty"&&H!=="none")I.push(`background-image:url(${V0(H)})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");let S=Y?.fallback.url||T5(J,k,N,j,K),E=[];if(E.push(`src="${V0(S)}"`),E.push(`alt="${V0(Q)}"`),G)E.push(`width="${V0(G)}"`);if(q)E.push(`height="${V0(q)}"`);let b=R||(w||L?"eager":O?"lazy":"");if(b)E.push(`loading="${V0(b)}"`);if(w)E.push('fetchpriority="high"');if(E.push(`decoding="${V0(D)}"`),_)E.push(`class="${V0(_)}"`);if(I.length>0)E.push(`style="${V0(I.join(";"))}"`);if(A)E.push(`srcset="${V0(A)}"`);if(T)E.push(`sizes="${V0(T)}"`);let y=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(...a1($,y)),E.push(...t1($,y));let P=`<img ${E.join(" ")} />`,f="";if(L){let g=K==="webp"?"image/webp":K==="avif"?"image/avif":"";f=`<link rel="preload" as="image" href="${V0(S)}"${g?` type="${g}"`:""}${A?` imagesrcset="${V0(A)}"`:""}${T?` imagesizes="${V0(T)}"`:""} />
3556
+ `}if(M){let d=[];if(Y)for(let g of AG(Y))d.push(`<source type="image/${g.format}" srcset="${V0(g.srcset)}"${T?` sizes="${V0(T)}"`:""} />`);if(!Y&&(K==="avif"||K==="auto")){let g=T5(J,k,N,j,"avif"),Q0=A?T4(J,k4,j,"avif"):`${g}`;d.push(`<source type="image/avif" srcset="${V0(Q0)}"${T?` sizes="${V0(T)}"`:""} />`)}if(!Y&&(K==="webp"||K==="auto")){let g=T5(J,k,N,j,"webp"),Q0=A?T4(J,k4,j,"webp"):`${g}`;d.push(`<source type="image/webp" srcset="${V0(Q0)}"${T?` sizes="${V0(T)}"`:""} />`)}return`${f}<picture>
3555
3557
  ${d.join(`
3556
3558
  `)}
3557
3559
  ${P}
3558
- </picture>`}return`${f}${P}`}};var u9="/images/safe-image-default.svg";function E5($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Z5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var RG=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${u9}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,T4={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,X){let J=Z5($,"src")||"",Y=Z5($,"alt")||"",Q=Z5($,"fallback")||u9,G=Z5($,"class")||Z5($,"className")||"",q=Z5($,"fallbackClassName")||"",W=[];if(W.push(`src="${E5(J)}"`),W.push(`alt="${E5(Y)}"`),G)W.push(`class="${E5(G)}"`);if(W.push(`data-fallback="${E5(Q)}"`),q)W.push(`data-fallback-class="${E5(q)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let K=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...a1($,K)),W.push(...t1($,K));let U=`<img ${W.join(" ")} />`,z=X.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${RG}${U}`;return U}};function E4($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function b5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function E$($,Z,X){let J=b5($,Z);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return X}var b4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,X){let J=E4(b5($,"color")||"#6366f1"),Y=E4(b5($,"initialColor")||b5($,"initial-color")||""),Q=E4(b5($,"height")||"3px"),G=E$($,"duration",2000),q=E$($,"throttle",200),W=E$($,"zIndex",999999)||E$($,"z-index",999999),K=Y?`linear-gradient(to right, ${Y}, ${J})`:J;return`
3559
- <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${K};z-index:${W};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
3560
+ </picture>`}return`${f}${P}`}};var d9="/images/safe-image-default.svg";function E5($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Z5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var TG=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${d9}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,b4={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,X){let J=Z5($,"src")||"",Y=Z5($,"alt")||"",Q=Z5($,"fallback")||d9,G=Z5($,"class")||Z5($,"className")||"",q=Z5($,"fallbackClassName")||"",W=[];if(W.push(`src="${E5(J)}"`),W.push(`alt="${E5(Y)}"`),G)W.push(`class="${E5(G)}"`);if(W.push(`data-fallback="${E5(Q)}"`),q)W.push(`data-fallback-class="${E5(q)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let U=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...a1($,U)),W.push(...t1($,U));let z=`<img ${W.join(" ")} />`,K=X.context;if(!K.__safeImageHandlerEmitted)return K.__safeImageHandlerEmitted=!0,`${TG}${z}`;return z}};function y4($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function b5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function E$($,Z,X){let J=b5($,Z);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return X}var S4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,X){let J=y4(b5($,"color")||"#6366f1"),Y=y4(b5($,"initialColor")||b5($,"initial-color")||""),Q=y4(b5($,"height")||"3px"),G=E$($,"duration",2000),q=E$($,"throttle",200),W=E$($,"zIndex",999999)||E$($,"z-index",999999),U=Y?`linear-gradient(to right, ${Y}, ${J})`:J;return`
3561
+ <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${U};z-index:${W};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
3560
3562
  <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>
3561
3563
  </div>
3562
3564
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
3563
3565
  <script>
3564
3566
  (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)},${q})},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()})})();
3565
- </script>`}};function m9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function DG($,Z,X){let J=m9($,Z);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return X}var d9={"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%)"},y4={name:"StxToast",aliases:["stx-toast"],render($,Z,X){let J=w0(m9($,"position")||"top-right"),Y=DG($,"max",5),Q=d9[J]||d9["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" 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>
3567
+ </script>`}};function l9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function EG($,Z,X){let J=l9($,Z);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return X}var m9={"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%)"},C4={name:"StxToast",aliases:["stx-toast"],render($,Z,X){let J=w0(l9($,"position")||"top-right"),Y=EG($,"max",5),Q=m9[J]||m9["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" 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>
3566
3568
  <style>
3567
3569
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
3568
3570
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -3570,7 +3572,7 @@ ${P}
3570
3572
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
3571
3573
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
3572
3574
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
3573
- </style>`}};function b$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var l9={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)"},S4={name:"StxModal",aliases:["stx-modal"],render($,Z,X){let J=b$($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=w0(J),Q=b$($,"size")||"md",G=b$($,"closeOnBackdrop")!=="false",q=b$($,"closeOnEscape")!=="false",W=l9[Q]||l9.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${G}" data-close-escape="${q}" 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">
3575
+ </style>`}};function b$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var c9={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)"},P4={name:"StxModal",aliases:["stx-modal"],render($,Z,X){let J=b$($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=w0(J),Q=b$($,"size")||"md",G=b$($,"closeOnBackdrop")!=="false",q=b$($,"closeOnEscape")!=="false",W=c9[Q]||c9.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${G}" data-close-escape="${q}" 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">
3574
3576
  <div class="stx-modal-panel" style="${W};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)">
3575
3577
  <div style="padding:1.5rem">${Z}</div>
3576
3578
  </div>
@@ -3579,8 +3581,8 @@ ${P}
3579
3581
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
3580
3582
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
3581
3583
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
3582
- </style>`}};function X5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var c9={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},C4={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,X){let J=X5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=w0(J),Q=X5($,"side")||"right",G=X5($,"size")||"md",q=X5($,"closeOnBackdrop")!=="false",W=X5($,"closeOnEscape")!=="false",K=X5($,"overlay")!=="false",U=c9[G]||c9.md,z=Q==="left",H=z?"left:0":"right:0",B=z?"translateX(-100%)":"translateX(100%)",j=z?"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="${q}" data-close-escape="${W}" 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">
3583
- <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${H};width:${U};max-width:100vw;transform:${B};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">
3584
+ </style>`}};function X5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var p9={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},v4={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,X){let J=X5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=w0(J),Q=X5($,"side")||"right",G=X5($,"size")||"md",q=X5($,"closeOnBackdrop")!=="false",W=X5($,"closeOnEscape")!=="false",U=X5($,"overlay")!=="false",z=p9[G]||p9.md,K=Q==="left",H=K?"left:0":"right:0",B=K?"translateX(-100%)":"translateX(100%)",j=K?"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="${q}" data-close-escape="${W}" style="display:none;position:fixed;inset:0;z-index:99999;${U?"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">
3585
+ <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${H};width:${z};max-width:100vw;transform:${B};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">
3584
3586
  <div style="padding:1.5rem">${Z}</div>
3585
3587
  </div>
3586
3588
  </div>
@@ -3588,104 +3590,102 @@ ${P}
3588
3590
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
3589
3591
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3590
3592
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3591
- </style>`}};import{existsSync as NG,readFileSync as MG}from"fs";var E1=new Map,p9=new Set;function i9($){if(p9.has($))return;p9.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function n9($){let Z=process.cwd();for(let X 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(NG(X))return X;for(let X of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return x.resolve(X)}catch{}return null}function AG($){if(E1.has($))return E1.get($);let Z=n9($);if(!Z)return i9($),null;try{let X=JSON.parse(MG(Z,"utf8"));return E1.set($,X.icons),X.icons}catch{return null}}async function kG($,Z=!1){if(E1.has($))return E1.get($);let X=n9($);if(!X){if(!Z)i9($);return null}try{let J=await Bun.file(X).json();return E1.set($,J.icons),J.icons}catch{return null}}function J5($,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 P4={name:"Icon",aliases:["icon","stx-icon"],render($,Z,X){let J=J5($,"name")??J5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=J;if(J.includes(":")){let O=J.split(":");Y=O[0],Q=O[1]}let G=w0(J5($,"size")||"24"),q=w0(J5($,"color")||"currentColor"),W=w0(J5($,"class")||""),K=w0(J5($,"style")||""),U=E1.get(Y)??AG(Y);if(!U)return`<!-- Icon: collection "${Y}" not loaded -->`;let z=U[Q];if(!z)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let H=z.width||24,B=z.height||24,j=`0 0 ${H} ${B}`,_=z.body;if(q!=="currentColor")_=_.replace(/currentColor/g,q);let L=W?` class="${W}"`:"",V=K?` style="${K}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${V}>${_}</svg>`}};async function IG($="lucide",Z={}){await kG($,Z.speculative??!0)}function s9($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let J=$.static[X];if(typeof J==="string")return J}return}function o9($,Z){let X=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(X);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var v4={name:"Suspense",aliases:["suspense"],render($,Z,X){let J=o9(Z,"fallback"),Y=J.rest,Q=o9(Y,"error"),G=Q.rest,q=J.region??s9($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??s9($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${q}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function y$($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let J=$.static[X];if(typeof J==="string")return J}return}var f4={name:"TransitionGroup",aliases:["transition-group"],render($,Z,X){let J=(y$($,"name")||"v").replace(/["'<>]/g,""),Y=(y$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=y$($,"class"),G=y$($,"id"),q=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${q}>${Z}</${Y}>`}};function r9(){S0.registerBuiltin(D4),S0.registerBuiltin(I4),S0.registerBuiltin(T4),S0.registerBuiltin(b4),S0.registerBuiltin(y4),S0.registerBuiltin(S4),S0.registerBuiltin(C4),S0.registerBuiltin(P4),S0.registerBuiltin(v4),S0.registerBuiltin(f4)}function S$($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function a9($,Z,X){let J=[],Y=0;while(Y<$.length){let Q=$.indexOf("<",Y);if(Q===-1)break;let q=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!q){Y=Q+1;continue}let W=q[1];if(X&&X.has(W.toLowerCase())){let _=Q+1+W.length;while(_<$.length&&$[_]!==">")_++;Y=_+1;continue}let K=Q+1+W.length,U=null,z=K,H=-1,B=!1;while(K<$.length){let _=$[K];if(U){if(_==="\\"&&K+1<$.length){K+=2;continue}if(_===U)U=null;K++;continue}if(_==='"'||_==="'"){U=_,K++;continue}if(_==="/"&&K+1<$.length&&$[K+1]===">"){H=K+2,B=!0;break}if(_===">"){H=K+1;break}K++}if(H===-1){Y=Q+1;continue}let j=$.slice(z,B?H-2:H-1).trim();if(B)J.push({fullMatch:$.slice(Q,H),tagName:W,attributes:j,content:"",startIndex:Q,endIndex:H,isSelfClosing:!0}),Y=H;else{let _=`<${W}`,L=`</${W}>`,V=1,O=H,F=-1;while(V>0&&O<$.length){let D=$.indexOf(_,O),M=$.indexOf(L,O);if(M===-1)break;if(D!==-1&&D<M){let k=$[D+_.length];if(k===" "||k===">"||k==="/"||k===`
3592
- `||k==="\t")V++;O=D+_.length}else{if(V--,V===0){F=M;break}O=M+L.length}}if(F===-1){Y=H;continue}let w=$.slice(H,F),R=F+L.length;J.push({fullMatch:$.slice(Q,R),tagName:W,attributes:j,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),Y=R}}return J}function t9($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function e9($,Z){try{let X=Buffer.from($,"base64").toString("utf8");return JSON.parse(X)}catch{}try{let X=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(X)}catch(X){if(Z?.debug)console.error("Error decoding __stx_ prop:",X);return $}}import P$ from"fs";import g0 from"path";var $2=!1,TG=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 EG($,Z,X,J=!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=(U)=>{if(Q.size===0)return!1;let z=c0(U),H=z.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(H&&Q.has(H))return!0;for(let B of Q){let j=B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${j}\\s*\\(`).test(z))return!0}return!1},q=new Set(Y2),W=(U)=>{if(!U.includes("-")||U.startsWith("@")||U.startsWith(":")||U.startsWith("x-")||U.startsWith("__"))return U;if(U.startsWith("aria-")||U.startsWith("data-"))return U;return U.replace(/-([a-z0-9])/g,(z,H)=>H.toUpperCase())},K=(U,z)=>{let H=W(U);if(Y.static[H]=z,H!==U)Y.staticNames[H]=U};for(let[U,z]of Object.entries($)){let H=U.startsWith("x-")&&!q.has(U)&&!U.startsWith("x-bind:")&&!U.startsWith("x-on:")?`:${U.slice(2)}`:U;if(H.startsWith("@")){Y.events[H]=z;continue}if(H.startsWith("__stx_")){let B=W(H.slice(6));Y.serverDynamic[B]=e9(z,X);continue}if(H.startsWith(":")){let B=W(H.slice(1)),j=z===T1?B:z;if(B==="if"||B==="for"||B==="show"){Y.clientReactive[B]=j;continue}if(J){Y.clientReactive[B]=j;continue}if(G(j)){Y.clientReactive[B]=j;continue}try{if(!q0(j)){if(X.debug)console.error(`Unsafe expression in :${B} binding: ${j}`);Y.clientReactive[B]=j;continue}let _=Object.keys(Z),V=W0(j,_)(...Object.values(Z));if(V===void 0){let O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(l5(j).some((w)=>!O.has(w)&&!_.includes(w))){Y.clientReactive[B]=j;continue}}if(Y.serverDynamic[B]=V,B!==H.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[B]=H.slice(1)}catch{Y.clientReactive[B]=j}continue}if(typeof z==="string"&&z.includes("{{")&&z.includes("}}")){let B=z.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(B)try{let j=B[1];if(q0(j)){let L=W0(j,Object.keys(Z))(...Object.values(Z));K(H,L!=null?String(L):"")}else{if(X.debug)console.error(`Unsafe expression in ${H}: ${j}`);K(H,z)}}catch(j){if(X.debug)console.error(`Error evaluating expression for ${H}:`,j);K(H,z)}else{let j=z,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,L;while((L=_.exec(z))!==null)try{let V=L[1];if(!q0(V)){if(X.debug)console.error(`Unsafe expression in ${H}: ${V}`);continue}let F=W0(V,Object.keys(Z))(...Object.values(Z));j=j.replace(L[0],String(F??""))}catch(V){if(X.debug)console.error(`Error evaluating expression in ${H}:`,V)}K(H,j)}continue}K(H,z===T1?"true":t9(z))}return Y}var bG=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function yG($,Z,X){if(!$.includes("@"))return $;if(!bG.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return X1($,Z,X)}catch{return $}}function SG($){let Z={},X=0,J=$.length;while(X<J){while(X<J&&/\s/.test($[X]))X++;if(X>=J)break;let Y="";while(X<J&&!/[\s=]/.test($[X]))Y+=$[X],X++;if(!Y)break;while(X<J&&/\s/.test($[X]))X++;if(X<J&&$[X]==="="){X++;while(X<J&&/\s/.test($[X]))X++;let Q="";if(X<J&&($[X]==='"'||$[X]==="'")){let G=$[X];X++;while(X<J){let q=$[X];if(q==="\\"&&X+1<J){X++,Q+=$[X],X++;continue}if(q===G){X++;break}Q+=q,X++}}else while(X<J&&!/\s/.test($[X]))Q+=$[X],X++;Z[Y]=Q}else Z[Y]=T1}return Z}function Z2($){return Object.entries($).map(([Z,X])=>X===T1?Z:`${Z}="${CG(X)}"`).join(" ")}function CG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function PG($){let Z=new Set,X=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=X.exec($))!==null){let Y=J[1];if(S0.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}var X2=new Map;function vG($){let Z=X2.get($);if(Z)return Z;let X=new Map,J=[g0.join($,"src"),g0.join($,"dist"),$];function Y(Q,G){if(G>6)return;let q;try{q=P$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of q){let K=g0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;Y(K,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let U=W.name.slice(0,-4);if(!X.has(U))X.set(U,K);let z=U.toLowerCase();if(!X.has(z))X.set(z,K);let H=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,K)}}}for(let Q of J)if(Y(Q,0),X.size>0)break;return X2.set($,X),X}function fG($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let J=g0.join(X,"node_modules",$);try{if(P$.statSync(J).isDirectory())return J}catch{}let Y=g0.dirname(X);if(Y===X)return null;X=Y}}async function xG($,Z,X,J,Y){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=g0.dirname(X),q=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(W,(K,U,z)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,_=[];while((j=H.exec(z))!==null){let[L,V,O,F]=j,w=null,R=null;if(F.startsWith(".")||F.startsWith("/")){let k=g0.resolve(G,F);if(k.endsWith(".stx"))R=k;else{let N=`${k}.stx`;try{if(P$.statSync(N).isFile())R=N}catch{try{if(P$.statSync(k).isDirectory())w=k}catch{}}}}else w=fG(F,G);if(!w&&!R)continue;let D=!1,M=(k,N)=>{Q.set(k,N),Q.set(k.toLowerCase(),N);let A=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(A,N),Y.add(N)};if(O&&R)M(O,R),D=!0;else if(V){let k=V.slice(1,-1).split(",").map((A)=>A.trim()).filter(Boolean).map((A)=>{let T=A.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T)return{source:T[1],local:T[2]};return{source:A,local:A}}),N=w?vG(w):null;for(let{source:A,local:T}of k){let I=null;if(R)I=R;else if(N)I=N.get(A)??N.get(A.toLowerCase())??N.get(A.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)M(T,I),D=!0}}if(D)_.push({start:j.index,end:j.index+L.length})}if(_.length===0)return K;for(let L=_.length-1;L>=0;L--)B=B.slice(0,_[L].start)+B.slice(_[L].end);return`<script${U}>${B}</script>`}),q}async function gG($,Z,X,J,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=q.exec(Q))!==null){let[K,U]=W,z=U.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of z){let B=H.split("/"),_=B[B.length-1].replace(/\.stx$/,""),L=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),V=null,O=[g0.resolve(g0.dirname(X),`${H}.stx`),g0.resolve(g0.dirname(X),H),g0.resolve(J.componentsDir||"components",`${H}.stx`),g0.resolve(J.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(L,V),G.set(_,V),G.set(_.toLowerCase(),V);let F=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),Y.add(V),J.debug)console.log(`Imported component: ${L} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(K,""),q.lastIndex=0}return Q}async function hG($,Z,X,J,Y){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,W=/@component\s*\(/g,K;while((K=W.exec(Q))!==null){let U=K.index,z=U+K[0].length-1,H=1,B=z+1;while(B<Q.length&&H>0){if(Q[B]==="(")H++;else if(Q[B]===")"){if(H--,H===0)break}B++}if(H!==0)break;let j=Q.substring(z+1,B),_=B+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){W.lastIndex=0;continue}let V=L[1],O,F=j.slice(L[0].length),w=F.match(/^\s*,\s*/);if(w)O=F.slice(w[0].length).trim();let R={};if(O)try{R=R0(O,Z)}catch(T){let I=T instanceof Error?T.message:String(T);Q=Q.replace(Q.substring(U,_),`[Error parsing component props: ${I}]`);continue}let D="",M=_,N=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(N)D=N[1].trim(),M=_+N[0].length;let A=await I1(V,R,D,G,Z,X,J,q,Y);Q=Q.substring(0,U)+A+Q.substring(M),W.lastIndex=0}return Q}async function uG($,Z,X,J,Y){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,W=r0(Q);Q=W.output;let K=X4(Q);return Q=await B(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await B(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await B(Q,/[a-z][a-z0-9]*/,!1,TG),Q=P1(Q,W.scripts),Q;async function B(j,_,L,V){if(!j)return j;let O=j,F=a9(O,_,V);for(let w=F.length-1;w>=0;w--){let R=F[w],D=L?S$(R.tagName):R.tagName,M=SG(yG(R.attributes,Z,X)),k=K.some(([b,y])=>R.startIndex>=b&&R.startIndex<y),N=EG(M,Z,J,k),A=S0.getBuiltin(R.tagName),T=A?await C$(D,G,Z,X,J):!1;if(A&&!T){let b={context:Z,filePath:X,options:J,dependencies:Y},y=A.render(N,R.content,b);if(Object.keys(N.events).length>0){let P=Z2(N.events);y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${P}`)}if(Object.keys(N.clientReactive).length>0)y=J2(y,N.clientReactive);O=O.substring(0,R.startIndex)+y+O.substring(R.endIndex);continue}if(!L&&R.tagName.includes("-")&&!await C$(D,G,Z,X,J))continue;let I={};for(let[b,y]of Object.entries(N.static))I[b]=y;for(let[b,y]of Object.entries(N.serverDynamic))I[b]=y;let E=await I1(D,I,P1(R.content,W.scripts),G,Z,X,J,q,Y);if(Object.keys(N.events).length>0){let b=Q2(E);if(b){let y=Z2(N.events),P=Object.keys(N.events).map((f)=>f.replace(/^@/,"").split(".")[0]).join(" ");E=E.substring(0,b.insertPos)+` data-stx-parent-events="${P}" ${y}`+E.substring(b.insertPos)}}if(Object.keys(N.clientReactive).length>0)E=J2(E,N.clientReactive);O=O.substring(0,R.startIndex)+E+O.substring(R.endIndex)}return O}}function J2($,Z){let X=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(Z).filter(([U])=>!X.has(U)),Q=Y.filter(([U])=>!J.has(U)).map(([U])=>S$(U)).join(" "),G=$,q=Y.length>0?Q2(G):null;if(q){let U=Y.map(([H,B])=>`:${S$(H)}="${B.replace(/"/g,"&quot;")}"`).join(" "),z=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,q.insertPos)+`${z} ${U}`+G.substring(q.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,"&quot;")}">${G}</template>`;let K=Z.for;if(K)G=`<template :for="${K.replace(/"/g,"&quot;")}">${G}</template>`;return G}function Q2($){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 X=0;while(X<$.length){let J=$.slice(X),Y=J.match(/^\s+/);if(Y){X+=Y[0].length;continue}if(J.startsWith("<!--")){let q=$.indexOf("-->",X+4);if(q===-1)return null;X=q+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let q=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(q,X+Q[0].length);if(W===-1)return null;X=W+q.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:X+1+G[1].length}}return null}async function x4($,Z,X,J,Y){if(!$2)r9(),$2=!0;let Q=await xG($,Z,X,J,Y);Q=await gG(Q,Z,X,J,Y),Q=await hG(Q,Z,X,J,Y);let G=[];for(let q=0;q<3;q++){let W=o0(Q,U5,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...W.tokens);let K=Q;if(Q=await uG(W.output,Z,X,J,Y),Q===K)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,W)=>G[Number(W)]??"");if(J.debug){let q=PG(Q);if(q.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import Q5 from"path";import G2 from"process";function Y5($="STX_PUBLIC_"){let Z={},X={};for(let[J,Y]of Object.entries(G2.env)){if(!J.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(Y),X[J]=Y}return Z["import.meta.env"]=JSON.stringify(X),Z}function A_($="STX_PUBLIC_"){let Z={};for(let[X,J]of Object.entries(G2.env))if(X.startsWith($)&&J!==void 0)Z[X]=J;return Z}function q2($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function W2($,Z,X){try{let J;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=Q5.join(Y,$);if(await Bun.file(G).exists())return G;Y=Q5.dirname(Y)}J=Q5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=Q5.resolve(Z,$);else J=Q5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function K2($,Z,X){let J=$,Y=Q5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[K,U,z,H]=G;if(q2(z))continue;let B=await W2(z,Y,Z);if(B)try{let j=await Bun.file(B).text();if(X.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[B],target:"browser",minify:!0,define:Y5()});if(L.outputs.length>0)j=await L.outputs[0].text()}let _=`<script>
3593
- // Source: ${z}
3593
+ </style>`}};import{existsSync as bG,readFileSync as yG}from"fs";var E1=new Map,i9=new Set;function n9($){if(i9.has($))return;i9.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function s9($){let Z=process.cwd();for(let X 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(bG(X))return X;for(let X of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return x.resolve(X)}catch{}return null}function SG($){if(E1.has($))return E1.get($);let Z=s9($);if(!Z)return n9($),null;try{let X=JSON.parse(yG(Z,"utf8"));return E1.set($,X.icons),X.icons}catch{return null}}async function CG($,Z=!1){if(E1.has($))return E1.get($);let X=s9($);if(!X){if(!Z)n9($);return null}try{let J=await Bun.file(X).json();return E1.set($,J.icons),J.icons}catch{return null}}function J5($,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 f4={name:"Icon",aliases:["icon","stx-icon"],render($,Z,X){let J=J5($,"name")??J5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=J;if(J.includes(":")){let O=J.split(":");Y=O[0],Q=O[1]}let G=w0(J5($,"size")||"24"),q=w0(J5($,"color")||"currentColor"),W=w0(J5($,"class")||""),U=w0(J5($,"style")||""),z=E1.get(Y)??SG(Y);if(!z)return`<!-- Icon: collection "${Y}" not loaded -->`;let K=z[Q];if(!K)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let H=K.width||24,B=K.height||24,j=`0 0 ${H} ${B}`,_=K.body;if(q!=="currentColor")_=_.replace(/currentColor/g,q);let F=W?` class="${W}"`:"",V=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${F}${V}>${_}</svg>`}};async function PG($="lucide",Z={}){await CG($,Z.speculative??!0)}function o9($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let J=$.static[X];if(typeof J==="string")return J}return}function r9($,Z){let X=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(X);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var x4={name:"Suspense",aliases:["suspense"],render($,Z,X){let J=r9(Z,"fallback"),Y=J.rest,Q=r9(Y,"error"),G=Q.rest,q=J.region??o9($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??o9($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${q}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function y$($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let J=$.static[X];if(typeof J==="string")return J}return}var g4={name:"TransitionGroup",aliases:["transition-group"],render($,Z,X){let J=(y$($,"name")||"v").replace(/["'<>]/g,""),Y=(y$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=y$($,"class"),G=y$($,"id"),q=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${q}>${Z}</${Y}>`}};function a9(){S0.registerBuiltin(M4),S0.registerBuiltin(E4),S0.registerBuiltin(b4),S0.registerBuiltin(S4),S0.registerBuiltin(C4),S0.registerBuiltin(P4),S0.registerBuiltin(v4),S0.registerBuiltin(f4),S0.registerBuiltin(x4),S0.registerBuiltin(g4)}function S$($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var t9=new Map;function vG($){let Z=t9.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),t9.set($.source,Z);return Z}function e9($,Z,X){let J=[],Y=0;while(Y<$.length){let Q=$.indexOf("<",Y);if(Q===-1)break;let G=vG(Z);G.lastIndex=Q+1;let q=G.exec($);if(!q){Y=Q+1;continue}let W=q[1];if(X&&X.has(W.toLowerCase())){let _=Q+1+W.length;while(_<$.length&&$[_]!==">")_++;Y=_+1;continue}let U=Q+1+W.length,z=null,K=U,H=-1,B=!1;while(U<$.length){let _=$[U];if(z){if(_==="\\"&&U+1<$.length){U+=2;continue}if(_===z)z=null;U++;continue}if(_==='"'||_==="'"){z=_,U++;continue}if(_==="/"&&U+1<$.length&&$[U+1]===">"){H=U+2,B=!0;break}if(_===">"){H=U+1;break}U++}if(H===-1){Y=Q+1;continue}let j=$.slice(K,B?H-2:H-1).trim();if(B)J.push({fullMatch:$.slice(Q,H),tagName:W,attributes:j,content:"",startIndex:Q,endIndex:H,isSelfClosing:!0}),Y=H;else{let _=`<${W}`,F=`</${W}>`,V=1,O=H,L=-1;while(V>0&&O<$.length){let D=$.indexOf(_,O),M=$.indexOf(F,O);if(M===-1)break;if(D!==-1&&D<M){let k=$[D+_.length];if(k===" "||k===">"||k==="/"||k===`
3594
+ `||k==="\t")V++;O=D+_.length}else{if(V--,V===0){L=M;break}O=M+F.length}}if(L===-1){Y=H;continue}let w=$.slice(H,L),R=L+F.length;J.push({fullMatch:$.slice(Q,R),tagName:W,attributes:j,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),Y=R}}return J}function $2($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Z2($,Z){try{let X=Buffer.from($,"base64").toString("utf8");return JSON.parse(X)}catch{}try{let X=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(X)}catch(X){if(Z?.debug)console.error("Error decoding __stx_ prop:",X);return $}}import P$ from"fs";import g0 from"path";var X2=!1,fG=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 xG($,Z,X,J=!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=(z)=>{if(Q.size===0)return!1;let K=c0(z),H=K.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(H&&Q.has(H))return!0;for(let B of Q){let j=B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${j}\\s*\\(`).test(K))return!0}return!1},q=new Set(G2),W=(z)=>{if(!z.includes("-")||z.startsWith("@")||z.startsWith(":")||z.startsWith("x-")||z.startsWith("__"))return z;if(z.startsWith("aria-")||z.startsWith("data-"))return z;return z.replace(/-([a-z0-9])/g,(K,H)=>H.toUpperCase())},U=(z,K)=>{let H=W(z);if(Y.static[H]=K,H!==z)Y.staticNames[H]=z};for(let[z,K]of Object.entries($)){let H=z.startsWith("x-")&&!q.has(z)&&!z.startsWith("x-bind:")&&!z.startsWith("x-on:")?`:${z.slice(2)}`:z;if(H.startsWith("@")){Y.events[H]=K;continue}if(H.startsWith("__stx_")){let B=W(H.slice(6));Y.serverDynamic[B]=Z2(K,X);continue}if(H.startsWith(":")){let B=W(H.slice(1)),j=K===T1?B:K;if(B==="if"||B==="for"||B==="show"){Y.clientReactive[B]=j;continue}if(J){Y.clientReactive[B]=j;continue}if(G(j)){Y.clientReactive[B]=j;continue}try{if(!q0(j)){if(X.debug)console.error(`Unsafe expression in :${B} binding: ${j}`);Y.clientReactive[B]=j;continue}let _=Object.keys(Z),V=W0(j,_)(...Object.values(Z));if(V===void 0){let O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(l5(j).some((w)=>!O.has(w)&&!_.includes(w))){Y.clientReactive[B]=j;continue}}if(Y.serverDynamic[B]=V,B!==H.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[B]=H.slice(1)}catch{Y.clientReactive[B]=j}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let B=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(B)try{let j=B[1];if(q0(j)){let F=W0(j,Object.keys(Z))(...Object.values(Z));U(H,F!=null?String(F):"")}else{if(X.debug)console.error(`Unsafe expression in ${H}: ${j}`);U(H,K)}}catch(j){if(X.debug)console.error(`Error evaluating expression for ${H}:`,j);U(H,K)}else{let j=K,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,F;while((F=_.exec(K))!==null)try{let V=F[1];if(!q0(V)){if(X.debug)console.error(`Unsafe expression in ${H}: ${V}`);continue}let L=W0(V,Object.keys(Z))(...Object.values(Z));j=j.replace(F[0],String(L??""))}catch(V){if(X.debug)console.error(`Error evaluating expression in ${H}:`,V)}U(H,j)}continue}U(H,K===T1?"true":$2(K))}return Y}var gG=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function hG($,Z,X){if(!$.includes("@"))return $;if(!gG.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return X1($,Z,X)}catch{return $}}function uG($){let Z={},X=0,J=$.length;while(X<J){while(X<J&&/\s/.test($[X]))X++;if(X>=J)break;let Y="";while(X<J&&!/[\s=]/.test($[X]))Y+=$[X],X++;if(!Y)break;while(X<J&&/\s/.test($[X]))X++;if(X<J&&$[X]==="="){X++;while(X<J&&/\s/.test($[X]))X++;let Q="";if(X<J&&($[X]==='"'||$[X]==="'")){let G=$[X];X++;while(X<J){let q=$[X];if(q==="\\"&&X+1<J){X++,Q+=$[X],X++;continue}if(q===G){X++;break}Q+=q,X++}}else while(X<J&&!/\s/.test($[X]))Q+=$[X],X++;Z[Y]=Q}else Z[Y]=T1}return Z}function J2($){return Object.entries($).map(([Z,X])=>X===T1?Z:`${Z}="${dG(X)}"`).join(" ")}function dG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mG($){let Z=new Set,X=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=X.exec($))!==null){let Y=J[1];if(S0.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}var Y2=new Map;function lG($){let Z=Y2.get($);if(Z)return Z;let X=new Map,J=[g0.join($,"src"),g0.join($,"dist"),$];function Y(Q,G){if(G>6)return;let q;try{q=P$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of q){let U=g0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;Y(U,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let z=W.name.slice(0,-4);if(!X.has(z))X.set(z,U);let K=z.toLowerCase();if(!X.has(K))X.set(K,U);let H=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,U)}}}for(let Q of J)if(Y(Q,0),X.size>0)break;return Y2.set($,X),X}function cG($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let J=g0.join(X,"node_modules",$);try{if(P$.statSync(J).isDirectory())return J}catch{}let Y=g0.dirname(X);if(Y===X)return null;X=Y}}async function pG($,Z,X,J,Y){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=g0.dirname(X),q=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(W,(U,z,K)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=K,j,_=[];while((j=H.exec(K))!==null){let[F,V,O,L]=j,w=null,R=null;if(L.startsWith(".")||L.startsWith("/")){let k=g0.resolve(G,L);if(k.endsWith(".stx"))R=k;else{let N=`${k}.stx`;try{if(P$.statSync(N).isFile())R=N}catch{try{if(P$.statSync(k).isDirectory())w=k}catch{}}}}else w=cG(L,G);if(!w&&!R)continue;let D=!1,M=(k,N)=>{Q.set(k,N),Q.set(k.toLowerCase(),N);let A=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(A,N),Y.add(N)};if(O&&R)M(O,R),D=!0;else if(V){let k=V.slice(1,-1).split(",").map((A)=>A.trim()).filter(Boolean).map((A)=>{let T=A.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T)return{source:T[1],local:T[2]};return{source:A,local:A}}),N=w?lG(w):null;for(let{source:A,local:T}of k){let I=null;if(R)I=R;else if(N)I=N.get(A)??N.get(A.toLowerCase())??N.get(A.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)M(T,I),D=!0}}if(D)_.push({start:j.index,end:j.index+F.length})}if(_.length===0)return U;for(let F=_.length-1;F>=0;F--)B=B.slice(0,_[F].start)+B.slice(_[F].end);return`<script${z}>${B}</script>`}),q}async function iG($,Z,X,J,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=q.exec(Q))!==null){let[U,z]=W,K=z.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of K){let B=H.split("/"),_=B[B.length-1].replace(/\.stx$/,""),F=_.includes("-")?_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),V=null,O=[g0.resolve(g0.dirname(X),`${H}.stx`),g0.resolve(g0.dirname(X),H),g0.resolve(J.componentsDir||"components",`${H}.stx`),g0.resolve(J.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let L of O)try{if(await Bun.file(L).exists()){V=L;break}}catch{}if(V){G.set(F,V),G.set(_,V),G.set(_.toLowerCase(),V);let L=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,V),Y.add(V),J.debug)console.log(`Imported component: ${F} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(U,""),q.lastIndex=0}return Q}async function nG($,Z,X,J,Y){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,W=/@component\s*\(/g,U;while((U=W.exec(Q))!==null){let z=U.index,K=z+U[0].length-1,H=1,B=K+1;while(B<Q.length&&H>0){if(Q[B]==="(")H++;else if(Q[B]===")"){if(H--,H===0)break}B++}if(H!==0)break;let j=Q.substring(K+1,B),_=B+1,F=j.match(/^\s*['"]([^'"]+)['"]/);if(!F){W.lastIndex=0;continue}let V=F[1],O,L=j.slice(F[0].length),w=L.match(/^\s*,\s*/);if(w)O=L.slice(w[0].length).trim();let R={};if(O)try{R=R0(O,Z)}catch(T){let I=T instanceof Error?T.message:String(T);Q=Q.replace(Q.substring(z,_),`[Error parsing component props: ${I}]`);continue}let D="",M=_,N=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(N)D=N[1].trim(),M=_+N[0].length;let A=await I1(V,R,D,G,Z,X,J,q,Y);Q=Q.substring(0,z)+A+Q.substring(M),W.lastIndex=0}return Q}async function sG($,Z,X,J,Y){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,W=r0(Q);Q=W.output;let U=X4(Q);return Q=await B(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await B(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await B(Q,/[a-z][a-z0-9]*/,!1,fG),Q=P1(Q,W.scripts),Q;async function B(j,_,F,V){if(!j)return j;let O=j,L=e9(O,_,V);for(let w=L.length-1;w>=0;w--){let R=L[w],D=F?S$(R.tagName):R.tagName,M=uG(hG(R.attributes,Z,X)),k=U.some(([b,y])=>R.startIndex>=b&&R.startIndex<y),N=xG(M,Z,J,k),A=S0.getBuiltin(R.tagName),T=A?await C$(D,G,Z,X,J):!1;if(A&&!T){let b={context:Z,filePath:X,options:J,dependencies:Y},y=A.render(N,R.content,b);if(Object.keys(N.events).length>0){let P=J2(N.events);y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${P}`)}if(Object.keys(N.clientReactive).length>0)y=Q2(y,N.clientReactive);O=O.substring(0,R.startIndex)+y+O.substring(R.endIndex);continue}if(!F&&R.tagName.includes("-")&&!await C$(D,G,Z,X,J))continue;let I={};for(let[b,y]of Object.entries(N.static))I[b]=y;for(let[b,y]of Object.entries(N.serverDynamic))I[b]=y;let E=await I1(D,I,P1(R.content,W.scripts),G,Z,X,J,q,Y);if(Object.keys(N.events).length>0){let b=q2(E);if(b){let y=J2(N.events),P=Object.keys(N.events).map((f)=>f.replace(/^@/,"").split(".")[0]).join(" ");E=E.substring(0,b.insertPos)+` data-stx-parent-events="${P}" ${y}`+E.substring(b.insertPos)}}if(Object.keys(N.clientReactive).length>0)E=Q2(E,N.clientReactive);O=O.substring(0,R.startIndex)+E+O.substring(R.endIndex)}return O}}function Q2($,Z){let X=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(Z).filter(([z])=>!X.has(z)),Q=Y.filter(([z])=>!J.has(z)).map(([z])=>S$(z)).join(" "),G=$,q=Y.length>0?q2(G):null;if(q){let z=Y.map(([H,B])=>`:${S$(H)}="${B.replace(/"/g,"&quot;")}"`).join(" "),K=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,q.insertPos)+`${K} ${z}`+G.substring(q.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,"&quot;")}">${G}</template>`;let U=Z.for;if(U)G=`<template :for="${U.replace(/"/g,"&quot;")}">${G}</template>`;return G}function q2($){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 X=0;while(X<$.length){let J=$.slice(X),Y=J.match(/^\s+/);if(Y){X+=Y[0].length;continue}if(J.startsWith("<!--")){let q=$.indexOf("-->",X+4);if(q===-1)return null;X=q+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let q=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(q,X+Q[0].length);if(W===-1)return null;X=W+q.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:X+1+G[1].length}}return null}async function h4($,Z,X,J,Y){if(!X2)a9(),X2=!0;let Q=await pG($,Z,X,J,Y);Q=await iG(Q,Z,X,J,Y),Q=await nG(Q,Z,X,J,Y);let G=[];for(let q=0;q<3;q++){let W=o0(Q,U5,(z,K)=>`\x00STX_COMPONENT_COMMENT_${G.length+K}\x00`);G.push(...W.tokens);let U=Q;if(Q=await sG(W.output,Z,X,J,Y),Q===U)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,W)=>G[Number(W)]??"");if(J.debug){let q=mG(Q);if(q.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import Q5 from"path";import W2 from"process";function Y5($="STX_PUBLIC_"){let Z={},X={};for(let[J,Y]of Object.entries(W2.env)){if(!J.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(Y),X[J]=Y}return Z["import.meta.env"]=JSON.stringify(X),Z}function C_($="STX_PUBLIC_"){let Z={};for(let[X,J]of Object.entries(W2.env))if(X.startsWith($)&&J!==void 0)Z[X]=J;return Z}function U2($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function z2($,Z,X){try{let J;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=Q5.join(Y,$);if(await Bun.file(G).exists())return G;Y=Q5.dirname(Y)}J=Q5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=Q5.resolve(Z,$);else J=Q5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function K2($,Z,X){let J=$,Y=Q5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[U,z,K,H]=G;if(U2(K))continue;let B=await z2(K,Y,Z);if(B)try{let j=await Bun.file(B).text();if(X.add(B),K.endsWith(".ts")||K.endsWith(".tsx")){let F=await Bun.build({entrypoints:[B],target:"browser",minify:!0,define:Y5()});if(F.outputs.length>0)j=await F.outputs[0].text()}let _=`<script>
3595
+ // Source: ${K}
3594
3596
  ${j}
3595
- </script>`;J=J.replace(K,_),Q.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=q.exec(J))!==null){let[K,U,z,H]=W,B=U+H;if(q2(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let _=await W2(z,Y,Z);if(_)try{let L=await Bun.file(_).text();X.add(_);let V=`<style>
3596
- /* Source: ${z} */
3597
- ${L}
3598
- </style>`;J=J.replace(K,V),q.lastIndex=0}catch(L){}}}return J}function g4($,Z){let X=$,J=/@json\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index,G=Q+Y[0].length-1,q=1,W=G+1,K=null,U=!1;while(W<X.length&&q>0){let F=X[W];if(U){U=!1,W++;continue}if(F==="\\"&&K){U=!0,W++;continue}if(K){if(F===K)K=null;W++;continue}if(F==='"'||F==="'"||F==="`"){K=F,W++;continue}if(F==="(")q++;else if(F===")"){if(q--,q===0)break}W++}if(q!==0)break;let z=X.substring(G+1,W).trim(),H=X.substring(Q,W+1),B=-1,j=0,_=null,L=!1;for(let F=0;F<z.length;F++){let w=z[F];if(L){L=!1;continue}if(w==="\\"&&_){L=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){B=F;break}}let V=B>=0?z.substring(0,B).trim():z,O=B>=0?z.substring(B+1).trim():void 0;try{let F=V.trim(),w;if(q0(F))w=W0(F,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");X=X.substring(0,Q)+D+X.substring(W+1),J.lastIndex=Q+D.length}catch(F){i0.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=Q+H.length}}return X}function h4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function U2($){let Z=$,X=/@memo\s*\(/g,J,Y=[];while((J=X.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,q=1,W=G;while(W<Z.length&&q>0){if(Z[W]==="(")q++;else if(Z[W]===")")q--;W++}if(q!==0)continue;let K=Z.slice(G,W-1).trim(),U=W,z=Z.slice(U),H=z.indexOf("@endmemo");if(H===-1)continue;let B=z.slice(0,H),j=U+H+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=_?_[0].length:0,V=B.slice(L),O=B.match(/(\s*)$/),F=O?O[0].length:0,w=V.slice(0,V.length-F),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),D;if(R){let[M,k,N="",A]=R,T=`<${k}${N} data-stx-memo="${K}"${A}>`;D=B.slice(0,L)+T+w.slice(M.length)+B.slice(L+w.length)}else D=`${B.slice(0,L)}<div data-stx-memo="${K}">${w}</div>${B.slice(L+w.length)}`;Y.push({start:Q,end:j,replacement:D}),X.lastIndex=j}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 u4($){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}var dG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),z2=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/;function mG($,Z){let X=!1,J=!1;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(X){if(Q==="'")X=!1}else if(J){if(Q==='"')J=!1}else if(Q==="'")X=!0;else if(Q==='"')J=!0;else if(Q===">")return Y}return-1}function lG($,Z){let X=0,J="",Y=Z;while(Y<$.length){let Q=$[Y];if(Q!=="<"){if(X===0)J+=Q;Y++;continue}if($.startsWith("<!--",Y)){let K=$.indexOf("-->",Y);Y=K===-1?$.length:K+3;continue}let G=mG($,Y);if(G===-1)break;let q=$.slice(Y,G+1),W=/^<\/?\s*([a-z][\w-]*)/i.exec(q)?.[1]?.toLowerCase()??"";if(q[1]==="/"){if(X===0)break;X--}else if(!/\/\s*>$/.test(q)&&!dG.has(W))X++;Y=G+1}return J}function H2($){let X=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"),J="",Y=0,Q;while((Q=X.exec($))!==null){let G=Q.index,q=G+Q[0].length,W=!1,K=!1,U=-1;while(q<$.length){let B=$[q];if(W){if(B==="'")W=!1}else if(K){if(B==='"')K=!1}else if(B==="'")W=!0;else if(B==='"')K=!0;else if(B===">"){U=q;break}q++}if(U===-1)continue;let z=$.slice(G,U+1);if(z2.test(z))continue;if(z.includes("x-cloak"))continue;let H=lG($,U+1);if(/\{\{[\s\S]*?\}\}/.test(H))J+=$.slice(Y,U)+" x-cloak>",Y=U+1}return J+=$.slice(Y),J}var cG=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/;function B2($){let Z=/<[a-z][\w-]*/gi,X="",J=0,Y;while((Y=Z.exec($))!==null){let Q=Y.index,G=Y[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,_=$.toLowerCase().indexOf(j,Q);if(_!==-1)Z.lastIndex=_+j.length;continue}let q=Q+Y[0].length,W=!1,K=!1,U=-1;while(q<$.length){let j=$[q];if(W){if(j==="'")W=!1}else if(K){if(j==='"')K=!1}else if(j==="'")W=!0;else if(j==='"')K=!0;else if(j===">"){U=q;break}q++}if(U===-1)continue;let z=$.slice(Q+Y[0].length,U);if(z2.test(z))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!cG.test(z))continue;let H=$[U-1]==="/",B=H?U-1:U;X+=`${$.slice(J,B)} x-cloak${H?" ":""}`,J=B}return X+=$.slice(J),X}var d4=G5(256),pG=[{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 m4($,Z,X,J){let Y=typeof X==="boolean"?{enabled:X,failOnViolation:X}:X??{enabled:!1};if(!Y.enabled)return;let Q=b1($,Z,J,JSON.stringify(Y)),G=d4.get(Q);if(G!==void 0){if(G&&Y.failOnViolation)throw Error(G);return}let q=Y.allowPatterns??[],W=[],K=c0($.replace(/\{\{--[\s\S]*?--\}\}/g,(B)=>B.replace(/[^\n]/g," ")));for(let{pattern:B,message:j,suggestion:_}of pG){if(q.some((V)=>/\w/.test(V)&&j.includes(V)))continue;B.lastIndex=0;let L=K.match(B);if(L&&L.length>0){let V=K.split(`
3597
+ </script>`;J=J.replace(U,_),Q.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=q.exec(J))!==null){let[U,z,K,H]=W,B=z+H;if(U2(K))continue;if(/rel=["']stylesheet["']/.test(B)||K.endsWith(".css")){let _=await z2(K,Y,Z);if(_)try{let F=await Bun.file(_).text();X.add(_);let V=`<style>
3598
+ /* Source: ${K} */
3599
+ ${F}
3600
+ </style>`;J=J.replace(U,V),q.lastIndex=0}catch(F){}}}return J}function u4($,Z){let X=$,J=/@json\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index,G=Q+Y[0].length-1,q=1,W=G+1,U=null,z=!1;while(W<X.length&&q>0){let L=X[W];if(z){z=!1,W++;continue}if(L==="\\"&&U){z=!0,W++;continue}if(U){if(L===U)U=null;W++;continue}if(L==='"'||L==="'"||L==="`"){U=L,W++;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0)break}W++}if(q!==0)break;let K=X.substring(G+1,W).trim(),H=X.substring(Q,W+1),B=-1,j=0,_=null,F=!1;for(let L=0;L<K.length;L++){let w=K[L];if(F){F=!1;continue}if(w==="\\"&&_){F=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){B=L;break}}let V=B>=0?K.substring(0,B).trim():K,O=B>=0?K.substring(B+1).trim():void 0;try{let L=V.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");X=X.substring(0,Q)+D+X.substring(W+1),J.lastIndex=Q+D.length}catch(L){i0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),J.lastIndex=Q+H.length}}return X}function d4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function H2($){let Z=$,X=/@memo\s*\(/g,J,Y=[];while((J=X.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,q=1,W=G;while(W<Z.length&&q>0){if(Z[W]==="(")q++;else if(Z[W]===")")q--;W++}if(q!==0)continue;let U=Z.slice(G,W-1).trim(),z=W,K=Z.slice(z),H=K.indexOf("@endmemo");if(H===-1)continue;let B=K.slice(0,H),j=z+H+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),F=_?_[0].length:0,V=B.slice(F),O=B.match(/(\s*)$/),L=O?O[0].length:0,w=V.slice(0,V.length-L),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),D;if(R){let[M,k,N="",A]=R,T=`<${k}${N} data-stx-memo="${U}"${A}>`;D=B.slice(0,F)+T+w.slice(M.length)+B.slice(F+w.length)}else D=`${B.slice(0,F)}<div data-stx-memo="${U}">${w}</div>${B.slice(F+w.length)}`;Y.push({start:Q,end:j,replacement:D}),X.lastIndex=j}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 m4($){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}var oG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),B2=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/;function rG($,Z){let X=!1,J=!1;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(X){if(Q==="'")X=!1}else if(J){if(Q==='"')J=!1}else if(Q==="'")X=!0;else if(Q==='"')J=!0;else if(Q===">")return Y}return-1}function aG($,Z){let X=0,J="",Y=Z;while(Y<$.length){let Q=$[Y];if(Q!=="<"){if(X===0)J+=Q;Y++;continue}if($.startsWith("<!--",Y)){let U=$.indexOf("-->",Y);Y=U===-1?$.length:U+3;continue}let G=rG($,Y);if(G===-1)break;let q=$.slice(Y,G+1),W=/^<\/?\s*([a-z][\w-]*)/i.exec(q)?.[1]?.toLowerCase()??"";if(q[1]==="/"){if(X===0)break;X--}else if(!/\/\s*>$/.test(q)&&!oG.has(W))X++;Y=G+1}return J}function j2($){let X=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"),J="",Y=0,Q;while((Q=X.exec($))!==null){let G=Q.index,q=G+Q[0].length,W=!1,U=!1,z=-1;while(q<$.length){let B=$[q];if(W){if(B==="'")W=!1}else if(U){if(B==='"')U=!1}else if(B==="'")W=!0;else if(B==='"')U=!0;else if(B===">"){z=q;break}q++}if(z===-1)continue;let K=$.slice(G,z+1);if(B2.test(K))continue;if(K.includes("x-cloak"))continue;let H=aG($,z+1);if(/\{\{[\s\S]*?\}\}/.test(H))J+=$.slice(Y,z)+" x-cloak>",Y=z+1}return J+=$.slice(Y),J}var tG=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/;function _2($){let Z=/<[a-z][\w-]*/gi,X="",J=0,Y;while((Y=Z.exec($))!==null){let Q=Y.index,G=Y[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,_=$.toLowerCase().indexOf(j,Q);if(_!==-1)Z.lastIndex=_+j.length;continue}let q=Q+Y[0].length,W=!1,U=!1,z=-1;while(q<$.length){let j=$[q];if(W){if(j==="'")W=!1}else if(U){if(j==='"')U=!1}else if(j==="'")W=!0;else if(j==='"')U=!0;else if(j===">"){z=q;break}q++}if(z===-1)continue;let K=$.slice(Q+Y[0].length,z);if(B2.test(K))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(K))continue;if(!tG.test(K))continue;let H=$[z-1]==="/",B=H?z-1:z;X+=`${$.slice(J,B)} x-cloak${H?" ":""}`,J=B}return X+=$.slice(J),X}var l4=G5(256),eG=[{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 c4($,Z,X,J){let Y=typeof X==="boolean"?{enabled:X,failOnViolation:X}:X??{enabled:!1};if(!Y.enabled)return;let Q=b1($,Z,J,JSON.stringify(Y)),G=l4.get(Q);if(G!==void 0){if(G&&Y.failOnViolation)throw Error(G);return}let q=Y.allowPatterns??[],W=[],U=c0($.replace(/\{\{--[\s\S]*?--\}\}/g,(B)=>B.replace(/[^\n]/g," ")));for(let{pattern:B,message:j,suggestion:_}of eG){if(q.some((V)=>/\w/.test(V)&&j.includes(V)))continue;B.lastIndex=0;let F=U.match(B);if(F&&F.length>0){let V=U.split(`
3599
3601
  `),O=$.split(`
3600
- `),F=[];V.forEach((M,k)=>{if(B.lastIndex=0,B.test(M))F.push(k+1)});let w=F.length>0?` (script line${F.length>1?"s":""} ${F.join(", ")})`:"",R=F.slice(0,3).map((M)=>` ${M} | ${(O[M-1]??"").trim().slice(0,100)}`).join(`
3602
+ `),L=[];V.forEach((M,k)=>{if(B.lastIndex=0,B.test(M))L.push(k+1)});let w=L.length>0?` (script line${L.length>1?"s":""} ${L.join(", ")})`:"",R=L.slice(0,3).map((M)=>` ${M} | ${(O[M-1]??"").trim().slice(0,100)}`).join(`
3601
3603
  `),D=R?`
3602
3604
  ${R}`:"";W.push(` \u2717 ${j}${w}
3603
- \u2192 ${_}${D}`)}}if(W.length===0){d4.set(Q,"");return}let U=(B)=>{let j=`${process.cwd()}/`;return B.startsWith(j)?B.slice(j.length):B},H=`[STX] DOM API violation in ${J&&J!==Z?`${U(J)} (composed into ${U(Z)})`:U(Z)}:
3605
+ \u2192 ${_}${D}`)}}if(W.length===0){l4.set(Q,"");return}let z=(B)=>{let j=`${process.cwd()}/`;return B.startsWith(j)?B.slice(j.length):B},H=`[STX] DOM API violation in ${J&&J!==Z?`${z(J)} (composed into ${z(Z)})`:z(Z)}:
3604
3606
  ${W.join(`
3605
3607
  `)}
3606
- Tip: prefer useRef(), navigate(), and composables for component code`;if(d4.set(Q,H),Y.failOnViolation)throw Error(H);else console.warn(H)}iG();var y1="<!--PARENT_CONTENT_PLACEHOLDER-->";function j2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function sG($,Z){let X=$.length,J=Z,Y=!0,Q=[],G=(q)=>q+9<=X&&$[q]==="<"&&$[q+1]==="/"&&($[q+2]==="s"||$[q+2]==="S")&&($[q+3]==="c"||$[q+3]==="C")&&($[q+4]==="r"||$[q+4]==="R")&&($[q+5]==="i"||$[q+5]==="I")&&($[q+6]==="p"||$[q+6]==="P")&&($[q+7]==="t"||$[q+7]==="T")&&($[q+8]===">"||/\s/.test($[q+8]));while(J<X){let q=$[J];if(G(J))return J;if(q==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
3607
- `,J+2),J===-1)return-1;J+=1,Y=!0;continue}if(q==="/"&&$[J+1]==="*"){let W=$.indexOf("*/",J+2);if(W===-1)return-1;J=W+2,Y=!0;continue}if(q==="/"&&Y){let W=J+1,K=!1;while(W<X){let U=$[W];if(U==="\\"){W+=2;continue}if(U==="[")K=!0;else if(U==="]")K=!1;else if(U==="/"&&!K){W++;break}else if(U===`
3608
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(l4.set(Q,H),Y.failOnViolation)throw Error(H);else console.warn(H)}$q();var y1="<!--PARENT_CONTENT_PLACEHOLDER-->";function V2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Xq($,Z){let X=$.length,J=Z,Y=!0,Q=[],G=(q)=>q+9<=X&&$[q]==="<"&&$[q+1]==="/"&&($[q+2]==="s"||$[q+2]==="S")&&($[q+3]==="c"||$[q+3]==="C")&&($[q+4]==="r"||$[q+4]==="R")&&($[q+5]==="i"||$[q+5]==="I")&&($[q+6]==="p"||$[q+6]==="P")&&($[q+7]==="t"||$[q+7]==="T")&&($[q+8]===">"||/\s/.test($[q+8]));while(J<X){let q=$[J];if(G(J))return J;if(q==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
3609
+ `,J+2),J===-1)return-1;J+=1,Y=!0;continue}if(q==="/"&&$[J+1]==="*"){let W=$.indexOf("*/",J+2);if(W===-1)return-1;J=W+2,Y=!0;continue}if(q==="/"&&Y){let W=J+1,U=!1;while(W<X){let z=$[W];if(z==="\\"){W+=2;continue}if(z==="[")U=!0;else if(z==="]")U=!1;else if(z==="/"&&!U){W++;break}else if(z===`
3608
3610
  `){W=-1;break}W++}if(W===-1){J++,Y=!1;continue}while(W<X&&/[a-z]/.test($[W]))W++;J=W,Y=!1;continue}if(q==="'"||q==='"'){let W=q;J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]===W){J++;break}if($[J]===`
3609
- `)break;J++}Y=!1;continue}if(q==="`"){J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}if(Q.length===0)Y=!1;continue}if(q==="}"&&Q.length>0){Q.pop(),J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Y=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}continue}if(/\s/.test(q));else if(/[)\].\w$]/.test(q))Y=!1;else Y=!0;J++}return-1}function q5($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${X}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let Y=J.index+J[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function _2($){let Z=0;while(Z<$.length){let X=$.indexOf("<",Z);if(X===-1)return-1;if($.startsWith("<!--",X)){let Q=$.indexOf("-->",X+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(X),Y=/^<style\b[^>]*>/i.exec(J);if(Y){let Q=$.toLowerCase().indexOf("</style>",X+Y[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return X;Z=X+1}return-1}function oG($){let Z=q5($,"data-stx-runtime");if(!Z)return $;let X=_2($);if(X===-1||X===Z.start)return $;let J=$.slice(Z.start,Z.end),Y=$.slice(0,Z.start)+$.slice(Z.end),Q=_2(Y);if(Q===-1)return J+`
3611
+ `)break;J++}Y=!1;continue}if(q==="`"){J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}if(Q.length===0)Y=!1;continue}if(q==="}"&&Q.length>0){Q.pop(),J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Y=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}continue}if(/\s/.test(q));else if(/[)\].\w$]/.test(q))Y=!1;else Y=!0;J++}return-1}function T2($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${X}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let Y=J.index+J[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}var O2=/<style\b[^>]*>/iy,F2=/<\/style>/gi,L2=/<script\b[^>]*>/iy;function w2($){let Z=0;while(Z<$.length){let X=$.indexOf("<",Z);if(X===-1)return-1;if($.startsWith("<!--",X)){let Y=$.indexOf("-->",X+4);Z=Y===-1?$.length:Y+3;continue}O2.lastIndex=X;let J=O2.exec($);if(J){F2.lastIndex=X+J[0].length;let Y=F2.exec($);Z=Y===null?$.length:Y.index+8;continue}if(L2.lastIndex=X,L2.test($))return X;Z=X+1}return-1}function Jq($){let Z=T2($,"data-stx-runtime");if(!Z)return $;let X=w2($);if(X===-1||X===Z.start)return $;let J=$.slice(Z.start,Z.end),Y=$.slice(0,Z.start)+$.slice(Z.end),Q=w2(Y);if(Q===-1)return J+`
3610
3612
  `+Y;return Y.slice(0,Q)+J+`
3611
- `+Y.slice(Q)}async function l4($,Z,X,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=G1($,X);let Q=!Z.__stxProcessingDepth;if(Q)G7(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!O5()&&!Z$())&&X&&X.endsWith(".stx"))D2($,X);try{return await L2.timeAsync("template-processing",async()=>{let G=await rG($,Z,X,J,Y);if(Q)G=u4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},K=(Z.__stx_runtime_head||null)??R2(),U=(Z.__stx_head_raw||"").trim(),z,H=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)z=H[1].trim(),U=U.replace(H[0],"").trim();let B=Z.__sections?.title,j=K.title||z||B,_=!K.title&&(!!z||!!B),L=K.meta||[],V=new Set(L.map((M)=>s1(M)).filter(Boolean)),O={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((M)=>!V.has(s1(M))),...L],link:[...q.link||[],...K.link||[]],script:[...q.script||[],...K.script||[]],headRaw:[q.headRaw,U].filter(Boolean).join(`
3612
- `),...K.htmlAttrs&&{htmlAttrs:U9(q.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...K.bodyAttrs}}},F=z4(G);if(G=B9(G,O,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),F)G=H9(G,q),G=z9(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let M=w[1],k=F2(M);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
3613
- <meta name="stx-layout" content="${j2(M)}">
3614
- <meta name="stx-layout-group" content="${j2(k)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?q1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=v1(G,(k,N)=>`<body${N} data-stx="${R[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let q=G9(),W=K4(G);if(W!==null)q.beforeClose.push(W);let K=W4(G);if(K!==null)q.afterOpen.push(K);G=q9(G,q);let U=J.app?.colorMode;if(U)G=J9(G,U);G=oG(G)}if(Q)try{let{getStoreScript:q}=await o("stx/store-loader",()=>import("./chunk-tjgyd8gt.js")),W=J.storesDir,K=await q(W);if(K){let U=`<script data-stx-stores>${K}</script>`,z=q5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
3615
- `+U+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await o("stx/framework-composables",()=>import("./chunk-zpne6q7q.js")),W=await q(G);if(W){let K=q5(G,"data-stx-stores")||q5(G,"data-stx-runtime");if(K)G=G.slice(0,K.end)+`
3616
- `+W+G.slice(K.end)}}catch{}if(Q)try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-1k3zp68a.js")),W=J.composablesDir,K=await q(W,G);if(K){let U=`<script data-stx-composables>${K}</script>`,z=q5(G,"data-stx-stores")||q5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
3617
- `+U+G.slice(z.end)}}catch{}if(Q)G=Y9(G);if(Q&&Z.__stx_inject_css!==!1)G=await w2(G,void 0,J.buildMode==="serve");if(Q)G=$9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Y$)throw G;let q=G instanceof Error?G.message:String(G),W=new w1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(i0.log(W,{filePath:X,context:Z}),L3.logDetailedError(W,{filePath:X,template:$.substring(0,500)}),J.debug)throw W;return O3.createFallbackContent("Template Processing",W)}}async function rG($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!A0.isAbsolute(J.partialsDir)?A0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!A0.isAbsolute(J.componentsDir)?A0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!A0.isAbsolute(J.layoutsDir)?A0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,W=$;await eG(X,Z),tG(Z,q),W=await h1(()=>P8(W,Z,X,q),W,(F)=>{i0.log(F,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${F.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=o0(W,U5,(F,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);W=K.output;let U=K.tokens,z=(F)=>U.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>U[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,H),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(F,w)=>{return`{{ ${w} }}`}),W=m8(W),W=await K2(W,X,Y);let B={};W=t3(W,B);let j={...Z.__sections||{}},_="",L=m7(d7($)),V=/@nolayout\b/.test(W)||L===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let O=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof L==="string"){if(_=L,!/@section\s*\(/.test(W))W=`@section('content')
3613
+ `+Y.slice(Q)}async function p4($,Z,X,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=G1($,X);let Q=!Z.__stxProcessingDepth;if(Q)W7(Z),Z.__stx_head_injections=G4(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!V5()&&!Z$())&&X&&X.endsWith(".stx"))I2($,X);try{return await M2.timeAsync("template-processing",async()=>{let G=await Yq($,Z,X,J,Y);if(Q)G=m4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},U=(Z.__stx_runtime_head||null)??k2(),z=(Z.__stx_head_raw||"").trim(),K,H=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)K=H[1].trim(),z=z.replace(H[0],"").trim();let B=Z.__sections?.title,j=U.title||K||B,_=!U.title&&(!!K||!!B),F=U.meta||[],V=new Set(F.map((M)=>s1(M)).filter(Boolean)),O={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((M)=>!V.has(s1(M))),...F],link:[...q.link||[],...U.link||[]],script:[...q.script||[],...U.script||[]],headRaw:[q.headRaw,z].filter(Boolean).join(`
3614
+ `),...U.htmlAttrs&&{htmlAttrs:K9(q.htmlAttrs,U.htmlAttrs)},...U.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...U.bodyAttrs}}},L=B4(G);if(G=j9(G,O,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)G=B9(G,q),G=H9(G,O.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let M=w[1],k=N2(M);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
3615
+ <meta name="stx-layout" content="${V2(M)}">
3616
+ <meta name="stx-layout-group" content="${V2(k)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?q1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=v1(G,(k,N)=>`<body${N} data-stx="${R[1]}">`);let M=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(M,"$1")}}if(Q){let q=Z.__stx_head_injections??G4(),W=K4(G);if(W!==null)q.beforeClose.push(W);let U=z4(G);if(U!==null)q.afterOpen.push(U);G=Y9(G,q);let z=J.app?.colorMode;if(z)G=G9(G,z);G=Jq(G)}if(Q){let q=T2(G,"data-stx-runtime");if(q){let W=null,U=null,z=null;try{let{getStoreScript:H}=await o("stx/store-loader",()=>import("./chunk-vxskcekj.js")),B=J.storesDir,j=await H(B);if(j)W=`<script data-stx-stores>${j}</script>`}catch{}try{let{getFrameworkComposableScript:H}=await o("stx/framework-composables",()=>import("./chunk-s6759be9.js"));z=await H(G)}catch{}try{let{getComposableScript:H}=await o("stx/composable-loader",()=>import("./chunk-61rfw29f.js")),B=J.composablesDir,j=[W,z].filter((F)=>F!==null),_=await H(B,G,j);if(_)U=`<script data-stx-composables>${_}</script>`}catch{}let K=[W,U,z].filter((H)=>H!==null).map((H)=>`
3617
+ ${H}`).join("");if(K)G=G.slice(0,q.end)+K+G.slice(q.end)}}if(Q)G=q9(G);if(Q&&Z.__stx_inject_css!==!1)G=await A2(G,void 0,J.buildMode==="serve");if(Q)G=X9(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Y$)throw G;let q=G instanceof Error?G.message:String(G),W=new w1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(i0.log(W,{filePath:X,context:Z}),L3.logDetailedError(W,{filePath:X,template:$.substring(0,500)}),J.debug)throw W;return O3.createFallbackContent("Template Processing",W)}}async function Yq($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!A0.isAbsolute(J.partialsDir)?A0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!A0.isAbsolute(J.componentsDir)?A0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!A0.isAbsolute(J.layoutsDir)?A0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,W=$;await qq(X,Z),Gq(Z,q),W=await h1(()=>f8(W,Z,X,q),W,(L)=>{i0.log(L,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${L.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=o0(W,U5,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);W=U.output;let z=U.tokens,K=(L)=>z.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>z[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,H),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),W=c8(W),W=await K2(W,X,Y);let B={};W=t3(W,B);let j={...Z.__sections||{}},_="",F=c7(l7($)),V=/@nolayout\b/.test(W)||F===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let O=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof F==="string"){if(_=F,!/@section\s*\(/.test(W))W=`@section('content')
3618
3618
  ${W.trim()}
3619
- @endsection`}if(!_&&!V&&q.defaultLayout){let F=U4(W),w=/@section\s*\(/.test(W);if(!F||w){let R="",D=A0.dirname(X),M=q.layoutsDir?A0.dirname(q.layoutsDir):process.cwd();for(let k=0;k<20;k++){let N=A0.join(D,"_layout.stx");if(await t(N)){R=N;break}let A=A0.dirname(D);if(A===D||A.length<M.length)break;D=A}if(R)_=R;else if(q.layoutsDir){let k=A0.isAbsolute(q.layoutsDir)?q.layoutsDir:A0.resolve(process.cwd(),q.layoutsDir),N=A0.join(k,`${q.defaultLayout}.stx`);if(await t(N))_=N}if(_&&!w)W=`@section('content')
3619
+ @endsection`}if(!_&&!V&&q.defaultLayout){let L=H4(W),w=/@section\s*\(/.test(W);if(!L||w){let R="",D=A0.dirname(X),M=q.layoutsDir?A0.dirname(q.layoutsDir):process.cwd();for(let k=0;k<20;k++){let N=A0.join(D,"_layout.stx");if(await t(N)){R=N;break}let A=A0.dirname(D);if(A===D||A.length<M.length)break;D=A}if(R)_=R;else if(q.layoutsDir){let k=A0.isAbsolute(q.layoutsDir)?q.layoutsDir:A0.resolve(process.cwd(),q.layoutsDir),N=A0.join(k,`${q.defaultLayout}.stx`);if(await t(N))_=N}if(_&&!w)W=`@section('content')
3620
3620
  ${W.trim()}
3621
- @endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,w,R)=>{return j[w]=R,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return F;try{let D=e(R.trim(),Z);if(D===void 0)return F;return j[w]=String(D??""),""}catch{return F}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,w,R)=>{if(R.includes("@parent"))j[w]=R.replace("@parent",y1);else j[w]=R.trim();return""}),Z.__sections=j,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,w,R)=>{return j[w]||R||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(W=e3(W,B),_){let F=[],w=r0(W),R=o0(w.output,C1,(D,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(W=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,M,k)=>{let N=M==="SCRIPT"?w.scripts[Number(k)]:R.tokens[Number(k)];if(N)F.push(N);return""}),F.length>0){let D=F.join(`
3621
+ @endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return j[w]=R,""}),W=W.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 j[w]=String(D??""),""}catch{return L}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))j[w]=R.replace("@parent",y1);else j[w]=R.trim();return""}),Z.__sections=j,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return j[w]||R||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(W=e3(W,B),_){let L=[],w=r0(W),R=o0(w.output,C1,(D,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(W=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,M,k)=>{let N=M==="SCRIPT"?w.scripts[Number(k)]:R.tokens[Number(k)];if(N)L.push(N);return""}),L.length>0){let D=L.join(`
3622
3622
  `);j.content=j.content?`${j.content}
3623
- ${D}`:D,Z.__sections=j}}if(_)try{let F;if(A0.isAbsolute(_))F=_,Y.add(_);else F=await h1(()=>q$(_,X,G,Y),null,()=>{throw new w1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!F){let N=(I)=>{if(!I)return[];try{let S=A0.isAbsolute(I)?I:A0.resolve(process.cwd(),I);return nG.readdirSync(S).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},A=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((I,S,E)=>E.indexOf(I)===S).sort(),T=`Layout not found: ${_} (referenced from ${X})`+(A.length>0?`. Available layouts: ${A.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(i0.log(Error(T),{layoutPath:_,filePath:X,available:A},"error"),console.error(`[stx] ${T}`),G.debug)throw new w1(T,X);return W}let w=await h1(()=>Bun.file(F).text(),"",()=>{throw new w1(`Failed to read layout file: ${F}`,X,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${F}`);let N={},A=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,E,b)=>{return N[E]=b.trim(),""});for(let[S,E]of Object.entries(N))if(j[S]&&j[S].includes(y1)){let b=j[S].indexOf(y1);j[S]=j[S].slice(0,b)+E+j[S].slice(b+y1.length)}else if(!j[S])j[S]=E;let T={...Z,__sections:j},I=`@layout('${R[1]}')${A}`;return await l4(I,T,F,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=t3(D,B),k={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,A,T)=>{return k[A]=T.trim(),`@slot('${A}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,A,T)=>{if(j[A]){let I=j[A];if(I.includes(y1)){let S=k[A]||"",E=I.indexOf(y1);I=I.slice(0,E)+S+I.slice(E+y1.length)}return I}return T||""}),M=aG(M,j),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),M=e3(M,B),Z.__originalFilePath=X,W=await V2(M,Z,F,G,Y),W=`<!-- stx-layout: ${_} -->
3624
- ${W}`,z(W)}catch(F){return i0.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await V2(W,Z,X,G,Y))}function aG($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function tG($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function eG($,Z){await h1(()=>x8($,Z),void 0,(X)=>{i0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function $q($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-f0f8pne1.js"));await W(G,Z,X,{preserveExisting:!0})}catch(W){let K=W instanceof Error?W:Error(String(W));i0.log(K,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${K.message}`)}}}async function Zq($,Z,X){try{let{interpolateScriptsInTemplate:J}=await o("stx/expressions",()=>import("./chunk-kr2q64k9.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return i0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function V2($,Z,X,J,Y){let Q=$,G=J;if(await $q(Q,Z,X),Q=await Zq(Q,Z,X),Q=await R8(Q,Z,X),Q=await D8(Q,Z,X),Q=await Y8(Q,Z,X,G),G1(Q))Q=b9(Q,Z),Q=L4(Q,Z);Q=S9(Q);let{processStreamDirectives:q}=await o("stx/streaming",()=>import("./chunk-wz87behc.js"));Q=q(Q,Z),Q=E8(Q,Z,X,G),Q=await i8(Q,Z,X,G,Y),Q=await x4(Q,Z,X,G,Y),Q=u7(Q,Z,X,G);let{processDeferDirectives:W}=await o("stx/defer",()=>import("./chunk-2218hm3h.js"));Q=W(Q,Z,X);let{processTeleportDirectives:K}=await o("stx/teleport",()=>import("./chunk-08q58gc0.js"));Q=K(Q,Z,X);let{processTransitionDirectives:U,processTransitionAttributes:z}=await o("stx/transitions",()=>import("./chunk-y3r71hx6.js"));Q=U(Q,Z,X),Q=z(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-4z157x30.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await o("stx/suspense",()=>import("./chunk-3tr99nn5.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await o("stx/async-components",()=>import("./chunk-dyd3jdrn.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await o("stx/keep-alive",()=>import("./chunk-k47az0ta.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:L,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await o("stx/virtual-scrolling",()=>import("./chunk-2fx2xdre.js"));Q=L(Q,Z,X),Q=V(Q,Z,X),Q=O(Q,Z,X);let{processPartialHydrationDirectives:F,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-5v2wk7sj.js"));Q=F(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await o("stx/computed",()=>import("./chunk-9y5xb0p4.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:M}=await o("stx/forms-validation",()=>import("./chunk-5mkc9fvx.js"));Q=M(Q,Z,X);let{processHeadDirective:k,processTitleDirective:N,processMetaDirective:A,resetHead:T}=await o("stx/head",()=>import("./chunk-zbynjn6g.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)T();let I=k(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
3625
- `;if(Q=N(Q,Z),Q=A(Q,Z),Q=f8(Q),Q=S3(Q,Z),Q=J8(Q),Q=S8(Q),Q=await a3(Q,Z,X,G,Y),Q=await x4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=q7(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=u4(Q),Q=X1(Q,Z,X),Q=c7(Q,Z,{filePath:X,buildMode:G.buildMode}),Q=C3(Q,Z),Q=P3(Q,Z),Q=N5(Q,Z),Q=d3(Q,Z),Q=m3(Q,Z),Q=await c6(Q,Z,X,G),Q=await a7(Q,Z,X),Q=await _8(Q,Z,X,G),Q=O2(Q,Z,X,G),Q=E6(Q,Z,X,G),Q=b6(Q,Z,X),Q=y6(Q,Z,X,G),Q=Z8(Q,Z,X,G),Q=g4(Q,Z),Q=h4(Q),Q=U2(Q),!G.skipEventDirectives)Q=Q7(Q,Z,X);if(Q=n7(Q,Z,X),G.debug){let p=/\bx-data\s*=/.test(Q),i=F4($);if(p&&i)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3623
+ ${D}`:D,Z.__sections=j}}if(_)try{let L;if(A0.isAbsolute(_))L=_,Y.add(_);else L=await h1(()=>q$(_,X,G,Y),null,()=>{throw new w1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!L){let N=(I)=>{if(!I)return[];try{let S=A0.isAbsolute(I)?I:A0.resolve(process.cwd(),I);return Zq.readdirSync(S).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},A=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((I,S,E)=>E.indexOf(I)===S).sort(),T=`Layout not found: ${_} (referenced from ${X})`+(A.length>0?`. Available layouts: ${A.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(i0.log(Error(T),{layoutPath:_,filePath:X,available:A},"error"),console.error(`[stx] ${T}`),G.debug)throw new w1(T,X);return W}let w=await h1(()=>Bun.file(L).text(),"",()=>{throw new w1(`Failed to read layout file: ${L}`,X,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${L}`);let N={},A=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,E,b)=>{return N[E]=b.trim(),""});for(let[S,E]of Object.entries(N))if(j[S]&&j[S].includes(y1)){let b=j[S].indexOf(y1);j[S]=j[S].slice(0,b)+E+j[S].slice(b+y1.length)}else if(!j[S])j[S]=E;let T={...Z,__sections:j},I=`@layout('${R[1]}')${A}`;return await p4(I,T,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=t3(D,B),k={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,A,T)=>{return k[A]=T.trim(),`@slot('${A}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,A,T)=>{if(j[A]){let I=j[A];if(I.includes(y1)){let S=k[A]||"",E=I.indexOf(y1);I=I.slice(0,E)+S+I.slice(E+y1.length)}return I}return T||""}),M=Qq(M,j),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),M=e3(M,B),Z.__originalFilePath=X,W=await R2(M,Z,L,G,Y),W=`<!-- stx-layout: ${_} -->
3624
+ ${W}`,K(W)}catch(L){return i0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return K(await R2(W,Z,X,G,Y))}function Qq($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function Gq($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function qq($,Z){await h1(()=>h8($,Z),void 0,(X)=>{i0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function Wq($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await o("stx/variable-extractor",()=>import("./chunk-rvmt27kv.js"));await W(G,Z,X,{preserveExisting:!0})}catch(W){let U=W instanceof Error?W:Error(String(W));i0.log(U,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${U.message}`)}}}async function Uq($,Z,X){try{let{interpolateScriptsInTemplate:J}=await o("stx/expressions",()=>import("./chunk-pgvskhg2.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return i0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function R2($,Z,X,J,Y){let Q=$,G=J;if(await Wq(Q,Z,X),Q=await Uq(Q,Z,X),Q=await N8(Q,Z,X),Q=await M8(Q,Z,X),Q=await G8(Q,Z,X,G),G1(Q))Q=y9(Q,Z),Q=R4(Q,Z);Q=C9(Q);let{processStreamDirectives:q}=await o("stx/streaming",()=>import("./chunk-3p2w5dag.js"));Q=q(Q,Z),Q=y8(Q,Z,X,G),Q=await s8(Q,Z,X,G,Y),Q=await h4(Q,Z,X,G,Y),Q=m7(Q,Z,X,G);let{processDeferDirectives:W}=await o("stx/defer",()=>import("./chunk-2218hm3h.js"));Q=W(Q,Z,X);let{processTeleportDirectives:U}=await o("stx/teleport",()=>import("./chunk-08q58gc0.js"));Q=U(Q,Z,X);let{processTransitionDirectives:z,processTransitionAttributes:K}=await o("stx/transitions",()=>import("./chunk-y3r71hx6.js"));Q=z(Q,Z,X),Q=K(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-4z157x30.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await o("stx/suspense",()=>import("./chunk-3tr99nn5.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await o("stx/async-components",()=>import("./chunk-dyd3jdrn.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await o("stx/keep-alive",()=>import("./chunk-k47az0ta.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:F,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await o("stx/virtual-scrolling",()=>import("./chunk-2fx2xdre.js"));Q=F(Q,Z,X),Q=V(Q,Z,X),Q=O(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-5v2wk7sj.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await o("stx/computed",()=>import("./chunk-9y5xb0p4.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:M}=await o("stx/forms-validation",()=>import("./chunk-5mkc9fvx.js"));Q=M(Q,Z,X);let{processHeadDirective:k,processTitleDirective:N,processMetaDirective:A,resetHead:T}=await o("stx/head",()=>import("./chunk-zbynjn6g.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)T();let I=k(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
3625
+ `;if(Q=N(Q,Z),Q=A(Q,Z),Q=g8(Q),Q=S3(Q,Z),Q=Q8(Q),Q=P8(Q),Q=await a3(Q,Z,X,G,Y),Q=await h4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=U7(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=m4(Q),Q=X1(Q,Z,X),Q=i7(Q,Z,{filePath:X,buildMode:G.buildMode}),Q=C3(Q,Z),Q=P3(Q,Z),Q=D5(Q,Z),Q=d3(Q,Z),Q=m3(Q,Z),Q=await i6(Q,Z,X,G),Q=await e7(Q,Z,X),Q=await O8(Q,Z,X,G),Q=D2(Q,Z,X,G),Q=y6(Q,Z,X,G),Q=S6(Q,Z,X),Q=C6(Q,Z,X,G),Q=J8(Q,Z,X,G),Q=u4(Q,Z),Q=d4(Q),Q=H2(Q),!G.skipEventDirectives)Q=q7(Q,Z,X);if(Q=o7(Q,Z,X),G.debug){let p=/\bx-data\s*=/.test(Q),i=w4($);if(p&&i)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3626
3626
  Both work on the same page, but they manage separate scopes.
3627
- Prefer signals (state/derived/effect) for new components.`)}Q=u8(Q,Z),Q=await O1(Q,Z,X),Q=H2(Q),Q=B2(Q),Q=S7(Q);let{processXElementDirectives:S}=await o("stx/x-element",()=>import("./chunk-jj6nrqje.js"));Q=S(Q);let E=Z.__originalFilePath||X,b=v$(Z);if(Q=await C9(Q,G,E,b),Q=W8(Q,Z),Q=await v8(Q,Z,X,G),G.media?.image?.autoSiblings){let p=G.publicDir||"public",{rewriteImagesWithSiblings:i}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-t7snemp0.js"));Q=await i(Q,{publicDir:p})}if(G.seo?.enabled)Q=S6(Q,Z,G);let y=(p,i,K0=!0)=>{if(!i)return p;let G0=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),N0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(G0&&N0){if(K0)p=p.replace(N0[0],G0[0]);if(i=i.replace(G0[0],"").trim(),!i)return p}if(/<\/head>/i.test(p))return p.replace(/<\/head>/i,`${i}
3627
+ Prefer signals (state/derived/effect) for new components.`)}Q=m8(Q,Z),Q=await O1(Q,Z,X),Q=j2(Q),Q=_2(Q),Q=P7(Q);let{processXElementDirectives:S}=await o("stx/x-element",()=>import("./chunk-jj6nrqje.js"));Q=S(Q);let E=Z.__originalFilePath||X,b=v$(Z);if(Q=await P9(Q,G,E,b),Q=z8(Q,Z),Q=await x8(Q,Z,X,G),G.media?.image?.autoSiblings){let p=G.publicDir||"public",{rewriteImagesWithSiblings:i}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-t7snemp0.js"));Q=await i(Q,{publicDir:p})}if(G.seo?.enabled)Q=P6(Q,Z,G);let y=(p,i,U0=!0)=>{if(!i)return p;let G0=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),N0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(G0&&N0){if(U0)p=p.replace(N0[0],G0[0]);if(i=i.replace(G0[0],"").trim(),!i)return p}if(/<\/head>/i.test(p))return p.replace(/<\/head>/i,`${i}
3628
3628
  </head>`);if(/<head\b[^>]*>/i.test(p))return p.replace(/(<head\b[^>]*>)/i,`$1
3629
3629
  ${i}`);if(/<html\b[^>]*>/i.test(p))return p.replace(/(<html\b[^>]*>)/i,`$1
3630
3630
  <head>
3631
3631
  ${i}
3632
- </head>`);return p},{renderHead:P,getHead:f}=await o("stx/head",()=>import("./chunk-zbynjn6g.js")),g=Z.__stx_runtime_head??f();if(g.title||g.meta?.length||g.link?.length){let p=P(g);if(p)Q=y(Q,p)}if(I.headContent)Q=y(Q,I.headContent,!g.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=e6(Q,G.csp,Z);if(G.analytics?.enabled)Q=P7(Q,G);if(G.heatmap?.enabled)Q=f7(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:p}=await o("stx/pwa/inject",()=>import("./chunk-pghw8xrx.js"));Q=p(Q,G)}let Q0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),e0=/\bSTX\.\w+/.test(Q),k0=/window\.STX\s*=/.test(Q);if(Q0&&e0&&!k0){let i=`<script data-stx-scoped data-stx-run="once">
3633
- ${E7()}
3634
- </script>`;if(Q.includes("</head>")){let K0=Q.indexOf("</head>"),N0=Q.slice(0,K0).indexOf("<script");if(N0!==-1){let P0=Q.slice(0,N0),K5=Q.slice(N0);Q=P0+i+`
3635
- `+K5}else Q=Q.replace("</head>",`${i}
3632
+ </head>`);return p},{renderHead:P,getHead:f}=await o("stx/head",()=>import("./chunk-zbynjn6g.js")),g=Z.__stx_runtime_head??f();if(g.title||g.meta?.length||g.link?.length){let p=P(g);if(p)Q=y(Q,p)}if(I.headContent)Q=y(Q,I.headContent,!g.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=Z8(Q,G.csp,Z);if(G.analytics?.enabled)Q=f7(Q,G);if(G.heatmap?.enabled)Q=g7(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:p}=await o("stx/pwa/inject",()=>import("./chunk-pghw8xrx.js"));Q=p(Q,G)}let Q0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),e0=/\bSTX\.\w+/.test(Q),k0=/window\.STX\s*=/.test(Q);if(Q0&&e0&&!k0){let i=`<script data-stx-scoped data-stx-run="once">
3633
+ ${y7()}
3634
+ </script>`;if(Q.includes("</head>")){let U0=Q.indexOf("</head>"),N0=Q.slice(0,U0).indexOf("<script");if(N0!==-1){let P0=Q.slice(0,N0),W5=Q.slice(N0);Q=P0+i+`
3635
+ `+W5}else Q=Q.replace("</head>",`${i}
3636
3636
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
3637
3637
  ${i}`);else Q=i+`
3638
- `+Q}{let{scanScriptTags:p}=await o("stx/signal-processing",()=>import("./chunk-3cqwrprg.js")),i=[];for(let K0 of p(Q)){if(!/\bserver\b/i.test(K0.attrs))continue;let G0=K0.start+K0.fullMatch.indexOf(">")+1,N0=sG(Q,G0);if(N0===-1)continue;let P0=N0+9;while(P0<Q.length&&/\s/.test(Q[P0]))P0++;i.push({start:K0.start,end:P0})}for(let K0=i.length-1;K0>=0;K0--){let{start:G0,end:N0}=i[K0];Q=Q.substring(0,G0)+Q.substring(N0)}}let C0=R$(Q,X);if(C0.hasScoped)Q=C0.html;let X0=Z.__stx_event_bindings||[],H0=!1,I0=[],E0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:m0}=await o("stx/signal-processing",()=>import("./chunk-3cqwrprg.js"));for(let p of m0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))I0.push({match:p.fullMatch,attrs:p.attrs,content:p.body});for(let{match:p,attrs:i,content:K0}of I0){H0=!0;let G0=K0;m4(K0,X,J.strict,Z.__originalFilePath);let N0=await f$(K0,{eventBindings:X0,attrs:i,hasColonDirectives:E0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(p,()=>N0)}if(H0)Z.__stx_event_bindings=[];if(!H0&&Z.__stxProcessingDepth===1){let p=Z.__stx_event_bindings||[];if(p.length>0){let i=c$(p);if(i){let K0=Q.lastIndexOf("</body>");Q=K0===-1?Q+i:Q.slice(0,K0)+i+`
3639
- `+Q.slice(K0)}Z.__stx_event_bindings=[]}}if(!L9(Q)&&w9(Q))Q=await A$(Q,G);if(Q=R9(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=$8(Q,Z.cspNonce);return Q}var Xq=[{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"}],Jq=[{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')"}],Yq=[{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 Qq($){let Z=[],X=[];return Gq($,Z),qq($,Z,X),Wq($,X),Kq($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function Gq($,Z){let X=($.match(/\{\{/g)||[]).length,J=($.match(/\}\}/g)||[]).length;if(X!==J)Z.push({type:"expression",message:`Unclosed expression brackets: found ${X} opening '{{' and ${J} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function qq($,Z,X){for(let J of Xq){let Y=new RegExp(`${J.open}(?:\\s|\\()`,"g"),Q=new RegExp(J.close,"g"),G=($.match(Y)||[]).length,q=($.match(Q)||[]).length;if(J.altClose){let W=new RegExp(J.altClose,"g");q+=($.match(W)||[]).length}if(G>q)Z.push({type:"directive",message:`Unclosed @${J.name} directive: found ${G} opening and ${q} closing`,suggestion:`Add ${G-q} missing ${J.close} tag(s)`});else if(q>G)X.push({type:"directive",message:`Extra ${J.close} found: ${q-G} more closing than opening`,suggestion:`Check for orphaned ${J.close} tags`})}}function Wq($,Z){for(let X of Jq)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function Kq($,Z){for(let X of Yq)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function Uq($,Z){let X=$.slice(0,Z).split(`
3640
- `);return{line:X.length,column:X[X.length-1].length+1}}function zq($,Z,X){let J=[];switch($){case"if":case"elseif":case"unless":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(X.length===0||!X[0].includes(" as "))J.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(X.length===0)J.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(X.length===0)J.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(X.length===0)J.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return J}function Hq($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function Bq($){let Z=$.matchAll(/@([a-z]+)/gi),X=new Set;for(let J of Z){let Y=J[1].toLowerCase();if(!Y.startsWith("end"))X.add(Y)}return Array.from(X)}import t0 from"path";import W5 from"process";var y2=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","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"],N2=new Set(y2),jq=new Set(["props","$props","defineProps"]),_q=new Set(["stx","@stacksjs/stx"]),M2=G5(128);function Vq($){let Z=[],X=0,J=$.split(`
3641
- `);for(let Y of J){let Q=X,G=null,q=!1;for(let W=0;W<Y.length;W++){let K=Y[W];if(q){q=!1;continue}if(K==="\\"){q=!0;continue}if(G){if(K===G)G=null;continue}if(K==="'"||K==='"'||K==="`"){G=K;continue}if(K==="/"&&W+1<Y.length&&Y[W+1]==="/")break;if(K==="{")X++;else if(K==="}")X--}if(Q===0){let W=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[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 z=K[1].slice(1,-1).split(",").map((H)=>{let B=H.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...z)}}}}return[...new Set(Z)]}function Oq($){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 X(J){if(!J.includes(":"))return J;let Y=[],Q="",G=0,q=0,W=null;for(let K=0;K<J.length;K++){let U=J[K];if(W){if(Q+=U,U===W)W=null;continue}if(U==='"'||U==="'"||U==="`"){W=U,Q+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")q++;else if(U===")")q--;if(U===","&&G===0&&q===0){Y.push(Q),Q="";continue}Q+=U}if(Q)Y.push(Q);return Y.map((K)=>{let U=K.trim(),z=U.startsWith("..."),H=z?U.slice(3):U,B=-1,j=0;for(let R=0;R<H.length;R++)if(H[R]==="<")j++;else if(H[R]===">")j--;else if(H[R]===":"&&j===0){B=R;break}if(B===-1)return K;let L=H.substring(0,B).trim().replace(/\?$/,""),V=H.substring(B+1),O=-1,F=0;for(let R=0;R<V.length;R++)if(V[R]==="<")F++;else if(V[R]===">")F--;else if(V[R]==="="&&F===0){O=R;break}let w=z?"...":"";if(O!==-1)return`${w}${L} = ${V.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,Q)=>{if(!Q.includes(":"))return J;return`${Y}(${X(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,q=1,W=G+1,K=0,U=null;while(W<Z.length&&q>0){let B=Z[W];if(U){if(B===U)U=null;W++;continue}if(B==='"'||B==="'"||B==="`"){U=B,W++;continue}if(B==="<")K++;else if(B===">"&&K>0)K--;else if(K===0){if(B==="(")q++;else if(B===")")q--}if(q>0)W++}if(q!==0)continue;let z=Z.substring(G+1,W);if(!z.includes(":"))continue;let H=X(z);Q.push({start:G+1,end:W,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:q,end:W,replacement:K}=Q[G];Z=Z.substring(0,q)+K+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.split(",").map((G)=>{let[q,...W]=G.split("="),K=q.split(":")[0].trim();if(W.length>0)return`${K} = ${W.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,`
3638
+ `+Q}{let{scanScriptTags:p}=await o("stx/signal-processing",()=>import("./chunk-edctags2.js")),i=[];for(let U0 of p(Q)){if(!/\bserver\b/i.test(U0.attrs))continue;let G0=U0.start+U0.fullMatch.indexOf(">")+1,N0=Xq(Q,G0);if(N0===-1)continue;let P0=N0+9;while(P0<Q.length&&/\s/.test(Q[P0]))P0++;i.push({start:U0.start,end:P0})}for(let U0=i.length-1;U0>=0;U0--){let{start:G0,end:N0}=i[U0];Q=Q.substring(0,G0)+Q.substring(N0)}}let C0=R$(Q,X);if(C0.hasScoped)Q=C0.html;let X0=Z.__stx_event_bindings||[],H0=!1,I0=[],E0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:m0}=await o("stx/signal-processing",()=>import("./chunk-edctags2.js"));for(let p of m0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))I0.push({match:p.fullMatch,attrs:p.attrs,content:p.body});for(let{match:p,attrs:i,content:U0}of I0){H0=!0;let G0=U0;c4(U0,X,J.strict,Z.__originalFilePath);let N0=await f$(U0,{eventBindings:X0,attrs:i,hasColonDirectives:E0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(p,()=>N0)}if(H0)Z.__stx_event_bindings=[];if(!H0&&Z.__stxProcessingDepth===1){let p=Z.__stx_event_bindings||[];if(p.length>0){let i=c$(p);if(i){let U0=Q.lastIndexOf("</body>");Q=U0===-1?Q+i:Q.slice(0,U0)+i+`
3639
+ `+Q.slice(U0)}Z.__stx_event_bindings=[]}}if(!w9(Q)&&R9(Q))Q=await A$(Q,G);if(Q=D9(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=X8(Q,Z.cspNonce);return Q}var zq=[{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"}],Kq=[{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')"}],Hq=[{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 Bq($){let Z=[],X=[];return jq($,Z),_q($,Z,X),Vq($,X),Oq($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function jq($,Z){let X=($.match(/\{\{/g)||[]).length,J=($.match(/\}\}/g)||[]).length;if(X!==J)Z.push({type:"expression",message:`Unclosed expression brackets: found ${X} opening '{{' and ${J} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function _q($,Z,X){for(let J of zq){let Y=new RegExp(`${J.open}(?:\\s|\\()`,"g"),Q=new RegExp(J.close,"g"),G=($.match(Y)||[]).length,q=($.match(Q)||[]).length;if(J.altClose){let W=new RegExp(J.altClose,"g");q+=($.match(W)||[]).length}if(G>q)Z.push({type:"directive",message:`Unclosed @${J.name} directive: found ${G} opening and ${q} closing`,suggestion:`Add ${G-q} missing ${J.close} tag(s)`});else if(q>G)X.push({type:"directive",message:`Extra ${J.close} found: ${q-G} more closing than opening`,suggestion:`Check for orphaned ${J.close} tags`})}}function Vq($,Z){for(let X of Kq)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function Oq($,Z){for(let X of Hq)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function Fq($,Z){let X=$.slice(0,Z).split(`
3640
+ `);return{line:X.length,column:X[X.length-1].length+1}}function Lq($,Z,X){let J=[];switch($){case"if":case"elseif":case"unless":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(X.length===0||!X[0].includes(" as "))J.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(X.length===0)J.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(X.length===0)J.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(X.length===0)J.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return J}function wq($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function Rq($){let Z=$.matchAll(/@([a-z]+)/gi),X=new Set;for(let J of Z){let Y=J[1].toLowerCase();if(!Y.startsWith("end"))X.add(Y)}return Array.from(X)}import t0 from"path";import q5 from"process";var x2=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","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"],E2=new Set(x2),Dq=new Set(["props","$props","defineProps"]),Nq=new Set(["stx","@stacksjs/stx"]),b2=G5(128);function Mq($){let Z=[],X=0,J=$.split(`
3641
+ `);for(let Y of J){let Q=X,G=null,q=!1;for(let W=0;W<Y.length;W++){let U=Y[W];if(q){q=!1;continue}if(U==="\\"){q=!0;continue}if(G){if(U===G)G=null;continue}if(U==="'"||U==='"'||U==="`"){G=U;continue}if(U==="/"&&W+1<Y.length&&Y[W+1]==="/")break;if(U==="{")X++;else if(U==="}")X--}if(Q===0){let W=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let U=Y.match(/(?:const|let|var)\s+(\w+)/);if(U)Z.push(U[1])}else{let U=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(U){let K=U[1].slice(1,-1).split(",").map((H)=>{let B=H.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...K)}}}}return[...new Set(Z)]}function Aq($){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 X(J){if(!J.includes(":"))return J;let Y=[],Q="",G=0,q=0,W=null;for(let U=0;U<J.length;U++){let z=J[U];if(W){if(Q+=z,z===W)W=null;continue}if(z==='"'||z==="'"||z==="`"){W=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")q++;else if(z===")")q--;if(z===","&&G===0&&q===0){Y.push(Q),Q="";continue}Q+=z}if(Q)Y.push(Q);return Y.map((U)=>{let z=U.trim(),K=z.startsWith("..."),H=K?z.slice(3):z,B=-1,j=0;for(let R=0;R<H.length;R++)if(H[R]==="<")j++;else if(H[R]===">")j--;else if(H[R]===":"&&j===0){B=R;break}if(B===-1)return U;let F=H.substring(0,B).trim().replace(/\?$/,""),V=H.substring(B+1),O=-1,L=0;for(let R=0;R<V.length;R++)if(V[R]==="<")L++;else if(V[R]===">")L--;else if(V[R]==="="&&L===0){O=R;break}let w=K?"...":"";if(O!==-1)return`${w}${F} = ${V.substring(O+1).trim()}`;return`${w}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,Q)=>{if(!Q.includes(":"))return J;return`${Y}(${X(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,q=1,W=G+1,U=0,z=null;while(W<Z.length&&q>0){let B=Z[W];if(z){if(B===z)z=null;W++;continue}if(B==='"'||B==="'"||B==="`"){z=B,W++;continue}if(B==="<")U++;else if(B===">"&&U>0)U--;else if(U===0){if(B==="(")q++;else if(B===")")q--}if(q>0)W++}if(q!==0)continue;let K=Z.substring(G+1,W);if(!K.includes(":"))continue;let H=X(K);Q.push({start:G+1,end:W,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:q,end:W,replacement:U}=Q[G];Z=Z.substring(0,q)+U+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.split(",").map((G)=>{let[q,...W]=G.split("="),U=q.split(":")[0].trim();if(W.length>0)return`${U} = ${W.join("=").trim()}`;return U}).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,`
3642
3642
 
3643
- `),Z}function Fq($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function Lq($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function wq($,Z,X,J={}){if(!$.trim())return;let Y=Y5(),Q=b1($,JSON.stringify(Y)),G=M2.get(Q);if(G===void 0){try{let C=p4({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=C.transformSync(v)}catch{G=Oq($)}M2.set(Q,G)}let q={exports:{}},W=q.exports,K=W5.cwd(),U={},z=[...G.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C)),H=new Map;for(let C of z)try{if(C.startsWith(".")){U[C]=await import(t0.resolve(t0.dirname(X),C));continue}let v=t0.resolve(K,"node_modules",C),r=t0.join(v,"package.json"),a=JSON.parse(x("fs").readFileSync(r,"utf8")),J0=a.main||"index.js";if(a.exports){let Y0=typeof a.exports==="string"?a.exports:a.exports["."];if(typeof Y0==="string")J0=Y0;else if(Y0?.bun)J0=Y0.bun;else if(Y0?.import)J0=Y0.import;else if(Y0?.default)J0=Y0.default}U[C]=await import(t0.resolve(v,J0))}catch(v){if(C.startsWith("."))H.set(C,v instanceof Error?v.message:String(v))}let B=(C)=>{if(U[C])return U[C];let v=H.get(C);if(v!==void 0)throw Error(`Cannot require '${C}' from ${X}: ${v}`);return x(C)},j=Z.props||{},_=(C)=>{if(!C)return j;let v={};for(let[r,a]of Object.entries(C)){let J0=j[r];if(J0!==void 0)v[r]=J0;else if(typeof a==="function")v[r]=a();else v[r]=a}return v};for(let[C,v]of Object.entries(j))Object.defineProperty(_,C,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(j,C))continue;try{Object.defineProperty(_,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let L=(C)=>{if(!C)return j;let v={...j};for(let[r,a]of Object.entries(C)){let J0=a&&typeof a==="object"&&!Array.isArray(a)?a:{type:a};if(v[r]===void 0&&J0.default!==void 0)v[r]=typeof J0.default==="function"?J0.default():J0.default}return v},V=()=>Z.slots||{},O=(C,v)=>{let r={...C};for(let[a,J0]of Object.entries(v))if(r[a]===void 0)if(typeof J0==="function")r[a]=J0();else r[a]=J0;return r},F=(C)=>{let v=()=>C;return v.set=(r)=>{},v.update=(r)=>{},v},w=(C)=>{let v,r=!1;return()=>{if(!r)try{v=C(),r=!0}catch{v=void 0}return v}},R=(C)=>{},D=(C)=>C(),M=(C)=>{},k=(C)=>{},N=l7(Z);function A(C){let v=C||{};if(v.title!==void 0||v.description!==void 0)b({title:v.title,description:v.description})}function T(C){if(!C||typeof C!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,C),Z.__stxClientPayload=v}let I=()=>{let C=Z.__stxServeContext,v=Z.__stxServeSearch??C?.search??"",r=C?.path??"",a=Object.fromEntries(new URLSearchParams(v)),J0=Z.query,Y0=Object.keys(a).length>0?a:J0??{},u=v||(Object.keys(Y0).length>0?`?${new URLSearchParams(Y0).toString()}`:"");return{params:Z.params??{},query:Y0,path:r,name:"",fullPath:r+u,hash:"",matched:[]}},S=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),E=(C)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=G$(v,C||{})},b=(C)=>{E(b2(C||{}))},y=(C)=>({value:C}),P=(C)=>C,f=(C)=>({value:typeof C==="function"?C():C}),d=(C,v)=>{},g=(C)=>{},Q0=(C)=>{},e0=(C)=>C?C():Promise.resolve(),k0=(C)=>(v,...r)=>{},C0=(C)=>{},X0=(C,v)=>{},H0=(C,v)=>v,I0=()=>({value:"light"}),E0=()=>F(!1),m0=(C)=>F(!1),p=()=>F(!1),i=()=>m0("(prefers-color-scheme: dark)"),K0=()=>m0("(prefers-color-scheme: light)"),G0=()=>m0("(prefers-reduced-motion: reduce)"),N0=()=>m0("(prefers-contrast: more)"),P0={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:{}},K5=new Proxy(P0,{get(C,v){if(v in C)return C[v];return},set(C,v,r){return C[v]=r,!0}}),C5={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},P5=console;try{let C=S2(G,X),v=new Set(Object.keys(j)),r=(s)=>/^[a-z_$][\w$]*$/i.test(s),a=Object.keys(Z).filter((s)=>!v.has(s)&&!jq.has(s)&&r(s)),J0=a.map((s)=>Z[s]);if(!a.includes("__stxServeContext"))a.push("__stxServeContext"),J0.push(void 0);let Y0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),u=[],m=[];for(let[s,l0]of Object.entries(j)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(s))continue;if(Y0.has(s))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${s}\\b`).test(C))continue;u.push(s),m.push(l0)}let n=Vq(C).map((s)=>`module.exports.${s} = typeof ${s} !== 'undefined' ? ${s} : module.exports.${s};`).join(`
3644
- `),O0=Z.params??{},F0=[],v0=[];for(let s=0;s<a.length;s++){if(a[s]==="params")continue;F0.push(a[s]),v0.push(J0[s])}let b0=await Function(...y2,...u,...F0,`return (async () => {
3643
+ `),Z}function kq($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function Iq($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function Tq($,Z,X,J={}){if(!$.trim())return;let Y=Y5(),Q=b1($,JSON.stringify(Y)),G=b2.get(Q);if(G===void 0){try{let C=n4({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=C.transformSync(v)}catch{G=Aq($)}b2.set(Q,G)}let q={exports:{}},W=q.exports,U=q5.cwd(),z={},K=[...G.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C)),H=new Map;for(let C of K)try{if(C.startsWith(".")){z[C]=await import(t0.resolve(t0.dirname(X),C));continue}let v=t0.resolve(U,"node_modules",C),r=t0.join(v,"package.json"),a=JSON.parse(x("fs").readFileSync(r,"utf8")),J0=a.main||"index.js";if(a.exports){let Y0=typeof a.exports==="string"?a.exports:a.exports["."];if(typeof Y0==="string")J0=Y0;else if(Y0?.bun)J0=Y0.bun;else if(Y0?.import)J0=Y0.import;else if(Y0?.default)J0=Y0.default}z[C]=await import(t0.resolve(v,J0))}catch(v){if(C.startsWith("."))H.set(C,v instanceof Error?v.message:String(v))}let B=(C)=>{if(z[C])return z[C];let v=H.get(C);if(v!==void 0)throw Error(`Cannot require '${C}' from ${X}: ${v}`);return x(C)},j=Z.props||{},_=(C)=>{if(!C)return j;let v={};for(let[r,a]of Object.entries(C)){let J0=j[r];if(J0!==void 0)v[r]=J0;else if(typeof a==="function")v[r]=a();else v[r]=a}return v};for(let[C,v]of Object.entries(j))Object.defineProperty(_,C,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(j,C))continue;try{Object.defineProperty(_,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let F=(C)=>{if(!C)return j;let v={...j};for(let[r,a]of Object.entries(C)){let J0=a&&typeof a==="object"&&!Array.isArray(a)?a:{type:a};if(v[r]===void 0&&J0.default!==void 0)v[r]=typeof J0.default==="function"?J0.default():J0.default}return v},V=()=>Z.slots||{},O=(C,v)=>{let r={...C};for(let[a,J0]of Object.entries(v))if(r[a]===void 0)if(typeof J0==="function")r[a]=J0();else r[a]=J0;return r},L=(C)=>{let v=()=>C;return v.set=(r)=>{},v.update=(r)=>{},v},w=(C)=>{let v,r=!1;return()=>{if(!r)try{v=C(),r=!0}catch{v=void 0}return v}},R=(C)=>{},D=(C)=>C(),M=(C)=>{},k=(C)=>{},N=p7(Z);function A(C){let v=C||{};if(v.title!==void 0||v.description!==void 0)b({title:v.title,description:v.description})}function T(C){if(!C||typeof C!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,C),Z.__stxClientPayload=v}let I=()=>{let C=Z.__stxServeContext,v=Z.__stxServeSearch??C?.search??"",r=C?.path??"",a=Object.fromEntries(new URLSearchParams(v)),J0=Z.query,Y0=Object.keys(a).length>0?a:J0??{},u=v||(Object.keys(Y0).length>0?`?${new URLSearchParams(Y0).toString()}`:"");return{params:Z.params??{},query:Y0,path:r,name:"",fullPath:r+u,hash:"",matched:[]}},S=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),E=(C)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=G$(v,C||{})},b=(C)=>{E(f2(C||{}))},y=(C)=>({value:C}),P=(C)=>C,f=(C)=>({value:typeof C==="function"?C():C}),d=(C,v)=>{},g=(C)=>{},Q0=(C)=>{},e0=(C)=>C?C():Promise.resolve(),k0=(C)=>(v,...r)=>{},C0=(C)=>{},X0=(C,v)=>{},H0=(C,v)=>v,I0=()=>({value:"light"}),E0=()=>L(!1),m0=(C)=>L(!1),p=()=>L(!1),i=()=>m0("(prefers-color-scheme: dark)"),U0=()=>m0("(prefers-color-scheme: light)"),G0=()=>m0("(prefers-reduced-motion: reduce)"),N0=()=>m0("(prefers-contrast: more)"),P0={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:{}},W5=new Proxy(P0,{get(C,v){if(v in C)return C[v];return},set(C,v,r){return C[v]=r,!0}}),C5={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},P5=console;try{let C=g2(G,X),v=new Set(Object.keys(j)),r=(s)=>/^[a-z_$][\w$]*$/i.test(s),a=Object.keys(Z).filter((s)=>!v.has(s)&&!Dq.has(s)&&r(s)),J0=a.map((s)=>Z[s]);if(!a.includes("__stxServeContext"))a.push("__stxServeContext"),J0.push(void 0);let Y0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),u=[],m=[];for(let[s,l0]of Object.entries(j)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(s))continue;if(Y0.has(s))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${s}\\b`).test(C))continue;u.push(s),m.push(l0)}let n=Mq(C).map((s)=>`module.exports.${s} = typeof ${s} !== 'undefined' ? ${s} : module.exports.${s};`).join(`
3644
+ `),O0=Z.params??{},F0=[],v0=[];for(let s=0;s<a.length;s++){if(a[s]==="params")continue;F0.push(a[s]),v0.push(J0[s])}let b0=await Function(...x2,...u,...F0,`return (async () => {
3645
3645
  ${C}
3646
3646
  ${n}
3647
3647
  return module.exports
3648
- })()`)(q,W,B,j,_,L,O,T,F,w,R,D,M,k,A,I,S,E,b,N.setResponseStatus,N.setResponseHeader,N.notFound,y,P,f,d,g,Q0,e0,k0,C0,V,X0,H0,I0,E0,m0,p,i,K0,G0,N0,K5,C5,P5,P0.confirm,P0.alert,P0.fetch,O0,...m,...v0);if(J.preserveExisting){for(let[s,l0]of Object.entries(b0))if(!(s in Z)||Z[s]===void 0)Z[s]=l0}else Object.assign(Z,b0);for(let[s,l0]of Object.entries(j))if(!(s in Z))Z[s]=l0}catch(C){let v=C instanceof Error?C.message:String(C);if(Fq(v))console.warn(`[stx] server <script> in ${X??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(Lq(v))console.warn(`[stx] server <script> in ${X??"<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(W5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${X??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await Tq(G,Z,X)}catch(r){if(W5.env.STX_DEBUG){let a=r instanceof Error?r.message:String(r);console.warn(`[stx] fallback extraction also failed in ${X??"<unknown>"}: ${a}`)}}}}function Rq($){let Z=0,X=null,J=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G===X){if(X=null,J||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){X=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return X===null&&Z===0&&Y}var Dq=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function S2($,Z){let X=Z?t0.dirname(Z):W5.cwd(),J=W5.cwd(),Y=$.split(`
3649
- `),Q=[],G=0;while(G<Y.length){let q=Y[G].trim();if(q.startsWith("interface ")||q.startsWith("export interface ")||q.startsWith("type ")||q.startsWith("export type ")){if(q.includes("{")&&!q.includes("}")){let W=0;for(;G<Y.length;G++){for(let K of Y[G])if(K==="{")W++;else if(K==="}")W--;if(W<=0)break}}G++;continue}if(q.startsWith("definePageMeta(")){let W=0,K=!1,U=G;for(let B=G;B<Y.length&&!K;B++){let j=null,_=!1,L=Y[B];for(let V=0;V<L.length;V++){let O=L[V];if(_){_=!1;continue}if(O==="\\"){_=!0;continue}if(j){if(O===j)j=null;continue}if(O==='"'||O==="'"||O==="`"){j=O;continue}if(O==="(")W++;else if(O===")"){if(W--,W===0){G=B+1,K=!0;break}}}}if(!K)G=Y.length;let z=Y.slice(U,G).join(`
3650
- `),H=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(j)H.push(`${B}: ${JSON.stringify(j[2])}`)}if(H.length>0)Q.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(q.startsWith("import ")||q==="import"||q.startsWith("import{")){let W=q,K=0;while(!Rq(W)&&G+K+1<Y.length)K++,W=`${W} ${Y[G+K].trim()}`;G+=K;let U=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=W.match(/^import\s+['"](.+?)['"]/),B=W,j=(_)=>{if(_.startsWith("."))return t0.resolve(X,_);if(_.startsWith("~/")||_.startsWith("@/"))return t0.resolve(J,_.slice(2));return _};if(U){let[,_,L]=U,V=j(L);Q.push(`const ${_} = (await import('${V}')).default`),Q.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,L]=z,V=j(L),O=[],F=[],w=_q.has(L);for(let R of _.split(",")){let D=R.trim();if(!D)continue;let M=D.split(/\s+as\s+/);if(M.length===2){let[k,N]=[M[0].trim(),M[1].trim()];if(w&&N2.has(k)){Q.push(`const ${N} = ${k};`);continue}O.push(`${k}: ${N}`),F.push(N)}else{if(w&&N2.has(D))continue;O.push(D),F.push(D)}}if(O.length>0)Q.push(`const { ${O.join(", ")} } = await import('${V}')`);for(let R of F)Q.push(`module.exports.${R} = ${R};`)}else if(H){let _=j(H[1]);Q.push(`await import('${_}')`)}else Q.push(B);G++;continue}if(Dq.test(q))Q.push(Y[G]),G++;else if(q.startsWith("export const ")||q.startsWith("export let ")||q.startsWith("export var ")){let W=k2(Y,G),{type:K,name:U,value:z}=W;Q.push(`${K} ${U} = ${z};`),Q.push(`module.exports.${U} = ${U};`),G=W.nextIndex}else if(q.startsWith("export function ")||q.startsWith("export async function ")){let W=c4(Y,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(q.startsWith("const ")||q.startsWith("let ")||q.startsWith("var ")){let W=k2(Y,G),{type:K,name:U,value:z}=W;Q.push(`${K} ${U} = ${z};`),Q.push(`module.exports.${U} = ${U};`),G=W.nextIndex}else if(q.startsWith("function ")||q.startsWith("async function ")){let W=c4(Y,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(q.startsWith("export default function ")||q.startsWith("export default async function ")){let W=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),K=[...Y];K[G]=W;let U=c4(K,G);if(Q.push(U.functionCode),U.name)Q.push(`module.exports.default = ${U.name};`);G=U.nextIndex}else if(q.startsWith("export default ")){let W=q.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${W};`),G++}else if(q.startsWith("class ")||q.startsWith("export class ")){let W=q.match(/(?:export\s+)?class\s+(\w+)/);if(W){let K=W[1],U=Y[G].replace(/^export\s+/,""),z=0,H=G;for(;H<Y.length;H++){let B=Y[H];for(let j of B)if(j==="{")z++;else if(j==="}")z--;if(H>G)U+=`
3651
- `+B;if(z<=0&&H>=G)break}Q.push(U),Q.push(`module.exports.${K} = ${K};`),G=H+1}else Q.push(q),G++}else if(q.includes("module.exports"))Q.push(q),G++;else if(q.trim()&&!q.startsWith("//"))Q.push(q),G++;else G++}return Nq(Q.join(`
3652
- `),X,J)}function Nq($,Z,X){let J=$.length,Y="",Q=0,G=null,q=!1,W=!1,K=0;while(Q<J){let U=$[Q],z=$[Q+1];if(q){if(Y+=U,U===`
3653
- `)q=!1;Q++;continue}if(W){if(Y+=U,U==="*"&&z==="/"){Y+=z,Q+=2,W=!1;continue}Q++;continue}if(!G&&U==="/"&&z==="/"){q=!0,Y+=U,Q++;continue}if(!G&&U==="/"&&z==="*"){W=!0,Y+=U,Q++;continue}if(G){if(Y+=U,U==="\\"){Y+=z,Q+=2;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(U==="$"&&z==="{"){K++,Y+=z,Q+=2;continue}if(U==="`"){G=null,Q++;continue}}Q++;continue}if(K>0){if(U==="{")K++;else if(U==="}")K--}if(U==='"'||U==="'"||U==="`"){G=U,Y+=U,Q++;continue}if(U==="a"&&$.startsWith("await",Q)){let H=Mq($,Q);if(H){let{quote:B,path:j,end:_}=H;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let L=j.startsWith(".")?t0.resolve(Z,j):t0.resolve(X,j.slice(2));Y+=`await import(${B}${L}${B})`,Q=_;continue}}}Y+=U,Q++}return Y}function Mq($,Z){let X=Z+5;if(X>=$.length)return null;if(!/\s/.test($[X]))return null;while(X<$.length&&/\s/.test($[X]))X++;if(!$.startsWith("import",X))return null;X+=6;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;X++;while(X<$.length&&/\s/.test($[X]))X++;let J=$[X];if(J!=="'"&&J!=='"')return null;X++;let Y=X;while(X<$.length&&$[X]!==J)if($[X]==="\\")X+=2;else X++;if(X>=$.length)return null;let Q=$.slice(Y,X);X++;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!==")")return null;return{quote:J,path:Q,end:X+1}}function C2($,Z){let X=$[Z];if(X!=="{"&&X!=="[")return null;let Y=j0($,X,X==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function P2($){let Z=[],X=$.slice(1,-1).trim();if(!X)return Z;let J=0,Y=0,Q="";while(J<X.length){let G=X[J];if(G==="{"||G==="["){let q=Y===0?C2(X,J):null;if(q){Z.push(...P2(q.pattern)),J=q.endPos,Q="";continue}Y++}else if(G==="}"||G==="]")Y--;if(Y>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<X.length&&X[J]!==","&&Y===0){if(X[J]==="{"||X[J]==="[")Y++;else if(X[J]==="}"||X[J]==="]")Y--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function Aq($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let X=Z[0].length,J=(Y)=>Y===" "||Y==="\t";while(X<$.length&&J($[X]))X++;if($[X]===":"){let Y=0,Q=null;X++;for(;X<$.length;X++){let G=$[X];if(Q){if(G==="\\"){X++;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 q=$[X+1],W=$[X-1];if(q!=="="&&q!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if($[X]!=="=")return null}while(X<$.length&&J($[X]))X++;if($[X]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(X+1).trim()}}function A2($,Z,X,J){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)J++;else if(G===X)J--}return J}function k2($,Z){let X=$[Z].trim(),J=Aq(X),Y=J?[X,J.type,J.name,J.value]:null;if(!Y){let U=X.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let z=X.slice(U[0].length),H=Z;if(z.startsWith("{")||z.startsWith("[")){let j=z[0],_=j==="{"?"}":"]",L=A2(z,j,_,0),V=z;for(let O=Z+1;O<$.length&&L>0;O++)V+=` ${$[O].trim()}`,H=O,L=A2($[O],j,_,L);if(L>0)V=z,H=Z;z=V}let B=C2(z,0);if(B){let j=U[1],_=B.pattern,L=z.slice(B.endPos).trim();if(L.startsWith("=")){let V=L.slice(1).trim(),O=V,F=Math.max(H,Z);if(I2(V)){let M=T2($,F,V);O=M.value,F=M.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let w=P2(_),R=`__stx_src_${Z}`,D=w.map((M)=>`module.exports.${M} = ${M};`).join(`
3648
+ })()`)(q,W,B,j,_,F,O,T,L,w,R,D,M,k,A,I,S,E,b,N.setResponseStatus,N.setResponseHeader,N.notFound,y,P,f,d,g,Q0,e0,k0,C0,V,X0,H0,I0,E0,m0,p,i,U0,G0,N0,W5,C5,P5,P0.confirm,P0.alert,P0.fetch,O0,...m,...v0);if(J.preserveExisting){for(let[s,l0]of Object.entries(b0))if(!(s in Z)||Z[s]===void 0)Z[s]=l0}else Object.assign(Z,b0);for(let[s,l0]of Object.entries(j))if(!(s in Z))Z[s]=l0}catch(C){let v=C instanceof Error?C.message:String(C);if(kq(v))console.warn(`[stx] server <script> in ${X??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(Iq(v))console.warn(`[stx] server <script> in ${X??"<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(q5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${X??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await fq(G,Z,X)}catch(r){if(q5.env.STX_DEBUG){let a=r instanceof Error?r.message:String(r);console.warn(`[stx] fallback extraction also failed in ${X??"<unknown>"}: ${a}`)}}}}function Eq($){let Z=0,X=null,J=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G===X){if(X=null,J||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){X=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return X===null&&Z===0&&Y}var bq=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function g2($,Z){let X=Z?t0.dirname(Z):q5.cwd(),J=q5.cwd(),Y=$.split(`
3649
+ `),Q=[],G=0;while(G<Y.length){let q=Y[G].trim();if(q.startsWith("interface ")||q.startsWith("export interface ")||q.startsWith("type ")||q.startsWith("export type ")){if(q.includes("{")&&!q.includes("}")){let W=0;for(;G<Y.length;G++){for(let U of Y[G])if(U==="{")W++;else if(U==="}")W--;if(W<=0)break}}G++;continue}if(q.startsWith("definePageMeta(")){let W=0,U=!1,z=G;for(let B=G;B<Y.length&&!U;B++){let j=null,_=!1,F=Y[B];for(let V=0;V<F.length;V++){let O=F[V];if(_){_=!1;continue}if(O==="\\"){_=!0;continue}if(j){if(O===j)j=null;continue}if(O==='"'||O==="'"||O==="`"){j=O;continue}if(O==="(")W++;else if(O===")"){if(W--,W===0){G=B+1,U=!0;break}}}}if(!U)G=Y.length;let K=Y.slice(z,G).join(`
3650
+ `),H=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(K);if(j)H.push(`${B}: ${JSON.stringify(j[2])}`)}if(H.length>0)Q.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(q.startsWith("import ")||q==="import"||q.startsWith("import{")){let W=q,U=0;while(!Eq(W)&&G+U+1<Y.length)U++,W=`${W} ${Y[G+U].trim()}`;G+=U;let z=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),K=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=W.match(/^import\s+['"](.+?)['"]/),B=W,j=(_)=>{if(_.startsWith("."))return t0.resolve(X,_);if(_.startsWith("~/")||_.startsWith("@/"))return t0.resolve(J,_.slice(2));return _};if(z){let[,_,F]=z,V=j(F);Q.push(`const ${_} = (await import('${V}')).default`),Q.push(`module.exports.${_} = ${_};`)}else if(K){let[,_,F]=K,V=j(F),O=[],L=[],w=Nq.has(F);for(let R of _.split(",")){let D=R.trim();if(!D)continue;let M=D.split(/\s+as\s+/);if(M.length===2){let[k,N]=[M[0].trim(),M[1].trim()];if(w&&E2.has(k)){Q.push(`const ${N} = ${k};`);continue}O.push(`${k}: ${N}`),L.push(N)}else{if(w&&E2.has(D))continue;O.push(D),L.push(D)}}if(O.length>0)Q.push(`const { ${O.join(", ")} } = await import('${V}')`);for(let R of L)Q.push(`module.exports.${R} = ${R};`)}else if(H){let _=j(H[1]);Q.push(`await import('${_}')`)}else Q.push(B);G++;continue}if(bq.test(q))Q.push(Y[G]),G++;else if(q.startsWith("export const ")||q.startsWith("export let ")||q.startsWith("export var ")){let W=S2(Y,G),{type:U,name:z,value:K}=W;Q.push(`${U} ${z} = ${K};`),Q.push(`module.exports.${z} = ${z};`),G=W.nextIndex}else if(q.startsWith("export function ")||q.startsWith("export async function ")){let W=i4(Y,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(q.startsWith("const ")||q.startsWith("let ")||q.startsWith("var ")){let W=S2(Y,G),{type:U,name:z,value:K}=W;Q.push(`${U} ${z} = ${K};`),Q.push(`module.exports.${z} = ${z};`),G=W.nextIndex}else if(q.startsWith("function ")||q.startsWith("async function ")){let W=i4(Y,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(q.startsWith("export default function ")||q.startsWith("export default async function ")){let W=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),U=[...Y];U[G]=W;let z=i4(U,G);if(Q.push(z.functionCode),z.name)Q.push(`module.exports.default = ${z.name};`);G=z.nextIndex}else if(q.startsWith("export default ")){let W=q.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${W};`),G++}else if(q.startsWith("class ")||q.startsWith("export class ")){let W=q.match(/(?:export\s+)?class\s+(\w+)/);if(W){let U=W[1],z=Y[G].replace(/^export\s+/,""),K=0,H=G;for(;H<Y.length;H++){let B=Y[H];for(let j of B)if(j==="{")K++;else if(j==="}")K--;if(H>G)z+=`
3651
+ `+B;if(K<=0&&H>=G)break}Q.push(z),Q.push(`module.exports.${U} = ${U};`),G=H+1}else Q.push(q),G++}else if(q.includes("module.exports"))Q.push(q),G++;else if(q.trim()&&!q.startsWith("//"))Q.push(q),G++;else G++}return yq(Q.join(`
3652
+ `),X,J)}function yq($,Z,X){let J=$.length,Y="",Q=0,G=null,q=!1,W=!1,U=0;while(Q<J){let z=$[Q],K=$[Q+1];if(q){if(Y+=z,z===`
3653
+ `)q=!1;Q++;continue}if(W){if(Y+=z,z==="*"&&K==="/"){Y+=K,Q+=2,W=!1;continue}Q++;continue}if(!G&&z==="/"&&K==="/"){q=!0,Y+=z,Q++;continue}if(!G&&z==="/"&&K==="*"){W=!0,Y+=z,Q++;continue}if(G){if(Y+=z,z==="\\"){Y+=K,Q+=2;continue}if(z===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(z==="$"&&K==="{"){U++,Y+=K,Q+=2;continue}if(z==="`"){G=null,Q++;continue}}Q++;continue}if(U>0){if(z==="{")U++;else if(z==="}")U--}if(z==='"'||z==="'"||z==="`"){G=z,Y+=z,Q++;continue}if(z==="a"&&$.startsWith("await",Q)){let H=Sq($,Q);if(H){let{quote:B,path:j,end:_}=H;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let F=j.startsWith(".")?t0.resolve(Z,j):t0.resolve(X,j.slice(2));Y+=`await import(${B}${F}${B})`,Q=_;continue}}}Y+=z,Q++}return Y}function Sq($,Z){let X=Z+5;if(X>=$.length)return null;if(!/\s/.test($[X]))return null;while(X<$.length&&/\s/.test($[X]))X++;if(!$.startsWith("import",X))return null;X+=6;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;X++;while(X<$.length&&/\s/.test($[X]))X++;let J=$[X];if(J!=="'"&&J!=='"')return null;X++;let Y=X;while(X<$.length&&$[X]!==J)if($[X]==="\\")X+=2;else X++;if(X>=$.length)return null;let Q=$.slice(Y,X);X++;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!==")")return null;return{quote:J,path:Q,end:X+1}}function h2($,Z){let X=$[Z];if(X!=="{"&&X!=="[")return null;let Y=j0($,X,X==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function u2($){let Z=[],X=$.slice(1,-1).trim();if(!X)return Z;let J=0,Y=0,Q="";while(J<X.length){let G=X[J];if(G==="{"||G==="["){let q=Y===0?h2(X,J):null;if(q){Z.push(...u2(q.pattern)),J=q.endPos,Q="";continue}Y++}else if(G==="}"||G==="]")Y--;if(Y>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<X.length&&X[J]!==","&&Y===0){if(X[J]==="{"||X[J]==="[")Y++;else if(X[J]==="}"||X[J]==="]")Y--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function Cq($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let X=Z[0].length,J=(Y)=>Y===" "||Y==="\t";while(X<$.length&&J($[X]))X++;if($[X]===":"){let Y=0,Q=null;X++;for(;X<$.length;X++){let G=$[X];if(Q){if(G==="\\"){X++;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 q=$[X+1],W=$[X-1];if(q!=="="&&q!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if($[X]!=="=")return null}while(X<$.length&&J($[X]))X++;if($[X]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(X+1).trim()}}function y2($,Z,X,J){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)J++;else if(G===X)J--}return J}function S2($,Z){let X=$[Z].trim(),J=Cq(X),Y=J?[X,J.type,J.name,J.value]:null;if(!Y){let z=X.match(/^(?:export\s+)?(const|let|var)\s+/);if(z){let K=X.slice(z[0].length),H=Z;if(K.startsWith("{")||K.startsWith("[")){let j=K[0],_=j==="{"?"}":"]",F=y2(K,j,_,0),V=K;for(let O=Z+1;O<$.length&&F>0;O++)V+=` ${$[O].trim()}`,H=O,F=y2($[O],j,_,F);if(F>0)V=K,H=Z;K=V}let B=h2(K,0);if(B){let j=z[1],_=B.pattern,F=K.slice(B.endPos).trim();if(F.startsWith("=")){let V=F.slice(1).trim(),O=V,L=Math.max(H,Z);if(C2(V)){let M=P2($,L,V);O=M.value,L=M.nextIndex}else L=L+1;O=O.trim().replace(/;$/,"");let w=u2(_),R=`__stx_src_${Z}`,D=w.map((M)=>`module.exports.${M} = ${M};`).join(`
3654
3654
  `);return{type:j,name:R,value:`${O}; ${j} ${_} = ${R};
3655
- ${D}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${X}`)}let[,Q,G,q]=Y,W=q,K=Z;if(I2(q)){let U=T2($,Z,q);W=U.value,K=U.nextIndex}else K=Z+1;while(K<$.length){let U=$[K].trim();if(U.startsWith(".")||U.startsWith("?."))W+=`
3656
- ${$[K]}`,K++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:K}}function c4($,Z){let X=$[Z].trim(),J=X.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${X}`);let[,Y]=J,Q=X.replace(/^export\s+/,""),G=Z;if(kq(X)){let q=Iq($,Z,Q);Q=q.functionCode,G=q.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function I2($){let Z=$.trim();if(Z.startsWith("{"))return j0(Z,"{","}",0)===-1;if(Z.startsWith("["))return j0(Z,"[","]",0)===-1;return!v2(Z)}function v2($){let Z={paren:0,bracket:0,brace:0},X=null,J=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&X)continue;if((Q==='"'||Q==="'")&&!X){X=Q;continue}if(Q===X&&X!=="`"){X=null;continue}if(Q==="`"&&!X){X="`";continue}if(Q==="`"&&X==="`"&&J===0){X=null;continue}if(X==="`"&&Q==="$"&&$[Y+1]==="{"){J++,Y++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(X)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&&X===null}function f2($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let X=j0($,"(",")",Z);if(X===-1)return-1;return $.indexOf("{",X)}function kq($){let Z=f2($);if(Z===-1)return!0;return j0($,"{","}",Z)===-1}function T2($,Z,X){let J=X,Y=Z+1;while(Y<$.length&&!v2(J)){let Q=$[Y];J+=`
3655
+ ${D}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${X}`)}let[,Q,G,q]=Y,W=q,U=Z;if(C2(q)){let z=P2($,Z,q);W=z.value,U=z.nextIndex}else U=Z+1;while(U<$.length){let z=$[U].trim();if(z.startsWith(".")||z.startsWith("?."))W+=`
3656
+ ${$[U]}`,U++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:U}}function i4($,Z){let X=$[Z].trim(),J=X.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${X}`);let[,Y]=J,Q=X.replace(/^export\s+/,""),G=Z;if(Pq(X)){let q=vq($,Z,Q);Q=q.functionCode,G=q.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function C2($){let Z=$.trim();if(Z.startsWith("{"))return j0(Z,"{","}",0)===-1;if(Z.startsWith("["))return j0(Z,"[","]",0)===-1;return!d2(Z)}function d2($){let Z={paren:0,bracket:0,brace:0},X=null,J=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&X)continue;if((Q==='"'||Q==="'")&&!X){X=Q;continue}if(Q===X&&X!=="`"){X=null;continue}if(Q==="`"&&!X){X="`";continue}if(Q==="`"&&X==="`"&&J===0){X=null;continue}if(X==="`"&&Q==="$"&&$[Y+1]==="{"){J++,Y++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(X)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&&X===null}function m2($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let X=j0($,"(",")",Z);if(X===-1)return-1;return $.indexOf("{",X)}function Pq($){let Z=m2($);if(Z===-1)return!0;return j0($,"{","}",Z)===-1}function P2($,Z,X){let J=X,Y=Z+1;while(Y<$.length&&!d2(J)){let Q=$[Y];J+=`
3657
3657
  ${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
3658
- ${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function Iq($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=f2(J);if(Q!==-1){if(j0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
3659
- ${G}`,Y++}return{functionCode:J,nextIndex:Y}}function E2($,Z){let X=e($,Z)??e(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...W5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function Tq($,Z,X){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,q]=Q;try{let W=q.trim().replace(/;$/,""),K=E2(W,Z);if(K!==void 0)Z[G]=K}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}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,q]=Q;if(!(G in Z))try{let W=q.trim().replace(/;$/,""),K=E2(W,Z);if(K!==void 0)Z[G]=K}catch{}}}function Eq($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:J}}function bq($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var y5=new p1(500),g$=new p1(1000),d2=33554432,n4=d2;function Sq($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===n4)return;n4=Z,h$.setMaxBytes(Z)}var h$=new p1(2000,{maxBytes:d2,sizeOf:($)=>$.output.length});function Cq($){let Z=new WeakSet;try{let X=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(X);let Y={};for(let Q of Object.keys(J).sort())Y[Q]=X(J[Q]);return Y};return JSON.stringify(X($))}catch{return null}}function x2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function M1($){return!Pq($)}var x$=new Map;function p4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=x$.get(Z);if(X)return X;if(x$.size>=16)x$.clear();let J=new Bun.Transpiler($);return x$.set(Z,J),J}function A1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let X=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`});let Y=p4({loader:"ts",target:"browser",define:Y5()}).transformSync(Z);for(let Q=0;Q<X.length;Q++)Y=Y.replace(`"__STX_EXPR_${Q}__"`,X[Q]),Y=Y.replace(`'__STX_EXPR_${Q}__'`,X[Q]);return Y}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function vq($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(U)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===U){Y++;return}Y++}},q=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let U=1;while(Y<Q&&U>0)if($[Y]==="{")U++,Y++;else if($[Y]==="}")U--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")q();else Y++;continue}Y++}},W=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
3660
- `)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(J!==0)return;let U=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let j=U[2].split(",").map((_)=>{let L=_.trim().split(":");return L[L.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(W())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))K();Y++}return Z}function fq($){let Z=[],X=0,J=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==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function xq($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function gq($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let W of fq(q)){let K=W.trim();if(!K||K.startsWith("..."))continue;let U=xq(K);if(U===-1)continue;let z=K.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let H=K.slice(U+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[z]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function C$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=X.__importedComponents;if(W){for(let L of[Q,Q.toLowerCase(),G(Q),q(Q)])if(W.has(L))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],U=typeof Y.root==="string"?h.resolve(Y.root):void 0,z=U??h.dirname(J),H=[],B=(L)=>{if(L&&!H.includes(L))H.push(L)},j=X.__originalFilePath;if(j)B(h.join(h.dirname(j),"components"));if(B(Z),B(Y._rootComponentsDir),B(h.join(h.dirname(J),"components")),B(Y.componentsDir),U)B(h.resolve(U,"resources/views/components")),B(h.resolve(U,"resources/components")),B(h.resolve(U,"src/components")),B(h.resolve(U,"components"));let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let L of _)B(typeof L==="string"?L:null);if(B(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return t(h.resolve(h.dirname(J),`${Q}.stx`));for(let L of H){let V=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of K)if(await t(h.join(V,O)))return!0}return!1}function hq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function uq($){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 dq($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function I1($,Z,X,J,Y,Q,G,q=new Set,W){let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-f0f8pne1.js")),U=q??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=H&&H!=="load"&&hq(H)?H:"";try{let j=(u)=>u.split("-").map((m)=>m.charAt(0).toUpperCase()+m.slice(1)).join(""),_=(u)=>u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=Y.__importedComponents;if(O){let u=[L,L.toLowerCase(),j(L),_(L)];for(let m of u)if(O.has(m)){V=O.get(m);break}}let F=[];if(!V){let u=[`${L}.stx`,`${j(L)}.stx`,`${_(L)}.stx`],m=[...new Set(u)],U0=Y.__originalFilePath,n=[];if(U0){let L0=h.join(h.dirname(U0),"components");n.push(L0)}if(J)n.push(J);let O0=G._rootComponentsDir;if(typeof O0==="string"&&!n.includes(O0))n.push(O0);let F0=h.join(h.dirname(Q),"components");if(!n.includes(F0))n.push(F0);if(G.componentsDir&&G.componentsDir!==J&&!n.includes(G.componentsDir))n.push(G.componentsDir);let v0=typeof G.root==="string"?h.resolve(G.root):void 0,V1=v0??h.dirname(Q),b0=[];if(v0)b0.push(h.resolve(v0,"resources/views/components")),b0.push(h.resolve(v0,"resources/components")),b0.push(h.resolve(v0,"src/components")),b0.push(h.resolve(v0,"components"));b0.push(h.resolve(import.meta.dir,"components"));for(let L0 of b0)if(!n.includes(L0))n.push(L0);let s=G._pluginComponentDirs;if(Array.isArray(s)){for(let L0 of s)if(typeof L0==="string"&&!n.includes(L0))n.push(L0)}if(G.fallbackComponentsDir&&!n.includes(G.fallbackComponentsDir))n.push(G.fallbackComponentsDir);let l0=[...new Set(n.map((L0)=>{if(!L0)return L0;return h.isAbsolute(L0)?L0:h.resolve(V1,L0)}))];n.length=0,n.push(...l0);let v5=`${L}\x00${Q}\x00${l0.join("\x00")}`,u$=g$.get(v5);if(u$)if(await t(u$))V=u$;else g$.delete(v5);if(!V&&(L.startsWith("./")||L.startsWith("../")))V=h.resolve(h.dirname(Q),`${L}.stx`),F.push(V);else if(!V)for(let L0 of n){if(!L0)continue;for(let f5 of m){let x5=h.join(L0,f5);if(F.push(x5),await t(x5)){V=x5;break}}if(V)break;if(!V)try{let f5=await import("fs");if(!f5.statSync(L0,{throwIfNoEntry:!1})?.isDirectory())continue;let a2=8,d$=[{path:L0,depth:0}];while(d$.length>0&&!V){let g5=d$.pop();if(g5.depth>=a2)continue;let a4;try{a4=f5.readdirSync(g5.path,{withFileTypes:!0})}catch{continue}for(let h5 of a4){if(!h5.isDirectory())continue;if(h5.name==="node_modules"||h5.name.startsWith("."))continue;let t4=h.join(g5.path,h5.name);for(let t2 of m){let m$=h.join(t4,t2);if(F.push(m$),await t(m$)){V=m$;break}}if(V)break;d$.push({path:t4,depth:g5.depth+1})}}}catch{}if(V)break}if(V)g$.set(v5,V)}if(!V||!await t(V)){let u=F.length>0?`
3658
+ ${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function vq($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=m2(J);if(Q!==-1){if(j0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
3659
+ ${G}`,Y++}return{functionCode:J,nextIndex:Y}}function v2($,Z){let X=e($,Z)??e(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...q5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function fq($,Z,X){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,q]=Q;try{let W=q.trim().replace(/;$/,""),U=v2(W,Z);if(U!==void 0)Z[G]=U}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}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,q]=Q;if(!(G in Z))try{let W=q.trim().replace(/;$/,""),U=v2(W,Z);if(U!==void 0)Z[G]=U}catch{}}}function xq($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:J}}function gq($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var y5=new p1(500),g$=new p1(1000),n2=33554432,o4=n2;function uq($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===o4)return;o4=Z,h$.setMaxBytes(Z)}var h$=new p1(2000,{maxBytes:n2,sizeOf:($)=>$.output.length});function dq($){let Z=new WeakSet;try{let X=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(X);let Y={};for(let Q of Object.keys(J).sort())Y[Q]=X(J[Q]);return Y};return JSON.stringify(X($))}catch{return null}}function l2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function M1($){return!mq($)}var x$=new Map;function n4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=x$.get(Z);if(X)return X;if(x$.size>=16)x$.clear();let J=new Bun.Transpiler($);return x$.set(Z,J),J}function A1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let X=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`});let Y=n4({loader:"ts",target:"browser",define:Y5()}).transformSync(Z);for(let Q=0;Q<X.length;Q++)Y=Y.replace(`"__STX_EXPR_${Q}__"`,X[Q]),Y=Y.replace(`'__STX_EXPR_${Q}__'`,X[Q]);return Y}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function lq($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(z)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===z){Y++;return}Y++}},q=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let z=1;while(Y<Q&&z>0)if($[Y]==="{")z++,Y++;else if($[Y]==="}")z--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")q();else Y++;continue}Y++}},W=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
3660
+ `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},U=()=>{if(J!==0)return;let z=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((_)=>{let F=_.trim().split(":");return F[F.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let K=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let j=K[2];if(!X.has(j))Z.push(j),X.add(j);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let j=H[1];if(!X.has(j))Z.push(j),X.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Z.push(j),X.add(j)}};while(Y<Q){if(W())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){q();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))U();Y++}return Z}function cq($){let Z=[],X=0,J=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==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function pq($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function iq($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let W of cq(q)){let U=W.trim();if(!U||U.startsWith("..."))continue;let z=pq(U);if(z===-1)continue;let K=U.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if(Z[K]!==void 0)continue;let H=U.slice(z+1).trim();if(!H)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${H});`);Z[K]=j(...B.map((_)=>Z[_]))}catch{}}}catch{}}async function C$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(F)=>F.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),q=(F)=>F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=X.__importedComponents;if(W){for(let F of[Q,Q.toLowerCase(),G(Q),q(Q)])if(W.has(F))return!0}let U=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],z=typeof Y.root==="string"?h.resolve(Y.root):void 0,K=z??h.dirname(J),H=[],B=(F)=>{if(F&&!H.includes(F))H.push(F)},j=X.__originalFilePath;if(j)B(h.join(h.dirname(j),"components"));if(B(Z),B(Y._rootComponentsDir),B(h.join(h.dirname(J),"components")),B(Y.componentsDir),z)B(h.resolve(z,"resources/views/components")),B(h.resolve(z,"resources/components")),B(h.resolve(z,"src/components")),B(h.resolve(z,"components"));let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let F of _)B(typeof F==="string"?F:null);if(B(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return t(h.resolve(h.dirname(J),`${Q}.stx`));for(let F of H){let V=h.isAbsolute(F)?F:h.resolve(K,F);for(let O of U)if(await t(h.join(V,O)))return!0}return!1}function nq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function sq($){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 oq($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function I1($,Z,X,J,Y,Q,G,q=new Set,W){let{extractVariables:U}=await o("stx/variable-extractor",()=>import("./chunk-rvmt27kv.js")),z=q??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let K=new Set(z);K.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=H&&H!=="load"&&nq(H)?H:"";try{let j=(u)=>u.split("-").map((m)=>m.charAt(0).toUpperCase()+m.slice(1)).join(""),_=(u)=>u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),F=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=Y.__importedComponents;if(O){let u=[F,F.toLowerCase(),j(F),_(F)];for(let m of u)if(O.has(m)){V=O.get(m);break}}let L=[];if(!V){let u=[`${F}.stx`,`${j(F)}.stx`,`${_(F)}.stx`],m=[...new Set(u)],z0=Y.__originalFilePath,n=[];if(z0){let L0=h.join(h.dirname(z0),"components");n.push(L0)}if(J)n.push(J);let O0=G._rootComponentsDir;if(typeof O0==="string"&&!n.includes(O0))n.push(O0);let F0=h.join(h.dirname(Q),"components");if(!n.includes(F0))n.push(F0);if(G.componentsDir&&G.componentsDir!==J&&!n.includes(G.componentsDir))n.push(G.componentsDir);let v0=typeof G.root==="string"?h.resolve(G.root):void 0,V1=v0??h.dirname(Q),b0=[];if(v0)b0.push(h.resolve(v0,"resources/views/components")),b0.push(h.resolve(v0,"resources/components")),b0.push(h.resolve(v0,"src/components")),b0.push(h.resolve(v0,"components"));b0.push(h.resolve(import.meta.dir,"components"));for(let L0 of b0)if(!n.includes(L0))n.push(L0);let s=G._pluginComponentDirs;if(Array.isArray(s)){for(let L0 of s)if(typeof L0==="string"&&!n.includes(L0))n.push(L0)}if(G.fallbackComponentsDir&&!n.includes(G.fallbackComponentsDir))n.push(G.fallbackComponentsDir);let l0=[...new Set(n.map((L0)=>{if(!L0)return L0;return h.isAbsolute(L0)?L0:h.resolve(V1,L0)}))];n.length=0,n.push(...l0);let v5=`${F}\x00${Q}\x00${l0.join("\x00")}`,u$=g$.get(v5);if(u$)if(await t(u$))V=u$;else g$.delete(v5);if(!V&&(F.startsWith("./")||F.startsWith("../")))V=h.resolve(h.dirname(Q),`${F}.stx`),L.push(V);else if(!V)for(let L0 of n){if(!L0)continue;for(let f5 of m){let x5=h.join(L0,f5);if(L.push(x5),await t(x5)){V=x5;break}}if(V)break;if(!V)try{let f5=await import("fs");if(!f5.statSync(L0,{throwIfNoEntry:!1})?.isDirectory())continue;let JZ=8,d$=[{path:L0,depth:0}];while(d$.length>0&&!V){let g5=d$.pop();if(g5.depth>=JZ)continue;let e4;try{e4=f5.readdirSync(g5.path,{withFileTypes:!0})}catch{continue}for(let h5 of e4){if(!h5.isDirectory())continue;if(h5.name==="node_modules"||h5.name.startsWith("."))continue;let $7=h.join(g5.path,h5.name);for(let YZ of m){let m$=h.join($7,YZ);if(L.push(m$),await t(m$)){V=m$;break}}if(V)break;d$.push({path:$7,depth:g5.depth+1})}}}catch{}if(V)break}if(V)g$.set(v5,V)}if(!V||!await t(V)){let u=L.length>0?`
3661
3661
  Searched paths:
3662
- ${F.map((m)=>` - ${m}`).join(`
3663
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${u}`}W.add(V);let w;if(y5.has(V))w=y5.get(V);else try{w=await Bun.file(V).text(),y5.set(V,w)}catch(u){return`[Error loading component: ${u instanceof Error?u.message:String(u)}]`}let R=new Set(["__originalFilePath","__importedComponents",u5,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[u,m]of Object.entries(Y))if(!u.startsWith("__")||R.has(u))D[u]=m;let M=X;if(X.includes("@include")){let{processIncludes:u}=await o("stx/includes",()=>import("./chunk-q0ctxav6.js"));M=await u(X,Y,Q,G,W)}let k=r0(M),N=[],A=k.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(u,m)=>{let U0=k.scripts[Number(m)]||"",n=U0.match(/^<script\b([^>]*)>/i)?.[1]||"",O0=n.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),F0=!O0||["module","text/javascript","application/javascript"].includes(O0);if(!/\bserver\b/i.test(n)&&F0)return N.push(U0),"";return U0}),{extractSlotContent:T}=await o("stx/slots",()=>import("./chunk-083kj0ge.js")),I=T(A),S={};if(I.defaultSlot?.trim())S.default=I.defaultSlot;for(let[u,m]of I.namedSlots)S[u]=m.content;let E=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,y={...D,$uid:b,...Z,props:Z,slot:A,$slots:S,__processedComponents:z,__sections:{},__stx_signals_gate:G1(w)||uq(X)};gq(w,y);let P=w,f=V$(P);if(f)P=f.content.trim();let d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g=[...w.matchAll(d)],Q0=[],e0=g.some((u)=>/\bserver\b/.test(u[1]||"")&&/\bcache\b/.test(u[1]||"")),k0=null,C0=null,X0=null,H0=0,I0=null;if(Sq(G),e0&&n4>0){let u=Cq({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,uid:b});if(u!==null){k0=`${V}\x00${b1(w)}\x00${u}`;let m=h$.get(k0);if(m){for(let U0 of m.dependencies)W.add(U0);if(U7(Y,m.clientFactories),E.n+=m.uidsConsumed,m.preservedClientExpressions.length>0){let U0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let n of m.preservedClientExpressions)U0.add(n);Y.__stx_preserved_client_expressions=[...U0]}return m.output}C0=new Set(W),X0=W7(Y),H0=E.n,I0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let u of g){let m=u[1]||"",U0=u[2]||"",n=m.includes("server");if(M1(m)&&U0.trim())U0=A1(U0);if(n&&U0)try{await K(U0,y,V)}catch(F0){}if(!n){let F0=U0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),v0=F0.includes("{{")&&F0.includes("}}"),V1=F0.includes("{!!")&&F0.includes("!!}");if(v0||V1)F0=s$(F0,y);let b0=m.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Q0.push(`<script${b0}>${F0}</script>`)}}let E0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),m0=E0?E0[1]:"",p=E0?E0[2]:"",i="",K0=m0&&/\bscoped\b/i.test(m0);if(E0)i=`<style${m0}>${p}</style>`;let G0=P;if(G0=G0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E0)G0=G0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let u=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,m=[];if(G0=G0.replace(u,(U0,n)=>{let O0=n.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(O0)m.push(`<style${O0[1]}>${O0[2]}</style>`);return""}),G0=G0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),m.length>0)i=`${i}${m.join(`
3664
- `)}`}if(X&&G0.includes("{{ text || slot }}"))G0=G0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:N0}=await o("stx/slots",()=>import("./chunk-083kj0ge.js")),{defaultSlot:P0,namedSlots:K5}=I;G0=await N0(G0,P0,K5,y);let C5=Q0.some((u)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(u)),P5=dq(Q0),C=Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[];if(P5.length>0||C.length>0)y.__stx_client_signal_names=[...new Set([...C,...P5])];let v={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:C5||Q0.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let r=await l4(G0,y,V,v,W),a=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let u of r.matchAll(/\{\{([\s\S]*?)\}\}/g))a.add(u[1].trim());if(a.size>0)Y.__stx_preserved_client_expressions=[...a];let J0=b,Y0=r;if(C5){let u="";if(Object.keys(Z).length>0)try{u=` data-stx-props="${x2(JSON.stringify(Z))}"`}catch{}let m=B?` stx-hydrate="${x2(B)}"`:"";Y0=`<div data-stx-scope="${J0}"${u}${m}>${r}</div>`;let U0=await Promise.all(Q0.map(async(n)=>{let O0=n.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!O0)return n;let[,F0,v0]=O0,{vendorStyleTags:V1,factoryBody:b0}=await cq(v0,V,G.buildMode==="compile"),s=B?null:p$(Y,b0),l0=s?`window.__stxComponentFactories[${JSON.stringify(s)}](${JSON.stringify(J0)});`:`(${b0})(${JSON.stringify(J0)});`;if(B)return`${V1}<script type="stx/island" data-stx-island="${J0}" data-stx-scoped${F0}>${l0}</script>`;return`${V1}<script data-stx-scoped data-stx-run="always"${F0}>${l0}</script>`}));if(Y0=Y0+`
3665
- `+U0.join(`
3662
+ ${L.map((m)=>` - ${m}`).join(`
3663
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${u}`}W.add(V);let w;if(y5.has(V))w=y5.get(V);else try{w=await Bun.file(V).text(),y5.set(V,w)}catch(u){return`[Error loading component: ${u instanceof Error?u.message:String(u)}]`}let R=new Set(["__originalFilePath","__importedComponents",u5,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[u,m]of Object.entries(Y))if(!u.startsWith("__")||R.has(u))D[u]=m;let M=X;if(X.includes("@include")){let{processIncludes:u}=await o("stx/includes",()=>import("./chunk-xen25bsv.js"));M=await u(X,Y,Q,G,W)}let k=r0(M),N=[],A=k.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(u,m)=>{let z0=k.scripts[Number(m)]||"",n=z0.match(/^<script\b([^>]*)>/i)?.[1]||"",O0=n.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),F0=!O0||["module","text/javascript","application/javascript"].includes(O0);if(!/\bserver\b/i.test(n)&&F0)return N.push(z0),"";return z0}),{extractSlotContent:T}=await o("stx/slots",()=>import("./chunk-k7m8p93y.js")),I=T(A),S={};if(I.defaultSlot?.trim())S.default=I.defaultSlot;for(let[u,m]of I.namedSlots)S[u]=m.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}`,y={...D,$uid:b,...Z,props:Z,slot:A,$slots:S,__processedComponents:K,__sections:{},__stx_signals_gate:G1(w)||sq(X)};iq(w,y);let P=w,f=V$(P);if(f)P=f.content.trim();let d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g=[...w.matchAll(d)],Q0=[],e0=g.some((u)=>/\bserver\b/.test(u[1]||"")&&/\bcache\b/.test(u[1]||"")),k0=null,C0=null,X0=null,H0=0,I0=null;if(uq(G),e0&&o4>0){let u=dq({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,uid:b});if(u!==null){k0=`${V}\x00${b1(w)}\x00${u}`;let m=h$.get(k0);if(m){for(let z0 of m.dependencies)W.add(z0);if(H7(Y,m.clientFactories),E.n+=m.uidsConsumed,m.preservedClientExpressions.length>0){let z0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let n of m.preservedClientExpressions)z0.add(n);Y.__stx_preserved_client_expressions=[...z0]}return m.output}C0=new Set(W),X0=z7(Y),H0=E.n,I0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let u of g){let m=u[1]||"",z0=u[2]||"",n=m.includes("server");if(M1(m)&&z0.trim())z0=A1(z0);if(n&&z0)try{await U(z0,y,V)}catch(F0){}if(!n){let F0=z0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),v0=F0.includes("{{")&&F0.includes("}}"),V1=F0.includes("{!!")&&F0.includes("!!}");if(v0||V1)F0=s$(F0,y);let b0=m.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Q0.push(`<script${b0}>${F0}</script>`)}}let E0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),m0=E0?E0[1]:"",p=E0?E0[2]:"",i="",U0=m0&&/\bscoped\b/i.test(m0);if(E0)i=`<style${m0}>${p}</style>`;let G0=P;if(G0=G0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E0)G0=G0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let u=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,m=[];if(G0=G0.replace(u,(z0,n)=>{let O0=n.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(O0)m.push(`<style${O0[1]}>${O0[2]}</style>`);return""}),G0=G0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),m.length>0)i=`${i}${m.join(`
3664
+ `)}`}if(X&&G0.includes("{{ text || slot }}"))G0=G0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:N0}=await o("stx/slots",()=>import("./chunk-k7m8p93y.js")),{defaultSlot:P0,namedSlots:W5}=I;G0=await N0(G0,P0,W5,y);let C5=Q0.some((u)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(u)),P5=oq(Q0),C=Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[];if(P5.length>0||C.length>0)y.__stx_client_signal_names=[...new Set([...C,...P5])];let v={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:C5||Q0.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let r=await p4(G0,y,V,v,W),a=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let u of r.matchAll(/\{\{([\s\S]*?)\}\}/g))a.add(u[1].trim());if(a.size>0)Y.__stx_preserved_client_expressions=[...a];let J0=b,Y0=r;if(C5){let u="";if(Object.keys(Z).length>0)try{u=` data-stx-props="${l2(JSON.stringify(Z))}"`}catch{}let m=B?` stx-hydrate="${l2(B)}"`:"";Y0=`<div data-stx-scope="${J0}"${u}${m}>${r}</div>`;let z0=await Promise.all(Q0.map(async(n)=>{let O0=n.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!O0)return n;let[,F0,v0]=O0,{vendorStyleTags:V1,factoryBody:b0}=await tq(v0,V,G.buildMode==="compile"),s=B?null:p$(Y,b0),l0=s?`window.__stxComponentFactories[${JSON.stringify(s)}](${JSON.stringify(J0)});`:`(${b0})(${JSON.stringify(J0)});`;if(B)return`${V1}<script type="stx/island" data-stx-island="${J0}" data-stx-scoped${F0}>${l0}</script>`;return`${V1}<script data-stx-scoped data-stx-run="always"${F0}>${l0}</script>`}));if(Y0=Y0+`
3665
+ `+z0.join(`
3666
3666
  `),i)Y0+=`
3667
3667
  `+i}else{if(i)Y0+=`
3668
- `+i;if(Q0.length>0){let u=y.__stx_event_bindings||[],m=v$(y),U0=await Promise.all(Q0.map(async(n)=>{let O0=n.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!O0)return n;return await f$(O0[1],{eventBindings:u,templateContent:Y0,filePath:V,projectRoot:process.cwd(),serverData:m})}));Y0+=`
3669
- `+U0.join(`
3670
- `),y.__stx_event_bindings=[]}}if(K0){let u=R$(Y0,V);if(u.hasScoped)Y0=u.html}if(k0&&C0){let u=Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[];h$.set(k0,{output:Y0,dependencies:[...W].filter((m)=>!C0.has(m)),clientFactories:X0?K7(Y,X0):[],uidsConsumed:E.n-H0,preservedClientExpressions:I0?u.filter((m)=>!I0.has(m)):[]})}return N.length>0?`${Y0}
3668
+ `+i;if(Q0.length>0){let u=y.__stx_event_bindings||[],m=v$(y),z0=await Promise.all(Q0.map(async(n)=>{let O0=n.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!O0)return n;return await f$(O0[1],{eventBindings:u,templateContent:Y0,filePath:V,projectRoot:process.cwd(),serverData:m})}));Y0+=`
3669
+ `+z0.join(`
3670
+ `),y.__stx_event_bindings=[]}}if(U0){let u=R$(Y0,V);if(u.hasScoped)Y0=u.html}if(k0&&C0){let u=Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[];h$.set(k0,{output:Y0,dependencies:[...W].filter((m)=>!C0.has(m)),clientFactories:X0?K7(Y,X0):[],uidsConsumed:E.n-H0,preservedClientExpressions:I0?u.filter((m)=>!I0.has(m)):[]})}return N.length>0?`${Y0}
3671
3671
  ${N.join(`
3672
- `)}`:Y0}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{U.delete($)}}async function t($){return Bun.file($).exists()}function s4($,Z){let X=h.resolve(Z),J=h.resolve($),Y=X.endsWith(h.sep)?X:X+h.sep;if(J===X||J.startsWith(Y))return J;return null}async function mq($,Z,X,J){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=h.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await t(G)){if(J)console.log(`Found layout in ${$}: ${G}`);return X?.add(G),G}return null}async function q$($,Z,X,J){let Y=await lq($,Z,X,J);if(Y===null)return null;let Q=s4(Y,process.cwd());if(Q)return Q;let G=[X.root,X.layoutsDir,X.fallbackLayoutsDir,X.componentsDir,X.partialsDir,X.pagesDir].filter((q)=>typeof q==="string"&&q.length>0);for(let q of G){let W=h.isAbsolute(q)?q:h.resolve(process.cwd(),q);if(s4(Y,W))return h.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function lq($,Z,X,J){if(X.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let H=h.join(Q,$),B=s4(H,Q);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(X.debug)console.log(`Checking absolute path: ${B}`);if(await t(B)&&J)J.add(B);return B}let G=h.join(Y,$);if(await t(G)){if(X.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let H of[".stx",".tsx",".jsx"]){let B=`${G}${H}`;if(await t(B)){if(X.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let q=[];if(X.layoutsDir)q.push(h.isAbsolute(X.layoutsDir)?X.layoutsDir:h.resolve(process.cwd(),X.layoutsDir));let W=h.resolve(Y),K=process.cwd();for(let H=0;H<10;H++){let B=h.join(W,"layouts"),j=!1;try{j=yq.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){q.push(B);break}let _=h.dirname(W);if(_===W||_.length<K.length)break;W=_}for(let H of q){let B=await mq(H,$,J,X.debug);if(B)return B}if(X.fallbackLayoutsDir){let H=h.isAbsolute(X.fallbackLayoutsDir)?X.fallbackLayoutsDir:h.resolve(process.cwd(),X.fallbackLayoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=[h.join(H,B)];if(!$.endsWith(".stx"))j.push(`${j[0]}.stx`);for(let _ of j)if(await t(_)){if(X.debug)console.log(`Found in options.fallbackLayoutsDir: ${_}`);if(J)J.add(_);return _}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),B=h.join(X.partialsDir||Y,"layouts",H[1]);if(await t(B)){if(X.debug)console.log(`Found in layouts path: ${B}`);if(J)J.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await t(j)){if(X.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(X.partialsDir){let H=h.join(X.partialsDir,"layouts");if(await t(H)){let B=h.join(H,$);if(await t(B)){if(X.debug)console.log(`Found in partials layouts dir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await t(j)){if(X.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}}let U=X.partialsDir||h.join(process.cwd(),"views"),z=h.join(U,$);if(await t(z)){if(X.debug)console.log(`Found in views path: ${z}`);if(J)J.add(z);return z}if(!$.endsWith(".stx")){let H=`${z}.stx`;if(await t(H)){if(X.debug)console.log(`Found in views path with extension: ${H}`);if(J)J.add(H);return H}}if(Y.includes("temp")){let H=h.join(h.dirname(Y),"layouts",$);if(await t(H)){if(X.debug)console.log(`Found in temp layouts dir: ${H}`);if(J)J.add(H);return H}if(!$.endsWith(".stx")){let B=`${H}.stx`;if(await t(B)){if(X.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(X.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 m2($,Z,X){let J=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
3673
- `),q=0;for(let W=0;W<G.length;W++)if(q+=G[W].length+1,q>=Z){J=W+1,Y=G[W].trim();let K=Math.max(0,W-2),U=Math.min(G.length,W+3);Q=G.slice(K,U).map((z,H)=>{let B=K+H+1;return`${B===J?"> ":" "}${B}: ${z}`}).join(`
3674
- `);break}}else if(X){let G=$.indexOf(X);if(G>=0)return m2($,G)}}catch{}return{lineNumber:J,lineContent:Y,context:Q}}var Z0={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 B0($,Z,X,J,Y,Q){let{lineNumber:G,context:q}=m2(J,Y,Q),W=X.split("/").pop(),K=0;if(typeof Y==="number"&&Y>=0&&J){let z=J.lastIndexOf(`
3675
- `,Math.max(0,Y-1));K=Y-(z+1)+1}let U="";if(G>0)U+=`
3676
- ${X}:${G}${K>0?`:${K}`:""}: ${$.toLowerCase()} error: ${Z}
3677
- `;if(U+=`
3672
+ `)}`:Y0}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{z.delete($)}}async function t($){return Bun.file($).exists()}function r4($,Z){let X=h.resolve(Z),J=h.resolve($),Y=X.endsWith(h.sep)?X:X+h.sep;if(J===X||J.startsWith(Y))return J;return null}async function rq($,Z,X,J){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=h.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await t(G)){if(J)console.log(`Found layout in ${$}: ${G}`);return X?.add(G),G}return null}async function q$($,Z,X,J){let Y=await aq($,Z,X,J);if(Y===null)return null;let Q=r4(Y,process.cwd());if(Q)return Q;let G=[X.root,X.layoutsDir,X.fallbackLayoutsDir,X.componentsDir,X.partialsDir,X.pagesDir].filter((q)=>typeof q==="string"&&q.length>0);for(let q of G){let W=h.isAbsolute(q)?q:h.resolve(process.cwd(),q);if(r4(Y,W))return h.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function aq($,Z,X,J){if(X.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let H=h.join(Q,$),B=r4(H,Q);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(X.debug)console.log(`Checking absolute path: ${B}`);if(await t(B)&&J)J.add(B);return B}let G=h.join(Y,$);if(await t(G)){if(X.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let H of[".stx",".tsx",".jsx"]){let B=`${G}${H}`;if(await t(B)){if(X.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let q=[];if(X.layoutsDir)q.push(h.isAbsolute(X.layoutsDir)?X.layoutsDir:h.resolve(process.cwd(),X.layoutsDir));let W=h.resolve(Y),U=process.cwd();for(let H=0;H<10;H++){let B=h.join(W,"layouts"),j=!1;try{j=hq.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){q.push(B);break}let _=h.dirname(W);if(_===W||_.length<U.length)break;W=_}for(let H of q){let B=await rq(H,$,J,X.debug);if(B)return B}if(X.fallbackLayoutsDir){let H=h.isAbsolute(X.fallbackLayoutsDir)?X.fallbackLayoutsDir:h.resolve(process.cwd(),X.fallbackLayoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=[h.join(H,B)];if(!$.endsWith(".stx"))j.push(`${j[0]}.stx`);for(let _ of j)if(await t(_)){if(X.debug)console.log(`Found in options.fallbackLayoutsDir: ${_}`);if(J)J.add(_);return _}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),B=h.join(X.partialsDir||Y,"layouts",H[1]);if(await t(B)){if(X.debug)console.log(`Found in layouts path: ${B}`);if(J)J.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await t(j)){if(X.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(X.partialsDir){let H=h.join(X.partialsDir,"layouts");if(await t(H)){let B=h.join(H,$);if(await t(B)){if(X.debug)console.log(`Found in partials layouts dir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await t(j)){if(X.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}}let z=X.partialsDir||h.join(process.cwd(),"views"),K=h.join(z,$);if(await t(K)){if(X.debug)console.log(`Found in views path: ${K}`);if(J)J.add(K);return K}if(!$.endsWith(".stx")){let H=`${K}.stx`;if(await t(H)){if(X.debug)console.log(`Found in views path with extension: ${H}`);if(J)J.add(H);return H}}if(Y.includes("temp")){let H=h.join(h.dirname(Y),"layouts",$);if(await t(H)){if(X.debug)console.log(`Found in temp layouts dir: ${H}`);if(J)J.add(H);return H}if(!$.endsWith(".stx")){let B=`${H}.stx`;if(await t(B)){if(X.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(X.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 s2($,Z,X){let J=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
3673
+ `),q=0;for(let W=0;W<G.length;W++)if(q+=G[W].length+1,q>=Z){J=W+1,Y=G[W].trim();let U=Math.max(0,W-2),z=Math.min(G.length,W+3);Q=G.slice(U,z).map((K,H)=>{let B=U+H+1;return`${B===J?"> ":" "}${B}: ${K}`}).join(`
3674
+ `);break}}else if(X){let G=$.indexOf(X);if(G>=0)return s2($,G)}}catch{}return{lineNumber:J,lineContent:Y,context:Q}}var Z0={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 B0($,Z,X,J,Y,Q){let{lineNumber:G,context:q}=s2(J,Y,Q),W=X.split("/").pop(),U=0;if(typeof Y==="number"&&Y>=0&&J){let K=J.lastIndexOf(`
3675
+ `,Math.max(0,Y-1));U=Y-(K+1)+1}let z="";if(G>0)z+=`
3676
+ ${X}:${G}${U>0?`:${U}`:""}: ${$.toLowerCase()} error: ${Z}
3677
+ `;if(z+=`
3678
3678
  ${Z0.bold}${Z0.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Z0.reset}
3679
- `,U+=`${Z0.bold}${Z0.red}\u2502${Z0.reset} ${Z0.bold}${Z0.bgRed} ERROR ${Z0.reset} ${Z0.red}${$} Error${Z0.reset}${" ".repeat(Math.max(0,43-$.length))}${Z0.bold}${Z0.red}\u2502${Z0.reset}
3680
- `,U+=`${Z0.bold}${Z0.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Z0.reset}
3681
- `,U+=`
3682
- ${Z0.cyan}${Z0.bold}File:${Z0.reset} ${Z0.dim}${W}${Z0.reset}`,G>0)U+=` ${Z0.gray}(line ${G}${K>0?`, col ${K}`:""})${Z0.reset}`;if(U+=`
3679
+ `,z+=`${Z0.bold}${Z0.red}\u2502${Z0.reset} ${Z0.bold}${Z0.bgRed} ERROR ${Z0.reset} ${Z0.red}${$} Error${Z0.reset}${" ".repeat(Math.max(0,43-$.length))}${Z0.bold}${Z0.red}\u2502${Z0.reset}
3680
+ `,z+=`${Z0.bold}${Z0.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Z0.reset}
3681
+ `,z+=`
3682
+ ${Z0.cyan}${Z0.bold}File:${Z0.reset} ${Z0.dim}${W}${Z0.reset}`,G>0)z+=` ${Z0.gray}(line ${G}${U>0?`, col ${U}`:""})${Z0.reset}`;if(z+=`
3683
3683
  ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
3684
- `,q)U+=`
3684
+ `,q)z+=`
3685
3685
  ${Z0.blue}${Z0.bold}Context:${Z0.reset}
3686
3686
  ${Z0.dim}${q}${Z0.reset}
3687
- `;return U}function FO(){y5.clear(),g$.clear(),h$.clear()}function LO(){return{size:y5.size,maxSize:500}}var i4=G5(128);async function cq($,Z,X){let J=b1($,Z,X),Y=i4.get(J);if(Y){if(u2(Y.deps))return Y;i4.delete(J)}let Q=o4($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,q=r4(Q.styles);G=r1(G).code;let{hasUserImports:W,bundleClientScript:K}=await o("stx/client-script-bundler",()=>import("./chunk-s0v2g53x.js")),U=[],z=!1;if(W(G)){let V=G;G=await K(V,Z,{projectRoot:process.cwd(),minify:X,collectInputs:U}),z=G===V}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-3cqwrprg.js"));G=H(G);let B=$1(G),j=vq(B),_=`function(__scopeId) {
3688
- ${c1("const",[...g2,...j],B)}
3687
+ `;return z}function kO(){y5.clear(),g$.clear(),h$.clear()}function IO(){return{size:y5.size,maxSize:500}}var s4=G5(128);async function tq($,Z,X){let J=b1($,Z,X),Y=s4.get(J);if(Y){if(i2(Y.deps))return Y;s4.delete(J)}let Q=a4($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,q=t4(Q.styles);G=r1(G).code;let{hasUserImports:W,bundleClientScript:U}=await o("stx/client-script-bundler",()=>import("./chunk-hysmnz0q.js")),z=[],K=!1;if(W(G)){let V=G;G=await U(V,Z,{projectRoot:process.cwd(),minify:X,collectInputs:z}),K=G===V}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-edctags2.js"));G=H(G);let B=$1(G),j=lq(B),_=`function(__scopeId) {
3688
+ ${c1("const",[...c2,...j],B)}
3689
3689
  const __scope = window.stx._scopes = window.stx._scopes || {};
3690
3690
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
3691
3691
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -3713,18 +3713,18 @@ catch (e) {}
3713
3713
  finally {
3714
3714
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
3715
3715
  }
3716
- }`,L={vendorStyleTags:q,factoryBody:_,deps:h2([...U,...Q.styles.map((V)=>V.resolvedPath)])};if(!z&&Q.unresolved.length===0)i4.set(J,L);return L}var pq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function iq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let X=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!X)return null;return{pkg:X[1],subpath:X[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function nq($,Z){let X=Z;while(!0){let J=S1.join(X,"node_modules",$,"package.json");if(S5.existsSync(J))return S1.dirname(J);let Y=S1.dirname(X);if(Y===X)return null;X=Y}}function sq($,Z){if(!$||typeof $!=="object")return null;let X=(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 X(Y.import);if(typeof Y.default==="object")return X(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return X($[Z]);let J=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),q=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(q))continue;if(Z.length<G.length+q.length)continue;if(!J||G.length>J.prefix.length)J={pattern:Y,prefix:G,suffix:q}}if(J){let Y=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=X($[J.pattern]);if(Q)return Q.replace("*",Y)}return null}function oq($,Z){let X=iq($);if(!X||!X.subpath)return null;let J=nq(X.pkg,Z);if(!J)return null;let Y;try{Y=JSON.parse(S5.readFileSync(S1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${X.subpath}`,G=sq(Y.exports,Q);if(!G)return null;let q=S1.resolve(J,G);return S5.existsSync(q)?q:null}function o4($,Z){let X=Z.filePath?S1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),Y=new Set,Q=[],G=[];return{code:$.replace(pq,(W,K)=>{let U;try{if(K.startsWith("./")||K.startsWith("../")||K.startsWith("/")){if(U=K.startsWith("/")?K:S1.resolve(X,K),!S5.existsSync(U))throw Error(`file not found: ${U}`)}else{let z=null;try{z=Bun.resolveSync(K,J)}catch{z=oq(K,J)}if(!z)throw Error(`could not resolve ${K} (Bun.resolveSync + exports fallback both failed)`);U=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(K)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),G.push(K),""}if(Y.has(U))return"";Y.add(U);try{let z=S5.readFileSync(U,"utf8");Q.push({source:K,resolvedPath:U,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${U}: ${z?.message||z}`),G.push(K)}return""}),styles:Q,unresolved:G}}function rq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function r4($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${rq(Z.source)}" data-stx-layer="vendor">
3716
+ }`,F={vendorStyleTags:q,factoryBody:_,deps:p2([...z,...Q.styles.map((V)=>V.resolvedPath)])};if(!K&&Q.unresolved.length===0)s4.set(J,F);return F}var eq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function $W($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let X=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!X)return null;return{pkg:X[1],subpath:X[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function ZW($,Z){let X=Z;while(!0){let J=S1.join(X,"node_modules",$,"package.json");if(S5.existsSync(J))return S1.dirname(J);let Y=S1.dirname(X);if(Y===X)return null;X=Y}}function XW($,Z){if(!$||typeof $!=="object")return null;let X=(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 X(Y.import);if(typeof Y.default==="object")return X(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return X($[Z]);let J=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),q=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(q))continue;if(Z.length<G.length+q.length)continue;if(!J||G.length>J.prefix.length)J={pattern:Y,prefix:G,suffix:q}}if(J){let Y=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=X($[J.pattern]);if(Q)return Q.replace("*",Y)}return null}function JW($,Z){let X=$W($);if(!X||!X.subpath)return null;let J=ZW(X.pkg,Z);if(!J)return null;let Y;try{Y=JSON.parse(S5.readFileSync(S1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${X.subpath}`,G=XW(Y.exports,Q);if(!G)return null;let q=S1.resolve(J,G);return S5.existsSync(q)?q:null}function a4($,Z){let X=Z.filePath?S1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),Y=new Set,Q=[],G=[];return{code:$.replace(eq,(W,U)=>{let z;try{if(U.startsWith("./")||U.startsWith("../")||U.startsWith("/")){if(z=U.startsWith("/")?U:S1.resolve(X,U),!S5.existsSync(z))throw Error(`file not found: ${z}`)}else{let K=null;try{K=Bun.resolveSync(U,J)}catch{K=JW(U,J)}if(!K)throw Error(`could not resolve ${U} (Bun.resolveSync + exports fallback both failed)`);z=K}}catch(K){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(U)} (from ${Z.filePath||"<unknown>"}): ${K?.message||K}`),G.push(U),""}if(Y.has(z))return"";Y.add(z);try{let K=S5.readFileSync(z,"utf8");Q.push({source:U,resolvedPath:z,contents:K})}catch(K){console.warn(`[stx:vendor-css] could not read ${z}: ${K?.message||K}`),G.push(U)}return""}),styles:Q,unresolved:G}}function YW($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t4($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${YW(Z.source)}" data-stx-layer="vendor">
3717
3717
  @layer vendor {
3718
3718
  ${Z.contents}
3719
3719
  }
3720
3720
  </style>`}).join(`
3721
3721
  `)}
3722
- `}var aq=i2;function r1($){let Z=c0($),X=new Set;for(let q of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let W of q[1].split(",")){let K=W.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(K)X.add(K)}let J=new Set;for(let q of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(q[1]);for(let q of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let W of q[1].split(",")){let K=W.trim().split(/[:=]/).pop()?.trim();if(K)J.add(K)}let Y=k5.filter((q)=>{if(X.has(q)||J.has(q))return!1;return new RegExp(`\\b${q}\\s*\\(`).test(Z)}),Q=s2(Z).filter((q)=>!X.has(q)&&!J.has(q));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(`
3722
+ `}var QW=t2;function r1($){let Z=c0($),X=new Set;for(let q of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let W of q[1].split(",")){let U=W.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(U)X.add(U)}let J=new Set;for(let q of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(q[1]);for(let q of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let W of q[1].split(",")){let U=W.trim().split(/[:=]/).pop()?.trim();if(U)J.add(U)}let Y=k5.filter((q)=>{if(X.has(q)||J.has(q))return!1;return new RegExp(`\\b${q}\\s*\\(`).test(Z)}),Q=$Z(Z).filter((q)=>!X.has(q)&&!J.has(q));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(`
3723
3723
  `)}
3724
- ${$}`,imports:Y,models:Q}}var tq=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 s2($){let Z=new Set,X=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=X.exec($))!==null)if(!tq.has(J[1]))Z.add(J[1]);return Array.from(Z)}function eq($){let Z=new Set;for(let X of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(X[1]);for(let X of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of X[1].split(",")){let Y=J.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function o2($){let Z=new Set,X=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Y=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let z=G[1],H=G[2];if(G[0].includes("import type"))continue;let B=[];for(let _ of z.split(",")){let L=_.trim();if(!L||L.startsWith("type "))continue;let V=L.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!V)continue;let O=V[1],F=V[2]||O;if(Y.add(O),Y.add(F),H==="stx"||H==="@stacksjs/stx")Z.add(O);else X.add(O);if(F!==O)B.push(`${F} = ${O}`)}let j=B.length>0?`var ${B.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(G[0],j)}let q=eq(J);for(let z of aq){if(Y.has(z)||q.has(z))continue;if(new RegExp(`\\b${z}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))Z.add(z)}let W=c0(J),K=new Set;for(let z of J.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let H of z[1].split(",")){let B=H.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let j of B){let _=j.trim();if(_)K.add(_)}}for(let z of k5){if(Y.has(z)||q.has(z)||K.has(z))continue;if(new RegExp(`\\b${z}\\b`,"g").test(W))X.add(z)}let U=s2(J);for(let z of U)if(!Y.has(z)&&!q.has(z))X.add(z);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(X)}}function r2($,Z){let X=[];if($.length>0)X.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)X.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(X.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
3724
+ ${$}`,imports:Y,models:Q}}var GW=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 $Z($){let Z=new Set,X=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=X.exec($))!==null)if(!GW.has(J[1]))Z.add(J[1]);return Array.from(Z)}function qW($){let Z=new Set;for(let X of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(X[1]);for(let X of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of X[1].split(",")){let Y=J.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function ZZ($){let Z=new Set,X=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Y=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let K=G[1],H=G[2];if(G[0].includes("import type"))continue;let B=[];for(let _ of K.split(",")){let F=_.trim();if(!F||F.startsWith("type "))continue;let V=F.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!V)continue;let O=V[1],L=V[2]||O;if(Y.add(O),Y.add(L),H==="stx"||H==="@stacksjs/stx")Z.add(O);else X.add(O);if(L!==O)B.push(`${L} = ${O}`)}let j=B.length>0?`var ${B.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(G[0],j)}let q=qW(J);for(let K of QW){if(Y.has(K)||q.has(K))continue;if(new RegExp(`\\b${K}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))Z.add(K)}let W=c0(J),U=new Set;for(let K of J.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let H of K[1].split(",")){let B=H.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let j of B){let _=j.trim();if(_)U.add(_)}}for(let K of k5){if(Y.has(K)||q.has(K)||U.has(K))continue;if(new RegExp(`\\b${K}\\b`,"g").test(W))X.add(K)}let z=$Z(J);for(let K of z)if(!Y.has(K)&&!q.has(K))X.add(K);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(X)}}function XZ($,Z){let X=[];if($.length>0)X.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)X.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(X.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
3725
3725
  ${X.join(`
3726
3726
  `)}
3727
- ${$W($,Z)}`;return""}function vO($,Z=[]){let{browserImports:X}=o2($),J=new Set(Z);return r2([],X.filter((Y)=>!J.has(Y)))}function $W($,Z){let X=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(X.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
3727
+ ${WW($,Z)}`;return""}function lO($,Z=[]){let{browserImports:X}=ZZ($),J=new Set(Z);return XZ([],X.filter((Y)=>!J.has(Y)))}function WW($,Z){let X=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(X.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
3728
3728
  [${X.join(", ")}].forEach(function (e) {
3729
3729
  if (e[1] !== 'undefined') return;
3730
3730
  console.error(
@@ -3733,15 +3733,15 @@ ${$W($,Z)}`;return""}function vO($,Z=[]){let{browserImports:X}=o2($),J=new Set(Z
3733
3733
  + 'or it should be imported from a relative path so the bundler includes it.'
3734
3734
  );
3735
3735
  });
3736
- `}function v$($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let J={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;J[Y]=Q}return J.__stxDeclaredPayload=!0,J}let X={};for(let J in $){if(J.startsWith("__")||J.startsWith("$"))continue;let Y=$[J];if(typeof Y==="function")continue;X[J]=Y}return X}function l2($,Z){let X=new Set;for(let J of $.split(",")){let Y=J.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))X.add(Y)}return X}function ZW($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l2(X[1],!0).has(Z))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l2(X[1],!1).has(Z))return!0;return!1}function XW($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var JW=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,c2=new Set;function YW($,Z){let X=JW.test($),J=Z.length>32768;if(!X&&!J)return;if(c2.has($))return;if(c2.add($),X)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(J)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 O4($,Z){if(!Z)return"";let X=c0($),J=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(!J&&!XW(X,Q))continue;if(ZW($,Q))continue;let q;try{q=JSON.stringify(G)}catch{continue}if(q===void 0)continue;YW(Q,q),Y.push(` var ${Q} = ${q.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3736
+ `}function v$($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let J={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;J[Y]=Q}return J.__stxDeclaredPayload=!0,J}let X={};for(let J in $){if(J.startsWith("__")||J.startsWith("$"))continue;let Y=$[J];if(typeof Y==="function")continue;X[J]=Y}return X}function o2($,Z){let X=new Set;for(let J of $.split(",")){let Y=J.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))X.add(Y)}return X}function UW($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(o2(X[1],!0).has(Z))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(o2(X[1],!1).has(Z))return!0;return!1}function zW($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var KW=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,r2=new Set;function HW($,Z){let X=KW.test($),J=Z.length>32768;if(!X&&!J)return;if(r2.has($))return;if(r2.add($),X)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(J)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 L4($,Z){if(!Z)return"";let X=c0($),J=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(!J&&!zW(X,Q))continue;if(UW($,Q))continue;let q;try{q=JSON.stringify(G)}catch{continue}if(q===void 0)continue;HW(Q,q),Y.push(` var ${Q} = ${q.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3737
3737
  ${Y.join(`
3738
3738
  `)}
3739
- `}var QW={left:0,middle:1,right:2};function GW($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let X of $.systemKeys)Z.push(`if (!$event.${X}Key) return`);if($.keys.length>0){let X=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${X})) return`)}if($.mouse!==null){let X=QW[$.mouse];Z.push(`if ($event.button !== ${X}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function qW($,Z){let{elementId:X,event:J,modifiers:Y}=$,Q=l$($.handler),G=GW(Y),q=[];if(Y.once)q.push("once: true");if(Y.capture)q.push("capture: true");if(Y.passive)q.push("passive: true");let W=q.length>0?`, { ${q.join(", ")} }`:"",K="";if(G)K+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
3739
+ `}var BW={left:0,middle:1,right:2};function jW($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let X of $.systemKeys)Z.push(`if (!$event.${X}Key) return`);if($.keys.length>0){let X=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${X})) return`)}if($.mouse!==null){let X=BW[$.mouse];Z.push(`if ($event.button !== ${X}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function _W($,Z){let{elementId:X,event:J,modifiers:Y}=$,Q=l$($.handler),G=jW(Y),q=[];if(Y.once)q.push("once: true");if(Y.capture)q.push("capture: true");if(Y.passive)q.push("passive: true");let W=q.length>0?`, { ${q.join(", ")} }`:"",U="";if(G)U+=`${G}; `;let z=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),K=`var $emit = function(name, detail) {
3740
3740
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
3741
- };`;function H(B){if(/\$emit\s*\(/.test(B))return`${z}
3741
+ };`;function H(B){if(/\$emit\s*\(/.test(B))return`${K}
3742
3742
  ${B}`;return`var scope = $el.closest('[data-stx-scope]');
3743
3743
  if (scope && scope.__stx_execute) {
3744
- scope.__stx_execute('${U}', $event, $el);
3744
+ scope.__stx_execute('${z}', $event, $el);
3745
3745
  }
3746
3746
  else {
3747
3747
  ${B}
@@ -3768,34 +3768,34 @@ else {
3768
3768
  }${W})
3769
3769
  })()`;if(/\$emit\s*\(/.test(Q))return` var $el = document.getElementById('${X}')
3770
3770
  if ($el) $el.addEventListener('${J}', function($event) {
3771
- ${K}${z}
3771
+ ${U}${K}
3772
3772
  ${Q}
3773
3773
  }${W})`;return` var $el = document.getElementById('${X}')
3774
3774
  if ($el) $el.addEventListener('${J}', function($event) {
3775
- ${K}var scope = $el.closest('[data-stx-scope]');
3775
+ ${U}var scope = $el.closest('[data-stx-scope]');
3776
3776
  if (scope && scope.__stx_execute) {
3777
- scope.__stx_execute('${U}', $event, $el);
3777
+ scope.__stx_execute('${z}', $event, $el);
3778
3778
  }
3779
3779
  else {
3780
3780
  ${Q}
3781
3781
  }
3782
- }${W})`}function WW($){if($.length===0)return"";return`
3782
+ }${W})`}function VW($){if($.length===0)return"";return`
3783
3783
  // STX: auto-generated event bindings
3784
- ${$.map((X,J)=>qW(X,J)).join(`
3785
- `)}`}function p2($){let Z=[],X=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=J.length,G=0;while(G<Q){let q=J[G];if(q==="'"||q==='"'||q==="`"){let W=q;if(G++,W==="`"){let K=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&K===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){K++,G+=2;continue}if(J[G]==="}"&&K>0){K--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===W){G++;break}G++}continue}if(q==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
3786
- `)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let W=J.slice(G),K=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}let U=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=U[0].length;continue}let z=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let H=z[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=z[0].length;continue}}G++}return Z}var KW=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 UW($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!KW.has(j))Z.add(j)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);return Z}async function f$($,Z={}){let X=$,J="",Y=!1,Q=[],G=o4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=r4(G.styles),W=r1(X);X=W.code,Q=[...W.imports,...W.models];let{hasUserImports:K,bundleClientScript:U}=await o("stx/client-script-bundler",()=>import("./chunk-s0v2g53x.js"));if(K(X))X=await U(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let O=o2(X);X=O.code,J=r2(O.stxImports,O.browserImports.filter((F)=>!Q.includes(F)))}if(J=`${O4(X,Z.serverData)}${J}`,X=$1(X),!Y&&M1(Z.attrs||""))X=A1(X);let z=WW(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let O=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${q}<script ${F}>
3784
+ ${$.map((X,J)=>_W(X,J)).join(`
3785
+ `)}`}function a2($){let Z=[],X=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=J.length,G=0;while(G<Q){let q=J[G];if(q==="'"||q==='"'||q==="`"){let W=q;if(G++,W==="`"){let U=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&U===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){U++,G+=2;continue}if(J[G]==="}"&&U>0){U--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===W){G++;break}G++}continue}if(q==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
3786
+ `)G++;continue}if(q==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(q==="{"){Y++,G++;continue}if(q==="}"){Y--,G++;continue}if(Y===0){let W=J.slice(G),U=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let H=U[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=U[0].length;continue}let z=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((H)=>{let B=H.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=z[0].length;continue}let K=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}}G++}return Z}var OW=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 FW($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!OW.has(j))Z.add(j)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=U.exec($))!==null)J(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=K.exec($))!==null)J(Q[1]);return Z}async function f$($,Z={}){let X=$,J="",Y=!1,Q=[],G=a4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=t4(G.styles),W=r1(X);X=W.code,Q=[...W.imports,...W.models];let{hasUserImports:U,bundleClientScript:z}=await o("stx/client-script-bundler",()=>import("./chunk-hysmnz0q.js"));if(U(X))X=await z(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let O=ZZ(X);X=O.code,J=XZ(O.stxImports,O.browserImports.filter((L)=>!Q.includes(L)))}if(J=`${L4(X,Z.serverData)}${J}`,X=$1(X),!Y&&M1(Z.attrs||""))X=A1(X);let K=VW(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let O=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${q}<script ${L}>
3787
3787
  ${o1(`${J}${X}
3788
- ${z}`)}
3789
- </script>`}let j=n2($),_=/function __stx_setup_/.test(X),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(O){let F=O.length>0?`
3788
+ ${K}`)}
3789
+ </script>`}let j=e2($),_=/function __stx_setup_/.test(X),F=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(O){let L=O.length>0?`
3790
3790
  return { ${O.join(", ")} };`:"";return`${q}<script data-stx-scoped data-stx-run="always">
3791
3791
  window.stx.mount(function() {
3792
3792
  'use strict';
3793
3793
  ${o1(`${J}${X}
3794
- ${z}${F}`)}
3795
- })</script>`}if(!L&&!_){if(j)return V(p2($));if(Z.templateContent){let O=p2($);if(O.length>0){let F=UW(Z.templateContent);if(O.some((R)=>F.has(R)))return V(O)}}}return`${q}<script data-stx-scoped data-stx-run="always">
3794
+ ${K}${L}`)}
3795
+ })</script>`}if(!F&&!_){if(j)return V(a2($));if(Z.templateContent){let O=a2($);if(O.length>0){let L=FW(Z.templateContent);if(O.some((R)=>L.has(R)))return V(O)}}}return`${q}<script data-stx-scoped data-stx-run="always">
3796
3796
  ;(function() {
3797
3797
  'use strict';
3798
3798
  ${o1(`${J}${X}
3799
- ${z}`)}
3799
+ ${K}`)}
3800
3800
  })()</script>`}
3801
- export{vZ as jl,fZ as kl,xZ as ll,Z1 as ml,a$ as nl,t$ as ol,e$ as pl,$3 as ql,u7 as rl,h7 as sl,pZ as tl,nZ as ul,oZ as vl,sW as wl,oW as xl,rW as yl,aW as zl,tW as Al,CZ as Bl,v7 as Cl,f7 as Dl,x7 as El,g7 as Fl,iW as Gl,r7 as Hl,j5 as Il,l$ as Jl,c$ as Kl,JZ as Ll,Q7 as Ml,HW as Nl,$1 as Ol,jW as Pl,k5 as Ql,Y5 as Rl,A_ as Sl,o4 as Tl,r4 as Ul,aq as Vl,r1 as Wl,o2 as Xl,r2 as Yl,vO as Zl,v$ as _l,O4 as $l,f$ as am,q0 as bm,R0 as cm,l5 as dm,W0 as em,LW as fm,i5 as gm,wW as hm,RW as im,DW as jm,NW as km,Q1 as lm,U5 as mm,s5 as nm,jZ as om,SW as pm,_Z as qm,CW as rm,n$ as sm,A7 as tm,G1 as um,s$ as vm,FZ as wm,PW as xm,O1 as ym,LZ as zm,f0 as Am,vW as Bm,gW as Cm,kZ as Dm,IZ as Em,S7 as Fm,C7 as Gm,P7 as Hm,cW as Im,d7 as Jm,X3 as Km,H5 as Lm,o5 as Mm,XK as Nm,Z3 as Om,tZ as Pm,eZ as Qm,$X as Rm,JK as Sm,l7 as Tm,c7 as Um,U1 as Vm,fX as Wm,xX as Xm,gX as Ym,hX as Zm,w6 as _m,uX as $m,l as an,_3 as bn,O5 as cn,F5 as dn,Z$ as en,mX as fn,X$ as gn,lX as hn,J$ as in,L1 as jn,D6 as kn,w1 as ln,N6 as mn,M6 as nn,Y$ as on,V3 as pn,$0 as qn,oX as rn,rX as sn,aX as tn,h1 as un,O3 as vn,F3 as wn,i0 as xn,L3 as yn,R3 as zn,Q$ as An,eX as Bn,$J as Cn,ZJ as Dn,I6 as En,H$ as Fn,j0 as Gn,p6 as Hn,b3 as In,z1 as Jn,R1 as Kn,i6 as Ln,w5 as Mn,B$ as Nn,y3 as On,bJ as Pn,SJ as Qn,o6 as Rn,PJ as Sn,vJ as Tn,a6 as Un,D1 as Vn,kz as Wn,t6 as Xn,x3 as Yn,uJ as Zn,f3 as _n,dJ as $n,mJ as ao,Iz as bo,Tz as co,e6 as do,$8 as eo,Z8 as fo,lJ as go,cJ as ho,Ez as io,bz as jo,pJ as ko,yz as lo,Sz as mo,Y8 as no,W8 as oo,u3 as po,lz as qo,N5 as ro,d3 as so,m3 as to,cz as uo,qY as vo,pz as wo,WY as xo,z8 as yo,iz as zo,KY as Ao,nz as Bo,sz as Co,s3 as Do,ez as Eo,$H as Fo,ZH as Go,XH as Ho,JH as Io,HY as Jo,YH as Ko,_$ as Lo,BY as Mo,QH as No,GH as Oo,qH as Po,WH as Qo,LY as Ro,RY as So,CY as To,n3 as Uo,_8 as Vo,KH as Wo,V$ as Xo,x9 as Yo,Hj as Zo,Bj as _o,jj as $o,_j as ap,IG as bp,u8 as cp,xG as dp,x4 as ep,_9 as fp,IB as gp,L9 as hp,nQ as ip,oQ as jp,E9 as kp,F4 as lp,b9 as mp,S9 as np,L4 as op,QG as pp,GG as qp,C9 as rp,_4 as sp,qG as tp,KG as up,y2 as vp,Oq as wp,Fq as xp,Lq as yp,wq as zp,Rq as Ap,S2 as Bp,Aq as Cp,Eq as Dp,bq as Ep,T8 as Fp,E8 as Gp,NH as Hp,w8 as Ip,MH as Jp,a3 as Kp,t3 as Lp,e3 as Mp,C8 as Np,P8 as Op,v8 as Pp,E6 as Qp,b6 as Rp,y6 as Sp,S6 as Tp,D3 as Up,N3 as Vp,RU as Wp,DU as Xp,NU as Yp,JJ as Zp,MU as _p,nH as $p,sH as aq,x8 as bq,oH as cq,YQ as dq,m8 as eq,i8 as fq,$9 as gq,R$ as hq,WB as iq,KB as jq,q4 as kq,J9 as lq,Y9 as mq,fQ as nq,zB as oq,HB as pq,Q9 as qq,BB as rq,jB as sq,W4 as tq,W9 as uq,N$ as vq,M$ as wq,s1 as xq,hQ as yq,U9 as zq,z9 as Aq,FB as Bq,K4 as Cq,uQ as Dq,dQ as Eq,U4 as Fq,z4 as Gq,H9 as Hq,B9 as Iq,g4 as Jq,h4 as Kq,m4 as Lq,l4 as Mq,Qq as Nq,Uq as Oq,zq as Pq,Hq as Qq,Bq as Rq,Pq as Sq,M1 as Tq,p4 as Uq,A1 as Vq,C$ as Wq,hq as Xq,uq as Yq,dq as Zq,I1 as _q,t as $q,q$ as ar,m2 as br,B0 as cr,FO as dr,LO as er,a7 as fr,t7 as gr,F1 as hr,e7 as ir,f1 as jr,$6 as kr,_5 as lr,VK as mr,jX as nr,Y3 as or,OK as pr,Q3 as qr,FK as rr,LK as sr,K1 as tr,wK as ur,RK as vr,DK as wr,NK as xr,MK as yr,AK as zr,_X as Ar,q3 as Br,Z6 as Cr,IK as Dr,TK as Er,EK as Fr,bK as Gr,yK as Hr,J6 as Ir,SK as Jr,Y6 as Kr,CK as Lr,PK as Mr,V5 as Nr,RX as Or,gK as Pr,NX as Qr,U6 as Rr,e5 as Sr,cK as Tr,O6 as Ur,j3 as Vr,bU as Wr,A3 as Xr,KJ as Yr,BJ as Zr,yU as _r,SU as $r,CU as as,PU as bs,vU as cs,fU as ds,jJ as es,_J as fs,C6 as gs,m6 as hs,LJ as is,I3 as js,l6 as ks,tU as ls,eU as ms,E3 as ns,AJ as os,c6 as ps};
3801
+ export{dZ as jl,mZ as kl,lZ as ll,Z1 as ml,a$ as nl,t$ as ol,e$ as pl,$3 as ql,m7 as rl,d7 as sl,aZ as tl,eZ as ul,ZX as vl,XU as wl,JU as xl,YU as yl,QU as zl,GU as Al,hZ as Bl,x7 as Cl,g7 as Dl,h7 as El,u7 as Fl,$U as Gl,t7 as Hl,B5 as Il,l$ as Jl,c$ as Kl,UZ as Ll,q7 as Ml,wW as Nl,$1 as Ol,DW as Pl,k5 as Ql,Y5 as Rl,C_ as Sl,a4 as Tl,t4 as Ul,QW as Vl,r1 as Wl,ZZ as Xl,XZ as Yl,lO as Zl,v$ as _l,L4 as $l,f$ as am,q0 as bm,R0 as cm,l5 as dm,W0 as em,IW as fm,i5 as gm,TW as hm,EW as im,bW as jm,yW as km,Q1 as lm,U5 as mm,s5 as nm,wZ as om,uW as pm,RZ as qm,dW as rm,n$ as sm,I7 as tm,G1 as um,s$ as vm,MZ as wm,mW as xm,O1 as ym,AZ as zm,f0 as Am,lW as Bm,iW as Cm,SZ as Dm,CZ as Em,P7 as Fm,v7 as Gm,f7 as Hm,tW as Im,l7 as Jm,X3 as Km,K5 as Lm,o5 as Mm,zU as Nm,Z3 as Om,YX as Pm,QX as Qm,GX as Rm,KU as Sm,p7 as Tm,i7 as Um,z1 as Vm,mX as Wm,lX as Xm,cX as Ym,pX as Zm,D6 as _m,iX as $m,l as an,_3 as bn,V5 as cn,O5 as dn,Z$ as en,sX as fn,X$ as gn,oX as hn,J$ as in,L1 as jn,M6 as kn,w1 as ln,A6 as mn,k6 as nn,Y$ as on,V3 as pn,$0 as qn,ZJ as rn,XJ as sn,JJ as tn,h1 as un,O3 as vn,F3 as wn,i0 as xn,L3 as yn,R3 as zn,Q$ as An,QJ as Bn,GJ as Cn,qJ as Dn,E6 as En,H$ as Fn,j0 as Gn,n6 as Hn,b3 as In,K1 as Jn,R1 as Kn,s6 as Ln,L5 as Mn,B$ as Nn,y3 as On,fJ as Pn,gJ as Qn,a6 as Rn,uJ as Sn,dJ as Tn,e6 as Un,D1 as Vn,PK as Wn,$8 as Xn,x3 as Yn,iJ as Zn,f3 as _n,nJ as $n,sJ as ao,vK as bo,fK as co,Z8 as do,X8 as eo,J8 as fo,oJ as go,rJ as ho,xK as io,gK as jo,aJ as ko,hK as lo,uK as mo,G8 as no,z8 as oo,u3 as po,aK as qo,D5 as ro,d3 as so,m3 as to,tK as uo,BY as vo,eK as wo,jY as xo,B8 as yo,$H as zo,_Y as Ao,ZH as Bo,XH as Co,s3 as Do,qH as Eo,WH as Fo,UH as Go,zH as Ho,KH as Io,FY as Jo,HH as Ko,_$ as Lo,LY as Mo,BH as No,jH as Oo,_H as Po,VH as Qo,AY as Ro,IY as So,hY as To,n3 as Uo,O8 as Vo,OH as Wo,V$ as Xo,g9 as Yo,wj as Zo,Rj as _o,Dj as $o,Nj as ap,PG as bp,m8 as cp,pG as dp,h4 as ep,V9 as fp,PB as gp,w9 as hp,$G as ip,XG as jp,b9 as kp,w4 as lp,y9 as mp,C9 as np,R4 as op,HG as pp,BG as qp,P9 as rp,O4 as sp,jG as tp,VG as up,x2 as vp,Aq as wp,kq as xp,Iq as yp,Tq as zp,Eq as Ap,g2 as Bp,Cq as Cp,xq as Dp,gq as Ep,b8 as Fp,y8 as Gp,yH as Hp,D8 as Ip,SH as Jp,a3 as Kp,t3 as Lp,e3 as Mp,v8 as Np,f8 as Op,x8 as Pp,y6 as Qp,S6 as Rp,C6 as Sp,P6 as Tp,D3 as Up,N3 as Vp,Ez as Wp,bz as Xp,yz as Yp,UJ as Zp,Sz as _p,ZB as $p,XB as aq,h8 as bq,JB as cq,zQ as dq,c8 as eq,s8 as fq,X9 as gq,R$ as hq,W4 as iq,PQ as jq,U4 as kq,G9 as lq,q9 as mq,cQ as nq,LB as oq,wB as pq,W9 as qq,RB as rq,DB as sq,z4 as tq,U9 as uq,N$ as vq,M$ as wq,s1 as xq,iQ as yq,K9 as zq,H9 as Aq,AB as Bq,K4 as Cq,nQ as Dq,sQ as Eq,H4 as Fq,B4 as Gq,B9 as Hq,j9 as Iq,u4 as Jq,d4 as Kq,c4 as Lq,p4 as Mq,Bq as Nq,Fq as Oq,Lq as Pq,wq as Qq,Rq,mq as Sq,M1 as Tq,n4 as Uq,A1 as Vq,C$ as Wq,nq as Xq,sq as Yq,oq as Zq,I1 as _q,t as $q,q$ as ar,s2 as br,B0 as cr,kO as dr,IO as er,e7 as fr,$6 as gr,F1 as hr,Z6 as ir,f1 as jr,X6 as kr,j5 as lr,MU as mr,wX as nr,Y3 as or,AU as pr,Q3 as qr,kU as rr,IU as sr,U1 as tr,TU as ur,EU as vr,bU as wr,yU as xr,SU as yr,CU as zr,RX as Ar,q3 as Br,J6 as Cr,vU as Dr,fU as Er,xU as Fr,gU as Gr,hU as Hr,Q6 as Ir,uU as Jr,G6 as Kr,dU as Lr,mU as Mr,_5 as Nr,IX as Or,iU as Pr,EX as Qr,H6 as Rr,e5 as Sr,tU as Tr,L6 as Ur,j3 as Vr,gz as Wr,A3 as Xr,_J as Yr,LJ as Zr,hz as _r,uz as $r,dz as as,mz as bs,lz as cs,cz as ds,wJ as es,RJ as fs,v6 as gs,c6 as hs,AJ as is,I3 as js,p6 as ks,GK as ls,qK as ms,E3 as ns,yJ as os,i6 as ps};