@stacksjs/stx 0.2.202 → 0.2.204

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 (50) hide show
  1. package/dist/{chunk-n4v5733m.js → chunk-00a028s3.js} +1 -1
  2. package/dist/{chunk-hx338p3h.js → chunk-02n7khen.js} +1 -1
  3. package/dist/{chunk-ebrcakdt.js → chunk-0kdc3x7v.js} +1 -1
  4. package/dist/{chunk-jn49sc7r.js → chunk-12n9mz15.js} +1 -1
  5. package/dist/{chunk-cd8qdf35.js → chunk-1bq2xyax.js} +1 -1
  6. package/dist/{chunk-8gf8p3hq.js → chunk-2z6br22w.js} +1 -1
  7. package/dist/{chunk-1ms6ey5t.js → chunk-3acgbcv6.js} +1 -1
  8. package/dist/{chunk-q7tx4b74.js → chunk-44423f7c.js} +1 -1
  9. package/dist/{chunk-haawrsc8.js → chunk-4fe1ypxz.js} +1 -1
  10. package/dist/{chunk-wzytd8fh.js → chunk-5dxctm6h.js} +1 -1
  11. package/dist/{chunk-njvb5hn8.js → chunk-5gb0zjx0.js} +1 -1
  12. package/dist/{chunk-gfgpf7h8.js → chunk-5xpp3z95.js} +1 -1
  13. package/dist/{chunk-8a1524ge.js → chunk-66081bkn.js} +1 -1
  14. package/dist/{chunk-fk5a0t90.js → chunk-8sx4vf6p.js} +1 -1
  15. package/dist/{chunk-237jkeca.js → chunk-910sy8sk.js} +1 -1
  16. package/dist/{chunk-xgejppzh.js → chunk-9kf4q3ec.js} +1 -1
  17. package/dist/{chunk-4v5fsrdd.js → chunk-abzhv6v3.js} +1 -1
  18. package/dist/{chunk-h5rx09a5.js → chunk-bmpkpgx2.js} +8 -8
  19. package/dist/{chunk-241d3ex6.js → chunk-bpvp21dd.js} +1 -1
  20. package/dist/{chunk-seac724e.js → chunk-btgrvrxy.js} +1 -1
  21. package/dist/{chunk-a4mcc2dm.js → chunk-cm0ykjs1.js} +1 -1
  22. package/dist/{chunk-hdtca0hs.js → chunk-e0bk1mqp.js} +1 -1
  23. package/dist/{chunk-m1awve2j.js → chunk-evxg9pe7.js} +1 -1
  24. package/dist/{chunk-qw5gmsv7.js → chunk-g9kvpgha.js} +1 -1
  25. package/dist/{chunk-xdxhz4h3.js → chunk-gcns5vw5.js} +1 -1
  26. package/dist/{chunk-mvb60bhh.js → chunk-jsndbe2q.js} +1 -1
  27. package/dist/{chunk-31xczh3c.js → chunk-jvqjh17y.js} +1 -1
  28. package/dist/{chunk-5d664wp1.js → chunk-k03erdj7.js} +1 -1
  29. package/dist/{chunk-79m0qkj6.js → chunk-k25mqtht.js} +1 -1
  30. package/dist/{chunk-0kp3c02b.js → chunk-m0sd10cs.js} +1 -1
  31. package/dist/{chunk-as6mtt14.js → chunk-me5h5mkq.js} +1 -1
  32. package/dist/{chunk-r65jaef6.js → chunk-mz5hjxjv.js} +1 -1
  33. package/dist/{chunk-tke3ff0z.js → chunk-n35c984x.js} +2 -2
  34. package/dist/{chunk-6wx32fa5.js → chunk-n9eahkjg.js} +290 -290
  35. package/dist/{chunk-ncgvbje8.js → chunk-nd9d80gb.js} +1 -1
  36. package/dist/{chunk-te0r2g0x.js → chunk-syy7d9w2.js} +1 -1
  37. package/dist/{chunk-ajr4qgbe.js → chunk-t98920tc.js} +1 -1
  38. package/dist/{chunk-a438xffx.js → chunk-vpwjr05r.js} +1 -1
  39. package/dist/{chunk-m3qtqheb.js → chunk-vydqh4xr.js} +1 -1
  40. package/dist/{chunk-3jfg5kdy.js → chunk-xm6kwq2r.js} +2 -2
  41. package/dist/{chunk-6v4ddvfk.js → chunk-z21qzyh1.js} +1 -1
  42. package/dist/cli.js +7 -7
  43. package/dist/config.d.ts +15 -3
  44. package/dist/config.js +32 -7
  45. package/dist/craft-entry.js +1 -1
  46. package/dist/craft.js +1 -1
  47. package/dist/pwa.js +1 -1
  48. package/dist/ssg.js +2 -2
  49. package/dist/web-components.js +4 -1
  50. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Tr as v9,bs as U6,cs as W6}from"./chunk-8src5smc.js";import{hs as p0}from"./chunk-xp3fp266.js";import{ms as d5}from"./chunk-nye9brje.js";import{Gs as x9}from"./chunk-31xczh3c.js";import{Hs as K6,Js as z6,Ks as H6,Ms as j5}from"./chunk-cbc56wpd.js";import{Ns as g9,Rs as o5,Ts as i9}from"./chunk-x0zh76yv.js";import{ct as h9}from"./chunk-0ae6chzd.js";import{dt as Q8,et as $8,ft as l1,gt as G8,ht as E4,it as n2,jt as K2,kt as N9}from"./chunk-kjr22neh.js";import{Dt as f3,Ut as f9,Wt as dQ,Xt as h$,Zt as U5,tt as c3,wt as P2}from"./chunk-3952ykhb.js";import{cu as B6}from"./chunk-dtmwr674.js";import{hu as h}from"./chunk-pw0rzgpv.js";import b1 from"path";import I5 from"fs";var T4=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"]),I4={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"},H8=new Set(["ctrl","alt","shift","meta"]),b4={left:0,middle:1,right:2};function k4($){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 Y=X.toLowerCase();if(Y==="prevent")Z.prevent=!0;else if(Y==="stop")Z.stop=!0;else if(Y==="once")Z.once=!0;else if(Y==="capture")Z.capture=!0;else if(Y==="self")Z.self=!0;else if(Y==="passive")Z.passive=!0;else if(H8.has(Y))Z.systemKeys.push(Y);else if(Y in b4)Z.mouse=Y;else if(Y in I4||/^[a-z]$/.test(Y))Z.keys.push(I4[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);Z.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);Z.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return Z}function y4($){let Z=[],X=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec($))!==null){let[Q,G,q]=J,U=J.index,W=U+Q.length,K=`__stx_evt_${X++}`,z=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=H.exec(q))!==null){let[,_,V]=B,O=_.split("."),F=O[0];if(!T4.has(F))continue;z.push({attribute:`@${_}`,event:F,handler:V,modifiers:k4(O.slice(1)),elementId:K})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,V]=B,O=_.split("."),F=O[0];if(!T4.has(F))continue;z.push({attribute:`@${_}`,event:F,handler:V,modifiers:k4(O.slice(1)),elementId:K})}if(z.length>0)Z.push({originalTag:Q,elementId:K,events:z,startIndex:U,endIndex:W})}return Z}function B8($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let Y of X.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if(X.keys.length>0){let Y=X.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if(X.mouse!==null){let Y=b4[X.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function j8($,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 I$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function _8($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=B8($),J=j8(I$($.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=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2
+ import{Tr as x9,bs as K6,cs as z6}from"./chunk-8src5smc.js";import{hs as i0}from"./chunk-xp3fp266.js";import{ms as d5}from"./chunk-nye9brje.js";import{Gs as h9}from"./chunk-jvqjh17y.js";import{Hs as H6,Js as B6,Ks as j6,Ms as j5}from"./chunk-cbc56wpd.js";import{Ns as u9,Rs as o5,Ts as s9}from"./chunk-x0zh76yv.js";import{ct as d9}from"./chunk-0ae6chzd.js";import{dt as q8,et as X8,ft as l1,gt as U8,ht as y4,it as o2,jt as H2,kt as M9}from"./chunk-kjr22neh.js";import{Dt as g3,Ut as g9,Wt as cQ,Xt as u$,Zt as U5,tt as i3,wt as f2}from"./chunk-3952ykhb.js";import{cu as _6}from"./chunk-dtmwr674.js";import{hu as h}from"./chunk-pw0rzgpv.js";import b1 from"path";import I5 from"fs";var k4=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"]),E4={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"},j8=new Set(["ctrl","alt","shift","meta"]),S4={left:0,middle:1,right:2};function b4($){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(j8.has(J))Z.systemKeys.push(J);else if(J in S4)Z.mouse=J;else if(J in E4||/^[a-z]$/.test(J))Z.keys.push(E4[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 C4($){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,U=Y.index,W=U+Q.length,K=`__stx_evt_${X++}`,z=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=H.exec(q))!==null){let[,_,V]=B,O=_.split("."),F=O[0];if(!k4.has(F))continue;z.push({attribute:`@${_}`,event:F,handler:V,modifiers:b4(O.slice(1)),elementId:K})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,V]=B,O=_.split("."),F=O[0];if(!k4.has(F))continue;z.push({attribute:`@${_}`,event:F,handler:V,modifiers:b4(O.slice(1)),elementId:K})}if(z.length>0)Z.push({originalTag:Q,elementId:K,events:z,startIndex:U,endIndex:W})}return Z}function _8($){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=S4[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 O8($,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 k$($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function V8($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=_8($),Y=O8(k$($.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;
@@ -42,7 +42,7 @@ else {
42
42
  if (!$el) return;
43
43
  // eslint-disable-next-line pickier/no-unused-vars
44
44
  $el.addEventListener('${$.event}', function($event) {
45
- ${Y?Y+";":""}
45
+ ${J?J+";":""}
46
46
  // Find the closest reactive scope and execute within its context
47
47
  var scope = $el.closest('[data-stx-scope]');
48
48
  if (scope && scope.__stx_execute) {
@@ -53,7 +53,7 @@ else {
53
53
  __stx_runHandler('${q}', $event, $el);
54
54
  }
55
55
  }${G});
56
- })();`}function k$($){if($.length===0)return"";return`
56
+ })();`}function E$($){if($.length===0)return"";return`
57
57
  <script data-stx-events>
58
58
  (function() {
59
59
  'use strict';
@@ -108,22 +108,22 @@ else {
108
108
  }
109
109
 
110
110
  // Event listeners
111
- ${$.map(_8).join(`
111
+ ${$.map(V8).join(`
112
112
  `)}
113
113
  })();
114
- </script>`}function O8($){let Z=y4($);if(Z.length===0)return{template:$,bindings:[]};let X=$,Y=[];for(let J=Z.length-1;J>=0;J--){let Q=Z[J],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 U of Q.events)U.elementId=q[1]}for(let q of Q.events){let U=q.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),K=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(K,"")}X=X.slice(0,Q.startIndex)+G+X.slice(Q.endIndex),Y.push(...Q.events)}return{template:X,bindings:Y}}function S4($,Z,X){if(E4($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:U}=O8($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...U],q}let Y=y4($);if(Y.length===0)return $;let J=$;for(let q=Y.length-1;q>=0;q--){let U=Y[q],W=U.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${U.elementId}"`);else{let K=W.match(/id=["']([^"']+)["']/);if(K)for(let z of U.events)z.elementId=K[1]}for(let K of U.events){let z=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");W=W.replace(H,""),W=W.replace(B,"")}J=J.slice(0,U.startIndex)+W+J.slice(U.endIndex)}let Q=k$(Y.flatMap((q)=>q.events)),G=J.lastIndexOf("</body>");if(G!==-1)J=J.slice(0,G)+Q+`
115
- `+J.slice(G);else J+=Q;return J}function Gq($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}function o0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(Y,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
116
- `});let X=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(X,(Y,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
117
- `}),$}function Uq($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}import TG from"fs";import g from"path";import{createHash as V8}from"crypto";var y5="__stx_component_client_factories";function C4($){let Z=$[y5];return Z instanceof Map?Z:null}function P4($){$[y5]=new Map}function v4($,Z){let X=C4($);if(!X)return null;let Y=V8("sha256").update(Z).digest("hex").slice(0,16),J=X.get(Y);if(J)J.instances++;else X.set(Y,{body:Z,instances:1});return Y}function f4($,Z){let X=C4(Z);if(!X?.size)return $;let Y=$;for(let[U,W]of X){if(W.instances!==1)continue;let K=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(U)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(K,(z,H)=>`(${W.body})(${H});`)}let J=[...X].filter(([,U])=>U.instances>1);if(J.length===0)return Y;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
114
+ </script>`}function F8($){let Z=C4($);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 U of Q.events)U.elementId=q[1]}for(let q of Q.events){let U=q.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),K=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(K,"")}X=X.slice(0,Q.startIndex)+G+X.slice(Q.endIndex),J.push(...Q.events)}return{template:X,bindings:J}}function P4($,Z,X){if(y4($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:U}=F8($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...U],q}let J=C4($);if(J.length===0)return $;let Y=$;for(let q=J.length-1;q>=0;q--){let U=J[q],W=U.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${U.elementId}"`);else{let K=W.match(/id=["']([^"']+)["']/);if(K)for(let z of U.events)z.elementId=K[1]}for(let K of U.events){let z=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");W=W.replace(H,""),W=W.replace(B,"")}Y=Y.slice(0,U.startIndex)+W+Y.slice(U.endIndex)}let Q=E$(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 Wq($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}function r0($){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
+ `});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 zq($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}import EG from"fs";import g from"path";import{createHash as L8}from"crypto";var y5="__stx_component_client_factories";function v4($){let Z=$[y5];return Z instanceof Map?Z:null}function f4($){$[y5]=new Map}function x4($,Z){let X=v4($);if(!X)return null;let J=L8("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 g4($,Z){let X=v4(Z);if(!X?.size)return $;let J=$;for(let[U,W]of X){if(W.instances!==1)continue;let K=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(U)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(K,(z,H)=>`(${W.body})(${H});`)}let Y=[...X].filter(([,U])=>U.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
- ${J.map(([U,W])=>` try { factories[${JSON.stringify(U)}] = factories[${JSON.stringify(U)}] || ${W.body}; }
120
+ ${Y.map(([U,W])=>` try { factories[${JSON.stringify(U)}] = factories[${JSON.stringify(U)}] || ${W.body}; }
121
121
  catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(U)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
122
122
  `)}
123
123
  })();
124
- </script>`,q=Y.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(q<0)return`${G}
125
- ${Y}`;return`${Y.slice(0,q)}${G}
126
- ${Y.slice(q)}`}var F8={maxSanitizeDepth:10,allowBracketNotation:!1},g4={...F8};var h4=[/\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/],L8=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"]),u4=new Set(["__proto__","constructor","prototype"]),w8=/[\w)\]]\s*\[\s*['"]/;function R8($){let Z="",X=null,Y=!1;for(let J=0;J<$.length;J++){let Q=$[J];if(Y){Y=!1;continue}if(Q==="\\"&&X){Y=!0;continue}if(X){if(X==="`"&&Q==="$"&&J+1<$.length&&$[J+1]==="{"){let G=1;J+=2;while(J<$.length&&G>0){if($[J]==="{")G++;else if($[J]==="}")G--;if(G>0)Z+=$[J],J++}continue}if(Q===X)X=null;continue}if(Q==='"'||Q==="'"||Q==="`"){X=Q;continue}Z+=Q}return Z}function D8($,Z){let X=/[$A-Z_a-z][$\w]*/g,Y;while((Y=X.exec($))!==null){let J=Y[0],Q=$[Y.index-1];if(L8.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${Z}`);if(Q==="."&&u4.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${Z}`)}}function N8($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,X;while((X=Z.exec($))!==null){let Y=X[2];if(!u4.has(Y))continue;let J=$.slice(0,X.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(X.index+X[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${X[2]}): ${$}`)}}function S5($){let Z=$.trim(),X=R8(Z);D8(X,Z),N8(Z);for(let Y of h4)if(Y.test(X))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${Z}`);if(!g4.allowBracketNotation&&w8.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function A8($){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,Y]of Object.entries($)){if(X.startsWith("__")||h4.some((J)=>J.test(X)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))Z[X]=E$(Y);else Z[X]=Y}return Z}function E$($,Z=0){if(Z>=g4.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>E$(Y,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let X={};for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(J&&typeof J==="object")X[Y]=E$(J,Z+1);else X[Y]=J}return X}function X0($,Z){try{let X=A8(Z),Y=Object.keys(X),J=Object.values(X);return G0($,Y)(...J)}catch{return}}function Q0($){try{return S5($),!0}catch{return!1}}function _0($,Z){try{let X=X0($,Z);if(X&&typeof X==="object"&&!Array.isArray(X))return X;return{}}catch{return{}}}var d4=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 G0($,Z){let X=S5($),Y=/^[A-Za-z_$][\w$]*$/,J=[],Q=[];for(let W=0;W<Z.length;W++){let K=Z[W];if(!Y.test(K))continue;if(d4.has(K))continue;J.push(W),Q.push(K)}let G=(W)=>Function(...Q,...W,`
124
+ </script>`,q=J.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(q<0)return`${G}
125
+ ${J}`;return`${J.slice(0,q)}${G}
126
+ ${J.slice(q)}`}var w8={maxSanitizeDepth:10,allowBracketNotation:!1},u4={...w8};var d4=[/\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/],R8=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"]),m4=new Set(["__proto__","constructor","prototype"]),D8=/[\w)\]]\s*\[\s*['"]/;function N8($){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 A8($,Z){let X=/[$A-Z_a-z][$\w]*/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=$[J.index-1];if(R8.has(Y))throw Error(`Potentially unsafe expression (matched /\\b${Y}\\b/; identifier ${Y}): ${Z}`);if(Q==="."&&m4.has(Y))throw Error(`Potentially unsafe expression (matched /.${Y}/; property ${Y}): ${Z}`)}}function M8($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,X;while((X=Z.exec($))!==null){let J=X[2];if(!m4.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 S5($){let Z=$.trim(),X=N8(Z);A8(X,Z),M8(Z);for(let J of d4)if(J.test(X))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!u4.allowBracketNotation&&D8.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function T8($){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("__")||d4.some((Y)=>Y.test(X)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[X]=b$(J);else Z[X]=J}return Z}function b$($,Z=0){if(Z>=u4.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>b$(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]=b$(Y,Z+1);else X[J]=Y}return X}function X0($,Z){try{let X=T8(Z),J=Object.keys(X),Y=Object.values(X);return G0($,J)(...Y)}catch{return}}function Q0($){try{return S5($),!0}catch{return!1}}function _0($,Z){try{let X=X0($,Z);if(X&&typeof X==="object"&&!Array.isArray(X))return X;return{}}catch{return{}}}var l4=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 G0($,Z){let X=S5($),J=/^[A-Za-z_$][\w$]*$/,Y=[],Q=[];for(let W=0;W<Z.length;W++){let K=Z[W];if(!J.test(K))continue;if(l4.has(K))continue;Y.push(W),Q.push(K)}let G=(W)=>Function(...Q,...W,`
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 x4(q,Q,G);return x4((...W)=>{let K=Array(J.length);for(let z=0;z<J.length;z++)K[z]=W[J[z]];return q(...K)},Q,G,(W)=>{q=G(W)})}function x4($,Z,X,Y){let Q=/^(\w+) is not defined$/,G=$,q=[],U=new Set(Z);return(...W)=>{for(let K=0;K<=8;K++)try{return G(...W)}catch(z){let H=z instanceof Error?z.message:"",B=Q.exec(H);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(U.has(j)||d4.has(j))return;U.add(j),q.push(j),G=X(q),Y?.(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 Y of X)if(Y.test(Z))return!1;return!0}var m4=0,P5=new Map;function Bq(){m4=0,P5.clear()}function v5($,Z){let X=m4++,Y=`<!--__STX_${$.toUpperCase()}_${X}__-->`;return P5.set(Y,{type:$,expression:Z}),Y}function jq(){let $={};for(let[Z,X]of P5)$[Z]={type:X.type,expression:X.expression};return $}function _q($){let Z={},X=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,Y;while((Y=X.exec($))!==null){let J=Y[0],Q=Y[1].toLowerCase(),G=P5.get(J);Z[J]={type:Q,expression:G?.expression||""}}return Z}function Oq($,Z){let X=$;for(let[Y,J]of Z)X=X.split(Y).join(J);return X}function Vq($){return $.includes("<!--__STX_")}var l4=/<script\b[^>]*>/iy,c4=/<\/script\s*>/ig,p4=/<style\b[^>]*>/iy,i4=/<\/style\s*>/ig;function n4($,Z,X,Y){X.lastIndex=Z;let J=X.exec($);if(!J||J.index!==Z)return-1;Y.lastIndex=X.lastIndex;let Q=Y.exec($);if(!Q)return-1;return Q.index+Q[0].length}function Y1($,Z){return n4($,Z,l4,c4)}function S1($,Z){return n4($,Z,p4,i4)}function Q5($,Z){if(!$.startsWith("<!--",Z))return-1;let X=$.indexOf("-->",Z+4);if(X===-1)return-1;return X+3}function M8($,Z){if($.startsWith("<!--",Z)){let X=Q5($,Z);return X===-1?$.length:X}for(let[X,Y]of[[l4,c4],[p4,i4]]){X.lastIndex=Z;let J=X.exec($);if(!J||J.index!==Z)continue;Y.lastIndex=X.lastIndex;let Q=Y.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function f5($,Z){let X=[],Y=0,J=$.length,Q=!1,G=null;while(Y<J){let q=$[Y];if(Q){if(G){if(q===G)G=null}else if(q==='"'||q==="'")G=q;else if(q===">")Q=!1;Y++;continue}if(q!=="<"){Y++;continue}let U=Z($,Y);if(U>Y){X.push({start:Y,end:U,token:$.slice(Y,U)}),Y=U;continue}let W=M8($,Y);if(W>Y){Y=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Y,Y+2)))Q=!0;Y++}return X}function l0($,Z,X){let Y=f5($,Z);if(Y.length===0)return{output:$,tokens:[]};let J=Y.map((q)=>q.token),Q="",G=0;for(let q=0;q<Y.length;q++){let U=Y[q];Q+=$.slice(G,U.start),Q+=X(U.token,q),G=U.end}return Q+=$.slice(G),{output:Q,tokens:J}}function c0($){let{output:Z,tokens:X}=l0($,Y1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:Z,scripts:X}}function C1($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(X,Y)=>Z[+Y]??"")}var G5={},s4=new Map;function T8($){let Z=s4.get($);if(!Z){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${X}(?!\\w)`,"g"),s4.set($,Z)}return Z.lastIndex=0,Z}var x5={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 Y=Number($);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(X),10))}catch{return""}},fmt:($,Z,X="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return Y.toLocaleString(X)}catch{return String($)}},join:($,Z,X=",")=>{if(!Array.isArray($))return"";return $.join(String(X))},escape:($,Z)=>{if($===void 0||$===null)return"";return r4(String($))},translate:($,Z,X={})=>{if(!Z||!Z.__translations)return $;let Y=Z.__translations,J=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=Y;for(let U of Q){if(G===void 0||G===null)break;G=G[U]}if(G===void 0||G===null)return J?$:"";let q=String(G);return Object.entries(X).forEach(([U,W])=>{q=q.replace(T8(U),String(W))}),q},t:($,Z,X={})=>{return x5.translate($,Z,X)},truncate:($,Z,X=50,Y="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=X)return J;if(X<=Y.length)return Y.substring(0,X);return J.substring(0,X-Y.length)+Y},date:($,Z,X="short",Y="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.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 J.toISOString();return new Intl.DateTimeFormat(Y,Q[X]||Q.short).format(J)}catch{return String($)}},currency:($,Z,X="USD",Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(Y,{style:"currency",currency:X}).format(J)}catch{return String($)}},pluralize:($,Z,X,Y)=>{let J=Number($);if(Number.isNaN(J))return X;let Q=Y||`${X}s`;return J===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,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(X,Y);return $},replace:($,Z,X,Y="")=>{if($===void 0||$===null)return"";let J=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"g"),()=>Y)},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 Y=Number($);if(Number.isNaN(Y))return 0;let J=10**X;return Math.round(Y*J)/J}};function I8($,Z){if($ in x5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);G5[$]=Z}function Mq($){for(let[Z,X]of Object.entries($))I8(Z,X)}function k8(){return{...x5,...G5}}function Tq(){for(let $ of Object.keys(G5))delete G5[$]}function b$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function r4($){return b$($).replace(/\{{2,}/g,(Z)=>E8(Z.length)).replace(/\{(?=!)/g,`&#123;${a4}`)}var a4="&#8288;";function E8($){return Array.from({length:$},()=>"&#123;").join(a4)}function J1($){let{scripts:Z}=c0($);for(let X of Z){let Y=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))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 o4($,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"],Y=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",Q=!1,G=0;for(let W=0;W<Y.length;W++){let K=Y[W];if(!Q&&K==="`"){Q=!0,G=0;continue}if(Q){if(K==="`"&&G===0){Q=!1;continue}if(K==="$"&&Y[W+1]==="{"){G++,W++,J+=" ";continue}if(K==="}"&&G>0){G--;continue}if(G>0){J+=K;continue}continue}J+=K}Y=J;let q=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,U;while((U=q.exec(Y))!==null){let W=U[1];if(!Y.substring(0,U.index).trimEnd().endsWith(".")){if(!X.includes(W)&&!(W in Z))return!1}}return!0}function b8($,Z){let X=Z.__stx_serverDeclared;if(!X||X.size===0)return!1;let Y=p0($);for(let J of X)if(new RegExp(`(?<![.#\\w$])${J}(?![\\w$])`).test(Y))return!0;return!1}function y$($,Z){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let Q=b0(J,Z);if(Q===void 0)return Y;return Q===null?"":String(Q)}catch{return Y}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return Y;try{let G=b0(J,Z);if(G===void 0)return Y;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return Y}}),X}function y8($,Z){if(!$.includes("{"))return $;let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let Q=b0(J,Z);if(Q===void 0)return Y;return Q===null?"":String(Q)}catch{return Y}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return Y;try{let G=b0(J,Z);if(G===void 0)return Y;if(G===null)return"";return String(G).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return Y}}),X}function Iq($,Z,X={}){let{output:Y,scripts:J}=c0($),Q=J.map((G)=>{let q=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),U=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!q||!U||W===-1)return G;let K=q[1],z=q[2];if(/\bdata-raw\b/.test(K))return G;if(X.skipServer&&/\bserver\b/.test(K))return G;let B=`<script${y8(K,Z)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+z+G.slice(W);return B+y$(z,Z)+G.slice(W)});return C1(Y,Q)}function _1($,Z,X){let Y=$,J=(z,H)=>{let B=S1(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:V,tokens:O}=l0(z,H,(F,L)=>j(_+L));return B.push(...O),V},G=[];Y=Q(Y,J,G,(z)=>`<!--__STX_STYLE_${z}__-->`);let q=[];Y=Q(Y,Y1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let U=Z?.__stx_signals_gate===!0||J1($),W=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),K=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,H,B)=>{try{let j=b0(H,Z);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return W0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${_}`,X,$,B,z)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(z,H,B)=>{try{let j=b0(H,Z);if(j===void 0&&Z.__stx_buildMode==="compile")return v5("raw",H.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(Z.__stx_buildMode==="compile")return v5("raw",H.trim());let _=j instanceof Error?j.message:String(j);return W0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${_}`,X,$,B,z)}}),Y=Q(Y,Y1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),Y=Q(Y,J,G,(z)=>`<!--__STX_STYLE_${z}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(z,H,B)=>{let j=H.trim();if(K.has(j))return z;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=j.match(V)?.[1],L=F&&((F in Z)||_.includes(F)),w=Boolean(F&&W.has(F)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=j.match(R),N=D&&!_.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=b0(H,Z);if(w)return z;if(U&&!o4(j,Z))return z;if(Z.__stx_buildMode==="compile"&&!U&&(T===void 0||b8(j,Z)))return v5("expr",j);return T!==void 0&&T!==null?r4(String(T)):""}catch(T){if(w)return z;if(U&&!o4(j,Z))return z;if(N)return z;let A=T instanceof Error?T.message:String(T);return W0("Expression",`Error evaluating: {{ ${j} }}: ${A}`,X,$,B,z)}});for(let z=0;z<q.length;z++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>q[z]);for(let z=0;z<G.length;z++)Y=Y.replace(`<!--__STX_STYLE_${z}__-->`,()=>G[z]);return Y}function S8($,Z,X){if(!Z.trim())return $;let Y=$,J=Z.trim();while(J.length>0){let Q=J.match(/^(\w+)/);if(!Q)break;let G=Q[1];J=J.substring(G.length).trim();let q=G5[G]||x5[G];if(!q)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(k8()).join(", ")}`);let U=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let K=W[1].trim();try{let z=Number(K);U=[Number.isNaN(z)?K:z]}catch{U=[K]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,K=1;while(W>0&&K<J.length){if(J[K]==="(")W++;if(J[K]===")")W--;K++}if(W===0){let z=J.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))U=[b0(`(${z})`,X,!0)];else{let H=[],B="",j=null,_=0,V=0,O=0,F=!1;for(let L=0;L<z.length;L++){let w=z[L];if(F){B+=w,F=!1;continue}if(w==="\\"){B+=w,F=!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==="[")V++;else if(w==="]")V--;else if(w==="{")O++;else if(w==="}")O--;if(w===","&&_===0&&V===0&&O===0){H.push(B),B="";continue}B+=w}if(B)H.push(B);U=H.map((L)=>{let w=L.trim();return b0(w,X,!0)})}}catch{U=[z]}J=J.substring(K).trim()}}try{Y=q(Y,X,...U)}catch(W){let K=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${K}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function C8($){let Z=!1,X="",Y=0,J=0,Q=0,G=!1;for(let q=0;q<$.length;q++){let U=$[q],W=$[q+1];if(Z&&G){G=!1;continue}if(Z&&U==="\\"){G=!0;continue}if(G=!1,(U==='"'||U==="'"||U==="`")&&!G){if(!Z)Z=!0,X=U;else if(U===X)Z=!1,X="";continue}if(Z&&X==="`"&&U==="$"&&W==="{"){let K=1;q+=2;while(q<$.length&&K>0){if($[q]==="{")K++;else if($[q]==="}")K--;if(K>0)q++}continue}if(Z)continue;if(U==="(")Y++;else if(U===")")Y--;else if(U==="[")J++;else if(U==="]")J--;else if(U==="{")Q++;else if(U==="}")Q--;if(U==="|"&&Y===0&&J===0&&Q===0){if(W==="|"){q++;continue}if(W==="="){q++;continue}return q}}return-1}function b0($,Z,X=!1){try{let Y=$.trim(),J=C8(Y);if(J>0){let Q=Y.substring(0,J).trim(),G=Y.substring(J+1).trim(),q=b0(Q,Z,!0);return S8(q,G,Z)}if(!Q0(Y)){if(!X)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return X0(Y,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return G0(Y,Q)(...G)}catch{return X0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let Q=J[1],G=P8(Q,Object.keys(Z));if(G&&G!==Q)Y.message=`${Y.message} \u2014 did you mean '${G}'?`}}if(!X)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function P8($,Z){let X=null;for(let J of Z){if(J===$)continue;let Q=v8($,J);if(X===null||Q<X.dist)X={key:J,dist:Q}}if(!X)return null;let Y=Math.max($.length,X.key.length);if(X.dist<=2||X.dist/Y<=0.35)return X.key;return null}function v8($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[X,Y]=$.length<Z.length?[$,Z]:[Z,$],J=Array(X.length+1),Q=Array(X.length+1);for(let G=0;G<=X.length;G++)J[G]=G;for(let G=1;G<=Y.length;G++){Q[0]=G;for(let q=1;q<=X.length;q++){let U=X[q-1]===Y[G-1]?0:1;Q[q]=Math.min(Q[q-1]+1,J[q]+1,J[q-1]+U)}for(let q=0;q<=X.length;q++)J[q]=Q[q]}return J[X.length]}function kq($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}class O1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let X=this.cache.keys().next().value;if(X!==void 0)this.cache.delete(X)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var P1=new Map,f8=500;function v1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let X=`${$}:${Z||""}`;if(!P1.has(X)){if(P1.size>=f8){let Y=P1.keys().next().value;if(Y)P1.delete(Y)}P1.set(X,new RegExp($,Z))}return P1.get(X)}class t4{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),X=Z.sort().join(","),Y=this.pool.find((q)=>q.context.join(",")===X);if(Y)return Y.func;let J=this.fnCache,Q=this.fnCacheMaxSize,G=(...q)=>{return(U)=>{try{let W=`${X}:${U}`,K=J.get(W);if(!K){if(J.size>=Q){let z=J.keys().next().value;if(z)J.delete(z)}K=Function(...Z,`
137
+ `),q=G([]);if(Q.length===Z.length)return h4(q,Q,G);return h4((...W)=>{let K=Array(Y.length);for(let z=0;z<Y.length;z++)K[z]=W[Y[z]];return q(...K)},Q,G,(W)=>{q=G(W)})}function h4($,Z,X,J){let Q=/^(\w+) is not defined$/,G=$,q=[],U=new Set(Z);return(...W)=>{for(let K=0;K<=8;K++)try{return G(...W)}catch(z){let H=z instanceof Error?z.message:"",B=Q.exec(H);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(U.has(j)||l4.has(j))return;U.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 c4=0,P5=new Map;function Oq(){c4=0,P5.clear()}function v5($,Z){let X=c4++,J=`<!--__STX_${$.toUpperCase()}_${X}__-->`;return P5.set(J,{type:$,expression:Z}),J}function Vq(){let $={};for(let[Z,X]of P5)$[Z]={type:X.type,expression:X.expression};return $}function Fq($){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 Lq($,Z){let X=$;for(let[J,Y]of Z)X=X.split(J).join(Y);return X}function wq($){return $.includes("<!--__STX_")}var p4=/<script\b[^>]*>/iy,i4=/<\/script\s*>/ig,n4=/<style\b[^>]*>/iy,s4=/<\/style\s*>/ig;function o4($,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 Y1($,Z){return o4($,Z,p4,i4)}function S1($,Z){return o4($,Z,n4,s4)}function Q5($,Z){if(!$.startsWith("<!--",Z))return-1;let X=$.indexOf("-->",Z+4);if(X===-1)return-1;return X+3}function I8($,Z){if($.startsWith("<!--",Z)){let X=Q5($,Z);return X===-1?$.length:X}for(let[X,J]of[[p4,i4],[n4,s4]]){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 f5($,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 U=Z($,J);if(U>J){X.push({start:J,end:U,token:$.slice(J,U)}),J=U;continue}let W=I8($,J);if(W>J){J=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return X}function c0($,Z,X){let J=f5($,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 U=J[q];Q+=$.slice(G,U.start),Q+=X(U.token,q),G=U.end}return Q+=$.slice(G),{output:Q,tokens:Y}}function p0($){let{output:Z,tokens:X}=c0($,Y1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:Z,scripts:X}}function C1($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(X,J)=>Z[+J]??"")}var G5={},r4=new Map;function k8($){let Z=r4.get($);if(!Z){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${X}(?!\\w)`,"g"),r4.set($,Z)}return Z.lastIndex=0,Z}var x5={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 t4(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 U of Q){if(G===void 0||G===null)break;G=G[U]}if(G===void 0||G===null)return Y?$:"";let q=String(G);return Object.entries(X).forEach(([U,W])=>{q=q.replace(k8(U),String(W))}),q},t:($,Z,X={})=>{return x5.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 E8($,Z){if($ in x5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);G5[$]=Z}function kq($){for(let[Z,X]of Object.entries($))E8(Z,X)}function b8(){return{...x5,...G5}}function Eq(){for(let $ of Object.keys(G5))delete G5[$]}function y$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function t4($){return y$($).replace(/\{{2,}/g,(Z)=>y8(Z.length)).replace(/\{(?=!)/g,`&#123;${e4}`)}var e4="&#8288;";function y8($){return Array.from({length:$},()=>"&#123;").join(e4)}function Q1($){let{scripts:Z}=p0($);for(let X of Z){let J=X.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let Y=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))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 a4($,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 W=0;W<J.length;W++){let K=J[W];if(!Q&&K==="`"){Q=!0,G=0;continue}if(Q){if(K==="`"&&G===0){Q=!1;continue}if(K==="$"&&J[W+1]==="{"){G++,W++,Y+=" ";continue}if(K==="}"&&G>0){G--;continue}if(G>0){Y+=K;continue}continue}Y+=K}J=Y;let q=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,U;while((U=q.exec(J))!==null){let W=U[1];if(!J.substring(0,U.index).trimEnd().endsWith(".")){if(!X.includes(W)&&!(W in Z))return!1}}return!0}function S8($,Z){let X=Z.__stx_serverDeclared;if(!X||X.size===0)return!1;let J=i0($);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=y0(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=y0(Y,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),X}function C8($,Z){if(!$.includes("{"))return $;let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=y0(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=y0(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 bq($,Z,X={}){let{output:J,scripts:Y}=p0($),Q=Y.map((G)=>{let q=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),U=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!q||!U||W===-1)return G;let K=q[1],z=q[2];if(/\bdata-raw\b/.test(K))return G;if(X.skipServer&&/\bserver\b/.test(K))return G;let B=`<script${C8(K,Z)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+z+G.slice(W);return B+S$(z,Z)+G.slice(W)});return C1(J,Q)}function _1($,Z,X){let J=$,Y=(z,H)=>{let B=S1(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:V,tokens:O}=c0(z,H,(F,L)=>j(_+L));return B.push(...O),V},G=[];J=Q(J,Y,G,(z)=>`<!--__STX_STYLE_${z}__-->`);let q=[];J=Q(J,Y1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let U=Z?.__stx_signals_gate===!0||Q1($),W=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),K=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=y0(H,Z);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return W0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${_}`,X,$,B,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,H,B)=>{try{let j=y0(H,Z);if(j===void 0&&Z.__stx_buildMode==="compile")return v5("raw",H.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(Z.__stx_buildMode==="compile")return v5("raw",H.trim());let _=j instanceof Error?j.message:String(j);return W0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${_}`,X,$,B,z)}}),J=Q(J,Y1,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(K.has(j))return z;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=j.match(V)?.[1],L=F&&((F in Z)||_.includes(F)),w=Boolean(F&&W.has(F)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=j.match(R),N=D&&!_.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=y0(H,Z);if(w)return z;if(U&&!a4(j,Z))return z;if(Z.__stx_buildMode==="compile"&&!U&&(T===void 0||S8(j,Z)))return v5("expr",j);return T!==void 0&&T!==null?t4(String(T)):""}catch(T){if(w)return z;if(U&&!a4(j,Z))return z;if(N)return z;let A=T instanceof Error?T.message:String(T);return W0("Expression",`Error evaluating: {{ ${j} }}: ${A}`,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 P8($,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=G5[G]||x5[G];if(!q)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(b8()).join(", ")}`);let U=[];if(Y.startsWith(":")){let W=Y.match(/^:([^|\s]+)/);if(W){let K=W[1].trim();try{let z=Number(K);U=[Number.isNaN(z)?K:z]}catch{U=[K]}Y=Y.substring(W[0].length).trim()}}else if(Y.startsWith("(")){let W=1,K=1;while(W>0&&K<Y.length){if(Y[K]==="(")W++;if(Y[K]===")")W--;K++}if(W===0){let z=Y.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))U=[y0(`(${z})`,X,!0)];else{let H=[],B="",j=null,_=0,V=0,O=0,F=!1;for(let L=0;L<z.length;L++){let w=z[L];if(F){B+=w,F=!1;continue}if(w==="\\"){B+=w,F=!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==="[")V++;else if(w==="]")V--;else if(w==="{")O++;else if(w==="}")O--;if(w===","&&_===0&&V===0&&O===0){H.push(B),B="";continue}B+=w}if(B)H.push(B);U=H.map((L)=>{let w=L.trim();return y0(w,X,!0)})}}catch{U=[z]}Y=Y.substring(K).trim()}}try{J=q(J,X,...U)}catch(W){let K=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${K}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function v8($){let Z=!1,X="",J=0,Y=0,Q=0,G=!1;for(let q=0;q<$.length;q++){let U=$[q],W=$[q+1];if(Z&&G){G=!1;continue}if(Z&&U==="\\"){G=!0;continue}if(G=!1,(U==='"'||U==="'"||U==="`")&&!G){if(!Z)Z=!0,X=U;else if(U===X)Z=!1,X="";continue}if(Z&&X==="`"&&U==="$"&&W==="{"){let K=1;q+=2;while(q<$.length&&K>0){if($[q]==="{")K++;else if($[q]==="}")K--;if(K>0)q++}continue}if(Z)continue;if(U==="(")J++;else if(U===")")J--;else if(U==="[")Y++;else if(U==="]")Y--;else if(U==="{")Q++;else if(U==="}")Q--;if(U==="|"&&J===0&&Y===0&&Q===0){if(W==="|"){q++;continue}if(W==="="){q++;continue}return q}}return-1}function y0($,Z,X=!1){try{let J=$.trim(),Y=v8(J);if(Y>0){let Q=J.substring(0,Y).trim(),G=J.substring(Y+1).trim(),q=y0(Q,Z,!0);return P8(q,G,Z)}if(!Q0(J)){if(!X)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return X0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return G0(J,Q)(...G)}catch{return X0(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=f8(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 f8($,Z){let X=null;for(let Y of Z){if(Y===$)continue;let Q=x8($,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 x8($,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 U=X[q-1]===J[G-1]?0:1;Q[q]=Math.min(Q[q-1]+1,Y[q]+1,Y[q-1]+U)}for(let q=0;q<=X.length;q++)Y[q]=Q[q]}return Y[X.length]}function yq($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}class O1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let X=this.cache.keys().next().value;if(X!==void 0)this.cache.delete(X)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var P1=new Map,g8=500;function v1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let X=`${$}:${Z||""}`;if(!P1.has(X)){if(P1.size>=g8){let J=P1.keys().next().value;if(J)P1.delete(J)}P1.set(X,new RegExp($,Z))}return P1.get(X)}class $7{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),X=Z.sort().join(","),J=this.pool.find((q)=>q.context.join(",")===X);if(J)return J.func;let Y=this.fnCache,Q=this.fnCacheMaxSize,G=(...q)=>{return(U)=>{try{let W=`${X}:${U}`,K=Y.get(W);if(!K){if(Y.size>=Q){let z=Y.keys().next().value;if(z)Y.delete(z)}K=Function(...Z,`
138
138
  'use strict';
139
139
  try {
140
140
  return ${U};
@@ -145,7 +145,7 @@ catch (e) {
145
145
  }
146
146
  throw e;
147
147
  }
148
- `),J.set(W,K)}return K(...q)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}var bq=new t4;class e4{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,X]of Object.entries($))this.setBudget(Z,X)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,X]of this.budgets.entries())$[Z]=X;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let X=performance.now(),Y=Z(),J=performance.now()-X;return this.recordTime($,J),this.checkBudget($,J),Y}async timeAsync($,Z){if(!this.enabled)return Z();let X=performance.now(),Y=await Z(),J=performance.now()-X;return this.recordTime($,J),this.checkBudget($,J),Y}checkBudget($,Z){let X=this.budgets.get($);if(!X)return;let Y=Z/X.maxTime*100,J=X.warnThreshold!==void 0?Z>=X.maxTime*X.warnThreshold&&Z<X.maxTime:!1,Q=Z>=X.maxTime;if(!J&&!Q)return;let G={label:$,actualTime:Z,budgetTime:X.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let U of this.violationHandlers)try{U(G)}catch{}let q=J?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${Y.toFixed(1)}% of ${X.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${X.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(X.action){case"log":console.log(q);break;case"warn":console.warn(q);break;case"error":console.error(q);break;case"throw":if(Q)throw Error(q);else console.warn(q);break}}recordTime($,Z){let X=this.metrics.get($);if(X)X.count++,X.totalTime+=Z,X.maxTime=Math.max(X.maxTime,Z),X.minTime=Math.min(X.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let X=this.metrics.get($);if(!X)return{};let Y=this.budgets.get($);return{count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Y?.maxTime,budgetUtilization:Y?X.totalTime/X.count/Y.maxTime*100:void 0}}let Z={};for(let[X,Y]of this.metrics.entries()){let J=this.budgets.get(X);Z[X]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,X=0;for(let Y of this.violations)if($[Y.label]=($[Y.label]||0)+1,Y.isWarning)Z++;else X++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:X}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var S$=null;function x8(){if(!S$)S$=new e4;return S$}var $7=new Proxy({},{get($,Z){return x8()[Z]}});import mQ from"fs";import R0 from"path";var C$=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],Z7=/<body\b([^>]*)>/gi;function q5($){let Z=0,X,Y=C$.map(()=>{return});while(Z<$.length){if(X===void 0||X!==null&&X.index<Z)Z7.lastIndex=Z,X=Z7.exec($);if(!X)return null;let J=X.index,Q=-1,G=null;for(let U=0;U<C$.length;U++){let W=C$[U],K=Y[U];if(K===void 0||K!==null&&K.index<Z)W.open.lastIndex=Z,K=W.open.exec($),Y[U]=K;if(!K)continue;if(K.index<J&&(Q===-1||K.index<Q))Q=K.index,G=W.close}if(Q===-1||!G)return{index:J,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 g5($,Z){let X=q5($);if(!X)return $;return $.slice(0,X.index)+Z(X.tag,X.attrs)+$.slice(X.index+X.tag.length)}var X7=null;function g8($){if(!X7)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return X7}function Cq($){let Z=g8("onUpdate");if(Z)Z.updateHooks.push($)}function Y7(){return`
148
+ `),Y.set(W,K)}return K(...q)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}var Cq=new $7;class Z7{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,X]of Object.entries($))this.setBudget(Z,X)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,X]of this.budgets.entries())$[Z]=X;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let X=performance.now(),J=Z(),Y=performance.now()-X;return this.recordTime($,Y),this.checkBudget($,Y),J}async timeAsync($,Z){if(!this.enabled)return Z();let X=performance.now(),J=await Z(),Y=performance.now()-X;return this.recordTime($,Y),this.checkBudget($,Y),J}checkBudget($,Z){let X=this.budgets.get($);if(!X)return;let J=Z/X.maxTime*100,Y=X.warnThreshold!==void 0?Z>=X.maxTime*X.warnThreshold&&Z<X.maxTime:!1,Q=Z>=X.maxTime;if(!Y&&!Q)return;let G={label:$,actualTime:Z,budgetTime:X.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:Y};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let U of this.violationHandlers)try{U(G)}catch{}let q=Y?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${X.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${X.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(X.action){case"log":console.log(q);break;case"warn":console.warn(q);break;case"error":console.error(q);break;case"throw":if(Q)throw Error(q);else console.warn(q);break}}recordTime($,Z){let X=this.metrics.get($);if(X)X.count++,X.totalTime+=Z,X.maxTime=Math.max(X.maxTime,Z),X.minTime=Math.min(X.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let X=this.metrics.get($);if(!X)return{};let J=this.budgets.get($);return{count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:J?.maxTime,budgetUtilization:J?X.totalTime/X.count/J.maxTime*100:void 0}}let Z={};for(let[X,J]of this.metrics.entries()){let Y=this.budgets.get(X);Z[X]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Y?.maxTime,budgetUtilization:Y?J.totalTime/J.count/Y.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,X=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else X++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:X}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var C$=null;function h8(){if(!C$)C$=new Z7;return C$}var X7=new Proxy({},{get($,Z){return h8()[Z]}});import pQ from"fs";import R0 from"path";var P$=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],J7=/<body\b([^>]*)>/gi;function q5($){let Z=0,X,J=P$.map(()=>{return});while(Z<$.length){if(X===void 0||X!==null&&X.index<Z)J7.lastIndex=Z,X=J7.exec($);if(!X)return null;let Y=X.index,Q=-1,G=null;for(let U=0;U<P$.length;U++){let W=P$[U],K=J[U];if(K===void 0||K!==null&&K.index<Z)W.open.lastIndex=Z,K=W.open.exec($),J[U]=K;if(!K)continue;if(K.index<Y&&(Q===-1||K.index<Q))Q=K.index,G=W.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 g5($,Z){let X=q5($);if(!X)return $;return $.slice(0,X.index)+Z(X.tag,X.attrs)+$.slice(X.index+X.tag.length)}var Y7=null;function u8($){if(!Y7)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return Y7}function fq($){let Z=u8("onUpdate");if(Z)Z.updateHooks.push($)}function Q7(){return`
149
149
  // STX Lifecycle Runtime
150
150
  (function() {
151
151
  if (typeof window === 'undefined') return;
@@ -490,7 +490,7 @@ else {
490
490
 
491
491
  console.log('[stx] Lifecycle runtime initialized');
492
492
  })();
493
- `}function P$($){return Symbol($)}var Pq=P$("theme"),vq=P$("router"),fq=P$("i18n");import*as Q7 from"crypto";function J7($){let Z=/\$(\w+)\./g,X=[],Y;while((Y=Z.exec($))!==null)if(!X.includes(Y[1]))X.push(Y[1]);return X}function h8(){return`stx-${Q7.randomBytes(4).toString("hex")}`}function u8($){return/\$\w+\./.test($)}function d8($){let Z=[],X=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,J=$;return J=J.replace(Y,(Q,G,q,U)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let W=[],K=!1,z=q,H=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...q.matchAll(H)];for(let V of B){let O=V[0],F=V[1],L=V[2];if(u8(L)){K=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(W.push({attr:F,expr:R,fullMatch:O,originalAttr:F}),J7(R).forEach((N)=>X.add(N)),F==="text")z=z.replace(O,"");else if(F==="class")z=z.replace(O,'class=""');else if(F==="disabled"||F==="hidden")z=z.replace(O,"");else z=z.replace(O,`${F}=""`)}}}if(!K)return Q;let j=z.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=h8(),z=` id="${_}"${z}`;for(let V of W)Z.push({elementId:_,attribute:V.attr,expression:V.expr,stores:J7(V.expr)});return`<${G}${z}${U}`}),{html:J,bindings:Z,stores:X}}function m8($,Z){if($.length===0)return"";let X=Array.from(Z),Y=`
493
+ `}function v$($){return Symbol($)}var xq=v$("theme"),gq=v$("router"),hq=v$("i18n");import*as q7 from"crypto";function G7($){let Z=/\$(\w+)\./g,X=[],J;while((J=Z.exec($))!==null)if(!X.includes(J[1]))X.push(J[1]);return X}function d8(){return`stx-${q7.randomBytes(4).toString("hex")}`}function m8($){return/\$\w+\./.test($)}function l8($){let Z=[],X=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(J,(Q,G,q,U)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let W=[],K=!1,z=q,H=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...q.matchAll(H)];for(let V of B){let O=V[0],F=V[1],L=V[2];if(m8(L)){K=!0;let w=L.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(W.push({attr:F,expr:R,fullMatch:O,originalAttr:F}),G7(R).forEach((N)=>X.add(N)),F==="text")z=z.replace(O,"");else if(F==="class")z=z.replace(O,'class=""');else if(F==="disabled"||F==="hidden")z=z.replace(O,"");else z=z.replace(O,`${F}=""`)}}}if(!K)return Q;let j=z.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=d8(),z=` id="${_}"${z}`;for(let V of W)Z.push({elementId:_,attribute:V.attr,expression:V.expr,stores:G7(V.expr)});return`<${G}${z}${U}`}),{html:Y,bindings:Z,stores:X}}function c8($,Z){if($.length===0)return"";let X=Array.from(Z),J=`
494
494
  <script>
495
495
  (function() {
496
496
  'use strict';
@@ -506,11 +506,11 @@ else {
506
506
  // Store references for expressions
507
507
  // eslint-disable-next-line pickier/no-unused-vars
508
508
  var $state = {};
509
- `;for(let J of X)Y+=` $state.${J} = stores.${J} ? stores.${J}.get() : {};
510
- `;Y+=`
509
+ `;for(let Y of X)J+=` $state.${Y} = stores.${Y} ? stores.${Y}.get() : {};
510
+ `;J+=`
511
511
  // Binding update functions
512
512
  function updateBindings() {
513
- `;for(let J of $){let{elementId:Q,attribute:G,expression:q}=J,U=q.replace(/\$(\w+)\./g,"$state.$1.");if(G==="text")Y+=` (function() {
513
+ `;for(let Y of $){let{elementId:Q,attribute:G,expression:q}=Y,U=q.replace(/\$(\w+)\./g,"$state.$1.");if(G==="text")J+=` (function() {
514
514
  var el = document.getElementById('${Q}');
515
515
  if (el) {
516
516
  try {
@@ -519,7 +519,7 @@ else {
519
519
  catch (e) { console.error('Binding error:', e); }
520
520
  }
521
521
  })();
522
- `;else if(G==="html")Y+=` (function() {
522
+ `;else if(G==="html")J+=` (function() {
523
523
  var el = document.getElementById('${Q}');
524
524
  if (el) {
525
525
  try {
@@ -528,7 +528,7 @@ catch (e) { console.error('Binding error:', e); }
528
528
  catch (e) { console.error('Binding error:', e); }
529
529
  }
530
530
  })();
531
- `;else if(G==="class")Y+=` (function() {
531
+ `;else if(G==="class")J+=` (function() {
532
532
  var el = document.getElementById('${Q}');
533
533
  if (el) {
534
534
  try {
@@ -557,7 +557,7 @@ else {
557
557
  catch (e) { console.error('Binding error:', e); }
558
558
  }
559
559
  })();
560
- `;else if(G==="show")Y+=` (function() {
560
+ `;else if(G==="show")J+=` (function() {
561
561
  var el = document.getElementById('${Q}');
562
562
  if (el) {
563
563
  try {
@@ -566,7 +566,7 @@ catch (e) { console.error('Binding error:', e); }
566
566
  catch (e) { console.error('Binding error:', e); }
567
567
  }
568
568
  })();
569
- `;else if(G==="if")Y+=` (function() {
569
+ `;else if(G==="if")J+=` (function() {
570
570
  var el = document.getElementById('${Q}');
571
571
  if (el) {
572
572
  try {
@@ -575,7 +575,7 @@ catch (e) { console.error('Binding error:', e); }
575
575
  catch (e) { console.error('Binding error:', e); }
576
576
  }
577
577
  })();
578
- `;else Y+=` (function() {
578
+ `;else J+=` (function() {
579
579
  var el = document.getElementById('${Q}');
580
580
  if (el) {
581
581
  try {
@@ -593,7 +593,7 @@ else {
593
593
  catch (e) { console.error('Binding error:', e); }
594
594
  }
595
595
  })();
596
- `}Y+=` }
596
+ `}J+=` }
597
597
 
598
598
  // Subscribe to stores and update on changes. Capture the disposers so
599
599
  // SPA fragment swaps can tear down old bindings before the next page's
@@ -601,16 +601,16 @@ catch (e) { console.error('Binding error:', e); }
601
601
  // using reactive-bindings stacked another subscription on every store,
602
602
  // walking detached DOM forever. See stacksjs/stx#1709.
603
603
  var _disposers = [];
604
- `;for(let J of X)Y+=` if (stores.${J}) {
605
- var _unsub_${J} = stores.${J}.subscribe(function(state) {
606
- $state.${J} = state;
604
+ `;for(let Y of X)J+=` if (stores.${Y}) {
605
+ var _unsub_${Y} = stores.${Y}.subscribe(function(state) {
606
+ $state.${Y} = state;
607
607
  updateBindings();
608
608
  });
609
609
  // store.subscribe() may return the disposer (preferred) or void; both
610
610
  // are tolerated here.
611
- if (typeof _unsub_${J} === 'function') _disposers.push(_unsub_${J});
611
+ if (typeof _unsub_${Y} === 'function') _disposers.push(_unsub_${Y});
612
612
  }
613
- `;return Y+=`
613
+ `;return J+=`
614
614
  // Initial update
615
615
  updateBindings();
616
616
 
@@ -648,10 +648,10 @@ else {
648
648
  }
649
649
  })();
650
650
  </script>
651
- `,Y}function G7($){let{html:Z,bindings:X,stores:Y}=d8($);if(X.length===0)return $;let J=m8(X,Y),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+J+Z.slice(Q);return Z+J}function q7($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return l8(Z);case"google-analytics":return c8(Z);case"plausible":return p8(Z);case"self-hosted":return i8(Z);case"custom":return n8(Z);default:return""}}function l8($){let Z=$.fathom;if(!Z?.siteId)return"";let X=Z.scriptUrl||"https://cdn.usefathom.com/script.js",Y=Z.defer!==!1?" defer":"",J=[`data-site="${y0(Z.siteId)}"`];if(Z.honorDnt)J.push('data-honor-dnt="true"');if(Z.spa)J.push('data-spa="auto"');if(Z.canonical)J.push(`data-canonical="${y0(Z.canonical)}"`);if(Z.auto===!1)J.push('data-auto="false"');return`
651
+ `,J}function U7($){let{html:Z,bindings:X,stores:J}=l8($);if(X.length===0)return $;let Y=c8(X,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function W7($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return p8(Z);case"google-analytics":return i8(Z);case"plausible":return n8(Z);case"self-hosted":return s8(Z);case"custom":return o8(Z);default:return""}}function p8($){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="${S0(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="${S0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
652
652
  <!-- Fathom Analytics -->
653
- <script src="${y0(X)}" ${J.join(" ")}${Y}></script>
654
- `}function c8($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let X=y0(Z.measurementId),Y=Z.debug?`gtag('config', '${X}', { 'debug_mode': true });`:"";return`
653
+ <script src="${S0(X)}" ${Y.join(" ")}${J}></script>
654
+ `}function i8($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let X=S0(Z.measurementId),J=Z.debug?`gtag('config', '${X}', { 'debug_mode': true });`:"";return`
655
655
  <!-- Google Analytics -->
656
656
  <script async src="https://www.googletagmanager.com/gtag/js?id=${X}"></script>
657
657
  <script>
@@ -659,12 +659,12 @@ else {
659
659
  function gtag(){dataLayer.push(arguments);}
660
660
  gtag('js', new Date());
661
661
  gtag('config', '${X}');
662
- ${Y}
662
+ ${J}
663
663
  </script>
664
- `}function p8($){let Z=$.plausible;if(!Z?.domain)return"";let X=Z.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${y0(Z.domain)}"`],J=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")J=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
664
+ `}function n8($){let Z=$.plausible;if(!Z?.domain)return"";let X=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${S0(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`
665
665
  <!-- Plausible Analytics -->
666
- <script defer data-domain="${y0(Z.domain)}" src="${y0(J)}"></script>
667
- `}function i8($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let X=y0(Z.siteId),Y=y0(Z.apiEndpoint),J=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
666
+ <script defer data-domain="${S0(Z.domain)}" src="${S0(Y)}"></script>
667
+ `}function s8($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let X=S0(Z.siteId),J=S0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
668
668
  d.addEventListener('click',function(e){
669
669
  var a=e.target.closest('a');
670
670
  if(a&&a.hostname!==location.hostname){
@@ -672,12 +672,12 @@ else {
672
672
  }
673
673
  });`:"";return`
674
674
  <!-- Self-Hosted Analytics -->
675
- <script data-site="${X}" data-api="${Y}" defer>
675
+ <script data-site="${X}" data-api="${J}" defer>
676
676
  (function(){
677
677
  'use strict';
678
678
  var d=document,w=window,n=navigator,s=d.currentScript;
679
679
  var site=s.dataset.site,api=s.dataset.api;
680
- ${J}
680
+ ${Y}
681
681
  var q=[],sid=Math.random().toString(36).slice(2);
682
682
  function t(e,p){
683
683
  var x=new XMLHttpRequest();
@@ -697,15 +697,15 @@ else {
697
697
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
698
698
  })();
699
699
  </script>
700
- `}function n8($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
700
+ `}function o8($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
701
701
  <!-- Custom Analytics -->
702
702
  <script>
703
703
  ${Z.inlineScript}
704
704
  </script>
705
- `;if(!Z.scriptUrl)return"";let X=[];if(Z.scriptId)X.push(`id="${y0(Z.scriptId)}"`);if(Z.attributes)for(let[J,Q]of Object.entries(Z.attributes))X.push(`${y0(J)}="${y0(Q)}"`);return`
705
+ `;if(!Z.scriptUrl)return"";let X=[];if(Z.scriptId)X.push(`id="${S0(Z.scriptId)}"`);if(Z.attributes)for(let[Y,Q]of Object.entries(Z.attributes))X.push(`${S0(Y)}="${S0(Q)}"`);return`
706
706
  <!-- Custom Analytics -->
707
- <script${X.length>0?` ${X.join(" ")}`:""} src="${y0(Z.scriptUrl)}" defer></script>
708
- `}function U7($,Z){let X=q7(Z);if(!X)return $;if(!$.includes("</head>")){let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+X+$.slice(Y);return $+X}return $.replace("</head>",`${X}</head>`)}function y0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var hq={name:"analytics",hasEndTag:!1,handler:async($,Z,X,Y)=>{let J=X.__stx_config||{};return q7(J)}};var s8={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 W7($){let Z=$.heatmap;if(!Z?.enabled)return"";let X={...s8,...Z};return`
707
+ <script${X.length>0?` ${X.join(" ")}`:""} src="${S0(Z.scriptUrl)}" defer></script>
708
+ `}function K7($,Z){let X=W7(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 S0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var mq={name:"analytics",hasEndTag:!1,handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};return W7(Y)}};var r8={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 z7($){let Z=$.heatmap;if(!Z?.enabled)return"";let X={...r8,...Z};return`
709
709
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
710
710
  <script>
711
711
  (function() {
@@ -1088,7 +1088,7 @@ else {
1088
1088
  };
1089
1089
  })();
1090
1090
  </script>
1091
- `}function K7($,Z){let X=W7(Z);if(!X)return $;let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+X+$.slice(Y);return $+X}var z7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,X,Y)=>{let J=X.__stx_config||{};if(Z.length>0){let Q=o8(Z.join(" "));J.heatmap={...J.heatmap,...Q,enabled:!0}}return W7(J)}};function o8($){let Z={},X=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of X){let[J,Q]=Y.split("="),G=Q?.replace(/["']/g,"");switch(J){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 H7{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((Y)=>Y.type==="scroll"),X=new Map;for(let Y of Z)if(Y.depth!==void 0)X.set(Y.depth,(X.get(Y.depth)||0)+1);return Array.from(X.entries()).map(([Y,J])=>({depth:Y,count:J})).sort((Y,J)=>Y.depth-J.depth)}getZoneStats($){let Z=new Map,X=this.getPageData($);for(let Y of X)if(Y.zone){let J=Z.get(Y.zone)||{clicks:0,hovers:0};if(Y.type==="click")J.clicks++;else if(Y.type==="move")J.hovers++;Z.set(Y.zone,J)}return Z}generateGridData($,Z=20){let X=this.getPageData($),Y=[];for(let Q=0;Q<Z;Q++){Y[Q]=[];for(let G=0;G<Z;G++)Y[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);Y[q][G]+=Q.type==="click"?3:1}let J=0;for(let Q of Y)for(let G of Q)J=Math.max(J,G);return Y.map((Q,G)=>Q.map((q,U)=>({x:U,y:G,intensity:J>0?q/J: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 dq(){return new H7}var r8;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(r8||={});var a8;((Y)=>{Y.In="in";Y.Out="out";Y.Both="both"})(a8||={});var t8;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(t8||={});var r0={duration:300,delay:0,ease:"ease",direction:"both"};function e8($,Z={}){let{duration:X,delay:Y,ease:J,direction:Q,custom:G}={...r0,...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);"}
1091
+ `}function H7($,Z){let X=z7(Z);if(!X)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}var B7={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=a8(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return z7(Y)}};function a8($){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 j7{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,U)=>({x:U,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 cq(){return new j7}var t8;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(t8||={});var e8;((J)=>{J.In="in";J.Out="out";J.Both="both"})(e8||={});var $Z;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})($Z||={});var a0={duration:300,delay:0,ease:"ease",direction:"both"};function ZZ($,Z={}){let{duration:X,delay:J,ease:Y,direction:Q,custom:G}={...a0,...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);"}
1092
1092
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1093
1093
  @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);"}
1094
1094
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1098,7 +1098,7 @@ else {
1098
1098
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1099
1099
  @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);"}
1100
1100
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1101
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function $Z(){return`
1101
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function XZ(){return`
1102
1102
  <script data-stx-scoped data-stx-run="once">
1103
1103
  // Motion preferences handling
1104
1104
  (function() {
@@ -1126,7 +1126,7 @@ else {
1126
1126
  });
1127
1127
  })();
1128
1128
  </script>
1129
- `}function ZZ($){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 XZ($=0.1,Z="0px"){return`
1129
+ `}function JZ($){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 YZ($=0.1,Z="0px"){return`
1130
1130
  <script data-stx-scoped data-stx-run="always">
1131
1131
  // Intersection Observer for scroll animations
1132
1132
  (function() {
@@ -1169,7 +1169,7 @@ else {
1169
1169
  }
1170
1170
  })();
1171
1171
  </script>
1172
- `}function YZ(){return`
1172
+ `}function QZ(){return`
1173
1173
  <style id="stx-animation-base">
1174
1174
  :root {
1175
1175
  --stx-transition-duration: 300ms;
@@ -1284,13 +1284,13 @@ else {
1284
1284
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1285
1285
  }
1286
1286
  </style>
1287
- `}function JZ($,Z,X={}){let{staggerDelay:Y=50,sequence:J=!1}=X;return`
1287
+ `}function GZ($,Z,X={}){let{staggerDelay:J=50,sequence:Y=!1}=X;return`
1288
1288
  <script data-stx-scoped data-stx-run="always">
1289
1289
  // Animation Group: ${$}
1290
1290
  (function() {
1291
1291
  const elements = ${JSON.stringify(Z)};
1292
- const staggerDelay = ${Y};
1293
- const sequence = ${J};
1292
+ const staggerDelay = ${J};
1293
+ const sequence = ${Y};
1294
1294
 
1295
1295
  function animateGroup() {
1296
1296
  elements.forEach((selector, index) => {
@@ -1321,21 +1321,21 @@ else {
1321
1321
  }
1322
1322
  })();
1323
1323
  </script>
1324
- `}var v$={name:"transition",handler:($,Z,X,Y)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let J=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||r0.duration:r0.duration,G=Z.length>2?Z[2]||r0.ease:r0.ease,q=Z.length>3?Number.parseInt(Z[3],10)||r0.delay:r0.delay,U=Z.length>4?Z[4]||r0.direction:r0.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=e8(J,{duration:Q,delay:q,ease:G,direction:U}),z="stx-transition",H="";if(J==="fade")H="stx-fade";else if(J==="slide")H="stx-slide";else if(J==="scale")H="stx-scale";else if(J==="flip")H="stx-flip";else if(J==="rotate")H="stx-rotate";return`<div id="${W}" class="${z} ${H} ${U==="out"?"stx-out":""}"
1325
- 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"},f$={name:"scrollAnimate",handler:($,Z,X,Y)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let J=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,U=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,K=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${U}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(J==="fade")z+=" stx-fade";else if(J==="slide-up"||J==="slide")z+=" stx-from-bottom";else if(J==="slide-down")z+=" stx-from-top";else if(J==="slide-left")z+=" stx-from-right";else if(J==="slide-right")z+=" stx-from-left";else if(J==="scale")z+=" stx-scale";else if(J.includes("-"))z+=` stx-${J}`;else z+=` stx-${J}`;return`<div id="${W}" class="${z}" style="${K}" data-threshold="${q}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},x$={name:"animationGroup",handler:($,Z,X,Y)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let J=Z[0],Q=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=X.staggerDelay||50,q=X.sequence||!0,U=JZ(J,Q,{staggerDelay:G,sequence:q});return`${$}
1326
- ${U}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},g$={name:"motion",handler:($,Z,X,Y)=>{let J=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=$Z();return`<div data-animate="${J?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function j7($,Z,X,Y){let J=$;if(Y.animation?.enabled===!1)return J;let Q=X.includes("test")&&X.includes("animation");if(!ZZ(J)&&!Q)return J;if(!J.includes('<style id="stx-animation-base">')){let q=YZ();J=J.replace("</head>",`${q}
1327
- </head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let U=XZ(),W=J.lastIndexOf("</body>");if(W!==-1)J=J.slice(0,W)+U+`
1328
- `+J.slice(W)}}return J}var B7={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 QZ($,Z){let X=Z.map((Y)=>{let J=Y.offset!==void 0?`${Y.offset*100}%`:"from",Q=Object.entries(Y.properties).map(([G,q])=>`${G}: ${q}`).join("; ");return`${J} { ${Q} }`}).join(`
1324
+ `}var f$={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)||a0.duration:a0.duration,G=Z.length>2?Z[2]||a0.ease:a0.ease,q=Z.length>3?Number.parseInt(Z[3],10)||a0.delay:a0.delay,U=Z.length>4?Z[4]||a0.direction:a0.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=ZZ(Y,{duration:Q,delay:q,ease:G,direction:U}),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="${W}" class="${z} ${H} ${U==="out"?"stx-out":""}"
1325
+ 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"},x$={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,U=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,K=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${U}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="${W}" class="${z}" style="${K}" data-threshold="${q}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},g$={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((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=X.staggerDelay||50,q=X.sequence||!0,U=GZ(Y,Q,{staggerDelay:G,sequence:q});return`${$}
1326
+ ${U}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},h$={name:"motion",handler:($,Z,X,J)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=XZ();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function O7($,Z,X,J){let Y=$;if(J.animation?.enabled===!1)return Y;let Q=X.includes("test")&&X.includes("animation");if(!JZ(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let q=QZ();Y=Y.replace("</head>",`${q}
1327
+ </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let U=YZ(),W=Y.lastIndexOf("</body>");if(W!==-1)Y=Y.slice(0,W)+U+`
1328
+ `+Y.slice(W)}}return Y}var _7={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 qZ($,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(`
1329
1329
  `);return`@keyframes ${$} {
1330
1330
  ${X}
1331
- }`}var GZ={name:"keyframe",hasEndTag:!0,handler:($,Z,X,Y)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",q=Z[3]||"1",U=Z[4]?.replace(/['"`]/g,"")||"normal",W=Z[5]?.replace(/['"`]/g,"")||"forwards",K=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,z=`
1332
- animation-name: ${J};
1331
+ }`}var UZ={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",U=Z[4]?.replace(/['"`]/g,"")||"normal",W=Z[5]?.replace(/['"`]/g,"")||"forwards",K=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,z=`
1332
+ animation-name: ${Y};
1333
1333
  animation-duration: ${Q}ms;
1334
1334
  animation-timing-function: ${G};
1335
1335
  animation-iteration-count: ${q};
1336
1336
  animation-direction: ${U};
1337
1337
  animation-fill-mode: ${W};
1338
- `.trim().replace(/\s+/g," ");return`<div id="${K}" style="${z}">${$}</div>`},description:"Applies a keyframe animation to an element"};function qZ($,Z,X,Y,J){return`
1338
+ `.trim().replace(/\s+/g," ");return`<div id="${K}" style="${z}">${$}</div>`},description:"Applies a keyframe animation to an element"};function WZ($,Z,X,J,Y){return`
1339
1339
  <script data-stx-scoped data-stx-run="always">
1340
1340
  (function() {
1341
1341
  const container = document.getElementById('${$}');
@@ -1343,13 +1343,13 @@ ${U}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
1343
1343
 
1344
1344
  const children = container.querySelectorAll('${Z}');
1345
1345
  children.forEach((child, index) => {
1346
- const delay = ${X} + (index * ${Y});
1346
+ const delay = ${X} + (index * ${J});
1347
1347
  child.style.setProperty('--stx-stagger-delay', delay + 'ms');
1348
1348
  child.style.animationDelay = delay + 'ms';
1349
- child.classList.add('${J}');
1349
+ child.classList.add('${Y}');
1350
1350
  });
1351
1351
  })();
1352
- </script>`}var UZ={name:"stagger",hasEndTag:!0,handler:($,Z,X,Y)=>{let J=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",U=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,W="stx-stagger-item";if(q==="fade")W+=" stx-fade";else if(q==="slide")W+=" stx-from-bottom";else if(q==="scale")W+=" stx-scale";let K=qZ(U,J,G,Q,W);return`${`
1352
+ </script>`}var KZ={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",U=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,W="stx-stagger-item";if(q==="fade")W+=" stx-fade";else if(q==="slide")W+=" stx-from-bottom";else if(q==="scale")W+=" stx-scale";let K=WZ(U,Y,G,Q,W);return`${`
1353
1353
  <style>
1354
1354
  #${U} .stx-stagger-item {
1355
1355
  opacity: 0;
@@ -1359,12 +1359,12 @@ ${U}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
1359
1359
  from { opacity: 0; transform: translateY(10px); }
1360
1360
  to { opacity: 1; transform: translateY(0); }
1361
1361
  }
1362
- </style>`}<div id="${U}" class="stx-stagger-container">${$}</div>${K}`},description:"Applies staggered animations to child elements"};function WZ($){let{stiffness:Z,damping:X}=$,Y=X/(2*Math.sqrt(Z));if(Y<0.5)return"cubic-bezier(0.175, 0.885, 0.32, 1.275)";else if(Y<1)return"cubic-bezier(0.34, 1.56, 0.64, 1)";else return"cubic-bezier(0.25, 0.1, 0.25, 1)"}var KZ={name:"spring",hasEndTag:!0,handler:($,Z,X,Y)=>{let J=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(B7[J])Q=B7[J];else Q={stiffness:Number.parseInt(J,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)}`,U=WZ(Q),W=`
1362
+ </style>`}<div id="${U}" class="stx-stagger-container">${$}</div>${K}`},description:"Applies staggered animations to child elements"};function zZ($){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 HZ={name:"spring",hasEndTag:!0,handler:($,Z,X,J)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(_7[Y])Q=_7[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)}`,U=zZ(Q),W=`
1363
1363
  transition: all ${G}ms ${U};
1364
1364
  --stx-spring-stiffness: ${Q.stiffness};
1365
1365
  --stx-spring-damping: ${Q.damping};
1366
1366
  --stx-spring-mass: ${Q.mass};
1367
- `.trim().replace(/\s+/g," ");return`<div id="${q}" class="stx-spring" style="${W}">${$}</div>`},description:"Applies spring physics animations to an element"};function lq($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
1367
+ `.trim().replace(/\s+/g," ");return`<div id="${q}" class="stx-spring" style="${W}">${$}</div>`},description:"Applies spring physics animations to an element"};function iq($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
1368
1368
  <script data-stx-scoped data-stx-run="always">
1369
1369
  (function() {
1370
1370
  const timeline = ${JSON.stringify($)};
@@ -1401,7 +1401,7 @@ else {
1401
1401
  runTimeline();
1402
1402
  }
1403
1403
  })();
1404
- </script>`}function cq($,Z,X){let Y=QZ($,Z),J=`
1404
+ </script>`}function nq($,Z,X){let J=qZ($,Z),Y=`
1405
1405
  .${$}-animation {
1406
1406
  animation-name: ${$};
1407
1407
  animation-duration: ${X.duration}ms;
@@ -1410,8 +1410,8 @@ else {
1410
1410
  animation-iteration-count: ${X.iterations==="infinite"?"infinite":X.iterations||1};
1411
1411
  animation-direction: ${X.direction||"normal"};
1412
1412
  animation-fill-mode: ${X.fill||"forwards"};
1413
- }`;return`${Y}
1414
- ${J}`}function pq($){let Z=$.trim().split(/\s+/),X={duration:300};for(let Y=0;Y<Z.length;Y++){let J=Z[Y];if(/^\d+(?:ms|s)?$/.test(J)){let Q=Number.parseInt(J,10);if(Y===0)X.duration=J.endsWith("s")&&!J.endsWith("ms")?Q*1000:Q;else X.delay=J.endsWith("s")&&!J.endsWith("ms")?Q*1000:Q}else if(J==="infinite"||/^\d+$/.test(J))X.iterations=J==="infinite"?"infinite":Number.parseInt(J,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(J))X.direction=J;else if(["none","forwards","backwards","both"].includes(J))X.fill=J;else X.easing=J}return X}function iq(){return`
1413
+ }`;return`${J}
1414
+ ${Y}`}function sq($){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 oq(){return`
1415
1415
  <script data-stx-scoped data-stx-run="once">
1416
1416
  window.__stxAnimation = {
1417
1417
  // Registry of animations
@@ -1483,7 +1483,7 @@ else {
1483
1483
  );
1484
1484
  }
1485
1485
  };
1486
- </script>`}function nq($){let Z=$.customDirectives||[];return Z.push(v$),Z.push(x$),Z.push(g$),Z.push(f$),Z.push(GZ),Z.push(UZ),Z.push(KZ),{...$,customDirectives:Z}}function _7($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function O7($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var zZ=0,HZ=0;function V7($,Z){let X=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(X)return X[1];let Y=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function BZ($){let Z=[],X=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=X.exec($))!==null){let[J,Q,G]=Y,q=Y.index,U=V7(G,"x-data");if(!U)continue;let W=`__stx_scope_${zZ++}`,K=V7(G,"x-init"),z=jZ($,Q,q+J.length),H=$.slice(q,z.endIndex),B=_Z(H);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:U,initExpr:K,bindings:[],refs:B})}return Z}function jZ($,Z,X){let Y=1,J=X,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),q=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(Y>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J,q.lastIndex=J;let U=Q.exec($),W=G.exec($),K=q.exec($);if(K&&K.index<(U?.index??1/0)){J=K.index+K[0].length;continue}if(!W)return{endIndex:$.length};if(U&&U.index<W.index)Y++,J=U.index+U[0].length;else{if(Y--,Y===0)return{endIndex:W.index+W[0].length};J=W.index+W[0].length}}return{endIndex:$.length}}function _Z($){let Z=new Map,X=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(X))!==null){let[,Q,G]=J,q=OZ(Q);Z.set(G,q)}return Z}function OZ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${HZ++}`}function VZ(){return`
1486
+ </script>`}function rq($){let Z=$.customDirectives||[];return Z.push(f$),Z.push(g$),Z.push(h$),Z.push(x$),Z.push(UZ),Z.push(KZ),Z.push(HZ),{...$,customDirectives:Z}}function V7($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function F7($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var BZ=0,jZ=0;function L7($,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 _Z($){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,U=L7(G,"x-data");if(!U)continue;let W=`__stx_scope_${BZ++}`,K=L7(G,"x-init"),z=OZ($,Q,q+Y.length),H=$.slice(q,z.endIndex),B=VZ(H);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:U,initExpr:K,bindings:[],refs:B})}return Z}function OZ($,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 U=Q.exec($),W=G.exec($),K=q.exec($);if(K&&K.index<(U?.index??1/0)){Y=K.index+K[0].length;continue}if(!W)return{endIndex:$.length};if(U&&U.index<W.index)J++,Y=U.index+U[0].length;else{if(J--,J===0)return{endIndex:W.index+W[0].length};Y=W.index+W[0].length}}return{endIndex:$.length}}function VZ($){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=FZ(Q);Z.set(G,q)}return Z}function FZ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${jZ++}`}function LZ(){return`
1487
1487
  // STX Reactive Runtime - x-cloak and transition CSS
1488
1488
  (function() {
1489
1489
  var style = document.createElement('style');
@@ -1690,22 +1690,22 @@ window.__stx_reactive = (function() {
1690
1690
 
1691
1691
  return { initScope: initScope, reactive: reactive };
1692
1692
  })();
1693
- `}function F7($,Z){let X=$.replace(/\{!!([\s\S]*?)!!\}/g,(q,U)=>{try{let W=b0(U,Z,!0);if(W===void 0)return q;return String(W)}catch{return q}}),Y="",J=0,Q=null;while(J<X.length){let q=X[J];if(Q&&q==="\\"){Y+=q+(X[J+1]??""),J+=2;continue}if(q==="{"&&X[J+1]==="{"){let U=X.indexOf("}}",J+2);if(U!==-1){let W=X.slice(J,U+2);Y+=G(X.slice(J+2,U),W,Q),J=U+2;continue}}if(Q){if(q===Q)Q=null}else if(q==="'"||q==='"'||q==="`")Q=q;Y+=q,J++}return Y;function G(q,U,W){let K;try{K=b0(q,Z,!0)}catch{return U}if(K===void 0)return U;if(W){let z=String(K).replace(/\\/g,"\\\\").replace(new RegExp(W==="`"?"`":W,"g"),`\\${W}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return W==="`"?z.replace(/\$\{/g,"\\${"):z}if(typeof K==="string"){let z=K.trim();if(z.startsWith("{")&&z.endsWith("}")||z.startsWith("[")&&z.endsWith("]"))try{return JSON.parse(z),z}catch{}}return JSON.stringify(K)}}function FZ($,Z){if($.length===0)return"";let X=$.map((Y)=>{let J=JSON.stringify(Object.fromEntries(Y.refs)),Q=F7(Y.stateExpr,Z),G=Y.initExpr?F7(Y.initExpr,Z):null,q=JSON.stringify(Q),U=G?JSON.stringify(G):"null";return`
1693
+ `}function w7($,Z){let X=$.replace(/\{!!([\s\S]*?)!!\}/g,(q,U)=>{try{let W=y0(U,Z,!0);if(W===void 0)return q;return String(W)}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 U=X.indexOf("}}",Y+2);if(U!==-1){let W=X.slice(Y,U+2);J+=G(X.slice(Y+2,U),W,Q),Y=U+2;continue}}if(Q){if(q===Q)Q=null}else if(q==="'"||q==='"'||q==="`")Q=q;J+=q,Y++}return J;function G(q,U,W){let K;try{K=y0(q,Z,!0)}catch{return U}if(K===void 0)return U;if(W){let z=String(K).replace(/\\/g,"\\\\").replace(new RegExp(W==="`"?"`":W,"g"),`\\${W}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return W==="`"?z.replace(/\$\{/g,"\\${"):z}if(typeof K==="string"){let z=K.trim();if(z.startsWith("{")&&z.endsWith("}")||z.startsWith("[")&&z.endsWith("]"))try{return JSON.parse(z),z}catch{}}return JSON.stringify(K)}}function wZ($,Z){if($.length===0)return"";let X=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),Q=w7(J.stateExpr,Z),G=J.initExpr?w7(J.initExpr,Z):null,q=JSON.stringify(Q),U=G?JSON.stringify(G):"null";return`
1694
1694
  (function() {
1695
- var scopeEl = document.querySelector('${Y.selector}');
1695
+ var scopeEl = document.querySelector('${J.selector}');
1696
1696
  if (!scopeEl) return;
1697
- var refs = ${J};
1697
+ var refs = ${Y};
1698
1698
  __stx_reactive.initScope(scopeEl, ${q}, [], refs, ${U});
1699
1699
  })();`}).join(`
1700
1700
  `);return`
1701
1701
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
1702
- ${VZ()}
1702
+ ${LZ()}
1703
1703
  ${X}
1704
- </script>`}function L7($,Z,X){if(!wZ($))return $;let Y=BZ($);if(Y.length===0)return $;let J=LZ($,Y),Q=FZ(Y,Z),G=J.lastIndexOf("</body>");if(G!==-1)J=J.slice(0,G)+Q+`
1705
- `+J.slice(G);else J+=Q;return J}function LZ($,Z){let X=0,Y=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,Q,G)=>{let q=Z[X++];if(!q)return J;let U=/data-stx-scope="([^"]*)"/.exec(G);if(U)return q.id=U[1],q.selector=`[data-stx-scope="${q.id}"]`,J;return`<${Q} data-stx-scope="${q.id}"${G}>`});return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),Y=Y.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),Y}function wZ($){return/x-data\s*=\s*["']/.test($)}import yX from"fs";import W3 from"path";import{createHighlighter as SX}from"ts-syntax-highlighter";import a5 from"fs";import S0 from"path";import{loadConfigWithResult as MX}from"bunfig";U5();async function RZ($,Z,X,Y){let J=Z[0]?.replace(/['"]/g,"")||"main",Q=h$();if(J!=="main")Q=Q.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${Q}</script>`}var w7={name:"stxRouter",handler:RZ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Q1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function R7($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function D7($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,X=$.match(Z);if(!X)return{data:{},content:$.trim()};let Y=X[1],J=$.slice(X[0].length),Q={};for(let G of Y.split(`
1706
- `)){let q=G.trim();if(!q||q.startsWith("#"))continue;let U=q.indexOf(":");if(U===-1)continue;let W=q.slice(0,U).trim(),K=q.slice(U+1).trim();if(typeof K==="string"){if(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'"))K=K.slice(1,-1);else if(K.startsWith("[")&&K.endsWith("]"))try{K=JSON.parse(K)}catch{}else if(K==="true")K=!0;else if(K==="false")K=!1;else if(/^-?\d+(?:\.\d+)?$/.test(K))K=Number(K)}Q[W]=K}return{data:Q,content:J.trim()}}function W5($,Z={}){let{gfm:X=!0,breaks:Y=!1}=Z,J=$,Q=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(K,z,H)=>{let B=Q.length,j=z?` class="language-${Q1(z)}"`:"";return Q.push(`<pre><code${j}>${Q1(H.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),J=J.replace(/`([^`]*)`/g,(K,z)=>`<code>${Q1(z)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),X)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(K,z,H)=>{return`<img src="${R7(H)?Q1(H):""}" alt="${Q1(z)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,z,H)=>{return`<a href="${R7(H)?Q1(H):""}">${z}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
1707
- `),J=J.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),J=J.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),J=J.replace(/<\/ul>\n<ul>/g,""),J=J.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),J=J.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),J=J.replace(/<\/ol>\n<ol>/g,""),J=J.replace(/<li data-ul>/g,"<li>"),J=J.replace(/<li data-ol>/g,"<li>"),X)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(K,z,H)=>{let j=`<tr>${z.split("|").map((V)=>V.trim()).filter(Boolean).map((V)=>`<th>${Q1(V)}</th>`).join("")}</tr>`,_=H.trim().split(`
1708
- `).map((V)=>{return`<tr>${V.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<td>${Q1(F)}</td>`).join("")}</tr>`}).join(`
1704
+ </script>`}function R7($,Z,X){if(!DZ($))return $;let J=_Z($);if(J.length===0)return $;let Y=RZ($,J),Q=wZ(J,Z),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
1705
+ `+Y.slice(G);else Y+=Q;return Y}function RZ($,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 U=/data-stx-scope="([^"]*)"/.exec(G);if(U)return q.id=U[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 DZ($){return/x-data\s*=\s*["']/.test($)}import PX from"fs";import z3 from"path";import{createHighlighter as vX}from"ts-syntax-highlighter";import a5 from"fs";import N0 from"path";import{loadConfigWithResult as IX}from"bunfig";U5();async function NZ($,Z,X,J){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=u$();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var D7={name:"stxRouter",handler:NZ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function G1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function N7($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function A7($){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(`
1706
+ `)){let q=G.trim();if(!q||q.startsWith("#"))continue;let U=q.indexOf(":");if(U===-1)continue;let W=q.slice(0,U).trim(),K=q.slice(U+1).trim();if(typeof K==="string"){if(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'"))K=K.slice(1,-1);else if(K.startsWith("[")&&K.endsWith("]"))try{K=JSON.parse(K)}catch{}else if(K==="true")K=!0;else if(K==="false")K=!1;else if(/^-?\d+(?:\.\d+)?$/.test(K))K=Number(K)}Q[W]=K}return{data:Q,content:Y.trim()}}function W5($,Z={}){let{gfm:X=!0,breaks:J=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(K,z,H)=>{let B=Q.length,j=z?` class="language-${G1(z)}"`:"";return Q.push(`<pre><code${j}>${G1(H.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),Y=Y.replace(/`([^`]*)`/g,(K,z)=>`<code>${G1(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,(K,z,H)=>{return`<img src="${N7(H)?G1(H):""}" alt="${G1(z)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,z,H)=>{return`<a href="${N7(H)?G1(H):""}">${z}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
1707
+ `),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,(K,z,H)=>{let j=`<tr>${z.split("|").map((V)=>V.trim()).filter(Boolean).map((V)=>`<th>${G1(V)}</th>`).join("")}</tr>`,_=H.trim().split(`
1708
+ `).map((V)=>{return`<tr>${V.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<td>${G1(F)}</td>`).join("")}</tr>`}).join(`
1709
1709
  `);return`<table>
1710
1710
  <thead>
1711
1711
  ${j}
@@ -1713,16 +1713,16 @@ ${j}
1713
1713
  <tbody>
1714
1714
  ${_}
1715
1715
  </tbody>
1716
- </table>`});if(X)J=J.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),J=J.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=J.split(`
1717
- `),q=[],U=!1,W=[];for(let K of G){let z=K.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(U&&W.length>0)q.push(`<p>${W.join(Y?`<br />
1716
+ </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(`
1717
+ `),q=[],U=!1,W=[];for(let K of G){let z=K.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(U&&W.length>0)q.push(`<p>${W.join(J?`<br />
1718
1718
  `:`
1719
- `)}</p>`),W=[],U=!1;q.push(K)}else U=!0,W.push(z)}if(U&&W.length>0)q.push(`<p>${W.join(Y?`<br />
1719
+ `)}</p>`),W=[],U=!1;q.push(K)}else U=!0,W.push(z)}if(U&&W.length>0)q.push(`<p>${W.join(J?`<br />
1720
1720
  `:`
1721
- `)}</p>`);if(J=q.join(`
1722
- `),Y)J=J.replace(/\n/g,`<br />
1723
- `);for(let K=0;K<Q.length;K++)J=J.replace(`\x00CODEBLOCK${K}\x00`,Q[K]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}async function N7($,Z,X=""){let Y=$,J=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let q=G.index,U=G[0].match(/@markdown\(([^)]*)\)/),W=U?U[1]:"",K=q+G[0].length,z=1,H=K,B=-1;while(z>0&&H<$.length){let V=$.indexOf("@markdown",H),O=$.indexOf("@endmarkdown",H);if(O===-1)break;if(V!==-1&&V<O&&V!==q){let F=$[V+9];if(F==="("||F===`
1724
- `||F==="\r"||F===" "||F===void 0)z++;H=V+9}else{if(z--,z===0){B=O;break}H=O+12}}if(B===-1)continue;let j=$.slice(K,B),_=$.slice(q,B+12);J.push({fullMatch:_,options:W,content:j,index:q}),Q.lastIndex=B+12}for(let{fullMatch:q,options:U,content:W,index:K}of J)try{let z={};if(U)U.split(",").forEach((j)=>{let _=j.trim();if(_)z[_]=!0});let H={gfm:z.gfm??!0,breaks:z.breaks??!1},B=W5(W.trim(),H);Y=Y.split(q).join(B)}catch(z){let H=z instanceof Error?z.message:String(z),B=W0("Markdown Directive",`Error processing markdown: ${H}`,X,$,K,q);Y=Y.split(q).join(B)}return Y}async function A7($,Z,X,Y){let J={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")J.breaks=!0;if(G==="no-gfm")J.gfm=!1}),W5($.trim(),J)}var V1=[320,480,640,768,1024,1280,1536,1920,2560],M7=[1,1.5,2,3],f1=["avif","webp","jpeg"],T7={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},DZ={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function K5($,Z=V1,X={},Y){return Z.sort((J,Q)=>J-Q).map((J)=>{return`${G1($,{...X,w:J,fm:Y})} ${J}w`}).join(", ")}function qU($,Z=320,X=2560,Y=0.08,J={},Q){let G=NZ(Z,X,Y);return K5($,G,J,Q)}function NZ($,Z,X=0.08){let Y=[],J=$;while(J<Z)Y.push(Math.round(J)),J*=1+X*2;if(Y[Y.length-1]!==Z)Y.push(Z);return Y}function u$($,Z,X=M7,Y={},J){return X.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${G1($,{...Y,w:G,dpr:Q,fm:J})} ${Q}x`}).join(", ")}function UU($,Z,X=M7,Y=80,J={},Q){let G={1:Y,1.5:Math.round(Y*0.9),2:Math.round(Y*0.8),3:Math.round(Y*0.7),4:Math.round(Y*0.6),5:Math.round(Y*0.5)};return X.sort((q,U)=>q-U).map((q)=>{let U=Math.round(Z*q),W=G[q]||Math.round(Y*Math.max(0.5,1-q*0.1));return`${G1($,{...J,w:U,q:W,dpr:q,fm:Q})} ${q}x`}).join(", ")}function d$($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let Y=Object.entries($).map(([J,Q])=>{let G=/^\d+$/.test(J)?`${J}px`:J;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((J,Q)=>J.numericBp-Q.numericBp).map(({bp:J,size:Q})=>`(max-width: ${J}) ${Q}`);return Y.push(Z),Y.join(", ")}function WU($,Z="100vw"){if(!$||$.length===0)return Z;let Y=[...$].sort((J,Q)=>(J.maxWidth||0)-(Q.maxWidth||0)).filter((J)=>J.maxWidth).map((J)=>`(max-width: ${J.maxWidth}px) ${J.imageWidth}`);return Y.push(Z),Y.join(", ")}var KU={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 G1($,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 Y=X.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),J=$.includes("?")?"&":"?";return`${$}${J}${Y}`}function zU($){let[Z,X]=$.split("?"),Y={};if(X)new URLSearchParams(X).forEach((Q,G)=>{if(/^\d+$/.test(Q))Y[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))Y[G]=Number.parseFloat(Q);else if(Q==="true")Y[G]=!0;else if(Q==="false")Y[G]=!1;else Y[G]=Q});return{src:Z,params:Y}}function HU($){let{src:Z,widths:X,dprValues:Y,fixedWidth:J,formats:Q=f1,baseUrl:G="",params:q={}}=$,U=[];for(let W of Q){let K,z;if(J!==void 0&&Y)K=u$(Z,J,Y,q,W),z=Y.map((H)=>({path:"",url:G1(Z,{...q,w:Math.round(J*H),fm:W}),width:Math.round(J*H),height:0,format:W,size:0,dpr:H}));else{let H=X||V1;K=K5(Z,H,q,W),z=H.map((B)=>({path:"",url:G1(Z,{...q,w:B,fm:W}),width:B,height:0,format:W,size:0}))}U.push({srcset:K,format:W,mimeType:T7[W],variants:z})}return U}function BU($,Z="100vw"){return $.map(({srcset:X,mimeType:Y})=>`<source type="${Y}" srcset="${X}" sizes="${Z}" />`).join(`
1725
- `)}function jU($,Z){if($.length===0)return;let X=[...$].sort((J,Q)=>J.width-Q.width),Y=X.find((J)=>J.width>=Z);if(Y)return Y;return X[X.length-1]}function m$($){return T7[$]||"application/octet-stream"}function _U($){return DZ[$]||$}function OU($){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 AZ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},l$=`
1721
+ `)}</p>`);if(Y=q.join(`
1722
+ `),J)Y=Y.replace(/\n/g,`<br />
1723
+ `);for(let K=0;K<Q.length;K++)Y=Y.replace(`\x00CODEBLOCK${K}\x00`,Q[K]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function M7($,Z,X=""){let J=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let q=G.index,U=G[0].match(/@markdown\(([^)]*)\)/),W=U?U[1]:"",K=q+G[0].length,z=1,H=K,B=-1;while(z>0&&H<$.length){let V=$.indexOf("@markdown",H),O=$.indexOf("@endmarkdown",H);if(O===-1)break;if(V!==-1&&V<O&&V!==q){let F=$[V+9];if(F==="("||F===`
1724
+ `||F==="\r"||F===" "||F===void 0)z++;H=V+9}else{if(z--,z===0){B=O;break}H=O+12}}if(B===-1)continue;let j=$.slice(K,B),_=$.slice(q,B+12);Y.push({fullMatch:_,options:W,content:j,index:q}),Q.lastIndex=B+12}for(let{fullMatch:q,options:U,content:W,index:K}of Y)try{let z={};if(U)U.split(",").forEach((j)=>{let _=j.trim();if(_)z[_]=!0});let H={gfm:z.gfm??!0,breaks:z.breaks??!1},B=W5(W.trim(),H);J=J.split(q).join(B)}catch(z){let H=z instanceof Error?z.message:String(z),B=W0("Markdown Directive",`Error processing markdown: ${H}`,X,$,K,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}),W5($.trim(),Y)}var V1=[320,480,640,768,1024,1280,1536,1920,2560],I7=[1,1.5,2,3],f1=["avif","webp","jpeg"],k7={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},AZ={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function K5($,Z=V1,X={},J){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${q1($,{...X,w:Y,fm:J})} ${Y}w`}).join(", ")}function KU($,Z=320,X=2560,J=0.08,Y={},Q){let G=MZ(Z,X,J);return K5($,G,Y,Q)}function MZ($,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 d$($,Z,X=I7,J={},Y){return X.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${q1($,{...J,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function zU($,Z,X=I7,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,U)=>q-U).map((q)=>{let U=Math.round(Z*q),W=G[q]||Math.round(J*Math.max(0.5,1-q*0.1));return`${q1($,{...Y,w:U,q:W,dpr:q,fm:Q})} ${q}x`}).join(", ")}function m$($,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 HU($,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 BU={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"};function q1($,Z={}){let 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 jU($){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 _U($){let{src:Z,widths:X,dprValues:J,fixedWidth:Y,formats:Q=f1,baseUrl:G="",params:q={}}=$,U=[];for(let W of Q){let K,z;if(Y!==void 0&&J)K=d$(Z,Y,J,q,W),z=J.map((H)=>({path:"",url:q1(Z,{...q,w:Math.round(Y*H),fm:W}),width:Math.round(Y*H),height:0,format:W,size:0,dpr:H}));else{let H=X||V1;K=K5(Z,H,q,W),z=H.map((B)=>({path:"",url:q1(Z,{...q,w:B,fm:W}),width:B,height:0,format:W,size:0}))}U.push({srcset:K,format:W,mimeType:k7[W],variants:z})}return U}function OU($,Z="100vw"){return $.map(({srcset:X,mimeType:J})=>`<source type="${J}" srcset="${X}" sizes="${Z}" />`).join(`
1725
+ `)}function VU($,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 l$($){return k7[$]||"application/octet-stream"}function FU($){return AZ[$]||$}function LU($){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 TZ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},c$=`
1726
1726
  .stx-img-placeholder {
1727
1727
  position: relative;
1728
1728
  overflow: hidden;
@@ -1751,12 +1751,12 @@ ${_}
1751
1751
  filter: blur(0);
1752
1752
  transform: scale(1);
1753
1753
  }
1754
- `.trim();async function c$(){try{return await import("ts-images")}catch{return null}}async function I7($,Z={}){let X={...AZ,...Z},Y=await c$();if(Y)try{return await MZ($,X,Y)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return k7($,X)}async function MZ($,Z,X){let{generatePlaceholder:Y,generateThumbHash:J}=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 J($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let q=await Y($,{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 k7($,Z){let X=Z.width||20,Y=Z.height||X,J="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${Y}" viewBox="0 0 ${X} ${Y}"><rect fill="#e5e7eb" width="${X}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:X,height:Y,aspectRatio:X/Y,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function FU($){let Z=await c$();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await k7($,{strategy:"thumbhash",width:32,height:32})).dataURL}function LU($){let Z=$[0]|$[1]<<8|$[2]<<16,X=(Z&63)/63,Y=(Z>>6&63)/31.5-1,J=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,q=$[3]|$[4]<<8,U=(q>>3&63)/63,W=(q>>9&63)/63,K=q>>15!==0,z=Math.max(3,K?G?5:7:G?5:7),H=Math.max(3,K?G?5:7:G?5:7),B=32,j=32,_=Math.max(0,Math.min(255,Math.round((X+Y)*255))),V=Math.max(0,Math.min(255,Math.round(X*255))),O=Math.max(0,Math.min(255,Math.round((X-Y)*255))),F=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1754
+ `.trim();async function p$(){try{return await import("ts-images")}catch{return null}}async function E7($,Z={}){let X={...TZ,...Z},J=await p$();if(J)try{return await IZ($,X,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return b7($,X)}async function IZ($,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 b7($,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 RU($){let Z=await p$();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await b7($,{strategy:"thumbhash",width:32,height:32})).dataURL}function DU($){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,U=(q>>3&63)/63,W=(q>>9&63)/63,K=q>>15!==0,z=Math.max(3,K?G?5:7:G?5:7),H=Math.max(3,K?G?5:7:G?5:7),B=32,j=32,_=Math.max(0,Math.min(255,Math.round((X+J)*255))),V=Math.max(0,Math.min(255,Math.round(X*255))),O=Math.max(0,Math.min(255,Math.round((X-J)*255))),F=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1755
1755
  <rect fill="rgb(${_},${V},${O})" width="32" height="32"/>
1756
- </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(F)}`}async function wU($,Z=20,X=50){return I7($,{strategy:"blur",width:Z,quality:X,blurLevel:40})}async function RU($){let Z=await c$();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function DU($,Z=1,X=1){let Y=`<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(Y)}`}function E7($,Z,X={}){let Y=X.transitionDuration||300,J=X.easing||"ease-out";return`
1756
+ </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(F)}`}async function NU($,Z=20,X=50){return E7($,{strategy:"blur",width:Z,quality:X,blurLevel:40})}async function AU($){let Z=await p$();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function MU($,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 y7($,Z,X={}){let J=X.transitionDuration||300,Y=X.easing||"ease-out";return`
1757
1757
  #${$} {
1758
- --stx-img-transition-duration: ${Y}ms;
1759
- --stx-img-transition-easing: ${J};
1758
+ --stx-img-transition-duration: ${J}ms;
1759
+ --stx-img-transition-easing: ${Y};
1760
1760
  background-image: url('${Z.dataURL}');
1761
1761
  background-size: cover;
1762
1762
  background-position: center;
@@ -1770,8 +1770,8 @@ ${_}
1770
1770
  #${$}.stx-img-loaded img {
1771
1771
  opacity: 1;
1772
1772
  }
1773
- `.trim()}function NU($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var x1=new Map;async function b7($,Z={}){let X=`${$}:${JSON.stringify(Z)}`;if(x1.has(X))return x1.get(X);let Y=await I7($,Z);return x1.set(X,Y),Y}function AU(){x1.clear()}function MU(){return{size:x1.size,keys:Array.from(x1.keys())}}async function TZ(){try{return await import("./chunk-5n0dt838.js")}catch($){if(!y7)console.warn("[stx-media] Image processor not available, some features disabled:",$),y7=!0;return null}}var y7=!1,p$=80,h5="async",u5="lazy",S7=!1;async function z5($,Z={}){let X=Z,Y=$;if(Y.process&&!Y.skipOptimization){if(X.tsImagesConfig?.enabled&&!X.isDev)return yZ(Y,X)}if(X.processedResult?.processed)return s$($,X.processedResult,Z);if(X.responsiveVariants)return v7($,X.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:q,sizes:U,widths:W=V1,dpr:K,formats:z=f1,quality:H=p$,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:V=!0,priority:O=!1,loading:F=O?"eager":u5,decoding:L=h5,fetchpriority:w,objectFit:R,objectPosition:D,crossorigin:N,referrerpolicy:T}=$,A=$.class,M=$.style,k=$.id,I=$.data||{},{isDev:y=!1,baseUrl:E=""}=Z;if(y&&!Z.optimize)return EZ($);let b,C,x=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!O)try{b=await b7(J,{strategy:j,..._}),C=E7(x,b,_)}catch{}let f=K!==void 0&&G!==void 0,n;if(f)n=kZ($,x,b,Z);else n=await IZ($,x,b,Z);let m;if(O){let M0=z.includes("webp")?"webp":z[0],g0=K5(J,W,{...B,q:H},M0),t=typeof U==="object"?d$(U):U||"100vw";m=`<link rel="preload" as="image" imagesrcset="${g0}" imagesizes="${t}" />`}let V0=[];if(!S7&&j!=="none")V0.push(l$),S7=!0;if(C)V0.push(C);let A0=V?P7(x):void 0;return{html:n,preloadLink:m,css:V0.length>0?V0.join(`
1774
- `):void 0,script:A0}}async function IZ($,Z,X,Y){let{src:J,alt:Q,width:G,height:q,sizes:U,widths:W=V1,formats:K=f1,quality:z=p$,params:H={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":u5,decoding:V=h5,fetchpriority:O,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:R}=$,D=$.class,N=$.style,T=$.data||{},A=typeof U==="object"?d$(U):U||"100vw",M=[];for(let y of K){let E=K5(J,W,{...H,q:z},y),b=m$(y);if(B&&!j)M.push(` <source type="${b}" data-srcset="${E}" data-sizes="${A}" />`);else M.push(` <source type="${b}" srcset="${E}" sizes="${A}" />`)}let k=i$({src:G1(J,{...H,q:z}),alt:Q,width:G,height:q,loading:j?void 0:_,decoding:V,fetchpriority:j?"high":O,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:R,className:C7(D,X),style:n$(N,F,L,X),lazy:B&&!j,data:T}),I;if(X){let y=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
1773
+ `.trim()}function TU($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var x1=new Map;async function S7($,Z={}){let X=`${$}:${JSON.stringify(Z)}`;if(x1.has(X))return x1.get(X);let J=await E7($,Z);return x1.set(X,J),J}function IU(){x1.clear()}function kU(){return{size:x1.size,keys:Array.from(x1.keys())}}async function kZ(){try{return await import("./chunk-5n0dt838.js")}catch($){if(!C7)console.warn("[stx-media] Image processor not available, some features disabled:",$),C7=!0;return null}}var C7=!1,i$=80,h5="async",u5="lazy",P7=!1;async function z5($,Z={}){let X=Z,J=$;if(J.process&&!J.skipOptimization){if(X.tsImagesConfig?.enabled&&!X.isDev)return CZ(J,X)}if(X.processedResult?.processed)return o$($,X.processedResult,Z);if(X.responsiveVariants)return x7($,X.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:q,sizes:U,widths:W=V1,dpr:K,formats:z=f1,quality:H=i$,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:V=!0,priority:O=!1,loading:F=O?"eager":u5,decoding:L=h5,fetchpriority:w,objectFit:R,objectPosition:D,crossorigin:N,referrerpolicy:T}=$,A=$.class,M=$.style,k=$.id,I=$.data||{},{isDev:y=!1,baseUrl:E=""}=Z;if(y&&!Z.optimize)return yZ($);let b,C,x=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!O)try{b=await S7(Y,{strategy:j,..._}),C=y7(x,b,_)}catch{}let f=K!==void 0&&G!==void 0,n;if(f)n=bZ($,x,b,Z);else n=await EZ($,x,b,Z);let m;if(O){let T0=z.includes("webp")?"webp":z[0],h0=K5(Y,W,{...B,q:H},T0),t=typeof U==="object"?m$(U):U||"100vw";m=`<link rel="preload" as="image" imagesrcset="${h0}" imagesizes="${t}" />`}let V0=[];if(!P7&&j!=="none")V0.push(c$),P7=!0;if(C)V0.push(C);let M0=V?f7(x):void 0;return{html:n,preloadLink:m,css:V0.length>0?V0.join(`
1774
+ `):void 0,script:M0}}async function EZ($,Z,X,J){let{src:Y,alt:Q,width:G,height:q,sizes:U,widths:W=V1,formats:K=f1,quality:z=i$,params:H={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":u5,decoding:V=h5,fetchpriority:O,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:R}=$,D=$.class,N=$.style,T=$.data||{},A=typeof U==="object"?m$(U):U||"100vw",M=[];for(let y of K){let E=K5(Y,W,{...H,q:z},y),b=l$(y);if(B&&!j)M.push(` <source type="${b}" data-srcset="${E}" data-sizes="${A}" />`);else M.push(` <source type="${b}" srcset="${E}" sizes="${A}" />`)}let k=n$({src:q1(Y,{...H,q:z}),alt:Q,width:G,height:q,loading:j?void 0:_,decoding:V,fetchpriority:j?"high":O,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:R,className:v7(D,X),style:s$(N,F,L,X),lazy:B&&!j,data:T}),I;if(X){let y=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
1775
1775
  <picture>
1776
1776
  ${M.join(`
1777
1777
  `)}
@@ -1781,9 +1781,9 @@ ${M.join(`
1781
1781
  ${M.join(`
1782
1782
  `)}
1783
1783
  <img ${k} />
1784
- </picture>`;return I}function kZ($,Z,X,Y){let{src:J,alt:Q,width:G,height:q,dpr:U=[1,2,3],quality:W=p$,params:K={},lazy:z=!0,priority:H=!1,loading:B=H?"eager":u5,decoding:j=h5,fetchpriority:_,objectFit:V,objectPosition:O,crossorigin:F,referrerpolicy:L}=$,w=$.class,R=$.style,D=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=u$(J,N,U,{...K,q:W}),A=i$({src:G1(J,{...K,w:N,q:W}),alt:Q,width:G,height:q,loading:H?void 0:B,decoding:j,fetchpriority:H?"high":_,objectFit:V,objectPosition:O,crossorigin:F,referrerpolicy:L,className:C7(w,X),style:n$(R,V,O,X),lazy:z&&!H,data:D}),M=z&&!H?`data-srcset="${T}"`:`srcset="${T}"`;if(X){let k=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
1784
+ </picture>`;return I}function bZ($,Z,X,J){let{src:Y,alt:Q,width:G,height:q,dpr:U=[1,2,3],quality:W=i$,params:K={},lazy:z=!0,priority:H=!1,loading:B=H?"eager":u5,decoding:j=h5,fetchpriority:_,objectFit:V,objectPosition:O,crossorigin:F,referrerpolicy:L}=$,w=$.class,R=$.style,D=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=d$(Y,N,U,{...K,q:W}),A=n$({src:q1(Y,{...K,w:N,q:W}),alt:Q,width:G,height:q,loading:H?void 0:B,decoding:j,fetchpriority:H?"high":_,objectFit:V,objectPosition:O,crossorigin:F,referrerpolicy:L,className:v7(w,X),style:s$(R,V,O,X),lazy:z&&!H,data:D}),M=z&&!H?`data-srcset="${T}"`:`srcset="${T}"`;if(X){let k=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
1785
1785
  <img ${A} ${M} />
1786
- </div>`}return`<img ${Z?`id="${Z}" `:""}${A} ${M} />`}function EZ($){let{src:Z,alt:X,width:Y,height:J,loading:Q=u5,decoding:G=h5,fetchpriority:q,objectFit:U,objectPosition:W,crossorigin:K,referrerpolicy:z,priority:H=!1}=$,B=$.class,j=$.style,_=$.id,V=$.data||{};return{html:`<img ${i$({src:Z,alt:X,width:Y,height:J,loading:H?"eager":Q,decoding:G,fetchpriority:H?"high":q,objectFit:U,objectPosition:W,crossorigin:K,referrerpolicy:z,className:B,style:n$(j,U,W),id:_,data:V})} />`}}function i$($){let Z=[];if($.lazy)Z.push(`data-src="${h0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${h0($.src)}"`);if(Z.push(`alt="${h0($.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="${h0($.className)}"`);if($.style)Z.push(`style="${h0($.style)}"`);if($.id)Z.push(`id="${h0($.id)}"`);if($.data)for(let[X,Y]of Object.entries($.data))Z.push(`data-${X}="${h0(Y)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function C7($,Z){let X=[];if($)X.push($);if(Z)X.push("stx-img-blur");return X.join(" ")||""}function n$($,Z,X,Y){let J=[];if(Z)J.push(`object-fit: ${Z}`);if(X)J.push(`object-position: ${X}`);if(Y)J.push("opacity: 0; transition: opacity 300ms ease-out");if($)J.push($);return J.join("; ")}function h0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function P7($){return`
1786
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${A} ${M} />`}function yZ($){let{src:Z,alt:X,width:J,height:Y,loading:Q=u5,decoding:G=h5,fetchpriority:q,objectFit:U,objectPosition:W,crossorigin:K,referrerpolicy:z,priority:H=!1}=$,B=$.class,j=$.style,_=$.id,V=$.data||{};return{html:`<img ${n$({src:Z,alt:X,width:J,height:Y,loading:H?"eager":Q,decoding:G,fetchpriority:H?"high":q,objectFit:U,objectPosition:W,crossorigin:K,referrerpolicy:z,className:B,style:s$(j,U,W),id:_,data:V})} />`}}function n$($){let Z=[];if($.lazy)Z.push(`data-src="${u0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${u0($.src)}"`);if(Z.push(`alt="${u0($.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="${u0($.className)}"`);if($.style)Z.push(`style="${u0($.style)}"`);if($.id)Z.push(`id="${u0($.id)}"`);if($.data)for(let[X,J]of Object.entries($.data))Z.push(`data-${X}="${u0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function v7($,Z){let X=[];if($)X.push($);if(Z)X.push("stx-img-blur");return X.join(" ")||""}function s$($,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 u0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function f7($){return`
1787
1787
  (function() {
1788
1788
  const container = document.getElementById('${$}');
1789
1789
  if (!container) return;
@@ -1820,7 +1820,7 @@ ${M.join(`
1820
1820
 
1821
1821
  observer.observe(container);
1822
1822
  })();
1823
- `.trim()}function bZ($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let X=Z[1],Y={},J=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=J.exec(X))!==null){let[,G,q,U,W,K]=Q,z=U??W??K??!0;if(G===":"&&typeof z==="string")try{Y[q]=JSON.parse(z)}catch{Y[q]=z}else switch(q){case"src":Y.src=String(z);break;case"alt":Y.alt=String(z);break;case"width":Y.width=Number(z)||z;break;case"height":Y.height=Number(z)||z;break;case"sizes":Y.sizes=String(z);break;case"quality":Y.quality=Number(z);break;case"placeholder":Y.placeholder=z;break;case"lazy":Y.lazy=z===!0||z==="true";break;case"priority":Y.priority=z===!0||z==="true";break;case"class":Y.class=String(z);break;case"style":Y.style=String(z);break;case"id":Y.id=String(z);break;case"loading":Y.loading=z;break;case"decoding":Y.decoding=z;break;case"fetchpriority":Y.fetchpriority=z;break;case"objectFit":Y.objectFit=z;break;case"objectPosition":Y.objectPosition=String(z);break;case"crossorigin":Y.crossorigin=z;break}}if(!Y.src||!Y.alt)return null;return Y}async function EU($,Z={}){let X=/<Img\s+[^>]*?\/?>/g,Y=[],J=[],Q=[],G=$,q=[],U;while((U=X.exec($))!==null)q.push({match:U[0],index:U.index});for(let W=q.length-1;W>=0;W--){let{match:K}=q[W],z=bZ(K);if(z){let H=await z5(z,Z);if(G=G.replace(K,H.html),H.preloadLink)Y.push(H.preloadLink);if(H.css)J.push(H.css);if(H.script)Q.push(H.script)}}return{html:G,preloadLinks:Y,styles:J,scripts:Q}}async function yZ($,Z){let X=await TZ();if(!X)return z5({...$,process:!1},Z);let Y=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await X.generateResponsiveVariants($.src,$,Y);if(Q)return v7($,Q,Z)}else{let Q=await X.processImage($.src,$,Y);if(Q.processed)return s$($,Q,Z)}return z5({...$,process:!1},Z)}async function s$($,Z,X){let{alt:Y,width:J,height:Q,lazy:G=!0,priority:q=!1,objectFit:U,objectPosition:W,crossorigin:K,referrerpolicy:z}=$,H=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},V=Z.variants||[],O=V.find((C)=>C.format==="jpeg")||V.find((C)=>C.format==="webp")||V[0],F=O?.url||$.src,L=V.filter((C)=>C.format===(O?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of V){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],D=["avif","webp","jpeg","png"];for(let C of D){let x=w.get(C);if(x&&x.length>0){let f=x.map((m)=>`${m.url} ${m.width}w`).join(", "),n=m$(C);if(G&&!q)R.push(` <source type="${n}" data-srcset="${f}" />`);else R.push(` <source type="${n}" srcset="${f}" />`)}}let N=[];if(G&&!q){if(N.push(`data-src="${h0(F)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)N.push(`data-srcset="${L}"`)}else if(N.push(`src="${h0(F)}"`),L)N.push(`srcset="${L}"`);N.push(`alt="${h0(Y)}"`);let T=J||Z.originalWidth,A=Q||Z.originalHeight;if(T)N.push(`width="${T}"`);if(A)N.push(`height="${A}"`);if(!q)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),q)N.push('fetchpriority="high"');if(K)N.push(`crossorigin="${K}"`);if(z)N.push(`referrerpolicy="${z}"`);let M=[];if(U)M.push(`object-fit: ${U}`);if(W)M.push(`object-position: ${W}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(B)M.push(B);if(M.length>0)N.push(`style="${M.join("; ")}"`);let k=[];if(H)k.push(H);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)N.push(`class="${k.join(" ")}"`);if(G&&!q)N.push("data-stx-lazy");for(let[C,x]of Object.entries(_))N.push(`data-${C}="${h0(x)}"`);let I;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;I=`<div id="${j}" class="stx-img-placeholder" style="${C}">
1823
+ `.trim()}function SZ($){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,U,W,K]=Q,z=U??W??K??!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 SU($,Z={}){let X=/<Img\s+[^>]*?\/?>/g,J=[],Y=[],Q=[],G=$,q=[],U;while((U=X.exec($))!==null)q.push({match:U[0],index:U.index});for(let W=q.length-1;W>=0;W--){let{match:K}=q[W],z=SZ(K);if(z){let H=await z5(z,Z);if(G=G.replace(K,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 CZ($,Z){let X=await kZ();if(!X)return z5({...$,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 x7($,Q,Z)}else{let Q=await X.processImage($.src,$,J);if(Q.processed)return o$($,Q,Z)}return z5({...$,process:!1},Z)}async function o$($,Z,X){let{alt:J,width:Y,height:Q,lazy:G=!0,priority:q=!1,objectFit:U,objectPosition:W,crossorigin:K,referrerpolicy:z}=$,H=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},V=Z.variants||[],O=V.find((C)=>C.format==="jpeg")||V.find((C)=>C.format==="webp")||V[0],F=O?.url||$.src,L=V.filter((C)=>C.format===(O?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of V){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],D=["avif","webp","jpeg","png"];for(let C of D){let x=w.get(C);if(x&&x.length>0){let f=x.map((m)=>`${m.url} ${m.width}w`).join(", "),n=l$(C);if(G&&!q)R.push(` <source type="${n}" data-srcset="${f}" />`);else R.push(` <source type="${n}" srcset="${f}" />`)}}let N=[];if(G&&!q){if(N.push(`data-src="${u0(F)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)N.push(`data-srcset="${L}"`)}else if(N.push(`src="${u0(F)}"`),L)N.push(`srcset="${L}"`);N.push(`alt="${u0(J)}"`);let T=Y||Z.originalWidth,A=Q||Z.originalHeight;if(T)N.push(`width="${T}"`);if(A)N.push(`height="${A}"`);if(!q)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),q)N.push('fetchpriority="high"');if(K)N.push(`crossorigin="${K}"`);if(z)N.push(`referrerpolicy="${z}"`);let M=[];if(U)M.push(`object-fit: ${U}`);if(W)M.push(`object-position: ${W}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(B)M.push(B);if(M.length>0)N.push(`style="${M.join("; ")}"`);let k=[];if(H)k.push(H);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)N.push(`class="${k.join(" ")}"`);if(G&&!q)N.push("data-stx-lazy");for(let[C,x]of Object.entries(_))N.push(`data-${C}="${u0(x)}"`);let I;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;I=`<div id="${j}" class="stx-img-placeholder" style="${C}">
1824
1824
  <picture>
1825
1825
  ${R.join(`
1826
1826
  `)}
@@ -1830,11 +1830,11 @@ ${R.join(`
1830
1830
  ${R.join(`
1831
1831
  `)}
1832
1832
  <img ${N.join(" ")} />
1833
- </picture>`;let y=[];if(Z.placeholder)y.push(l$);let E=G?P7(j):void 0,b;if(q&&L)b=`<link rel="preload" as="image" imagesrcset="${L}" />`;return{html:I,preloadLink:b,css:y.length>0?y.join(`
1834
- `):void 0,script:E}}async function v7($,Z,X){let Y={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[J,Q]of Object.entries(Z.byFormat))if(Q)Y.variants.push(...Q);return s$($,Y,X)}function SZ(){return d5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,X,Y)=>{let{src:J,alt:Q,options:G}=CZ($,Z,X);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let q={src:J,alt:Q||"",widths:G.widths||V1,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},U=X.__isDev||!1,W=await z5(q,{isDev:U}),K=W.html;if(W.preloadLink)K=W.preloadLink+`
1833
+ </picture>`;let y=[];if(Z.placeholder)y.push(c$);let E=G?f7(j):void 0,b;if(q&&L)b=`<link rel="preload" as="image" imagesrcset="${L}" />`;return{html:I,preloadLink:b,css:y.length>0?y.join(`
1834
+ `):void 0,script:E}}async function x7($,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 o$($,J,X)}function PZ(){return d5({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}=vZ($,Z,X);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let q={src:Y,alt:Q||"",widths:G.widths||V1,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},U=X.__isDev||!1,W=await z5(q,{isDev:U}),K=W.html;if(W.preloadLink)K=W.preloadLink+`
1835
1835
  `+K;if(W.css)K+=`
1836
1836
  <style>${W.css}</style>`;if(W.script)K+=`
1837
- <script>${W.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function CZ($,Z,X){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let Y=$.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=PZ(Y),Q=o$(J[0],X)||"",G=o$(J[1],X)||"",q={};if(J[2]){let U=o$(J[2],X);if(typeof U==="object"&&U!==null)q=U;else if(typeof J[2]==="string")try{q=JSON.parse(J[2])}catch{}}return{src:Q,alt:G,options:q}}function PZ($){let Z=[],X="",Y=!1,J="",Q=0,G=0;for(let q=0;q<$.length;q++){let U=$[q],W=q>0?$[q-1]:"";if((U==='"'||U==="'"||U==="`")&&W!=="\\"){if(!Y)Y=!0,J=U;else if(U===J)Y=!1,J="";else X+=U;continue}if(!Y){if(U==="{")Q++;if(U==="}")Q--;if(U==="[")G++;if(U==="]")G--;if(U===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=U}if(X.trim())Z.push(X.trim());return Z}function o$($,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 Y=Z[X];if(Y!==void 0)return Y}if(X.startsWith("{")||X.startsWith("["))try{return JSON.parse(X)}catch{}return X}var f7=SZ();async function g7(){try{return await import("./chunk-nsjyn31z.js")}catch($){if(!x7)console.warn("[stx-media] Video processor not available, some features disabled:",$),x7=!0;return null}}var x7=!1,h7=!0,u7="metadata",vZ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function m5($,Z={}){let X=Z,Y=$;if(Y.process&&!Y.skipProcessing){if(X.tsVideosConfig?.enabled&&!X.isDev)return uZ(Y,X)}if(X.processedResult?.processed)return m7($,X.processedResult,Z);let J;if(Y.generatePoster&&Y.src&&!$.poster)J=await dZ(Y,X);let{src:Q,sources:G=[],poster:q,posterPlaceholder:U,controls:W=h7,autoplay:K=!1,muted:z=!1,loop:H=!1,preload:B=u7,playsinline:j=!0,lazy:_=!0,player:V="native",type:O,width:F,height:L,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:D=!1}=$,N=J||q,T=$.class,A=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(V==="ts-video")return xZ($,Z);if(O&&O!=="video")return fZ(Q||"",O,$);let k=G.length>0?G:Q?[{src:Q,type:d7(Q)}]:[],I=[`id="${M}"`];if(W)I.push("controls");if(K)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"'),N)I.push(`data-poster="${O0(N)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),N)I.push(`poster="${O0(N)}"`);if(F)I.push(`width="${F}"`);if(L)I.push(`height="${L}"`);if(T)I.push(`class="${O0(T)}"`);if(A)I.push(`style="${O0(A)}"`);let y=k.map((C)=>{return` <source ${_?`data-src="${O0(C.src)}"`:`src="${O0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
1837
+ <script>${W.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function vZ($,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=fZ(J),Q=r$(Y[0],X)||"",G=r$(Y[1],X)||"",q={};if(Y[2]){let U=r$(Y[2],X);if(typeof U==="object"&&U!==null)q=U;else if(typeof Y[2]==="string")try{q=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:q}}function fZ($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let q=0;q<$.length;q++){let U=$[q],W=q>0?$[q-1]:"";if((U==='"'||U==="'"||U==="`")&&W!=="\\"){if(!J)J=!0,Y=U;else if(U===Y)J=!1,Y="";else X+=U;continue}if(!J){if(U==="{")Q++;if(U==="}")Q--;if(U==="[")G++;if(U==="]")G--;if(U===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=U}if(X.trim())Z.push(X.trim());return Z}function r$($,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 g7=PZ();async function u7(){try{return await import("./chunk-nsjyn31z.js")}catch($){if(!h7)console.warn("[stx-media] Video processor not available, some features disabled:",$),h7=!0;return null}}var h7=!1,d7=!0,m7="metadata",xZ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function m5($,Z={}){let X=Z,J=$;if(J.process&&!J.skipProcessing){if(X.tsVideosConfig?.enabled&&!X.isDev)return mZ(J,X)}if(X.processedResult?.processed)return c7($,X.processedResult,Z);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await lZ(J,X);let{src:Q,sources:G=[],poster:q,posterPlaceholder:U,controls:W=d7,autoplay:K=!1,muted:z=!1,loop:H=!1,preload:B=m7,playsinline:j=!0,lazy:_=!0,player:V="native",type:O,width:F,height:L,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:D=!1}=$,N=Y||q,T=$.class,A=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(V==="ts-video")return hZ($,Z);if(O&&O!=="video")return gZ(Q||"",O,$);let k=G.length>0?G:Q?[{src:Q,type:l7(Q)}]:[],I=[`id="${M}"`];if(W)I.push("controls");if(K)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"'),N)I.push(`data-poster="${O0(N)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),N)I.push(`poster="${O0(N)}"`);if(F)I.push(`width="${F}"`);if(L)I.push(`height="${L}"`);if(T)I.push(`class="${O0(T)}"`);if(A)I.push(`style="${O0(A)}"`);let y=k.map((C)=>{return` <source ${_?`data-src="${O0(C.src)}"`:`src="${O0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
1838
1838
  `),E=`<video ${I.join(" ")}>
1839
1839
  ${y}
1840
1840
  Your browser does not support the video tag.
@@ -1873,9 +1873,9 @@ ${y}
1873
1873
 
1874
1874
  observer.observe(video);
1875
1875
  })();
1876
- `.trim();return{html:E,script:b}}function fZ($,Z,X){let{width:Y=640,height:J=360}=X,Q=X.class,G=X.style,q=X.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,U,W=null;switch(Z){case"youtube":W=gZ($),U=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=hZ($),U=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",U=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",U=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:U=$}let K=[`id="${q}"`,`src="${O0(U)}"`,`width="${Y}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)K.push(`class="${O0(Q)}"`);if(G)K.push(`style="${O0(G)}"`);if(X.lazy)K.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1876
+ `.trim();return{html:E,script:b}}function gZ($,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)}`,U,W=null;switch(Z){case"youtube":W=uZ($),U=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=dZ($),U=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",U=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",U=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:U=$}let K=[`id="${q}"`,`src="${O0(U)}"`,`width="${J}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)K.push(`class="${O0(Q)}"`);if(G)K.push(`style="${O0(G)}"`);if(X.lazy)K.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1877
1877
  <iframe ${K.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1878
- </div>`}}function xZ($,Z={}){let{src:X,sources:Y=[],poster:J,controls:Q=!0,autoplay:G=!1,muted:q=!1,loop:U=!1,preload:W="metadata",playsinline:K=!0,lazy:z=!0,width:H,height:B}=$,j=$.class,_=$.style,V=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:Y.length>0?Y:X,autoplay:G,loop:U,muted:q,playsinline:K,preload:W,poster:J,controls:Q,title:$.title},F=["position: relative",H?`width: ${typeof H==="number"?H+"px":H}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",_||""].filter(Boolean).join("; "),L=`
1878
+ </div>`}}function hZ($,Z={}){let{src:X,sources:J=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:q=!1,loop:U=!1,preload:W="metadata",playsinline:K=!0,lazy:z=!0,width:H,height:B}=$,j=$.class,_=$.style,V=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:J.length>0?J:X,autoplay:G,loop:U,muted:q,playsinline:K,preload:W,poster:Y,controls:Q,title:$.title},F=["position: relative",H?`width: ${typeof H==="number"?H+"px":H}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",_||""].filter(Boolean).join("; "),L=`
1879
1879
  <div
1880
1880
  id="${V}"
1881
1881
  class="ts-video-player${j?" "+O0(j):""}"
@@ -1885,8 +1885,8 @@ ${y}
1885
1885
  ${z?"data-lazy":""}
1886
1886
  >
1887
1887
  <div class="ts-video-player__container">
1888
- ${J?`
1889
- <div class="ts-video-player__placeholder" style="background-image: url('${O0(J)}');">
1888
+ ${Y?`
1889
+ <div class="ts-video-player__placeholder" style="background-image: url('${O0(Y)}');">
1890
1890
  <button class="ts-video-player__play-button" aria-label="Play video">
1891
1891
  <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
1892
1892
  <path d="M8 5v14l11-7z"/>
@@ -1912,7 +1912,7 @@ ${y}
1912
1912
 
1913
1913
  // Load ts-video-player from CDN
1914
1914
  var script = document.createElement('script');
1915
- script.src = '${vZ}';
1915
+ script.src = '${xZ}';
1916
1916
  script.onload = initPlayer;
1917
1917
  script.onerror = function() {
1918
1918
  console.error('[stx] Failed to load ts-video-player');
@@ -2042,7 +2042,7 @@ else {
2042
2042
  .ts-video-player__play-button svg {
2043
2043
  margin-left: 4px;
2044
2044
  }
2045
- `.trim();return{html:L,script:w,css:R}}function d7($){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 gZ($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let X of Z){let Y=$.match(X);if(Y)return Y[1]}return null}function hZ($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function O0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function vU($,Z,X){if(Z.src)return{src:String(Z.src),...Z};let Y=$.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=Y.indexOf(",");if(J===-1)return{src:Y.replace(/^['"]|['"]$/g,"")};let Q=Y.slice(0,J).trim().replace(/^['"]|['"]$/g,""),G=Y.slice(J+1).trim();try{let q=JSON.parse(G);return{src:Q,...q}}catch{return{src:Q}}}async function uZ($,Z){let X=await g7();if(!X)return m5({...$,process:!1},Z);let Y=Z.tsVideosConfig,J=await X.processVideo($.src,$,Y,$.onProcessProgress);if(J.processed)return m7($,J,Z);return m5({...$,process:!1},Z)}async function dZ($,Z){let X=await g7();if(!X||!$.src)return;let Y=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},J=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await X.generatePoster($.src,Y,J.outputDir,J.baseUrl||"/videos"))?.url}function m7($,Z,X){let{controls:Y=h7,autoplay:J=!1,muted:Q=!1,loop:G=!1,preload:q=u7,playsinline:U=!0,lazy:W=!0,width:K,height:z,crossorigin:H,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,_=$.class,V=$.style,O=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,F=$.src,L=d7(F);if(Z.transcoded)F=Z.transcoded.url,L="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)F=Z.streaming.hls.manifestUrl,L="application/x-mpegURL";else if(Z.streaming?.dash)F=Z.streaming.dash.manifestUrl,L="application/dash+xml"}let R=Z.poster?.url||$.poster,D=[`id="${O}"`];if(Y)D.push("controls");if(J)D.push("autoplay");if(Q)D.push("muted");if(G)D.push("loop");if(U)D.push("playsinline");if(B)D.push("disablepictureinpicture");if(j)D.push("disableremoteplayback");if(H)D.push(`crossorigin="${H}"`);if(W){if(D.push(`data-preload="${q}"`),D.push('preload="none"'),R)D.push(`data-poster="${O0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${q}"`),R)D.push(`poster="${O0(R)}"`);let N=K||Z.metadata?.width,T=z||Z.metadata?.height;if(N)D.push(`width="${N}"`);if(T)D.push(`height="${T}"`);if(_)D.push(`class="${O0(_)}"`);if(V)D.push(`style="${O0(V)}"`);let M=` <source ${W?`data-src="${O0(F)}"`:`src="${O0(F)}"`} type="${L}" />`,k=`<video ${D.join(" ")}>
2045
+ `.trim();return{html:L,script:w,css:R}}function l7($){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 uZ($){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 dZ($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function O0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function gU($,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 mZ($,Z){let X=await u7();if(!X)return m5({...$,process:!1},Z);let J=Z.tsVideosConfig,Y=await X.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return c7($,Y,Z);return m5({...$,process:!1},Z)}async function lZ($,Z){let X=await u7();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 c7($,Z,X){let{controls:J=d7,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:q=m7,playsinline:U=!0,lazy:W=!0,width:K,height:z,crossorigin:H,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,_=$.class,V=$.style,O=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,F=$.src,L=l7(F);if(Z.transcoded)F=Z.transcoded.url,L="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)F=Z.streaming.hls.manifestUrl,L="application/x-mpegURL";else if(Z.streaming?.dash)F=Z.streaming.dash.manifestUrl,L="application/dash+xml"}let R=Z.poster?.url||$.poster,D=[`id="${O}"`];if(J)D.push("controls");if(Y)D.push("autoplay");if(Q)D.push("muted");if(G)D.push("loop");if(U)D.push("playsinline");if(B)D.push("disablepictureinpicture");if(j)D.push("disableremoteplayback");if(H)D.push(`crossorigin="${H}"`);if(W){if(D.push(`data-preload="${q}"`),D.push('preload="none"'),R)D.push(`data-poster="${O0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${q}"`),R)D.push(`poster="${O0(R)}"`);let N=K||Z.metadata?.width,T=z||Z.metadata?.height;if(N)D.push(`width="${N}"`);if(T)D.push(`height="${T}"`);if(_)D.push(`class="${O0(_)}"`);if(V)D.push(`style="${O0(V)}"`);let M=` <source ${W?`data-src="${O0(F)}"`:`src="${O0(F)}"`} type="${L}" />`,k=`<video ${D.join(" ")}>
2046
2046
  ${M}
2047
2047
  Your browser does not support the video tag.
2048
2048
  </video>`;if(Z.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${O0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -2091,42 +2091,42 @@ ${k}
2091
2091
  width: 100%;
2092
2092
  height: auto;
2093
2093
  }
2094
- `.trim();return{html:k,script:I,css:y}}function l7(){return d5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,X,Y)=>{let{src:J,options:Q}=mZ($,Z,X);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:J,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},U={isDev:X.__isDev||!1,tsVideosConfig:X.__tsVideosConfig},W=await m5(G,U),K=W.html;if(W.css)K+=`
2094
+ `.trim();return{html:k,script:I,css:y}}function p7(){return d5({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}=cZ($,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},U={isDev:X.__isDev||!1,tsVideosConfig:X.__tsVideosConfig},W=await m5(G,U),K=W.html;if(W.css)K+=`
2095
2095
  <style>${W.css}</style>`;if(W.script)K+=`
2096
- <script>${W.script}</script>`;return K},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function mZ($,Z,X){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let Y=$.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=lZ(Y),Q=c7(J[0],X)||"",G={};if(J[1]){let q=c7(J[1],X);if(typeof q==="object"&&q!==null)G=q;else if(typeof J[1]==="string")try{G=JSON.parse(J[1])}catch{}}return{src:Q,options:G}}function lZ($){let Z=[],X="",Y=!1,J="",Q=0,G=0;for(let q=0;q<$.length;q++){let U=$[q],W=q>0?$[q-1]:"";if((U==='"'||U==="'"||U==="`")&&W!=="\\"){if(!Y)Y=!0,J=U;else if(U===J)Y=!1,J="";else X+=U;continue}if(!Y){if(U==="{")Q++;if(U==="}")Q--;if(U==="[")G++;if(U==="]")G--;if(U===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=U}if(X.trim())Z.push(X.trim());return Z}function c7($,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 Y=Z[X];if(Y!==void 0)return Y}if(X.startsWith("{")||X.startsWith("["))try{return JSON.parse(X)}catch{}return X}var r$=l7();var cZ={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"}},l5={},p7="en";function pZ($){p7=$}function iZ(){return p7}function nZ($){l5={...l5,...$}}function sZ(){l5={}}function i7($,Z={}){let X=l5[$]||cZ[$]||{message:`Unknown error (code: ${$})`},Y=X.message,J=X.help;for(let[Q,G]of Object.entries(Z)){let q=`{{${Q}}}`;if(Y=Y.replace(new RegExp(q,"g"),G),J)J=J.replace(new RegExp(q,"g"),G)}return{message:Y,help:J}}function oZ($,Z={}){let{message:X,help:Y}=i7($,Z);return Y?`${X}
2097
- Help: ${Y}`: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 a$($){for(let[Z,X]of Object.entries(l))if(X===$)return Z;return}import rZ from"path";function H5(){return!1}function B5(){return!H5()||process.env.STX_DEBUG==="true"}function c5(){return!1}var n7={showRelativePaths:!1,enableAutoRecovery:B5(),logRecoveryWarnings:!0},g1={...n7};function aZ($){g1={...g1,...$}}function p5(){return{...g1}}function tZ(){g1={...n7}}function i5($){if(!g1.showRelativePaths||!$)return $;let Z=g1.baseDir||process.cwd();try{let X=rZ.relative(Z,$);return X.startsWith("..")?$:X}catch{return $}}class F1 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,X,Y,J,Q,G){super($);this.code=Z;this.filePath=X;this.line=Y;this.column=J;this.context=Q;if(this.name="StxError",this.numericCode=G||l.EVALUATION_ERROR,this.filePath)this.filePath=i5(this.filePath)}}class s7 extends F1{constructor($,Z,X,Y,J,Q){super($,"stx_SYNTAX_ERROR",Z,X,Y,J,Q||l.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}}class L1 extends F1{constructor($,Z,X,Y,J,Q){super($,"stx_RUNTIME_ERROR",Z,X,Y,J,Q||l.EVALUATION_ERROR);this.name="StxRuntimeError"}}class o7 extends F1{constructor($,Z,X,Y,J,Q){super($,"stx_SECURITY_ERROR",Z,X,Y,J,Q||l.UNSAFE_EXPRESSION);this.name="StxSecurityError"}}class r7 extends F1{constructor($,Z,X,Y,J,Q){super($,"stx_FILE_ERROR",Z,X,Y,J,Q||l.FILE_NOT_FOUND);this.name="StxFileError"}}class n5 extends F1{isFatal=!0;constructor($,Z,X,Y,J,Q){super($,"stx_VALIDATION_ERROR",Z,X,Y,J,Q||l.DOM_API_VIOLATION);this.name="StxValidationError"}}function t$($){let{type:Z,message:X,code:Y,filePath:J,line:Q,column:G,template:q,offset:U,snippet:W,suggestion:K,format:z="text"}=$,H=Q,B=G;if(!H&&q&&U!==void 0){let F=t7(q,U);H=F.line,B=F.column}let j=J?i5(J):void 0,_=Y?a$(Y):void 0,V={type:Z,code:Y,codeName:_,message:X,filePath:j,line:H,column:B,snippet:W,suggestion:K,timestamp:new Date().toISOString()},O;switch(z){case"html":O=$X(V);break;case"json":O=JSON.stringify(V,null,2);break;case"console":O=ZX(V,q,U);break;case"text":default:O=eZ(V,q,U);break}return{formatted:O,data:V}}function eZ($,Z,X){let Y=[],J=$.code?` [${$.codeName||$.code}]`:"";if(Y.push(`[${$.type} Error${J}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}Y.push(`at ${Q}`)}if(Y.push(`
2098
- ${$.message}`),Z&&$.line){let Q=XX(Z,$.line,2);if(Q)Y.push(`
2099
- ${Q}`)}if($.snippet)Y.push(`
2100
- Snippet: ${$.snippet}`);if($.suggestion)Y.push(`
2101
- Suggestion: ${$.suggestion}`);return Y.join(" ")}function $X($){let Z=$.code?` [${$.code}]`:"",X=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",Y=`<!-- [${$.type} Error${Z}]${X}: ${a7($.message)}`;if($.suggestion)Y+=` | Suggestion: ${a7($.suggestion)}`;return Y+=" -->",Y}function ZX($,Z,X){let W=[],K=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${K} \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`}W.push(`
2096
+ <script>${W.script}</script>`;return K},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function cZ($,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=pZ(J),Q=i7(Y[0],X)||"",G={};if(Y[1]){let q=i7(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 pZ($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let q=0;q<$.length;q++){let U=$[q],W=q>0?$[q-1]:"";if((U==='"'||U==="'"||U==="`")&&W!=="\\"){if(!J)J=!0,Y=U;else if(U===Y)J=!1,Y="";else X+=U;continue}if(!J){if(U==="{")Q++;if(U==="}")Q--;if(U==="[")G++;if(U==="]")G--;if(U===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=U}if(X.trim())Z.push(X.trim());return Z}function i7($,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 a$=p7();var iZ={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"}},l5={},n7="en";function nZ($){n7=$}function sZ(){return n7}function oZ($){l5={...l5,...$}}function rZ(){l5={}}function s7($,Z={}){let X=l5[$]||iZ[$]||{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 aZ($,Z={}){let{message:X,help:J}=s7($,Z);return J?`${X}
2097
+ 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 t$($){for(let[Z,X]of Object.entries(l))if(X===$)return Z;return}import tZ from"path";function H5(){return!1}function B5(){return!H5()||process.env.STX_DEBUG==="true"}function c5(){return!1}var o7={showRelativePaths:!1,enableAutoRecovery:B5(),logRecoveryWarnings:!0},g1={...o7};function eZ($){g1={...g1,...$}}function p5(){return{...g1}}function $X(){g1={...o7}}function i5($){if(!g1.showRelativePaths||!$)return $;let Z=g1.baseDir||process.cwd();try{let X=tZ.relative(Z,$);return X.startsWith("..")?$:X}catch{return $}}class F1 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=i5(this.filePath)}}class r7 extends F1{constructor($,Z,X,J,Y,Q){super($,"stx_SYNTAX_ERROR",Z,X,J,Y,Q||l.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}}class L1 extends F1{constructor($,Z,X,J,Y,Q){super($,"stx_RUNTIME_ERROR",Z,X,J,Y,Q||l.EVALUATION_ERROR);this.name="StxRuntimeError"}}class a7 extends F1{constructor($,Z,X,J,Y,Q){super($,"stx_SECURITY_ERROR",Z,X,J,Y,Q||l.UNSAFE_EXPRESSION);this.name="StxSecurityError"}}class t7 extends F1{constructor($,Z,X,J,Y,Q){super($,"stx_FILE_ERROR",Z,X,J,Y,Q||l.FILE_NOT_FOUND);this.name="StxFileError"}}class n5 extends F1{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 e$($){let{type:Z,message:X,code:J,filePath:Y,line:Q,column:G,template:q,offset:U,snippet:W,suggestion:K,format:z="text"}=$,H=Q,B=G;if(!H&&q&&U!==void 0){let F=$6(q,U);H=F.line,B=F.column}let j=Y?i5(Y):void 0,_=J?t$(J):void 0,V={type:Z,code:J,codeName:_,message:X,filePath:j,line:H,column:B,snippet:W,suggestion:K,timestamp:new Date().toISOString()},O;switch(z){case"html":O=XX(V);break;case"json":O=JSON.stringify(V,null,2);break;case"console":O=JX(V,q,U);break;case"text":default:O=ZX(V,q,U);break}return{formatted:O,data:V}}function ZX($,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(`
2098
+ ${$.message}`),Z&&$.line){let Q=YX(Z,$.line,2);if(Q)J.push(`
2099
+ ${Q}`)}if($.snippet)J.push(`
2100
+ Snippet: ${$.snippet}`);if($.suggestion)J.push(`
2101
+ Suggestion: ${$.suggestion}`);return J.join(" ")}function XX($){let Z=$.code?` [${$.code}]`:"",X=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${X}: ${e7($.message)}`;if($.suggestion)J+=` | Suggestion: ${e7($.suggestion)}`;return J+=" -->",J}function JX($,Z,X){let W=[],K=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${K} \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`}W.push(`
2102
2102
  \x1B[90mat\x1B[0m ${z}`)}if(W.push(`
2103
2103
 
2104
- ${$.message}`),Z&&$.line){let z=YX(Z,$.line,2);if(z)W.push(`
2104
+ ${$.message}`),Z&&$.line){let z=QX(Z,$.line,2);if(z)W.push(`
2105
2105
 
2106
2106
  \x1B[90mContext:\x1B[0m
2107
2107
  ${z}`)}if($.suggestion)W.push(`
2108
2108
 
2109
2109
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
2110
- ${"\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"}`),W.join("")}function XX($,Z,X){let Y=$.split(`
2111
- `),J=Math.max(0,Z-X-1),Q=Math.min(Y.length-1,Z+X-1),G=[];for(let q=J;q<=Q;q++){let U=(q+1).toString().padStart(4),W=q===Z-1?">":" ";G.push(`${W}${U} | ${Y[q]}`)}return G.join(`
2112
- `)}function YX($,Z,X){let Y=$.split(`
2113
- `),J=Math.max(0,Z-X-1),Q=Math.min(Y.length-1,Z+X-1),G="\x1B[90m",q="\x1B[31m",U="\x1B[0m",W=[];for(let K=J;K<=Q;K++){let z=(K+1).toString().padStart(4),H=K===Z-1,B=H?"\x1B[31m>\x1B[0m":" ",j=H?`\x1B[31m${Y[K]}\x1B[0m`:`\x1B[90m${Y[K]}\x1B[0m`;W.push(`${B}\x1B[90m${z}\x1B[0m | ${j}`)}return W.join(`
2114
- `)}function a7($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function t7($,Z){let Y=$.substring(0,Z).split(`
2115
- `);return{line:Y.length,column:Y[Y.length-1].length}}function $0($,Z,X){return t$({type:$,message:Z,code:X,format:"html"}).formatted}function JX($,Z,X,Y,J){return t$({type:$,message:Z,code:J,filePath:X,line:Y,format:"console"}).formatted}function QX($,Z,X){let Y=X.template.split(`
2116
- `),J=t7(X.template,X.offset),Q=`[${$} Error at line ${J.line} in ${X.filePath}]: ${Z}
2117
-
2118
- `,G=Math.max(0,J.line-3),q=Math.min(Y.length-1,J.line+2);Q+=`Context:
2119
- `;for(let U=G;U<=q;U++){let W=U+1,K=Y[U]||"",z=U===J.line-1?">":" ";Q+=`${z} ${W.toString().padStart(3)}: ${K}
2120
- `}if(J.line-1<Y.length){let U=" ".repeat(J.column+5);Q+=`${U}^
2121
- `}return Q}function GX($,Z,X){try{return $()}catch(Y){if(X&&Y instanceof Error)X(Y);return Z}}async function h1($,Z,X){try{return await $()}catch(Y){if(X&&Y instanceof Error)X(Y);return Z}}var e$={isEnabled(){return p5().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=p5();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let X=$,Y=[],J=(X.match(/\{\{/g)||[]).length,Q=(X.match(/\}\}/g)||[]).length;if(J>Q){let q=J-Q;X+="}}".repeat(q),Y.push(`Added ${q} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let q of G){let U=(X.match(new RegExp(`@${q}\\b`,"g"))||[]).length,W=(X.match(new RegExp(`@end${q}\\b`,"g"))||[]).length;if(U>W){let K=U-W;for(let z=0;z<K;z++)X+=`
2122
- @end${q}`;Y.push(`Added ${K} missing @end${q}`)}}if(Y.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((q)=>console.warn(` - ${q}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:X,fixes:Y}},createFallbackContent($,Z){if(B5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};class $3{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 Y={timestamp:new Date,error:$,context:Z,level:X};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(X))this.writeToFile(Y)}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(`
2110
+ ${"\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"}`),W.join("")}function YX($,Z,X){let J=$.split(`
2111
+ `),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 U=(q+1).toString().padStart(4),W=q===Z-1?">":" ";G.push(`${W}${U} | ${J[q]}`)}return G.join(`
2112
+ `)}function QX($,Z,X){let J=$.split(`
2113
+ `),Y=Math.max(0,Z-X-1),Q=Math.min(J.length-1,Z+X-1),G="\x1B[90m",q="\x1B[31m",U="\x1B[0m",W=[];for(let K=Y;K<=Q;K++){let z=(K+1).toString().padStart(4),H=K===Z-1,B=H?"\x1B[31m>\x1B[0m":" ",j=H?`\x1B[31m${J[K]}\x1B[0m`:`\x1B[90m${J[K]}\x1B[0m`;W.push(`${B}\x1B[90m${z}\x1B[0m | ${j}`)}return W.join(`
2114
+ `)}function e7($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function $6($,Z){let J=$.substring(0,Z).split(`
2115
+ `);return{line:J.length,column:J[J.length-1].length}}function $0($,Z,X){return e$({type:$,message:Z,code:X,format:"html"}).formatted}function GX($,Z,X,J,Y){return e$({type:$,message:Z,code:Y,filePath:X,line:J,format:"console"}).formatted}function qX($,Z,X){let J=X.template.split(`
2116
+ `),Y=$6(X.template,X.offset),Q=`[${$} Error at line ${Y.line} in ${X.filePath}]: ${Z}
2117
+
2118
+ `,G=Math.max(0,Y.line-3),q=Math.min(J.length-1,Y.line+2);Q+=`Context:
2119
+ `;for(let U=G;U<=q;U++){let W=U+1,K=J[U]||"",z=U===Y.line-1?">":" ";Q+=`${z} ${W.toString().padStart(3)}: ${K}
2120
+ `}if(Y.line-1<J.length){let U=" ".repeat(Y.column+5);Q+=`${U}^
2121
+ `}return Q}function UX($,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 $3={isEnabled(){return p5().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=p5();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 U=(X.match(new RegExp(`@${q}\\b`,"g"))||[]).length,W=(X.match(new RegExp(`@end${q}\\b`,"g"))||[]).length;if(U>W){let K=U-W;for(let z=0;z<K;z++)X+=`
2122
+ @end${q}`;J.push(`Added ${K} 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(B5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};class Z3{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(`
2123
2123
  `).slice(1).join(`
2124
2124
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
2125
- `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(Y))Z.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded(Z);let J=`${this.formatEntry($)}
2126
- `;Z.appendFileSync(this.logFilePath,J,"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 Y=`${this.logFilePath}.${X}`,J=`${this.logFilePath}.${X+1}`;if($.existsSync(Y))if(X>=this.maxLogFiles-1)$.unlinkSync(Y);else $.renameSync(Y,J)}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 Y=X.error.constructor.name;$[Y]=($[Y]||0)+1;let J=X.level||"error";Z[J]=(Z[J]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let X=await import("fs"),J=(await import("path")).dirname($);if(!X.existsSync(J))X.mkdirSync(J,{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(`
2125
+ `)}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($)}
2126
+ `;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(`
2127
2127
 
2128
- `),"utf-8")}}async flush(){await this.writeQueue}}var u0=new $3,Z3={isDevelopment(){return B5()},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(`
2129
- `)}};import X3 from"path";var Y3={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 J=X3.resolve(Z,$),Q=X3.resolve(Z);if(!J.startsWith(Q+X3.sep)&&J!==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 qX($){let Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return $.replace(/[&<>"']/g,(X)=>Z[X]||X)}function s5($,Z={}){let{allowHtml:X=!1,maxLength:Y=1e4,allowSpecialChars:J=!0,customSanitizer:Q}=Z,G=[],q=$,U=!1;if(Q){let K=Q(q);if(K!==q)q=K,U=!0}if(q.includes("\x00"))q=q.replace(/\0/g,""),U=!0,G.push("Null bytes removed from parameter");if(q.length>Y)q=q.substring(0,Y),U=!0,G.push(`Parameter truncated to ${Y} characters`);if(!X&&/<[^>]+>/.test(q))q=qX(q),U=!0,G.push("HTML content was escaped");let W=[{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:K,replacement:z,name:H}of W)if(K.test(q))q=q.replace(K,z),U=!0,G.push(`Removed ${H} from parameter`);if(!J){let K=q;if(q=q.split("").filter((z)=>{let H=z.charCodeAt(0);return H>=32&&H!==127}).join(""),q!==K)U=!0,G.push("Control characters removed")}return{value:q,modified:U,warnings:G}}function UX($,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(!Y3.isValidFilePath(X,Z))return null;return X}function WX($){let Z=[],X=$.trim(),Y=X!==$,J=[{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 J)if(Q.test(X))Z.push(`Potentially dangerous pattern detected: ${G}`);if(X.includes("\x00"))X=X.replace(/\0/g,""),Y=!0,Z.push("Null bytes removed from expression");return{value:X,modified:Y,warnings:Z}}function KX($,Z={}){return $.map((X)=>s5(X,Z))}function e7($){let Z={};for(let[X,Y]of Object.entries($)){if(!Y3.isValidVariableName(X))continue;if(typeof Y==="string"){let J=s5(Y);Z[X]=J.value}else if(Array.isArray(Y))Z[X]=Y.map((J)=>typeof J==="string"?s5(J).value:J);else if(typeof Y==="object"&&Y!==null)Z[X]=e7(Y);else Z[X]=Y}return Z}function Z6($,Z,X,Y){let J=$;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(q,U,W)=>{if(!W&&U.includes(":")){let K=U.split(":"),z=U,H=K.length>1?K[1]:"";if(H&&Z[H])W=Z[H];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[K[1]])W=Z.openGraph[K[1]];else W="";return W?`<meta property="${c(z)}" content="${c(W)}">`:""}return W?`<meta name="${c(U)}" content="${c(W)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(J))!==null){let q=G.index,U=q+G[0].length-1,W=1,K=U+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 z=J.substring(U+1,K).trim(),H=K+1,B=(()=>{try{let j=_0(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)}})();J=J.substring(0,q)+B+J.substring(H),Q.lastIndex=0}return J}function X6($,Z,X){let Y=$,J=/@structuredData\s*\(/g,Q;while((Q=J.exec(Y))!==null){let G=Q.index,q=G+Q[0].length-1,U=1,W=q+1;while(W<Y.length&&U>0){if(Y[W]==="(")U++;else if(Y[W]===")"){if(U--,U===0)break}W++}if(U!==0)break;let K=Y.substring(q+1,W).trim(),z=W+1,H=(()=>{try{let B=_0(K,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)}})();Y=Y.substring(0,G)+H+Y.substring(z),J.lastIndex=0}return Y}function Y6($,Z,X,Y){let J=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(J))!==null){let q=J.indexOf("{",G.index+4),U=1,W=q+1,K=null,z=!1;while(W<J.length&&U>0){let O=J[W];if(z){z=!1,W++;continue}if(O==="\\"&&K){z=!0,W++;continue}if(K){if(O===K)K=null;W++;continue}if(O==='"'||O==="'"||O==="`"){K=O,W++;continue}if(O==="{")U++;else if(O==="}")U--;W++}if(U!==0)break;let H=J.substring(W).match(/^\s*\)/);if(!H)break;let B=W+H[0].length,j=J.substring(q,W),_=J.substring(G.index,B),V=((O)=>{try{let F=_0(O,Z);if(!F)return"";let L="";if(F.title)L+=`<title>${c(F.title)}</title>
2128
+ `),"utf-8")}}async flush(){await this.writeQueue}}var d0=new Z3,X3={isDevelopment(){return B5()},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(`
2129
+ `)}};import J3 from"path";var Y3={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=J3.resolve(Z,$),Q=J3.resolve(Z);if(!Y.startsWith(Q+J3.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 WX($){let Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return $.replace(/[&<>"']/g,(X)=>Z[X]||X)}function s5($,Z={}){let{allowHtml:X=!1,maxLength:J=1e4,allowSpecialChars:Y=!0,customSanitizer:Q}=Z,G=[],q=$,U=!1;if(Q){let K=Q(q);if(K!==q)q=K,U=!0}if(q.includes("\x00"))q=q.replace(/\0/g,""),U=!0,G.push("Null bytes removed from parameter");if(q.length>J)q=q.substring(0,J),U=!0,G.push(`Parameter truncated to ${J} characters`);if(!X&&/<[^>]+>/.test(q))q=WX(q),U=!0,G.push("HTML content was escaped");let W=[{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:K,replacement:z,name:H}of W)if(K.test(q))q=q.replace(K,z),U=!0,G.push(`Removed ${H} from parameter`);if(!Y){let K=q;if(q=q.split("").filter((z)=>{let H=z.charCodeAt(0);return H>=32&&H!==127}).join(""),q!==K)U=!0,G.push("Control characters removed")}return{value:q,modified:U,warnings:G}}function KX($,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(!Y3.isValidFilePath(X,Z))return null;return X}function zX($){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 HX($,Z={}){return $.map((X)=>s5(X,Z))}function Z6($){let Z={};for(let[X,J]of Object.entries($)){if(!Y3.isValidVariableName(X))continue;if(typeof J==="string"){let Y=s5(J);Z[X]=Y.value}else if(Array.isArray(J))Z[X]=J.map((Y)=>typeof Y==="string"?s5(Y).value:Y);else if(typeof J==="object"&&J!==null)Z[X]=Z6(J);else Z[X]=J}return Z}function J6($,Z,X,J){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(q,U,W)=>{if(!W&&U.includes(":")){let K=U.split(":"),z=U,H=K.length>1?K[1]:"";if(H&&Z[H])W=Z[H];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[K[1]])W=Z.openGraph[K[1]];else W="";return W?`<meta property="${c(z)}" content="${c(W)}">`:""}return W?`<meta name="${c(U)}" content="${c(W)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(Y))!==null){let q=G.index,U=q+G[0].length-1,W=1,K=U+1;while(K<Y.length&&W>0){if(Y[K]==="(")W++;else if(Y[K]===")"){if(W--,W===0)break}K++}if(W!==0)break;let z=Y.substring(U+1,K).trim(),H=K+1,B=(()=>{try{let j=_0(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 Y6($,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,U=1,W=q+1;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")"){if(U--,U===0)break}W++}if(U!==0)break;let K=J.substring(q+1,W).trim(),z=W+1,H=(()=>{try{let B=_0(K,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 Q6($,Z,X,J){let Y=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(Y))!==null){let q=Y.indexOf("{",G.index+4),U=1,W=q+1,K=null,z=!1;while(W<Y.length&&U>0){let O=Y[W];if(z){z=!1,W++;continue}if(O==="\\"&&K){z=!0,W++;continue}if(K){if(O===K)K=null;W++;continue}if(O==='"'||O==="'"||O==="`"){K=O,W++;continue}if(O==="{")U++;else if(O==="}")U--;W++}if(U!==0)break;let H=Y.substring(W).match(/^\s*\)/);if(!H)break;let B=W+H[0].length,j=Y.substring(q,W),_=Y.substring(G.index,B),V=((O)=>{try{let F=_0(O,Z);if(!F)return"";let L="";if(F.title)L+=`<title>${c(F.title)}</title>
2130
2130
  `,L+=`<meta name="title" content="${c(F.title)}">
2131
2131
  `;if(F.description)L+=`<meta name="description" content="${c(F.description)}">
2132
2132
  `;if(F.keywords){let w=Array.isArray(F.keywords)?F.keywords.join(", "):F.keywords;L+=`<meta name="keywords" content="${c(w)}">
@@ -2148,7 +2148,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
2148
2148
  `}if(w.site)L+=`<meta name="twitter:site" content="${c(w.site)}">
2149
2149
  `;if(w.creator)L+=`<meta name="twitter:creator" content="${c(w.creator)}">
2150
2150
  `}if(F.structuredData){let w=JSON.stringify(F.structuredData).replace(/<\//g,"<\\/");L+=`<script type="application/ld+json">${w}</script>
2151
- `}return L.trim()}catch(F){let L=F instanceof Error?F.message:String(F);return $0("SEO",`Error processing @seo directive: ${L}`,l.EVALUATION_ERROR)}})(j);J=J.substring(0,G.index)+V+J.substring(B),Q.lastIndex=G.index+V.length}return J}function J6($,Z,X){if(X.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||X.skipDefaultSeoTags===!0)return $;let Y=Z.__stx_runtime_head;if(!!(Y?.title||Y?.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 U="";if(Z.image)U=Z.image;else if(Z.meta&&Z.meta.image)U=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)U=Z.openGraph.image;else if(X.seo?.defaultImage)U=X.seo.defaultImage;else if(X.defaultImage)U=X.defaultImage;let W=`
2151
+ `}return L.trim()}catch(F){let L=F instanceof Error?F.message:String(F);return $0("SEO",`Error processing @seo directive: ${L}`,l.EVALUATION_ERROR)}})(j);Y=Y.substring(0,G.index)+V+Y.substring(B),Q.lastIndex=G.index+V.length}return Y}function G6($,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 U="";if(Z.image)U=Z.image;else if(Z.meta&&Z.meta.image)U=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)U=Z.openGraph.image;else if(X.seo?.defaultImage)U=X.seo.defaultImage;else if(X.defaultImage)U=X.defaultImage;let W=`
2152
2152
  <!-- stx SEO Tags -->
2153
2153
  <meta name="title" content="${c(G)}">
2154
2154
  <meta name="description" content="${c(q)}">
@@ -2164,19 +2164,19 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
2164
2164
  `;let K=$;if(!Q)K=K.replace(/<head[^>]*>/,`$&
2165
2165
  <title>${c(G)}</title>`);return K.replace(/<head[^>]*>/,`$&
2166
2166
  ${W}
2167
- `)}function c($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var zX=["og:","article:","book:","profile:","fb:","music:","video:"];function $6($){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 J3={name:"meta",handler:($,Z,X,Y)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",l.INVALID_DIRECTIVE_SYNTAX);let J=$6(Z[0]).value,Q;if(Z.length>1){let U=$6(Z[1]);Q=U.quoted?U.value:String(X?.[U.value]??U.value)}else{let U=J.includes(":")?J.slice(J.indexOf(":")+1):J,W=X?.openGraph;Q=String(X?.[U]??W?.[U]??"")}if(!Q)return"";let q=zX.some((U)=>J.startsWith(U))?{property:J,content:Q}:{name:J,content:Q};if(X)X.__stx_runtime_head=o5(X.__stx_runtime_head??{},{meta:[q]});return""},hasEndTag:!1},Q3={name:"structuredData",handler:($,Z,X,Y)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",l.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse($);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return $0("StructuredData","structuredData requires @type property",l.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let Q=J instanceof Error?J.message:String(J);return $0("StructuredData",Q,l.EVALUATION_ERROR)}},hasEndTag:!0};function HW(){return[J3,Q3]}function BW($,Z){let X=Z.replace(/\/$/,""),Y=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
2167
+ `)}function c($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var BX=["og:","article:","book:","profile:","fb:","music:","video:"];function X6($){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 Q3={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=X6(Z[0]).value,Q;if(Z.length>1){let U=X6(Z[1]);Q=U.quoted?U.value:String(X?.[U.value]??U.value)}else{let U=Y.includes(":")?Y.slice(Y.indexOf(":")+1):Y,W=X?.openGraph;Q=String(X?.[U]??W?.[U]??"")}if(!Q)return"";let q=BX.some((U)=>Y.startsWith(U))?{property:Y,content:Q}:{name:Y,content:Q};if(X)X.__stx_runtime_head=o5(X.__stx_runtime_head??{},{meta:[q]});return""},hasEndTag:!1},G3={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 _W(){return[Q3,G3]}function OW($,Z){let X=Z.replace(/\/$/,""),J=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
2168
2168
  <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
2169
2169
  ${$.map((Q)=>{let G=Q.startsWith("http")?Q:`${X}${Q.startsWith("/")?"":"/"}${Q}`;return` <sitemap>
2170
- <loc>${BX(G)}</loc>
2171
- <lastmod>${Y}</lastmod>
2170
+ <loc>${_X(G)}</loc>
2171
+ <lastmod>${J}</lastmod>
2172
2172
  </sitemap>`}).join(`
2173
2173
  `)}
2174
- </sitemapindex>`}async function jW($,Z){let{extensions:X=[".stx",".html",".htm"],ignore:Y=["_*",".*","node_modules","components","partials","layouts"]}=Z,J=[],Q=X.length===1?`*${X[0]}`:`*{${X.join(",")}}`,G=new Bun.Glob(`**/${Q}`);for await(let q of G.scan($)){if(Y.some((H)=>{if(H.startsWith("*"))return q.includes(H.slice(1));return q.startsWith(H)||q.includes(`/${H}`)}))continue;let W=q.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!W.startsWith("/"))W=`/${W}`;if(W!=="/"&&W.endsWith("/"))W=W.slice(0,-1);let K=`${$}/${q}`,z;try{let H=await Bun.file(K).stat();if(H)z=new Date(H.mtime).toISOString().split("T")[0]}catch{}J.push({loc:W||"/",lastmod:z,priority:W==="/"?1:0.5})}return J.sort((q,U)=>q.loc.localeCompare(U.loc)),J}function HX($){let Z=[];for(let X of $.rules){if(Z.push(`User-agent: ${X.userAgent}`),X.allow)for(let Y of X.allow)Z.push(`Allow: ${Y}`);if(X.disallow)for(let Y of X.disallow)Z.push(`Disallow: ${Y}`);if(X.crawlDelay!==void 0)Z.push(`Crawl-delay: ${X.crawlDelay}`);Z.push("")}if($.sitemap){let X=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let Y of X)Z.push(`Sitemap: ${Y}`)}if($.host)Z.push(`Host: ${$.host}`);return Z.join(`
2175
- `).trim()}function _W($){return HX({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function BX($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}import jX from"fs";import q1 from"path";async function RW($,Z){if(!$.webComponents?.enabled)return[];let X=$.webComponents.components||[],Y=[];if(X.length>0){if($.debug)console.log(`Building ${X.length} web components...`);for(let J of X)try{let Q=await _X(J,$,Z);if(Q)Y.push(Q)}catch(Q){if(console.error(`Error building web component ${J.name}:`,Q),$.debug)throw Q}}return Y}async function _X($,Z,X){let{name:Y,file:J,tag:Q,extends:G}=$;if(!Y||!J||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let q=null;if(q1.isAbsolute(J)&&await r(J))q=J;else if(Z.componentsDir){let _=q1.join(Z.componentsDir,J);if(await r(_))q=_}if(!q)q=await r5(J,process.cwd(),Z,X);if(!q)return console.error(`Web component source file not found: ${J}`),null;let U=await Bun.file(q).text();X.add(q);let K=($.outputFormat||"js")==="ts",z=K?VX({name:Y,tag:Q,baseElement:G,source:U,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):OX({name:Y,tag:Q,baseElement:G,source:U,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),H=Z.webComponents?.outputDir||"dist/web-components";await jX.promises.mkdir(H,{recursive:!0});let B=K?"ts":"js",j=q1.join(H,`${Q}.${B}`);if(await Bun.write(j,z),Z.debug)console.log(`Built web component ${Y} -> ${j}`);return j}function OX($){let{name:Z,tag:X,baseElement:Y="HTMLElement",source:J,shadowDOM:Q,template:G,styleSource:q,attributes:U=[]}=$,W=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)W=W.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),W=W.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),W=W.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),W=W.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let K="";if(q)K=`<link rel="stylesheet" href="${q}">`;return`/**
2174
+ </sitemapindex>`}async function VW($,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 W=q.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!W.startsWith("/"))W=`/${W}`;if(W!=="/"&&W.endsWith("/"))W=W.slice(0,-1);let K=`${$}/${q}`,z;try{let H=await Bun.file(K).stat();if(H)z=new Date(H.mtime).toISOString().split("T")[0]}catch{}Y.push({loc:W||"/",lastmod:z,priority:W==="/"?1:0.5})}return Y.sort((q,U)=>q.loc.localeCompare(U.loc)),Y}function jX($){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(`
2175
+ `).trim()}function FW($){return jX({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function _X($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}import OX from"fs";import f0 from"path";async function AW($,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 VX(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 VX($,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(f0.isAbsolute(Y)&&await r(Y))q=Y;else if(Z.componentsDir){let _=f0.join(Z.componentsDir,Y);if(await r(_))q=_}if(!q)q=await r5(Y,process.cwd(),Z,X);if(!q)return console.error(`Web component source file not found: ${Y}`),null;let U=await Bun.file(q).text();X.add(q);let K=($.outputFormat||"js")==="ts",z=K?LX({name:J,tag:Q,baseElement:G,source:U,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):FX({name:J,tag:Q,baseElement:G,source:U,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),H=Z.webComponents?.outputDir||"dist/web-components";await OX.promises.mkdir(H,{recursive:!0});let B=K?"ts":"js",j=f0.join(H,`${Q}.${B}`);if(await Bun.write(j,z),Z.debug)console.log(`Built web component ${J} -> ${j}`);return j}function FX($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:q,attributes:U=[]}=$,W=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)W=W.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),W=W.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),W=W.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),W=W.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let K="";if(q)K=`<link rel="stylesheet" href="${q}">`;return`/**
2176
2176
  * ${Z} Web Component
2177
2177
  * Auto-generated from stx component
2178
2178
  */
2179
- class ${Z.replace(/\W/g,"")} extends ${Y} {
2179
+ class ${Z.replace(/\W/g,"")} extends ${J} {
2180
2180
  constructor() {
2181
2181
  super()
2182
2182
  this._initialized = false
@@ -2264,7 +2264,7 @@ class ${Z.replace(/\W/g,"")} extends ${Y} {
2264
2264
 
2265
2265
  // Register the web component
2266
2266
  customElements.define('${X}', ${Z.replace(/\W/g,"")})
2267
- `}function VX($){let{name:Z,tag:X,baseElement:Y="HTMLElement",source:J,shadowDOM:Q,template:G,styleSource:q,attributes:U=[],attributeTypes:W={}}=$,K=Z.replace(/\W/g,""),z=J.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(W[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,N)=>N.toUpperCase()),_=U.map((R)=>` private _${j(R)}: ${B(R)} | null = null;`).join(`
2267
+ `}function LX($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:q,attributes:U=[],attributeTypes:W={}}=$,K=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(W[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,N)=>N.toUpperCase()),_=U.map((R)=>` private _${j(R)}: ${B(R)} | null = null;`).join(`
2268
2268
  `),V=U.map((R)=>{let D=B(R),N=j(R);return`
2269
2269
  get ${N}(): ${D} | null {
2270
2270
  return this._${N};
@@ -2344,7 +2344,7 @@ ${O}
2344
2344
  * ${Z} custom element class
2345
2345
  * @customElement ${X}
2346
2346
  */
2347
- export class ${K} extends ${Y} {
2347
+ export class ${K} extends ${J} {
2348
2348
  ${_}
2349
2349
  private _initialized = false;
2350
2350
  ${Q?"":"private _slotContent: Node[] = [];"}
@@ -2419,9 +2419,9 @@ declare global {
2419
2419
 
2420
2420
  // Register the web component
2421
2421
  customElements.define('${X}', ${K});
2422
- `}var G3={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function q3($){let Z=$.split("").reduce((X,Y)=>(X<<5)-X+Y.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function FX($,Z,X={}){let Y={...G3,...X},J=q3(Z);switch(Y.strategy){case"shadow":return $;case"prefix":return wX($,Y.prefix||Z,Y.preserveOriginal);case"attribute":return LX($,J,Y.attributeName||"data-v",Y.preserveOriginal);case"bem":return RX($,Z,Y.preserveOriginal);default:return $}}function LX($,Z,X,Y){let J=`[${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`${Y?`${G}${J}`:`${G}${J}`}${q}`})}function wX($,Z,X){return $.replace(/\.([a-z_][\w-]*)/gi,(Y,J)=>{if(J.startsWith(Z))return Y;let Q=`${Z}__${J}`;return X?`.${Q}`:`.${Q}`})}function RX($,Z,X){let Y=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(J,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(Y))return`.${Y}__${Q}`;return J}let G=`${Y}__${Q}`;return X?`.${G}`:`.${G}`})}function DX($,Z,X={}){let Y={...G3,...X};if(Y.strategy==="shadow")return $;if(Y.strategy==="attribute"){let J=q3(Z),G=`${Y.attributeName||"data-v"}-${J}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(q,U,W)=>{if(/^(?:script|style|!--)$/i.test(U))return q;let K=W.trimEnd().endsWith("/"),z=K?W.slice(0,-1):W;return`<${U}${z} ${G}${K?"/":""}>`})}if(Y.strategy==="prefix"||Y.strategy==="bem"){let J=Y.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):Y.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((U)=>{if(!U)return U;if(U.startsWith(J))return U;return`${J}__${U}`}).join(" ")}"`})}return $}function DW($,Z={}){let X={...G3,...Z},Y=q3($);return`${X.attributeName||"data-v"}-${Y}`}function NW($,Z,X={}){let Y="",J=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,q,U)=>{if(/\bscoped\b/i.test(q)||X.strategy!=="shadow")Y+=`${FX(U,Z,X)}
2423
- `;else Y+=`${U}
2424
- `;return""});return{html:DX(J,Z,X),css:Y.trim()}}function u1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function AW($){let{name:Z,tag:X,baseElement:Y="HTMLElement",template:J,styles:Q="",shadowDOM:G=!0,properties:q={},lifecycle:U={},events:W={},methods:K={},state:z={}}=$,H=Z.replace(/\W/g,""),B=Object.keys(q),j=B.filter((T)=>q[T].attribute!==!1).map((T)=>q[T].attribute||u1(T)),_=B.map((T)=>{let A=q[T],M=A.default!==void 0?JSON.stringify(A.default):A.type==="string"?'""':A.type==="number"?"0":A.type==="boolean"?"false":A.type==="array"?"[]":"{}";return` this._${T} = ${M};`}).join(`
2422
+ `}var q3={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function U3($){let Z=$.split("").reduce((X,J)=>(X<<5)-X+J.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function wX($,Z,X={}){let J={...q3,...X},Y=U3(Z);switch(J.strategy){case"shadow":return $;case"prefix":return DX($,J.prefix||Z,J.preserveOriginal);case"attribute":return RX($,Y,J.attributeName||"data-v",J.preserveOriginal);case"bem":return NX($,Z,J.preserveOriginal);default:return $}}function RX($,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 DX($,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 NX($,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 AX($,Z,X={}){let J={...q3,...X};if(J.strategy==="shadow")return $;if(J.strategy==="attribute"){let Y=U3(Z),G=`${J.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(q,U,W)=>{if(/^(?:script|style|!--)$/i.test(U))return q;let K=W.trimEnd().endsWith("/"),z=K?W.slice(0,-1):W;return`<${U}${z} ${G}${K?"/":""}>`})}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((U)=>{if(!U)return U;if(U.startsWith(Y))return U;return`${Y}__${U}`}).join(" ")}"`})}return $}function MW($,Z={}){let X={...q3,...Z},J=U3($);return`${X.attributeName||"data-v"}-${J}`}function TW($,Z,X={}){let J="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,q,U)=>{if(/\bscoped\b/i.test(q)||X.strategy!=="shadow")J+=`${wX(U,Z,X)}
2423
+ `;else J+=`${U}
2424
+ `;return""});return{html:AX(Y,Z,X),css:J.trim()}}function u1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function IW($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:q={},lifecycle:U={},events:W={},methods:K={},state:z={}}=$,H=Z.replace(/\W/g,""),B=Object.keys(q),j=B.filter((T)=>q[T].attribute!==!1).map((T)=>q[T].attribute||u1(T)),_=B.map((T)=>{let A=q[T],M=A.default!==void 0?JSON.stringify(A.default):A.type==="string"?'""':A.type==="number"?"0":A.type==="boolean"?"false":A.type==="array"?"[]":"{}";return` this._${T} = ${M};`}).join(`
2425
2425
  `),V=B.map((T)=>{let A=q[T],M=A.attribute!==!1?A.attribute||u1(T):null,k=A.reflect&&M?`
2426
2426
  if (value !== null && value !== undefined) {
2427
2427
  ${A.type==="boolean"?`if (value) { this.setAttribute('${M}', ''); }
@@ -2463,13 +2463,13 @@ else {
2463
2463
  ${T}() {
2464
2464
  ${A}
2465
2465
  }`}).join(`
2466
- `),w=JSON.stringify(Object.fromEntries(B.map((T)=>[T,q[T]]))),R=JSON.stringify(Object.fromEntries(B.filter((T)=>q[T].attribute!==!1).map((T)=>[q[T].attribute||u1(T),T]))),D=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),N=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2466
+ `),w=JSON.stringify(Object.fromEntries(B.map((T)=>[T,q[T]]))),R=JSON.stringify(Object.fromEntries(B.filter((T)=>q[T].attribute!==!1).map((T)=>[q[T].attribute||u1(T),T]))),D=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),N=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2467
2467
  * ${Z} - Reactive Web Component
2468
2468
  * Auto-generated with reactive properties and lifecycle management
2469
2469
  *
2470
2470
  * @customElement ${X}
2471
2471
  */
2472
- class ${H} extends ${Y} {
2472
+ class ${H} extends ${J} {
2473
2473
  // Property definitions
2474
2474
  _propertyDefs = ${w};
2475
2475
  _attrToProp = ${R};
@@ -2623,7 +2623,7 @@ customElements.define('${X}', ${H});
2623
2623
  // Export for module usage
2624
2624
  export { ${H} };
2625
2625
  export default ${H};
2626
- `}function MW($){let{name:Z,tag:X,baseElement:Y="HTMLElement",template:J,styles:Q="",shadowDOM:G=!0,properties:q={},lifecycle:U={},events:W={},methods:K={},state:z={}}=$,H=Z.replace(/\W/g,""),B=Object.keys(q),j=B.filter((A)=>q[A].attribute!==!1).map((A)=>q[A].attribute||u1(A)),_=(A)=>{switch(A){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"}},V=B.length>0?`
2626
+ `}function kW($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:q={},lifecycle:U={},events:W={},methods:K={},state:z={}}=$,H=Z.replace(/\W/g,""),B=Object.keys(q),j=B.filter((A)=>q[A].attribute!==!1).map((A)=>q[A].attribute||u1(A)),_=(A)=>{switch(A){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"}},V=B.length>0?`
2627
2627
  /**
2628
2628
  * Props interface for ${Z}
2629
2629
  */
@@ -2687,7 +2687,7 @@ else {
2687
2687
  ${A}(): void {
2688
2688
  ${M}
2689
2689
  }`}).join(`
2690
- `),N=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),T=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2690
+ `),N=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),T=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2691
2691
  * ${Z} - Reactive Web Component (TypeScript)
2692
2692
  * Auto-generated with reactive properties and lifecycle management
2693
2693
  *
@@ -2712,7 +2712,7 @@ interface PropertyDefinition {
2712
2712
  /**
2713
2713
  * ${Z} custom element
2714
2714
  */
2715
- export class ${H} extends ${Y} {
2715
+ export class ${H} extends ${J} {
2716
2716
  // Property definitions
2717
2717
  private _propertyDefs: Record<string, PropertyDefinition> = ${JSON.stringify(q)};
2718
2718
  private _attrToProp: Record<string, string> = ${JSON.stringify(Object.fromEntries(B.filter((A)=>q[A].attribute!==!1).map((A)=>[q[A].attribute||u1(A),A])))};
@@ -2875,7 +2875,7 @@ declare global {
2875
2875
  customElements.define('${X}', ${H});
2876
2876
 
2877
2877
  export default ${H};
2878
- `}function TW(){return`/**
2878
+ `}function EW(){return`/**
2879
2879
  * ReactiveElement Mixin
2880
2880
  * Adds reactive properties and lifecycle management to web components
2881
2881
  */
@@ -2997,7 +2997,7 @@ else {
2997
2997
 
2998
2998
  export { ReactiveElement };
2999
2999
  export default ReactiveElement;
3000
- `}function IW(){return`/**
3000
+ `}function bW(){return`/**
3001
3001
  * stx Reactive Web Components Runtime
3002
3002
  * Provides base classes and utilities for reactive web components
3003
3003
  */
@@ -3214,7 +3214,7 @@ else {
3214
3214
  };
3215
3215
 
3216
3216
  })(typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this);
3217
- `}function NX($,Z){let X=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=X?X[1].trim():"",J=Z,Q=[],G=!0;if(Y){let z=Y.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let H=z[1],B=H.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)J=B[1];let j=H.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)Q=j[1].split(",").map((V)=>V.trim().replace(/['"`]/g,"")).filter((V)=>V.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),U=q?q[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),K=W?W[1].trim():"";return{tag:J,props:Q,template:U,styles:K,script:Y,shadowDOM:G}}function AX($){let{tag:Z,props:X,template:Y,styles:J,shadowDOM:Q}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),U=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=X.map((z)=>`'${z}'`).join(", "),K=X.map((z)=>`
3217
+ `}function MX($,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((V)=>V.trim().replace(/['"`]/g,"")).filter((V)=>V.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),U=q?q[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),K=W?W[1].trim():"";return{tag:Y,props:Q,template:U,styles:K,script:J,shadowDOM:G}}function TX($){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,"\\${"),U=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=X.map((z)=>`'${z}'`).join(", "),K=X.map((z)=>`
3218
3218
  get ${z}() {
3219
3219
  return this.getAttribute('${z}') || '';
3220
3220
  }
@@ -3265,14 +3265,14 @@ ${K}
3265
3265
  }
3266
3266
 
3267
3267
  customElements.define('${Z}', ${G});
3268
- `}async function Q6($,Z,X,Y){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",l.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),G=(X.__stx_options||{}).componentsDir||"components",q=[q1.join(q1.dirname(Y),G,`${J}.stx`),q1.join(process.cwd(),G,`${J}.stx`),q1.join(q1.dirname(Y),`${J}.stx`)],U=null;for(let z of q)if(await r(z)){U=await Bun.file(z).text();break}if(!U)return $0("WebComponent",`Component file not found: ${J}.stx`,l.FILE_NOT_FOUND);let W=NX(U,J);return`<script type="module">
3269
- ${AX(W)}
3270
- </script>`}var j6={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:K6,cachePath:".stx/cache",cacheVersion:"1.0.0",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:A7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Q6,hasEndTag:!1,description:"Include a web component in the template"},U6,W6,J3,Q3,v$,x$,g$,f$,w7,z7,f7,r$,...B6],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 TX($,Z,X){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=X||process.cwd(),Q=S0.join(J,"resources","views"),G=S0.join(J,"resources","layouts");if(a5.existsSync(Q)&&a5.existsSync(G))return{root:"resources",pagesDir:"views"};let q=S0.join(J,"resources","views","pages");if(a5.existsSync(q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}var G6=new Set;function IX($,Z){let X=Z.replace(/[\\/]+$/,"");if(!X||X===".")return!0;let Y=$.replace(/\\/g,"/"),J=X.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function kX($,Z){let X=!$.root,Y=TX($.root,$.pagesDir,Z);if($.root=Y.root,$.pagesDir=Y.pagesDir,X&&Y.root!=="."){let J=`${Z}::${Y.root}`;if(!G6.has(J))G6.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let J=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(S0.isAbsolute(G)||IX(G,J))continue;$[Q]=S0.join(J,G)}}return $}function EX($,Z){let X=["componentsDir","layoutsDir","partialsDir"];for(let Y of X){let J=$[Y];if(typeof J!=="string"||!J)continue;let Q=S0.isAbsolute(J)?J:S0.join(Z,J);if(a5.existsSync(Q))continue;let G=$.root,q=!!G&&G!==".";console.warn(`[stx] ${String(Y)} resolves to "${Q}", which does not exist. Configured as "${J}"`+(q?`, resolved under root "${G}".`:"."))}}function bX($){if(z6($.stateDir),$.stateDir=H6(),$.cachePath=j5($.cachePath),$.build)$.build.cacheDir=j5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=j5($.media.cache.directory);if($.story)$.story.outDir=j5($.story.outDir)}var d1=null,q6=new Map,t5=null;async function U3($){if(!$){if(d1)return d1;if(t5)return t5}let Z=$?S0.resolve($):process.cwd(),X=q6.get(Z);if(X)return X;let Y=(async()=>{let Q=(await MX({name:"stx",alias:"ui",cwd:Z,defaultConfig:j6,verbose:!1})).config;if(bX(Q),kX(Q,Z),EX(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await import("./chunk-xfp10a23.js"),q=[],U=[];for(let W of Q.plugins){let K=typeof W==="string"?W:W[0],z=typeof W==="string"?{}:W[1]||{};try{let H,B;try{H=await import(K),B=S0.dirname(h.resolve(K))}catch{let _=S0.resolve(process.cwd(),K);H=await import(_),B=S0.dirname(_)}let j=H.default||H;if(G.register(j,Q),j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let V of _)q.push(S0.resolve(B,V))}if(j.pages){let _=S0.resolve(B,j.pages),V=z.path||"/";U.push({dir:_,prefix:V})}if(j.setup){let _={addDirective:(V)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(V)},addRoute:(V,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[V]=O},addMiddleware:(V)=>{Q.middleware=Q.middleware||[],Q.middleware.push(V)},pluginDir:B,config:Q};await j.setup(z,_)}console.log(`[stx] Plugin loaded: ${j.name||K}`)}catch(H){console.warn(`[stx] Failed to load plugin ${K}:`,H.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=U}return Q})();if(q6.set(Z,Y),!$)t5=Y,Y.then((J)=>{d1=J}).catch(()=>{});return Y}var _6=new Proxy(j6,{get($,Z){if(d1&&Z in d1)return d1[Z];if(!t5)U3().catch((X)=>{console.warn("[stx] Failed to load config file:",X?.message||X)});return $[Z]}});function lW($){return $}function cW($){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 Y=["auto","manual","sections"];if(!Y.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.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 Y=["AA","AAA"];if(!Y.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`customDirectives[${J}].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((Y,J)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))Z.push({path:`middleware[${J}].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 Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((J,Q)=>{if(!J.pattern||typeof J.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.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((J)=>typeof J!=="number"||J<16||J>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 Y=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!Y.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.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 K3=new Map;async function CX($,Z={}){try{if(!await r($))throw Error(`Markdown file not found: ${$}`);let Y=(await yX.promises.stat($)).mtime.getTime();if(Z.cache&&K3.has($)){let z=K3.get($);if(z.updatedAt>=Y)return{content:z.content,data:z.data}}let J=await Bun.file($).text(),{data:Q,content:G}=D7(J),q=Z.markdown||_6.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=W5(G,{gfm:!0});if(q.syntaxHighlighting?.enabled&&q.syntaxHighlighting?.serverSide)W=await PX(W,q.syntaxHighlighting?.defaultTheme||"github-dark",q.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:W,data:Q||{}};if(Z.cache)K3.set($,{...K,updatedAt:Y});return K}catch(X){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,X);let Y=X instanceof Error?X.message:String(X);return{content:W0("Markdown File",`Error reading/parsing markdown file: ${Y}`,$,"",0,""),data:{}}}}var e5=null;async function PX($,Z,X){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!e5)try{e5=await SX({theme:Z||"github-dark",cache:!0})}catch(q){return console.error("Failed to initialize ts-syntax-highlighter:",q),$}let J=async(q,U,W,K)=>{let z=K.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),H=W||(X?"text":"");if(!H)return q;try{if(!e5.getSupportedLanguages().includes(H))return q;return(await e5.highlight(z,H,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return q},Q=$,G=$.matchAll(Y);for(let q of G){let[U,W,K,z]=q,H=await J(U,W,K,z);Q=Q.replace(U,H)}return Q}async function O6($,Z,X="",Y={}){return await vX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,q,U,W)=>{try{let K=q;if(!W3.isAbsolute(q))K=W3.resolve(W3.dirname(X),q);let z={};if(U)try{try{z=JSON.parse(U)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let F=U.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),D=L.substring(w+1).trim(),N=D.startsWith('"')&&D.endsWith('"'),T=D.startsWith("'")&&D.endsWith("'");if(N||T)D=D.substring(1,D.length-1);z[R]=D}}}}catch(O){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:H,data:B}=await CX(K,Y),j={...Z,...B,...z},_=H,V=/\{\{([^}]+)\}\}/g;return _=_.replace(V,(O,F)=>{let L=F.trim();return j[L]!==void 0?String(j[L]):O}),_}catch(K){let z=K instanceof Error?K.message:String(K);return W0("Markdown File",`Error including markdown file: ${z}`,X,$,W,G)}})}async function vX($,Z,X){let Y=[],J;while((J=Z.exec($))!==null){let q=J[0],U=J.index,W=J;Y.push(X(...W).then((K)=>({match:q,replacement:K,index:U})))}let Q=await Promise.all(Y);Q.sort((q,U)=>U.index-q.index);let G=$;for(let{match:q,replacement:U}of Q)G=G.replace(q,()=>U);return G}function U1($,Z){try{let X=$.trim();if(Q0(X))return G0(X,Object.keys(Z))(...Object.values(Z));else return X0(X,Z)}catch{return!1}}class $${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,Y=this.source[this.pos];if(/\s/.test(Y))return this.readWhitespace($,Z,X);if(Y==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,X);if(Y==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,X);if(Y==='"'||Y==="'")return this.readString(Y,$,Z,X);if(Y==="`")return this.readTemplateString($,Z,X);if(/\d/.test(Y)||Y==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,X);if(/[a-z_$]/i.test(Y))return this.readIdentifier($,Z,X);if(Y==="{"){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(Y==="}"){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(Y==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:X};if(Y==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,X);let J=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of J)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(Y))return this.advance(),{type:"OPERATOR",value:Y,start:$,end:this.pos,line:Z,column:X};if(/[()[\]{},;.]/.test(Y))return this.advance(),{type:"PUNCTUATION",value:Y,start:$,end:this.pos,line:Z,column:X};return this.advance(),{type:"PUNCTUATION",value:Y,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]!==`
3271
- `)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,Y){this.advance();while(this.pos<this.source.length){let J=this.source[this.pos];if(J==="\\"){this.advance(2);continue}if(J===$){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Z,this.pos),start:Z,end:this.pos,line:X,column:Y}}readTemplateString($,Z,X){this.advance();let Y=0,J=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(Y>=J){this.pos=this.source.length;break}this.advance(2),Y++;continue}if(Q==="{"&&Y>0){Y++,this.advance();continue}if(Q==="}"&&Y>0){Y--,this.advance();continue}if(Q==="`"&&Y===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 Y=this.peek(1)?.toLowerCase();if(Y==="x"||Y==="o"||Y==="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]===`
3272
- `)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 H0($,Z,X,Y=0){let J=0,Q=Y,G=null,q=0,U=!1;while(Q<$.length){let W=$[Q];if(G&&U){U=!1,Q++;continue}if(G&&W==="\\"){U=!0,Q++;continue}if(U=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,Q++;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&W==="$"&&$[Q+1]==="{"){q++,Q+=2;continue}if(q>0&&W==="}"){q--,Q++;continue}if(W==="`"&&G==="`"&&q===0){G=null,Q++;continue}if(G){Q++;continue}if(W===Z)J++;else if(W===X){if(J--,J===0)return Q}Q++}return-1}function V6($,Z){let X=Z,Y={paren:0,bracket:0,brace:0},J=null,Q=0;while(X<$.length){let G=$[X];if((X>0?$[X-1]:"")==="\\"&&J){X++;continue}if((G==='"'||G==="'")&&!J){J=G,X++;continue}if(G===J&&J!=="`"){J=null,X++;continue}if(G==="`"&&!J){J="`",X++;continue}if(G==="`"&&J==="`"&&Q===0){J=null,X++;continue}if(J==="`"&&G==="$"&&$[X+1]==="{"){Q++,X+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;X++;continue}if(J){X++;continue}if(Y.paren===0&&Y.bracket===0&&Y.brace===0){if($.slice(X,X+2)==="}}"||$.slice(X,X+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")Y.paren++;else if(G===")"){if(Y.paren--,Y.paren<0)break}else if(G==="[")Y.bracket++;else if(G==="]"){if(Y.bracket--,Y.bracket<0)break}else if(G==="{")Y.brace++;else if(G==="}"){if(Y.brace--,Y.brace<0)break}X++}return{expression:$.slice(Z,X),endPos:X}}function z3($){let Z=[],X="",Y={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&J){X+=q;continue}if((q==='"'||q==="'")&&!J){J=q,X+=q;continue}if(q===J&&J!=="`"){J=null,X+=q;continue}if(q==="`"&&!J){J="`",X+=q;continue}if(q==="`"&&J==="`"&&Q===0){J=null,X+=q;continue}if(J==="`"&&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(J){X+=q;continue}if(q==="(")Y.paren++;else if(q===")")Y.paren--;else if(q==="[")Y.bracket++;else if(q==="]")Y.bracket--;else if(q==="{")Y.brace++;else if(q==="}")Y.brace--;if(q==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Z.push(X.trim()),X="";continue}if(q==="|"&&$[G-1]==="\\"&&!J){X=X.slice(0,-1)+q;continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function W1($,Z){let X=fX($,Z);return X.ok?{expression:X.expression,endPos:X.endPos}:null}function fX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return{ok:!1,reason:"missing-open-paren",pos:X};let Y=H0($,"(",")",X);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:X};return{ok:!0,expression:$.slice(X+1,Y),endPos:Y+1}}function xX($,Z){let X=$.lastIndexOf("<",Z);if(X===-1)return!1;return X>$.lastIndexOf(">",Z)}function w1($,Z,X,Y){let J=1,Q=Y,G=new RegExp(`@${Z}\\s*\\(`,"g"),q=new RegExp(`@${X}(?![a-z])`,"g");while(Q<$.length&&J>0){G.lastIndex=Q,q.lastIndex=Q;let U=G.exec($),W=q.exec($),K=U?U.index:1/0,z=W?W.index:1/0;if(K<z)J++,Q=K+U[0].length;else if(z<1/0){if(J--,J===0)return z;Q=z+W[0].length}else break}return-1}function F6($,Z){let X=$.slice(Z).match(/^@if\s*/);if(!X)return null;let Y=Z+X[0].length,J=W1($,Y);if(!J)return null;let Q=J.endPos,G=w1($,"if","endif",Q);if(G===-1)return null;let q=$.slice(Q,G),U=[],W=0,K="if",z=J.expression,H=0,B=0;while(W<q.length){let j=q.indexOf("@",W);if(j===-1)break;W=j;let _=q.substring(j);if(xX(q,j)){W++;continue}if(/^@if\s*\(/.test(_)){B++,W++;continue}if(/^@endif(?![a-z])/.test(_)){B--,W+=6;continue}if(B===0){let V=_.match(/^@elseif\s*/);if(V){U.push({type:K,condition:z,content:q.substring(H,W),start:Q+H,end:Q+W});let O=W+V[0].length,F=W1(q,O);if(!F){W++;continue}K="elseif",z=F.expression,W=F.endPos,H=W;continue}else if(/^@else(?![a-z])/.test(_)){U.push({type:K,condition:z,content:q.substring(H,W),start:Q+H,end:Q+W}),K="else",z=void 0,W+=5,H=W;continue}}W++}return U.push({type:K,condition:z,content:q.slice(H),start:Q+H,end:Q+q.length}),{fullMatch:$.slice(Z,G+6),branches:U,start:Z,end:G+6}}function _5($){let Z=[],X=/@if\s*\(/g,Y=X.exec($);while(Y!==null){if(Z.some((G)=>Y.index>G.start&&Y.index<G.end)){Y=X.exec($);continue}let Q=F6($,Y.index);if(Q)Z.push(Q),X.lastIndex=Q.end;Y=X.exec($)}return Z}function Z$($,Z,X){let Y=[],J=new RegExp(`@${Z}\\s*\\(`,"g"),Q=J.exec($);while(Q!==null){if(Y.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=J.exec($);continue}let q=Q.index,U=q+Q[0].length-1,W=H0($,"(",")",U);if(W===-1){Q=J.exec($);continue}let K=$.slice(U+1,W),z=W+1,H=w1($,Z,X,z);if(H===-1){Q=J.exec($);continue}let B=$.slice(z,H),j=H+`@${X}`.length;Y.push({fullMatch:$.slice(q,j),name:Z,params:K,content:B,start:q,end:j}),J.lastIndex=j,Q=J.exec($)}return Y}function H3($,Z){let X=$.slice(Z).match(/^@switch\s*/);if(!X)return null;let Y=Z+X[0].length,J=W1($,Y);if(!J)return null;let Q=J.endPos,G=w1($,"switch","endswitch",Q);if(G===-1)return null;let q=$.slice(Q,G),U=[],W=0,K=null,z=0;while(W<q.length){let H=q.slice(W),B=H.match(/^@switch\s*\(/),j=H.match(/^@endswitch(?![a-z])/);if(B){if(z++,K)K.content+=B[0];W+=B[0].length;continue}if(j){if(z--,K)K.content+=j[0];W+=j[0].length;continue}if(z>0){if(K)K.content+=q[W];W++;continue}let _=H.match(/^@case\s*/),V=H.match(/^@default(?![a-z])/),O=H.match(/^@break(?![a-z])/);if(_&&H.startsWith("@case")){if(K)U.push(K);let F=W+_[0].length,L=W1(q,F);if(!L){W++;continue}K={type:"case",value:L.expression,content:""},W=L.endPos}else if(V&&H.startsWith("@default")){if(K)U.push(K);K={type:"default",content:""},W+=V[0].length}else if(O&&H.startsWith("@break"))W+=O[0].length;else{if(K)K.content+=q[W];W++}}if(K)U.push(K);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:U,start:Z,end:G+10}}function gX($){let Z=[],X=0;while(X<$.length){let Y=$.indexOf("{{",X),J=$.indexOf("{!!",X),Q=!1,G;if(Y===-1&&J===-1)break;else if(Y===-1)G=J,Q=!0;else if(J===-1)G=Y,Q=!1;else if(J<Y)G=J,Q=!0;else G=Y,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let q=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",U=Q?q==="{{{"?"}}}":"!!}":"}}",W=G+q.length,K=hX($,W,U);if(K===-1){X=G+1;continue}let z=$.slice(W,K).trim(),H=K+U.length;Z.push({fullMatch:$.slice(G,H),expression:z,start:G,end:H,isRaw:Q}),X=H}return Z}function hX($,Z,X){let Y=Z,J=null,Q={paren:0,bracket:0,brace:0},G=0;while(Y<$.length){let q=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J){Y++;continue}if((q==='"'||q==="'")&&!J){J=q,Y++;continue}if(q===J&&J!=="`"){J=null,Y++;continue}if(q==="`"&&!J){J="`",Y++;continue}if(q==="`"&&J==="`"&&G===0){J=null,Y++;continue}if(J==="`"&&q==="$"&&$[Y+1]==="{"){G++,Y+=2;continue}if(G>0){if(q==="{")G++;else if(q==="}")G--;Y++;continue}if(J){Y++;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(Y,Y+X.length)===X)return Y}Y++}return-1}function uX($){let Z=z3($);if(Z.length===0)return{baseExpression:"",filters:[]};let X=Z[0],Y=[];for(let J=1;J<Z.length;J++){let Q=dX(Z[J]);if(Q)Y.push(Q)}return{baseExpression:X,filters:Y}}function dX($){let Z=$.trim();if(!Z)return null;let X=Z.indexOf("(");if(X===-1)return{name:Z,args:[]};let Y=Z.slice(0,X).trim(),J=X+1,Q=H0(Z,"(",")",X);if(Q===-1)return{name:Y,args:[]};let G=Z.slice(J,Q),q=R6(G);return{name:Y,args:q}}function R6($){let Z=[],X="",Y={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let q=$[G];if((G>0?$[G-1]:"")==="\\"&&J){X+=q;continue}if((q==='"'||q==="'")&&!J){J=q,X+=q;continue}if(q===J&&J!=="`"){J=null,X+=q;continue}if(q==="`"&&!J){J="`",X+=q;continue}if(q==="`"&&J==="`"&&Q===0){J=null,X+=q;continue}if(J==="`"&&q==="$"&&$[G+1]==="{"){Q++,X+="${",G++;continue}if(Q>0&&q==="{"){Q++,X+=q;continue}if(Q>0&&q==="}"){Q--,X+=q;continue}if(J){X+=q;continue}if(q==="(")Y.paren++;else if(q===")")Y.paren--;else if(q==="[")Y.bracket++;else if(q==="]")Y.bracket--;else if(q==="{")Y.brace++;else if(q==="}")Y.brace--;if(q===","&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Z.push(X.trim()),X="";continue}X+=q}if(X.trim())Z.push(X.trim());return Z}function mX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;let Y=H0($,"(",")",X);if(Y===-1)return null;return{params:$.slice(X+1,Y),endPos:Y+1}}function lX($){let Z=[],Y=new $$($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),J=0;while(J<Y.length){let Q=Y[J],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,J++,J>=Y.length)break}let q=Y[J];if(q.type==="IDENTIFIER"&&(q.value==="const"||q.value==="let"||q.value==="var")){let U=q.value;if(J++,J>=Y.length)break;let W=Y[J];if(W.type==="IDENTIFIER"){let K=W.value;if(J++,J<Y.length&&Y[J].type==="OPERATOR"&&Y[J].value==="="){J++;let z=J<Y.length?Y[J].start:$.length,H=L6(Y,J,$);J=H.nextIndex,Z.push({type:"variable",name:K,value:$.slice(z,H.endPos),exported:G,start:q.start,end:H.endPos})}}else if(W.type==="PUNCTUATION"&&(W.value==="{"||W.value==="[")){let K=W.start,z=W.value==="{"?"}":"]",H=H0($,W.value,z,K);if(H!==-1){let B=$.slice(K,H+1);if(J=w6(Y,H+1),J<Y.length&&Y[J].type==="OPERATOR"&&Y[J].value==="="){J++;let j=J<Y.length?Y[J].start:$.length,_=L6(Y,J,$);J=_.nextIndex;let V=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:V,value:`${$.slice(j,_.endPos)}; ${U} ${B} = ${V}`,exported:G,start:q.start,end:_.endPos})}}}}else if(q.type==="IDENTIFIER"&&q.value==="function"){let U=G?Y[J-1].start:q.start;if(J++,J>=Y.length)break;let W=Y[J];if(W.type==="IDENTIFIER"){let K=W.value;J++;let z=-1;while(J<Y.length){if(Y[J].type==="PUNCTUATION"&&Y[J].value==="{"){z=Y[J].start;break}J++}if(z!==-1){let H=H0($,"{","}",z);if(H!==-1)Z.push({type:"function",name:K,value:$.slice(U,H+1).replace(/^export\s+/,""),exported:G,start:U,end:H+1}),J=w6(Y,H+1)}}}else J++}return Z}function L6($,Z,X){let Y=Z,J={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:X.length;while(Y<$.length){let G=$[Y];if(G.type==="PUNCTUATION"){if(G.value==="(")J.paren++;else if(G.value===")")J.paren--;else if(G.value==="[")J.bracket++;else if(G.value==="]")J.bracket--;else if(G.value==="{")J.brace++;else if(G.value==="}")J.brace--;if(G.value===";"&&J.paren===0&&J.bracket===0&&J.brace===0){Q=G.start,Y++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(J.paren===0&&J.bracket===0&&J.brace===0){Q=$[Y-1]?.end??G.start;break}}Q=G.end,Y++}return{nextIndex:Y,endPos:Q}}function w6($,Z){for(let X=0;X<$.length;X++)if($[X].start>=Z)return X;return $.length}function cX($,Z,X){let Y=$,J=!0;while(J){J=!1;let Q=Y.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,q=H3(Y,G);if(!q)break;try{let U;if(Q0(q.expression))U=G0(q.expression,Object.keys(Z))(...Object.values(Z));else U=X0(q.expression,Z);let W="",K=!1;for(let z of q.cases)if(z.type==="default"){if(!K)W=z.content.trim()}else try{let H;if(z.value&&Q0(z.value))H=G0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)H=X0(z.value,Z);if(U===H){W=z.content.trim(),K=!0;break}}catch{continue}Y=Y.substring(0,G)+W+Y.substring(q.end),J=!0}catch(U){let W=U instanceof Error?U.message:String(U),K=$0("Switch",`Error evaluating @switch expression: ${W}`,l.EVALUATION_ERROR);Y=Y.substring(0,G)+K+Y.substring(q.end);break}}return Y}function pX($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return Z.push(Y),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function iX($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(X,Y)=>Z[Number(Y)]??X)}function a0($,Z,X){let{masked:Y,scripts:J}=pX($);return iX(nX(Y,Z,X),J)}function nX($,Z,X){let Y=$;Y=cX(Y,Z,X);{let Q=!0;while(Q){Q=!1;let G=Y.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let q=G.index,U=W1(Y,q+7);if(!U)break;let W=U.endPos,K=w1(Y,"unless","endunless",W);if(K===-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=Y.slice(W,K),H=U.expression,B=-1;{let _=0,V=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=V.exec(z))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(z))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(z))!==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 _=z.slice(0,B),V=z.slice(B+5);j=`@if (${H})${V}@else ${_}@endif`}else j=`@if (!(${H}))${z}@endif`;Y=Y.substring(0,q)+j+Y.substring(K+10),Q=!0}}Y=j3(Y,Z,X),Y=_3(Y,Z,X),Y=B3(Y,Z);let J=()=>{let Q=_5(Y);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let q=Q[G];try{let U="",W=!1;for(let K of q.branches){if(W)break;if(K.type==="else")U=K.content,W=!0;else try{let z;if(K.condition&&Q0(K.condition))z=G0(K.condition,Object.keys(Z))(...Object.values(Z));else if(K.condition)z=X0(K.condition,Z);if(z)U=K.content,W=!0}catch(z){U=$0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,l.EVALUATION_ERROR),W=!0}}Y=Y.substring(0,q.start)+U+Y.substring(q.end)}catch(U){let W=U instanceof Error?U.message:String(U),K=$0("If",`Error processing @if block: ${W}`,l.EVALUATION_ERROR);Y=Y.substring(0,q.start)+K+Y.substring(q.end)}}return!0};while(!0){let Q=Y;if(!J())break;if(Y===Q)break}return Y}function D6($){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 Y=[];while(Z<$.length){let J=$[Z];if(J==="\\"&&Z+1<$.length){Y.push($[Z+1]),Z+=2;continue}if(J===X){Z++;break}Y.push(J),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:Y.join(""),consumed:Z}}function B3($,Z){let X=$;function Y(q,U,W,K){let z=1,H=K,B=new RegExp(`@${U}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(H<q.length&&z>0){B.lastIndex=H,j.lastIndex=H;let _=B.exec(q),V=j.exec(q),O=_?_.index:1/0,F=V?V.index:1/0;if(O<F)z++,H=O+_[0].length;else if(F<1/0){if(z--,z===0)return F;H=F+V[0].length}else break}return-1}function J(q,U,W){let K=0,z=new RegExp(`@${U}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${W}(?![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((V,O)=>V.pos-O.pos);for(let V of j)if(V.type==="open")K++;else if(V.type==="close")K--;else if(V.type==="else"&&K===0)return V.pos;return-1}{let q=!0;while(q){q=!1;let U=X.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!U||U.index===void 0)break;let W=U.index,K,z,H=X.slice(W+5),B=D6(H);if(B)K=B.value,z=W+5+B.consumed;else z=W+5;let j=Y(X,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=X.slice(z,j),V=J(_,"auth","endauth"),O;if(!Z.auth)O=!1;else O=K?U1(`auth?.check && auth?.user?.[${K}]`,Z):U1("auth?.check",Z);let F;if(V!==-1){let L=_.slice(0,V),w=_.slice(V+5);F=O?L:w}else F=O?_:"";X=X.substring(0,W)+F+X.substring(j+8),q=!0}}{let q=!0;while(q){q=!1;let U=X.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!U||U.index===void 0)break;let W=U.index,K,z,H=X.slice(W+6),B=D6(H);if(B)K=B.value,z=W+6+B.consumed;else z=W+6;let j=Y(X,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=X.slice(z,j),V=J(_,"guest","endguest"),O;if(!Z.auth)O=!0;else O=K?U1(`!auth?.check || !auth?.user?.[${K}]`,Z):U1("!auth?.check",Z);let F;if(V!==-1){let L=_.slice(0,V),w=_.slice(V+5);F=O?L:w}else F=O?_:"";X=X.substring(0,W)+F+X.substring(j+9),q=!0}}function Q(q,U,W){if(Z.userCan&&typeof Z.userCan[q]==="boolean")return Z.userCan[q];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let K=[q];if(U)K.push(U);if(W){let z=U1(W,Z);K.push(z)}return Z.permissions.check(...K)}catch{return!1}return!1}function G(q){let U=q.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!U)return null;return{ability:U[1],type:U[2],id:U[3]?.trim(),paramsEnd:U[0].length}}for(let q of["can","cannot"]){let U=`end${q}`,W=q==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!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,V=Y(X,q,U,_);if(V===-1){console.warn(`[stx] @${q} directive at position ${H} has no matching @${U} \u2014 the block was skipped.`);break}let O=X.slice(_,V),F=[],L=0,w=new RegExp(`@${q}\\s*\\(`,"g"),R=new RegExp(`@${U}(?![a-z])`,"g"),D=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],A;while((A=w.exec(O))!==null)T.push({pos:A.index,type:"open"});while((A=R.exec(O))!==null)T.push({pos:A.index,type:"close"});while((A=D.exec(O))!==null)T.push({pos:A.index,type:"elseDirective"});while((A=N.exec(O))!==null)T.push({pos:A.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)F.push(b)}let M=[],k=0;for(let b=0;b<F.length;b++){let C=F[b];if(M.push({content:O.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=O.slice(C.pos+`@${W}`.length),f=G(x);if(f){M[M.length-1]={content:O.slice(k,C.pos)},k=C.pos+`@${W}`.length+f.paramsEnd,M.push({content:"",ability:f.ability,type:f.type,id:f.id}),M.pop();let n=F[b+1],m=n?n.pos:O.length;M.push({content:O.slice(k,m),ability:f.ability,type:f.type,id:f.id}),k=m}}else k=C.pos+5}if(k<O.length){let b=M[M.length-1];if(F.length>0&&F[F.length-1].type==="else")M.push({content:O.slice(k),isFinalElse:!0});else if(M.length===0)M.push({content:O.slice(k)})}let I=Q(j.ability,j.type,j.id),y=q==="can"?I:!I,E="";if(y)E=M[0]?.content||"";else{let b=!1;for(let C=1;C<M.length;C++){let x=M[C];if(x.isFinalElse){E=x.content,b=!0;break}if(x.ability){let f=Q(x.ability,x.type,x.id);if(q==="can"?f:!f){E=x.content,b=!0;break}}}if(!b&&M.length>0){let C=M[M.length-1];if(C.isFinalElse)E=C.content}}X=X.substring(0,H)+E+X.substring(V+`@${U}`.length),K=!0}}return X}function j3($,Z,X){let Y=$;function J(Q,G,q,U,W){let K=!0;while(K){K=!1;let z=new RegExp(`@${G}\\s*\\(`),H=Q.match(z);if(!H||H.index===void 0)break;let B=H.index,j=W1(Q,B+`@${G}`.length);if(!j)break;let _=j.endPos,V=w1(Q,G,q,_);if(V===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let O=Q.slice(_,V),F=j.expression,L=-1,w=0,R=0;while(R<O.length){let D=O.indexOf("@",R);if(D===-1)break;let N=O.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){L=D;break}R=D+1}try{let D=U(F.trim()),N;if(L!==-1){let T=O.slice(0,L),A=O.slice(L+5);N=D?T:A}else N=D?O:"";Q=Q.substring(0,B)+N+Q.substring(V+`@${q}`.length),K=!0}catch(D){let N=D instanceof Error?D.message:String(D),T=$0(W,`Error processing @${G} directive: ${N}`,l.EVALUATION_ERROR);Q=Q.substring(0,B)+T+Q.substring(V+`@${q}`.length);break}}return Q}return Y=J(Y,"isset","endisset",(Q)=>{let G=U1(Q,Z);return G!==void 0&&G!==null},"Isset"),Y=J(Y,"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"),Y}function _3($,Z,X){let Y=$,J="development";function Q(G,q,U,W){let K=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`@${U}(?![a-z])`,"g"),H=new RegExp(`^@${q}(?![a-z])`),B=new RegExp(`^@${U}(?![a-z])`),j=G,_=!0;while(_){_=!1,K.lastIndex=0;let V=K.exec(j);if(!V)break;let O=V.index,F=O+V[0].length;if(q==="env"){let I=j.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;F+=I[0].length,W=J===I[2]}let L=1,w=F,R=-1;while(L>0&&w<j.length){K.lastIndex=w,z.lastIndex=w;let I=K.exec(j),y=z.exec(j),E=I?I.index:1/0,b=y?y.index:1/0;if(E<b)L++,w=E+I[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${q} directive at position ${O} has no matching @${U} \u2014 the block was skipped.`);break}let D=j.substring(F,R),N=-1,T=0,A=0;while(A<D.length){let I=D.indexOf("@",A);if(I===-1)break;let y=D.substring(I);if(H.test(y)){T++,A=I+1;continue}if(B.test(y)){T--,A=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){N=I;break}A=I+1}let M;if(N!==-1){let I=D.slice(0,N),y=D.slice(N+5);M=W?I:y}else M=W?D:"";let k=`@${U}`.length;j=j.substring(0,O)+M+j.substring(R+k),_=!0}return j}return Y=Q(Y,"env","endenv",!1),Y=Q(Y,"production","endproduction",J==="production"),Y=Q(Y,"development","enddevelopment",J==="development"),Y=Q(Y,"staging","endstaging",J==="staging"),Y=Q(Y,"testing","endtesting",J==="testing"),Y}var O3=new WeakMap;function N6($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function R1($,Z){if(!$)return Z?.nonceGenerator?.()??N6();let X=O3.get($);if(!X)X=Z?.nonceGenerator?.()??N6(),O3.set($,X);return X}function VK($){O3.delete($)}function A6($,Z){let X=[];for(let[Y,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)X.push(Y);continue}if(Array.isArray(J)){let Q=[...J];if(Z&&(Y==="script-src"||Y==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)X.push(`${Y} ${Q.join(" ")}`)}}return X.join("; ")}function F3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${A6($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var sX={"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},V3={"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},oX={"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'"]},rX={"default-src":["'none'"],"frame-ancestors":["'none'"]};function FK($){return{enabled:!0,directives:{strict:sX,moderate:V3,relaxed:oX,api:rX}[$]||V3,useNonce:$==="strict",addMetaTag:!0}}function LK($,Z){let X={...$};for(let[Y,J]of Object.entries(Z)){let Q=Y,G=X[Q];if(J===void 0||J===null)continue;if(typeof J==="boolean")X[Q]=G||J;else if(Array.isArray(J)){let q=Array.isArray(G)?G:[],U=[...new Set([...q,...J])];X[Q]=U}}return X}function M6($,Z,X){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=Z.useNonce?R1(X,Z):void 0,J=F3(Z.directives,Y);return $.replace(/<head([^>]*)>/,`<head$1>
3273
- ${J}`)}function T6($,Z){let X=$;return X=X.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${Z}"${J}>`}),X=X.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${Z}"${J}>`}),X}function I6($,Z,X,Y){let J=$,Q=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?R1(Z,Q):void 0;return F3(Q.directives,G)}),J=J.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return R1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=R1(Z,Q);return J}var aX={name:"csp",handler:($,Z,X,Y)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?R1(X,Q):void 0;return F3(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},tX={name:"cspNonce",handler:($,Z,X,Y)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return R1(X,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function wK(){return[aX,tX]}function RK($){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,Y]of Object.entries($))if(Array.isArray(Y)&&Y.includes("http:"))Z.push(`CSP: Using http: in ${X} allows insecure resources`);return Z}function eX($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function DK($,Z){if(!$.enabled)return{};let X=$.useNonce?R1(Z,$):void 0,Y=A6($.directives,X);return{[eX($.reportOnly)]:Y}}var NK={enabled:!1,reportOnly:!1,directives:V3,useNonce:!1,addMetaTag:!0};import $Y from"crypto";var ZY=40,k6="_token",L3=null;function XY($=ZY){let Z=$Y.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return L3=Z,Z}function YY(){if(!L3)XY();return L3}function JY($=k6){let Z=YY();return`<input type="hidden" name="${$}" value="${Z}">`}function E6($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,X,Y)=>{return JY(Y||k6)})}async function b6($,Z,X,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return $;let J=$;for(let Q of Y.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)J=await QY(J,Q,Z,X,Y);else J=await GY(J,Q,Z,X,Y)}return J}async function QY($,Z,X,Y,J){let{name:Q,handler:G}=Z,q=`@${Q}`,U=`@end${Q}`,W=$,K=v1(`${q}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${U}`,"g"),z=[],H=K.exec(W);while(H!==null){let[B,j="",_=""]=H,V=H.index||0;try{let O=j?y6(j):[],F=_.trim(),L=await G(F,O,X,Y);z.push({original:B,processed:L,startIndex:V})}catch(O){let F=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${Q}:`,O);z.push({original:B,processed:$0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${F}`,l.EVALUATION_ERROR),startIndex:V})}H=K.exec(W)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:_}=z[B];W=W.replace(j,_)}return W}async function GY($,Z,X,Y,J){let{name:Q,handler:G}=Z,q=$,U=v1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],K=U.exec(q);while(K!==null){let[B,j=""]=K,_=K.index||0;try{let V=y6(j),O=await G("",V,X,Y);W.push({original:B,processed:O,startIndex:_})}catch(V){let O=V instanceof Error?V.message:String(V);if(J.debug)console.error(`Error processing custom directive @${Q}:`,V);W.push({original:B,processed:$0("CustomDirective",`Error in @${Q}(${j}): ${O}`,l.EVALUATION_ERROR),startIndex:_})}K=U.exec(q)}let z=v1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=z.exec(q);while(H!==null){let[B]=H,j=H.index||0;try{let _=await G("",[],X,Y);W.push({original:B,processed:_,startIndex:j})}catch(_){let V=_ instanceof Error?_.message:String(_);if(J.debug)console.error(`Error processing custom directive @${Q}:`,_);W.push({original:B,processed:$0("CustomDirective",`Error in @${Q}: ${V}`,l.EVALUATION_ERROR),startIndex:j})}H=z.exec(q)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:_}=W[B];q=q.replace(j,_)}return q}function y6($){if(!$.trim())return[];let Z=[],X="",Y=!1,J="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!Y)Y=!0,J=G;else if(G===J)Y=!1;else X+=G;else if(G===","&&!Y)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 S6=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,C6=/^[A-Za-z_$][\w$]*$/,qY=new Set(["light","dark","system"]);function D1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function UY($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,X=Z.appearance,Y=Z.colorMode;if(D1(Z.storageKey,"storageKey"),!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(D1(X.key,"appearance.key"),D1(X.attribute,"appearance.attribute"),D1(X.default,"appearance.default"),D1(Y.key,"colorMode.key"),D1(Y.attribute,"colorMode.attribute"),D1(Y.default,"colorMode.default"),!C6.test(X.key)||!C6.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!S6.test(X.attribute)||!S6.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(X.allowed)||X.allowed.length===0||X.allowed.some((J)=>typeof J!=="string"||J.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(Y.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:Y.key,attribute:Y.attribute,default:Y.default}}}function WY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function KY($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${WY($)};const root=document.documentElement;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{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function zY($,Z){let X=1,Y=null,J=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(J){J=!1;continue}if(Y){if(G==="\\")J=!0;else if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="(")X++;else if(G===")"&&--X===0)return Q}return-1}function P6($,Z){let X=$,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(X))!==null){let Q=J.index+J[0].length-1,G=zY(X,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let q=X.slice(Q+1,G).trim(),U=X0(`(${q})`,Z),W=KY(UY(U));X=X.slice(0,J.index)+W+X.slice(G+1),Y.lastIndex=J.index+W.length}return X}import HY from"crypto";function B0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var R3={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function BY($){return{...R3,...$.forms?.classes}}function X$($,Z,X,Y){let J=$||Z;return X?`${J} ${Y}`:J}function f0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function m1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${B0(Z)}"`}function w3($,Z,X){if(!Z)return"";let Y="";if(!/\baria-invalid\s*=/i.test(X))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(X))Y+=` aria-describedby="${B0(`${f0($)}-error`)}"`;return Y}function jY(){return HY.randomUUID()}function PK($,Z,X,Y){let J=BY(Y),Q=$;return Q=OY(Q,Z),Q=F5(Q,Z),Q=D3(Q,Z,J),Q=N3(Q,Z,J),Q}function F5($,Z){let X=$;return X=X.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let Y=jY();Z.csrf={token:Y}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${B0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),X=X.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let Q=J.toUpperCase();if(J&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${B0(Q)}">`;return Y}),X}function D3($,Z,X=R3){let Y=$;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,Q,G,q,U,W="")=>{let K=Q||G||"POST",z=q||U||"",H=K1(W),B=K.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${B0(j)}" action="${B0(z)}"${H?` ${H}`:""}>`;if(_+=`
3268
+ `}async function q6($,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=f0.isAbsolute(G)?[f0.join(G,`${Y}.stx`),f0.join(f0.dirname(J),`${Y}.stx`)]:[f0.join(f0.dirname(J),G,`${Y}.stx`),f0.join(process.cwd(),G,`${Y}.stx`),f0.join(f0.dirname(J),`${Y}.stx`)],U=null;for(let z of q)if(await r(z)){U=await Bun.file(z).text();break}if(!U)return $0("WebComponent",`Component file not found: ${Y}.stx`,l.FILE_NOT_FOUND);let W=MX(U,Y);return`<script type="module">
3269
+ ${TX(W)}
3270
+ </script>`}var O6={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:H6,cachePath:".stx/cache",cacheVersion:"1.0.0",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:q6,hasEndTag:!1,description:"Include a web component in the template"},K6,z6,Q3,G3,f$,g$,h$,x$,D7,B7,g7,a$,..._6],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 kX($,Z,X){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=X||process.cwd(),Q=N0.join(Y,"resources","views"),G=N0.join(Y,"resources","layouts");if(a5.existsSync(Q)&&a5.existsSync(G))return{root:"resources",pagesDir:"views"};let q=N0.join(Y,"resources","views","pages");if(a5.existsSync(q))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}var U6=new Set,t5=["partialsDir","componentsDir","layoutsDir"],W3=new WeakMap;function EX($,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 bX($,Z){let X=!$.root,J=kX($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,X&&J.root!=="."){let Y=`${Z}::${J.root}`;if(!U6.has(Y))U6.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(!W3.has($)){let Y={};for(let Q of t5){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}W3.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of t5){let G=$[Q];if(typeof G!=="string"||!G)continue;if(N0.isAbsolute(G)||EX(G,Y))continue;$[Q]=N0.join(Y,G)}}for(let Y of t5){let Q=$[Y];if(typeof Q!=="string"||!Q||N0.isAbsolute(Q))continue;$[Y]=N0.resolve(Z,Q)}return $}function yX($,Z){let X=W3.get($);for(let J of t5){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let Q=N0.isAbsolute(Y)?Y:N0.join(Z,Y);if(a5.existsSync(Q))continue;let G=X?.[J]??Y,q=$.root,U=!!q&&q!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(U?`, resolved under root "${q}".`:"."))}}function SX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function CX($){if(B6($.stateDir),$.stateDir=j6(),$.cachePath=j5($.cachePath),$.build)$.build.cacheDir=j5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=j5($.media.cache.directory);if($.story)$.story.outDir=j5($.story.outDir)}var d1=null,W6=new Map,e5=null;async function K3($){if(!$){if(d1)return d1;if(e5)return e5}let Z=$?N0.resolve($):process.cwd(),X=W6.get(Z);if(X)return X;let J=(async()=>{let Q=(await IX({name:"stx",alias:"ui",cwd:Z,defaultConfig:O6,verbose:!1})).config;if(SX(Q),CX(Q),bX(Q,Z),yX(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await import("./chunk-xfp10a23.js"),q=[],U=[];for(let W of Q.plugins){let K=typeof W==="string"?W:W[0],z=typeof W==="string"?{}:W[1]||{};try{let H,B;try{H=await import(K),B=N0.dirname(h.resolve(K))}catch{let _=N0.resolve(process.cwd(),K);H=await import(_),B=N0.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 V of _)q.push(N0.resolve(B,V))}if(j.pages){let _=N0.resolve(B,j.pages),V=z.path||"/";U.push({dir:_,prefix:V})}if(j.setup){let _={addDirective:(V)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(V)},addRoute:(V,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[V]=O},addMiddleware:(V)=>{Q.middleware=Q.middleware||[],Q.middleware.push(V)},pluginDir:B,config:Q};await j.setup(z,_)}console.log(`[stx] Plugin loaded: ${j.name||K}`)}catch(H){console.warn(`[stx] Failed to load plugin ${K}:`,H.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=U}return Q})();if(W6.set(Z,J),!$)e5=J,J.then((Y)=>{d1=Y}).catch(()=>{});return J}var V6=new Proxy(O6,{get($,Z){if(d1&&Z in d1)return d1[Z];if(!e5)K3().catch((X)=>{console.warn("[stx] Failed to load config file:",X?.message||X)});return $[Z]}});function iW($){return $}function nW($){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 H3=new Map;async function fX($,Z={}){try{if(!await r($))throw Error(`Markdown file not found: ${$}`);let J=(await PX.promises.stat($)).mtime.getTime();if(Z.cache&&H3.has($)){let z=H3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=A7(Y),q=Z.markdown||V6.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=W5(G,{gfm:!0});if(q.syntaxHighlighting?.enabled&&q.syntaxHighlighting?.serverSide)W=await xX(W,q.syntaxHighlighting?.defaultTheme||"github-dark",q.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:W,data:Q||{}};if(Z.cache)H3.set($,{...K,updatedAt:J});return K}catch(X){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,X);let J=X instanceof Error?X.message:String(X);return{content:W0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}var $$=null;async function xX($,Z,X){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!$$)try{$$=await vX({theme:Z||"github-dark",cache:!0})}catch(q){return console.error("Failed to initialize ts-syntax-highlighter:",q),$}let Y=async(q,U,W,K)=>{let z=K.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),H=W||(X?"text":"");if(!H)return q;try{if(!$$.getSupportedLanguages().includes(H))return q;return(await $$.highlight(z,H,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return q},Q=$,G=$.matchAll(J);for(let q of G){let[U,W,K,z]=q,H=await Y(U,W,K,z);Q=Q.replace(U,H)}return Q}async function F6($,Z,X="",J={}){return await gX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,q,U,W)=>{try{let K=q;if(!z3.isAbsolute(q))K=z3.resolve(z3.dirname(X),q);let z={};if(U)try{try{z=JSON.parse(U)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let F=U.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let R=L.substring(0,w).trim(),D=L.substring(w+1).trim(),N=D.startsWith('"')&&D.endsWith('"'),T=D.startsWith("'")&&D.endsWith("'");if(N||T)D=D.substring(1,D.length-1);z[R]=D}}}}catch(O){if(J.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:H,data:B}=await fX(K,J),j={...Z,...B,...z},_=H,V=/\{\{([^}]+)\}\}/g;return _=_.replace(V,(O,F)=>{let L=F.trim();return j[L]!==void 0?String(j[L]):O}),_}catch(K){let z=K instanceof Error?K.message:String(K);return W0("Markdown File",`Error including markdown file: ${z}`,X,$,W,G)}})}async function gX($,Z,X){let J=[],Y;while((Y=Z.exec($))!==null){let q=Y[0],U=Y.index,W=Y;J.push(X(...W).then((K)=>({match:q,replacement:K,index:U})))}let Q=await Promise.all(J);Q.sort((q,U)=>U.index-q.index);let G=$;for(let{match:q,replacement:U}of Q)G=G.replace(q,()=>U);return G}function U1($,Z){try{let X=$.trim();if(Q0(X))return G0(X,Object.keys(Z))(...Object.values(Z));else return X0(X,Z)}catch{return!1}}class Z${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]!==`
3271
+ `)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]===`
3272
+ `)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 H0($,Z,X,J=0){let Y=0,Q=J,G=null,q=0,U=!1;while(Q<$.length){let W=$[Q];if(G&&U){U=!1,Q++;continue}if(G&&W==="\\"){U=!0,Q++;continue}if(U=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,Q++;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&W==="$"&&$[Q+1]==="{"){q++,Q+=2;continue}if(q>0&&W==="}"){q--,Q++;continue}if(W==="`"&&G==="`"&&q===0){G=null,Q++;continue}if(G){Q++;continue}if(W===Z)Y++;else if(W===X){if(Y--,Y===0)return Q}Q++}return-1}function L6($,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 W1($,Z){let X=hX($,Z);return X.ok?{expression:X.expression,endPos:X.endPos}:null}function hX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return{ok:!1,reason:"missing-open-paren",pos:X};let J=H0($,"(",")",X);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:X};return{ok:!0,expression:$.slice(X+1,J),endPos:J+1}}function uX($,Z){let X=$.lastIndexOf("<",Z);if(X===-1)return!1;return X>$.lastIndexOf(">",Z)}function w1($,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 U=G.exec($),W=q.exec($),K=U?U.index:1/0,z=W?W.index:1/0;if(K<z)Y++,Q=K+U[0].length;else if(z<1/0){if(Y--,Y===0)return z;Q=z+W[0].length}else break}return-1}function w6($,Z){let X=$.slice(Z).match(/^@if\s*/);if(!X)return null;let J=Z+X[0].length,Y=W1($,J);if(!Y)return null;let Q=Y.endPos,G=w1($,"if","endif",Q);if(G===-1)return null;let q=$.slice(Q,G),U=[],W=0,K="if",z=Y.expression,H=0,B=0;while(W<q.length){let j=q.indexOf("@",W);if(j===-1)break;W=j;let _=q.substring(j);if(uX(q,j)){W++;continue}if(/^@if\s*\(/.test(_)){B++,W++;continue}if(/^@endif(?![a-z])/.test(_)){B--,W+=6;continue}if(B===0){let V=_.match(/^@elseif\s*/);if(V){U.push({type:K,condition:z,content:q.substring(H,W),start:Q+H,end:Q+W});let O=W+V[0].length,F=W1(q,O);if(!F){W++;continue}K="elseif",z=F.expression,W=F.endPos,H=W;continue}else if(/^@else(?![a-z])/.test(_)){U.push({type:K,condition:z,content:q.substring(H,W),start:Q+H,end:Q+W}),K="else",z=void 0,W+=5,H=W;continue}}W++}return U.push({type:K,condition:z,content:q.slice(H),start:Q+H,end:Q+q.length}),{fullMatch:$.slice(Z,G+6),branches:U,start:Z,end:G+6}}function _5($){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=w6($,J.index);if(Q)Z.push(Q),X.lastIndex=Q.end;J=X.exec($)}return Z}function X$($,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,U=q+Q[0].length-1,W=H0($,"(",")",U);if(W===-1){Q=Y.exec($);continue}let K=$.slice(U+1,W),z=W+1,H=w1($,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:K,content:B,start:q,end:j}),Y.lastIndex=j,Q=Y.exec($)}return J}function j3($,Z){let X=$.slice(Z).match(/^@switch\s*/);if(!X)return null;let J=Z+X[0].length,Y=W1($,J);if(!Y)return null;let Q=Y.endPos,G=w1($,"switch","endswitch",Q);if(G===-1)return null;let q=$.slice(Q,G),U=[],W=0,K=null,z=0;while(W<q.length){let H=q.slice(W),B=H.match(/^@switch\s*\(/),j=H.match(/^@endswitch(?![a-z])/);if(B){if(z++,K)K.content+=B[0];W+=B[0].length;continue}if(j){if(z--,K)K.content+=j[0];W+=j[0].length;continue}if(z>0){if(K)K.content+=q[W];W++;continue}let _=H.match(/^@case\s*/),V=H.match(/^@default(?![a-z])/),O=H.match(/^@break(?![a-z])/);if(_&&H.startsWith("@case")){if(K)U.push(K);let F=W+_[0].length,L=W1(q,F);if(!L){W++;continue}K={type:"case",value:L.expression,content:""},W=L.endPos}else if(V&&H.startsWith("@default")){if(K)U.push(K);K={type:"default",content:""},W+=V[0].length}else if(O&&H.startsWith("@break"))W+=O[0].length;else{if(K)K.content+=q[W];W++}}if(K)U.push(K);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:U,start:Z,end:G+10}}function dX($){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)==="{{{"?"{{{":"{!!":"{{",U=Q?q==="{{{"?"}}}":"!!}":"}}",W=G+q.length,K=mX($,W,U);if(K===-1){X=G+1;continue}let z=$.slice(W,K).trim(),H=K+U.length;Z.push({fullMatch:$.slice(G,H),expression:z,start:G,end:H,isRaw:Q}),X=H}return Z}function mX($,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 lX($){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=cX(Z[Y]);if(Q)J.push(Q)}return{baseExpression:X,filters:J}}function cX($){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=H0(Z,"(",")",X);if(Q===-1)return{name:J,args:[]};let G=Z.slice(Y,Q),q=N6(G);return{name:J,args:q}}function N6($){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 pX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;let J=H0($,"(",")",X);if(J===-1)return null;return{params:$.slice(X+1,J),endPos:J+1}}function iX($){let Z=[],J=new Z$($).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 U=q.value;if(Y++,Y>=J.length)break;let W=J[Y];if(W.type==="IDENTIFIER"){let K=W.value;if(Y++,Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let z=Y<J.length?J[Y].start:$.length,H=R6(J,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:K,value:$.slice(z,H.endPos),exported:G,start:q.start,end:H.endPos})}}else if(W.type==="PUNCTUATION"&&(W.value==="{"||W.value==="[")){let K=W.start,z=W.value==="{"?"}":"]",H=H0($,W.value,z,K);if(H!==-1){let B=$.slice(K,H+1);if(Y=D6(J,H+1),Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let j=Y<J.length?J[Y].start:$.length,_=R6(J,Y,$);Y=_.nextIndex;let V=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:V,value:`${$.slice(j,_.endPos)}; ${U} ${B} = ${V}`,exported:G,start:q.start,end:_.endPos})}}}}else if(q.type==="IDENTIFIER"&&q.value==="function"){let U=G?J[Y-1].start:q.start;if(Y++,Y>=J.length)break;let W=J[Y];if(W.type==="IDENTIFIER"){let K=W.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=H0($,"{","}",z);if(H!==-1)Z.push({type:"function",name:K,value:$.slice(U,H+1).replace(/^export\s+/,""),exported:G,start:U,end:H+1}),Y=D6(J,H+1)}}}else Y++}return Z}function R6($,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 D6($,Z){for(let X=0;X<$.length;X++)if($[X].start>=Z)return X;return $.length}function nX($,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=j3(J,G);if(!q)break;try{let U;if(Q0(q.expression))U=G0(q.expression,Object.keys(Z))(...Object.values(Z));else U=X0(q.expression,Z);let W="",K=!1;for(let z of q.cases)if(z.type==="default"){if(!K)W=z.content.trim()}else try{let H;if(z.value&&Q0(z.value))H=G0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)H=X0(z.value,Z);if(U===H){W=z.content.trim(),K=!0;break}}catch{continue}J=J.substring(0,G)+W+J.substring(q.end),Y=!0}catch(U){let W=U instanceof Error?U.message:String(U),K=$0("Switch",`Error evaluating @switch expression: ${W}`,l.EVALUATION_ERROR);J=J.substring(0,G)+K+J.substring(q.end);break}}return J}function sX($){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 oX($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(X,J)=>Z[Number(J)]??X)}function t0($,Z,X){let{masked:J,scripts:Y}=sX($);return oX(rX(J,Z,X),Y)}function rX($,Z,X){let J=$;J=nX(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,U=W1(J,q+7);if(!U)break;let W=U.endPos,K=w1(J,"unless","endunless",W);if(K===-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(W,K),H=U.expression,B=-1;{let _=0,V=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=V.exec(z))!==null)L.push({pos:w.index,type:"open"});while((w=O.exec(z))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(z))!==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 _=z.slice(0,B),V=z.slice(B+5);j=`@if (${H})${V}@else ${_}@endif`}else j=`@if (!(${H}))${z}@endif`;J=J.substring(0,q)+j+J.substring(K+10),Q=!0}}J=O3(J,Z,X),J=V3(J,Z,X),J=_3(J,Z);let Y=()=>{let Q=_5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let q=Q[G];try{let U="",W=!1;for(let K of q.branches){if(W)break;if(K.type==="else")U=K.content,W=!0;else try{let z;if(K.condition&&Q0(K.condition))z=G0(K.condition,Object.keys(Z))(...Object.values(Z));else if(K.condition)z=X0(K.condition,Z);if(z)U=K.content,W=!0}catch(z){U=$0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,l.EVALUATION_ERROR),W=!0}}J=J.substring(0,q.start)+U+J.substring(q.end)}catch(U){let W=U instanceof Error?U.message:String(U),K=$0("If",`Error processing @if block: ${W}`,l.EVALUATION_ERROR);J=J.substring(0,q.start)+K+J.substring(q.end)}}return!0};while(!0){let Q=J;if(!Y())break;if(J===Q)break}return J}function A6($){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 _3($,Z){let X=$;function J(q,U,W,K){let z=1,H=K,B=new RegExp(`@${U}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(H<q.length&&z>0){B.lastIndex=H,j.lastIndex=H;let _=B.exec(q),V=j.exec(q),O=_?_.index:1/0,F=V?V.index:1/0;if(O<F)z++,H=O+_[0].length;else if(F<1/0){if(z--,z===0)return F;H=F+V[0].length}else break}return-1}function Y(q,U,W){let K=0,z=new RegExp(`@${U}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${W}(?![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((V,O)=>V.pos-O.pos);for(let V of j)if(V.type==="open")K++;else if(V.type==="close")K--;else if(V.type==="else"&&K===0)return V.pos;return-1}{let q=!0;while(q){q=!1;let U=X.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!U||U.index===void 0)break;let W=U.index,K,z,H=X.slice(W+5),B=A6(H);if(B)K=B.value,z=W+5+B.consumed;else z=W+5;let j=J(X,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=X.slice(z,j),V=Y(_,"auth","endauth"),O;if(!Z.auth)O=!1;else O=K?U1(`auth?.check && auth?.user?.[${K}]`,Z):U1("auth?.check",Z);let F;if(V!==-1){let L=_.slice(0,V),w=_.slice(V+5);F=O?L:w}else F=O?_:"";X=X.substring(0,W)+F+X.substring(j+8),q=!0}}{let q=!0;while(q){q=!1;let U=X.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!U||U.index===void 0)break;let W=U.index,K,z,H=X.slice(W+6),B=A6(H);if(B)K=B.value,z=W+6+B.consumed;else z=W+6;let j=J(X,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=X.slice(z,j),V=Y(_,"guest","endguest"),O;if(!Z.auth)O=!0;else O=K?U1(`!auth?.check || !auth?.user?.[${K}]`,Z):U1("!auth?.check",Z);let F;if(V!==-1){let L=_.slice(0,V),w=_.slice(V+5);F=O?L:w}else F=O?_:"";X=X.substring(0,W)+F+X.substring(j+9),q=!0}}function Q(q,U,W){if(Z.userCan&&typeof Z.userCan[q]==="boolean")return Z.userCan[q];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let K=[q];if(U)K.push(U);if(W){let z=U1(W,Z);K.push(z)}return Z.permissions.check(...K)}catch{return!1}return!1}function G(q){let U=q.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!U)return null;return{ability:U[1],type:U[2],id:U[3]?.trim(),paramsEnd:U[0].length}}for(let q of["can","cannot"]){let U=`end${q}`,W=q==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!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,V=J(X,q,U,_);if(V===-1){console.warn(`[stx] @${q} directive at position ${H} has no matching @${U} \u2014 the block was skipped.`);break}let O=X.slice(_,V),F=[],L=0,w=new RegExp(`@${q}\\s*\\(`,"g"),R=new RegExp(`@${U}(?![a-z])`,"g"),D=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],A;while((A=w.exec(O))!==null)T.push({pos:A.index,type:"open"});while((A=R.exec(O))!==null)T.push({pos:A.index,type:"close"});while((A=D.exec(O))!==null)T.push({pos:A.index,type:"elseDirective"});while((A=N.exec(O))!==null)T.push({pos:A.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){L++;continue}if(b.type==="close"){L--;continue}if(L===0)F.push(b)}let M=[],k=0;for(let b=0;b<F.length;b++){let C=F[b];if(M.push({content:O.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=O.slice(C.pos+`@${W}`.length),f=G(x);if(f){M[M.length-1]={content:O.slice(k,C.pos)},k=C.pos+`@${W}`.length+f.paramsEnd,M.push({content:"",ability:f.ability,type:f.type,id:f.id}),M.pop();let n=F[b+1],m=n?n.pos:O.length;M.push({content:O.slice(k,m),ability:f.ability,type:f.type,id:f.id}),k=m}}else k=C.pos+5}if(k<O.length){let b=M[M.length-1];if(F.length>0&&F[F.length-1].type==="else")M.push({content:O.slice(k),isFinalElse:!0});else if(M.length===0)M.push({content:O.slice(k)})}let I=Q(j.ability,j.type,j.id),y=q==="can"?I:!I,E="";if(y)E=M[0]?.content||"";else{let b=!1;for(let C=1;C<M.length;C++){let x=M[C];if(x.isFinalElse){E=x.content,b=!0;break}if(x.ability){let f=Q(x.ability,x.type,x.id);if(q==="can"?f:!f){E=x.content,b=!0;break}}}if(!b&&M.length>0){let C=M[M.length-1];if(C.isFinalElse)E=C.content}}X=X.substring(0,H)+E+X.substring(V+`@${U}`.length),K=!0}}return X}function O3($,Z,X){let J=$;function Y(Q,G,q,U,W){let K=!0;while(K){K=!1;let z=new RegExp(`@${G}\\s*\\(`),H=Q.match(z);if(!H||H.index===void 0)break;let B=H.index,j=W1(Q,B+`@${G}`.length);if(!j)break;let _=j.endPos,V=w1(Q,G,q,_);if(V===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let O=Q.slice(_,V),F=j.expression,L=-1,w=0,R=0;while(R<O.length){let D=O.indexOf("@",R);if(D===-1)break;let N=O.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){L=D;break}R=D+1}try{let D=U(F.trim()),N;if(L!==-1){let T=O.slice(0,L),A=O.slice(L+5);N=D?T:A}else N=D?O:"";Q=Q.substring(0,B)+N+Q.substring(V+`@${q}`.length),K=!0}catch(D){let N=D instanceof Error?D.message:String(D),T=$0(W,`Error processing @${G} directive: ${N}`,l.EVALUATION_ERROR);Q=Q.substring(0,B)+T+Q.substring(V+`@${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 V3($,Z,X){let J=$,Y="development";function Q(G,q,U,W){let K=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`@${U}(?![a-z])`,"g"),H=new RegExp(`^@${q}(?![a-z])`),B=new RegExp(`^@${U}(?![a-z])`),j=G,_=!0;while(_){_=!1,K.lastIndex=0;let V=K.exec(j);if(!V)break;let O=V.index,F=O+V[0].length;if(q==="env"){let I=j.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;F+=I[0].length,W=Y===I[2]}let L=1,w=F,R=-1;while(L>0&&w<j.length){K.lastIndex=w,z.lastIndex=w;let I=K.exec(j),y=z.exec(j),E=I?I.index:1/0,b=y?y.index:1/0;if(E<b)L++,w=E+I[0].length;else if(b<1/0){if(L--,L===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${q} directive at position ${O} has no matching @${U} \u2014 the block was skipped.`);break}let D=j.substring(F,R),N=-1,T=0,A=0;while(A<D.length){let I=D.indexOf("@",A);if(I===-1)break;let y=D.substring(I);if(H.test(y)){T++,A=I+1;continue}if(B.test(y)){T--,A=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){N=I;break}A=I+1}let M;if(N!==-1){let I=D.slice(0,N),y=D.slice(N+5);M=W?I:y}else M=W?D:"";let k=`@${U}`.length;j=j.substring(0,O)+M+j.substring(R+k),_=!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 F3=new WeakMap;function M6($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function R1($,Z){if(!$)return Z?.nonceGenerator?.()??M6();let X=F3.get($);if(!X)X=Z?.nonceGenerator?.()??M6(),F3.set($,X);return X}function wK($){F3.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 w3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${T6($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var aX={"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},L3={"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},tX={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},eX={"default-src":["'none'"],"frame-ancestors":["'none'"]};function RK($){return{enabled:!0,directives:{strict:aX,moderate:L3,relaxed:tX,api:eX}[$]||L3,useNonce:$==="strict",addMetaTag:!0}}function DK($,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:[],U=[...new Set([...q,...Y])];X[Q]=U}}return X}function I6($,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?R1(X,Z):void 0,Y=w3(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
3273
+ ${Y}`)}function k6($,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 E6($,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?R1(Z,Q):void 0;return w3(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return R1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=R1(Z,Q);return Y}var $J={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?R1(X,Q):void 0;return w3(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},ZJ={name:"cspNonce",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return R1(X,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function NK(){return[$J,ZJ]}function AK($){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 XJ($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function MK($,Z){if(!$.enabled)return{};let X=$.useNonce?R1(Z,$):void 0,J=T6($.directives,X);return{[XJ($.reportOnly)]:J}}var TK={enabled:!1,reportOnly:!1,directives:L3,useNonce:!1,addMetaTag:!0};import JJ from"crypto";var YJ=40,b6="_token",R3=null;function QJ($=YJ){let Z=JJ.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return R3=Z,Z}function GJ(){if(!R3)QJ();return R3}function qJ($=b6){let Z=GJ();return`<input type="hidden" name="${$}" value="${Z}">`}function y6($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,X,J)=>{return qJ(J||b6)})}async function S6($,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 UJ(Y,Q,Z,X,J);else Y=await WJ(Y,Q,Z,X,J)}return Y}async function UJ($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=`@${Q}`,U=`@end${Q}`,W=$,K=v1(`${q}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${U}`,"g"),z=[],H=K.exec(W);while(H!==null){let[B,j="",_=""]=H,V=H.index||0;try{let O=j?C6(j):[],F=_.trim(),L=await G(F,O,X,J);z.push({original:B,processed:L,startIndex:V})}catch(O){let F=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);z.push({original:B,processed:$0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${F}`,l.EVALUATION_ERROR),startIndex:V})}H=K.exec(W)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:_}=z[B];W=W.replace(j,_)}return W}async function WJ($,Z,X,J,Y){let{name:Q,handler:G}=Z,q=$,U=v1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],K=U.exec(q);while(K!==null){let[B,j=""]=K,_=K.index||0;try{let V=C6(j),O=await G("",V,X,J);W.push({original:B,processed:O,startIndex:_})}catch(V){let O=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);W.push({original:B,processed:$0("CustomDirective",`Error in @${Q}(${j}): ${O}`,l.EVALUATION_ERROR),startIndex:_})}K=U.exec(q)}let z=v1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=z.exec(q);while(H!==null){let[B]=H,j=H.index||0;try{let _=await G("",[],X,J);W.push({original:B,processed:_,startIndex:j})}catch(_){let V=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);W.push({original:B,processed:$0("CustomDirective",`Error in @${Q}: ${V}`,l.EVALUATION_ERROR),startIndex:j})}H=z.exec(q)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:_}=W[B];q=q.replace(j,_)}return q}function C6($){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 P6=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,v6=/^[A-Za-z_$][\w$]*$/,KJ=new Set(["light","dark","system"]);function D1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function zJ($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,X=Z.appearance,J=Z.colorMode;if(D1(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(D1(X.key,"appearance.key"),D1(X.attribute,"appearance.attribute"),D1(X.default,"appearance.default"),D1(J.key,"colorMode.key"),D1(J.attribute,"colorMode.attribute"),D1(J.default,"colorMode.default"),!v6.test(X.key)||!v6.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!P6.test(X.attribute)||!P6.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(!KJ.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 HJ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function BJ($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${HJ($)};const root=document.documentElement;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{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function jJ($,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 f6($,Z){let X=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index+Y[0].length-1,G=jJ(X,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let q=X.slice(Q+1,G).trim(),U=X0(`(${q})`,Z),W=BJ(zJ(U));X=X.slice(0,Y.index)+W+X.slice(G+1),J.lastIndex=Y.index+W.length}return X}import _J from"crypto";function B0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var N3={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function OJ($){return{...N3,...$.forms?.classes}}function J$($,Z,X,J){let Y=$||Z;return X?`${Y} ${J}`:Y}function x0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function m1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${B0(Z)}"`}function D3($,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="${B0(`${x0($)}-error`)}"`;return J}function VJ(){return _J.randomUUID()}function xK($,Z,X,J){let Y=OJ(J),Q=$;return Q=LJ(Q,Z),Q=F5(Q,Z),Q=A3(Q,Z,Y),Q=M3(Q,Z,Y),Q}function F5($,Z){let X=$;return X=X.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=VJ();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${B0(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="${B0(Q)}">`;return J}),X}function A3($,Z,X=N3){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,q,U,W="")=>{let K=Q||G||"POST",z=q||U||"",H=K1(W),B=K.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${B0(j)}" action="${B0(z)}"${H?` ${H}`:""}>`;if(_+=`
3274
3274
  ${F5("@csrf",Z)}`,!["GET","POST"].includes(B))_+=`
3275
- ${F5(`@method('${B}')`,Z)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,Q,G,q,U,W="")=>{let K=Q||G||"",z=q||U||"",H=K1(W),B=O5(K,Z),j=B!==void 0&&B!==null?B:z||"",_=H.match(/type=['"]([^'"]+)['"]/i),V=_?_[1]:"text",O=V5(K,Z),F=H.match(/class=['"]([^'"]+)['"]/i),L=X$(F?F[1]:"",X.input,O,X.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${B0(V)}" name="${B0(K)}"${m1(H,f0(K))} value="${B0(j)}" class="${L}"${w3(K,O,H)}${w?` ${w}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,Q,G="",q="")=>{let U=K1(G),W=O5(Q,Z)||q.trim(),K=V5(Q,Z),z=U.match(/class=['"]([^'"]+)['"]/i),H=X$(z?z[1]:"",X.input,K,X.inputError),B=U.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${B0(Q)}"${m1(U,f0(Q))} class="${H}"${w3(Q,K,U)}${B?` ${B}`:""}>${B0(W)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,Q,G="",q)=>{let U=K1(G),W=O5(Q,Z),K=V5(Q,Z),z=U.match(/class=['"]([^'"]+)['"]/i),H=X$(z?z[1]:"",X.input,K,X.inputError),B=U.replace(/class=['"][^'"]+['"]/i,""),j=q;if(W!==void 0)j=q.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,V,O)=>{if((Array.isArray(W)?W.some((L)=>String(L)===O):String(W)===O)&&!V.includes("selected"))return V.replace(/(<option)/,"$1 selected");return _});return`<select name="${B0(Q)}"${m1(U,f0(Q))} class="${H}"${w3(Q,K,U)}${B?` ${B}`:""}>${j}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,q="")=>{let U=G===void 0?"1":G,W=G===void 0?f0(Q):`${f0(Q)}-${f0(U)}`,K=K1(q),z=O5(Q,Z),H=z!==void 0&&(Array.isArray(z)?z.some((V)=>String(V)===U):z===!0||String(z)===U),B=K.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:X.checkInput,_=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${B0(Q)}"${m1(K,W)} value="${B0(U)}" class="${j}"${H?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,q="")=>{let U=K1(q),W=O5(Q,Z),K=W!==void 0&&W===G,z=U.match(/class=['"]([^'"]+)['"]/i),H=z?z[1]:X.checkInput,B=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${B0(Q)}"${m1(U,`${f0(Q)}-${f0(G)}`)} value="${B0(G)}" class="${H}"${K?" checked":""}${B?` ${B}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="")=>{let q=K1(G),U=q.match(/accept=['"]([^'"]+)['"]/i),W=U?U[1]:"",K=q.includes("multiple"),z=V5(Q,Z),H=q.match(/class=['"]([^'"]+)['"]/i),B=X$(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="${B0(Q)}"${m1(q,f0(Q))}`,`class="${B}"`];if(W)_.push(`accept="${B0(W)}"`);if(K)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,Q,G="",q)=>{let U=K1(G),W=U.match(/class=['"]([^'"]+)['"]/i),K=W?W[1]:X.label,z=U.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${B0(f0(Q))}" class="${K}"${z?` ${z}`:""}>${q}</label>`}),Y}function N3($,Z,X=R3){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,Q)=>{try{if(V5(J,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(q,U)=>{try{if(U.trim()==="$message"||U.trim()==="message")return v6(J,Z);if(U.trim().includes("errors.first")||U.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(J);return v6(J,Z)}let W=U.trim();if(Q0(W)){let K=X0(W,Z);return K!==void 0?String(K):W}return W}catch{return U}});return`<div id="${B0(`${f0(J)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),Y}})}function V5($,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 v6($,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 O5($,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 Y=$.slice(0,-2);if(X=Z[Y],X!==void 0)return X}return Z[$]}function K1($){if(!$.trim())return"";let Z=[],X=$.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(X))!==null){let[,Q,,G]=J;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var f6={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 Y=Number(Z[0]);if(typeof $==="string"&&$.length<Y)return`The ${X} field must be at least ${Y} characters.`;if(typeof $==="number"&&$<Y)return`The ${X} field must be at least ${Y}.`;if(Array.isArray($)&&$.length<Y)return`The ${X} field must have at least ${Y} items.`;return null},max:($,Z,X)=>{if(!$)return null;let Y=Number(Z[0]);if(typeof $==="string"&&$.length>Y)return`The ${X} field must not exceed ${Y} characters.`;if(typeof $==="number"&&$>Y)return`The ${X} field must not exceed ${Y}.`;if(Array.isArray($)&&$.length>Y)return`The ${X} field must not have more than ${Y} 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 Y=new Date($);if(Number.isNaN(Y.getTime()))return`The ${X} field must be a valid date.`;return null},before:($,Z,X)=>{if(!$)return null;let Y=new Date($),J=new Date(Z[0]);if(Y>=J)return`The ${X} field must be before ${Z[0]}.`;return null},after:($,Z,X)=>{if(!$)return null;let Y=new Date($),J=new Date(Z[0]);if(Y<=J)return`The ${X} field must be after ${Z[0]}.`;return null}};function vK($,Z){f6[$]=Z}function A3($){let[Z,...X]=$.split(":"),Y=X.length>0?X.join(":").split(","):[];return{name:Z.trim(),params:Y}}function _Y($,Z,X,Y={}){let J=[],Q=X.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let q=A3(G),U=f6[q.name];if(!U){console.warn(`Unknown validation rule: ${q.name}`);continue}if(q.name==="confirmed"){let K=`${$}_confirmation`;q.params=[Y[K]]}let W=U(Z,q.params||[],$);if(W)J.push(q.message||W)}return{field:$,valid:J.length===0,errors:J}}function fK($,Z){let X={};for(let[Y,J]of Object.entries(Z)){let Q=_Y(Y,$[Y],J,$);if(!Q.valid)X[Y]=Q.errors}return X}function OY($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(X,Y,J,Q)=>{let G=J.split("|").map((U)=>U.trim()),q=[];for(let U of G){let W=A3(U);switch(W.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"'),W.name==="integer")q.push('step="1"');break;case"min":if(W.params?.[0])q.push(`minlength="${W.params[0]}"`);break;case"max":if(W.params?.[0])q.push(`maxlength="${W.params[0]}"`);break;case"regex":if(W.params?.[0])q.push(`pattern="${W.params[0]}"`);break}}return`<!-- @validate:${Y}:${J} -->${q.length>0?`<!-- attrs:${q.join(" ")} -->`:""}`})}var x6={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,Y]=Z.map(Number);if(typeof $==="string")return $.length>=X&&$.length<=Y||`Must be between ${X} and ${Y} characters`;if(typeof $==="number")return $>=X&&$<=Y||`Must be between ${X} and ${Y}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,X)=>{let Y=Object.keys(X);for(let J of Y)if(J.endsWith("_confirmation")&&X[J]===$)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($)),Y=new Date(Z[0]);return X<Y||`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($)),Y=new Date(Z[0]);return X>Y||`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 xK($){x6[$.name]=$}function VY($,Z,X={}){let Y=[],J=Z.split("|").map((Q)=>Q.trim());for(let Q of J){let G=A3(Q),q=x6[G.name];if(!q){console.warn(`Unknown validation rule: ${G.name}`);continue}let U=q.validate($,G.params||[],X);if(U!==!0)Y.push(U)}return{valid:Y.length===0,errors:Y}}function gK($,Z){let X={},Y=!0;for(let[J,Q]of Object.entries(Z)){let G=VY($[J],Q,$);if(!G.valid)Y=!1,X[J]=G.errors}return{valid:Y,errors:X}}function hK($,Z){let X=JSON.stringify(Z);return`
3275
+ ${F5(`@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,U,W="")=>{let K=Q||G||"",z=q||U||"",H=K1(W),B=O5(K,Z),j=B!==void 0&&B!==null?B:z||"",_=H.match(/type=['"]([^'"]+)['"]/i),V=_?_[1]:"text",O=V5(K,Z),F=H.match(/class=['"]([^'"]+)['"]/i),L=J$(F?F[1]:"",X.input,O,X.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${B0(V)}" name="${B0(K)}"${m1(H,x0(K))} value="${B0(j)}" class="${L}"${D3(K,O,H)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",q="")=>{let U=K1(G),W=O5(Q,Z)||q.trim(),K=V5(Q,Z),z=U.match(/class=['"]([^'"]+)['"]/i),H=J$(z?z[1]:"",X.input,K,X.inputError),B=U.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${B0(Q)}"${m1(U,x0(Q))} class="${H}"${D3(Q,K,U)}${B?` ${B}`:""}>${B0(W)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",q)=>{let U=K1(G),W=O5(Q,Z),K=V5(Q,Z),z=U.match(/class=['"]([^'"]+)['"]/i),H=J$(z?z[1]:"",X.input,K,X.inputError),B=U.replace(/class=['"][^'"]+['"]/i,""),j=q;if(W!==void 0)j=q.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,V,O)=>{if((Array.isArray(W)?W.some((L)=>String(L)===O):String(W)===O)&&!V.includes("selected"))return V.replace(/(<option)/,"$1 selected");return _});return`<select name="${B0(Q)}"${m1(U,x0(Q))} class="${H}"${D3(Q,K,U)}${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let U=G===void 0?"1":G,W=G===void 0?x0(Q):`${x0(Q)}-${x0(U)}`,K=K1(q),z=O5(Q,Z),H=z!==void 0&&(Array.isArray(z)?z.some((V)=>String(V)===U):z===!0||String(z)===U),B=K.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:X.checkInput,_=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${B0(Q)}"${m1(K,W)} value="${B0(U)}" class="${j}"${H?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,q="")=>{let U=K1(q),W=O5(Q,Z),K=W!==void 0&&W===G,z=U.match(/class=['"]([^'"]+)['"]/i),H=z?z[1]:X.checkInput,B=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${B0(Q)}"${m1(U,`${x0(Q)}-${x0(G)}`)} value="${B0(G)}" class="${H}"${K?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let q=K1(G),U=q.match(/accept=['"]([^'"]+)['"]/i),W=U?U[1]:"",K=q.includes("multiple"),z=V5(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="${B0(Q)}"${m1(q,x0(Q))}`,`class="${B}"`];if(W)_.push(`accept="${B0(W)}"`);if(K)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",q)=>{let U=K1(G),W=U.match(/class=['"]([^'"]+)['"]/i),K=W?W[1]:X.label,z=U.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${B0(x0(Q))}" class="${K}"${z?` ${z}`:""}>${q}</label>`}),J}function M3($,Z,X=N3){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,Q)=>{try{if(V5(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(q,U)=>{try{if(U.trim()==="$message"||U.trim()==="message")return x6(Y,Z);if(U.trim().includes("errors.first")||U.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return x6(Y,Z)}let W=U.trim();if(Q0(W)){let K=X0(W,Z);return K!==void 0?String(K):W}return W}catch{return U}});return`<div id="${B0(`${x0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function V5($,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 x6($,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 O5($,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 K1($){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 g6={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 gK($,Z){g6[$]=Z}function T3($){let[Z,...X]=$.split(":"),J=X.length>0?X.join(":").split(","):[];return{name:Z.trim(),params:J}}function FJ($,Z,X,J={}){let Y=[],Q=X.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let q=T3(G),U=g6[q.name];if(!U){console.warn(`Unknown validation rule: ${q.name}`);continue}if(q.name==="confirmed"){let K=`${$}_confirmation`;q.params=[J[K]]}let W=U(Z,q.params||[],$);if(W)Y.push(q.message||W)}return{field:$,valid:Y.length===0,errors:Y}}function hK($,Z){let X={};for(let[J,Y]of Object.entries(Z)){let Q=FJ(J,$[J],Y,$);if(!Q.valid)X[J]=Q.errors}return X}function LJ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(X,J,Y,Q)=>{let G=Y.split("|").map((U)=>U.trim()),q=[];for(let U of G){let W=T3(U);switch(W.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"'),W.name==="integer")q.push('step="1"');break;case"min":if(W.params?.[0])q.push(`minlength="${W.params[0]}"`);break;case"max":if(W.params?.[0])q.push(`maxlength="${W.params[0]}"`);break;case"regex":if(W.params?.[0])q.push(`pattern="${W.params[0]}"`);break}}return`<!-- @validate:${J}:${Y} -->${q.length>0?`<!-- attrs:${q.join(" ")} -->`:""}`})}var h6={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 uK($){h6[$.name]=$}function wJ($,Z,X={}){let J=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=T3(Q),q=h6[G.name];if(!q){console.warn(`Unknown validation rule: ${G.name}`);continue}let U=q.validate($,G.params||[],X);if(U!==!0)J.push(U)}return{valid:J.length===0,errors:J}}function dK($,Z){let X={},J=!0;for(let[Y,Q]of Object.entries(Z)){let G=wJ($[Y],Q,$);if(!G.valid)J=!1,X[Y]=G.errors}return{valid:J,errors:X}}function mK($,Z){let X=JSON.stringify(Z);return`
3276
3276
  <script>
3277
3277
  (function() {
3278
3278
  const form = document.getElementById('${$}');
@@ -3324,9 +3324,9 @@ catch { return 'Please enter a valid URL'; } },
3324
3324
  }
3325
3325
  });
3326
3326
  })();
3327
- </script>`.trim()}import T3 from"path";var L5;async function FY(){if(L5!==void 0)return L5;try{L5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{L5=null}return L5}var E3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},I0={},d0={},t0={};function cK($){if($)delete I0[$];else for(let Z of Object.keys(I0))delete I0[Z]}function pK(){let $=Object.entries(I0).map(([Z,X])=>({locale:Z,loadedAt:new Date(X.loadedAt),keyCount:h6(X.translations)}));return{size:Object.keys(I0).length,locales:Object.keys(I0),entries:$}}function h6($,Z=0){for(let X of Object.values($))if(Z++,X&&typeof X==="object"&&!Array.isArray(X))Z=h6(X,Z);return Z}function LY($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}function iK($){if(I0[$])return"loaded";return t0[$]||"idle"}function nK($){return t0[$]==="loading"}function sK($){return!!I0[$]}async function wY($,Z){let{locales:X,parallel:Y=!0,priority:J={},onLocaleLoaded:Q,onComplete:G,onError:q}=$,U=Y?X:[...X].sort((W,K)=>(J[K]||0)-(J[W]||0));if(Y){let W=U.map(async(K)=>{try{await Y$(K,Z),Q?.(K)}catch(z){q?.(K,z instanceof Error?z:Error(String(z)))}});await Promise.all(W)}else for(let W of U)try{await Y$(W,Z),Q?.(W)}catch(K){q?.(W,K instanceof Error?K:Error(String(K)))}G?.()}function oK($,Z){queueMicrotask(()=>{wY($,Z).catch((X)=>{if(Z.debug)console.error("Background preload error:",X)})})}async function Y$($,Z){if({...E3,...Z.i18n}.cache&&I0[$]){let J=I0[$],Q=Z.i18n?.cacheMaxAge??0;if(!LY(J,Q))return J.translations}if(d0[$]?.state==="loading")return d0[$].promise;t0[$]="loading";let Y=I3($,Z).then((J)=>{return t0[$]="loaded",delete d0[$],J}).catch((J)=>{throw t0[$]="error",d0[$]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return d0[$]={promise:Y,state:"loading"},Y}function RY($){return I0[$]?.translations}async function rK($,Z){let X=RY($);if(X)return X;return Y$($,Z)}async function aK($,Z){if(I0[$])return I0[$].translations;if(d0[$]){if(Z)return Promise.race([d0[$].promise,new Promise((X,Y)=>setTimeout(()=>Y(Error(`Timeout waiting for locale: ${$}`)),Z))]);return d0[$].promise}throw Error(`Locale "${$}" is not loading. Call loadTranslationLazy first.`)}function tK(){return Object.entries(t0).filter(([$,Z])=>Z==="loading").map(([$])=>$)}function eK($){if($)delete d0[$],delete t0[$];else{for(let Z of Object.keys(d0))delete d0[Z];for(let Z of Object.keys(t0))delete t0[Z]}}async function I3($,Z){let X={...E3,...Z.i18n},Y=T3.isAbsolute(X.translationsDir)?X.translationsDir:T3.resolve(Z.root||process.cwd(),X.translationsDir);try{let J=await FY(),Q=J?await J($,{translationsDir:Y,defaultLocale:X.defaultLocale,sources:TY(X.format)}):await DY($,X,Y);if(Q===void 0){if($!==X.defaultLocale)return I3(X.defaultLocale,Z);return{}}let G=Q;if(X.cache)I0[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(J){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,J);if($!==X.defaultLocale)return I3(X.defaultLocale,Z);return{}}}async function DY($,Z,X){let Y=T3.join(X,`${$}${NY(Z.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let Q=await Bun.file(Y).text();if(Z.format==="yaml"||Z.format==="yml")return AY(Q);if(Z.format==="json")return JSON.parse(Q);throw J}catch{return}}}function NY($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function AY($){let Z={},X=$.split(`
3328
- `),Y=[{obj:Z,indent:-1}];for(let J of X){let Q=J.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=G)Y.pop();let q=Y[Y.length-1].obj,U=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(U){let[,,W,K]=U,z=W.trim(),H=K.trim();if(H==="")q[z]={},Y.push({obj:q[z],indent:G});else q[z]=MY(H)}}return Z}function MY($){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 TY($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function IY($,Z){return Y$($,Z)}function kY($,Z){for(let X of $){let Y=X.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10);if(Z===G)return J[2];continue}let Q=Y.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 EY($,Z={}){return u6($,Z)}function u6($,Z){let X="",Y=0;while(Y<$.length)if($[Y]==="{"){let J=bY($,Y);if(J===-1){X+=$[Y],Y++;continue}let Q=$.slice(Y+1,J);X+=yY(Q,Z),Y=J+1}else if($[Y]==="'"&&Y+1<$.length)if($[Y+1]==="'")X+="'",Y+=2;else if($[Y+1]==="{"||$[Y+1]==="}")X+=$[Y+1],Y+=2;else X+=$[Y],Y++;else X+=$[Y],Y++;return X}function bY($,Z){let X=0;for(let Y=Z;Y<$.length;Y++)if($[Y]==="{")X++;else if($[Y]==="}"){if(X--,X===0)return Y}return-1}function yY($,Z){let X=SY($);if(X.length===0)return`{${$}}`;let Y=X[0].trim(),J=Z[Y];if(X.length===1)return J!==void 0?String(J):`{${Y}}`;switch(X[1].trim().toLowerCase()){case"plural":return CY(J,X.slice(2).join(","),Z);case"select":return vY(J,X.slice(2).join(","));case"selectordinal":return fY(J,X.slice(2).join(","));case"number":return gY(J,X[2]?.trim());case"date":return hY(J,X[2]?.trim());case"time":return uY(J,X[2]?.trim());default:return J!==void 0?String(J):`{${$}}`}}function SY($){let Z=[],X="",Y=0;for(let J=0;J<$.length;J++){let Q=$[J];if(Q==="{")Y++,X+=Q;else if(Q==="}")Y--,X+=Q;else if(Q===","&&Y===0)Z.push(X),X="";else X+=Q}if(X)Z.push(X);return Z}function CY($,Z,X){let Y=Number($)||0,J=b3(Z),Q=`=${Y}`;if(J[Q])return M3(J[Q],Y,X);let G=PY(Y);if(J[G])return M3(J[G],Y,X);if(J.other)return M3(J.other,Y,X);return String(Y)}function M3($,Z,X){let Y=$.replace(/#/g,String(Z));return u6(Y,X)}function PY($){let Z=Math.abs($),X=Math.floor(Z),Y=String($).includes(".")?String($).split(".")[1].length:0;if(X===1&&Y===0)return"one";return"other"}function vY($,Z){let X=String($||""),Y=b3(Z);if(Y[X])return Y[X];return Y.other||String($)}function fY($,Z){let X=Number($)||0,Y=b3(Z),J=xY(X);if(Y[J])return Y[J].replace(/#/g,String(X));if(Y.other)return Y.other.replace(/#/g,String(X));return String(X)}function xY($){let Z=Math.abs($),X=Z%10,Y=Z%100;if(X===1&&Y!==11)return"one";if(X===2&&Y!==12)return"two";if(X===3&&Y!==13)return"few";return"other"}function b3($){let Z={},X=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=X.exec($);while(Y!==null)Z[Y[1]]=Y[2],Y=X.exec($);return Z}function gY($,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 hY($,Z){let X=$ instanceof Date?$:new Date(String($));if(Number.isNaN(X.getTime()))return String($);let Y={};switch(Z){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return X.toLocaleDateString(void 0,Y)}function uY($,Z){let X=$ instanceof Date?$:new Date(String($));if(Number.isNaN(X.getTime()))return String($);let Y={};switch(Z){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return X.toLocaleTimeString(void 0,Y)}function dY($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function k3($,Z,X=!0,Y={}){let J=$.split("."),Q=Z;for(let q of J){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return X?$:"";let G=String(Q);if(dY(G))return EY(G,Y);if(G.includes("|")&&"count"in Y){let q=Number(Y.count),U=G.split("|");G=kY(U,q)}for(let[q,U]of Object.entries(Y)){let W=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(U))}return G}async function d6($,Z,X,Y){let J=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...E3,...Y.i18n},q=await IY(G.locale,Y);Z.__translations=q,Z.__locale=G.locale,Z.__i18nConfig=G,J=await g6(J,Q,async(K,z,H,B,j)=>{try{let _={};if(H)try{let O=[()=>JSON.parse(H),()=>{let F=`{"data":${H}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return _0(H,Z)}];for(let F of O)try{if(_=F(),Object.keys(_).length>0)break}catch{}}catch(O){if(Y.debug)console.error("Error parsing parameters for @translate directive:",O)}return k3(z,q,G.fallbackToKey,_)||B.trim()}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,l.EVALUATION_ERROR)}});let U=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let K=[...J.matchAll(U)];console.warn(`Found ${K.length} @translate matches`),K.forEach((z,H)=>console.warn(`Match ${H}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return J=await g6(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,z,H,B)=>{try{let j={};if(H)try{let _=[()=>JSON.parse(H),()=>{let V=`{"data":${H}}`,O=JSON.parse(V);return typeof O.data==="object"?O.data:{}},()=>{return _0(H,Z)}];for(let V of _)try{if(j=V(),Object.keys(j).length>0)break}catch{}}catch(_){if(Y.debug)console.error("Error parsing parameters for @translate directive:",_)}return k3(z,q,G.fallbackToKey,j)}catch(j){if(Y.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)}}),J}async function g6($,Z,X){let Y=[];return $.replace(Z,(Q,...G)=>{let q=X(Q,...G).then((U)=>({match:Q,replacement:U}));return Y.push(q),Q}),(await Promise.all(Y)).reduce((Q,{match:G,replacement:q})=>Q.replace(G,q),$)}function $z($,Z=!0){return(X,Y={})=>{return k3(X,$,Z,Y)}}var w5=/<\/?template\b[^>]*>/gi,mY=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function lY($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return mY.test(Z)}function J$($){w5.lastIndex=0;let Z;while((Z=w5.exec($))!==null){if(Z[0].startsWith("</")||lY(Z[0]))continue;let X=Z.index,Y=w5.lastIndex,J=1,Q;while((Q=w5.exec($))!==null)if(Q[0].startsWith("</")){if(J--,J===0){let G=Q.index;return{start:X,openEnd:Y,closeStart:G,end:w5.lastIndex,content:$.slice(Y,G)}}}else J++;return null}return null}import U0 from"path";function y3($,Z){let X=0;for(let Y=Z;Y<$.length;Y++){let J=$[Y];if(J==="("||J==="["||J==="{")X++;else if(J===")"||J==="]"||J==="}")X--;else if(J===","&&X===0)return Y}return-1}function cY($,Z,X){let Y=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=J.exec(Y);while(Q){let G=Q.index,q=G+Q[0].length-1,U=1,W=q+1;while(W<Y.length&&U>0){if(Y[W]==="(")U++;else if(Y[W]===")")U--;W++}if(U!==0)break;let K=Y.substring(q+1,W-1),z=`${X}(${K})`;Y=Y.substring(0,G)+z+Y.substring(W),J.lastIndex=G+z.length,Q=J.exec(Y)}return Y}function pY($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function l6($){let Z=$,X=[],Y=new Set,J=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++}},U=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let 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]==="`")U();else Q++;continue}Q++}},W=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3329
- `)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},K=()=>{if(J!==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(!Y.has(j))X.push(j),Y.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(!Y.has(j))X.push(j),Y.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(!Y.has(j))X.push(j),Y.add(j)}};while(Q<G){if(W())continue;if(Z[Q]==="'"||Z[Q]==='"'){q(Z[Q]);continue}if(Z[Q]==="`"){U();continue}if(Z[Q]==="{"){J++,Q++;continue}if(Z[Q]==="}"){J--,Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))K();Q++}return X.join(", ")}function c6($,Z=""){let X=l6($).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
3327
+ </script>`.trim()}import k3 from"path";var L5;async function RJ(){if(L5!==void 0)return L5;try{L5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{L5=null}return L5}var y3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},k0={},m0={},e0={};function nK($){if($)delete k0[$];else for(let Z of Object.keys(k0))delete k0[Z]}function sK(){let $=Object.entries(k0).map(([Z,X])=>({locale:Z,loadedAt:new Date(X.loadedAt),keyCount:d6(X.translations)}));return{size:Object.keys(k0).length,locales:Object.keys(k0),entries:$}}function d6($,Z=0){for(let X of Object.values($))if(Z++,X&&typeof X==="object"&&!Array.isArray(X))Z=d6(X,Z);return Z}function DJ($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}function oK($){if(k0[$])return"loaded";return e0[$]||"idle"}function rK($){return e0[$]==="loading"}function aK($){return!!k0[$]}async function NJ($,Z){let{locales:X,parallel:J=!0,priority:Y={},onLocaleLoaded:Q,onComplete:G,onError:q}=$,U=J?X:[...X].sort((W,K)=>(Y[K]||0)-(Y[W]||0));if(J){let W=U.map(async(K)=>{try{await Y$(K,Z),Q?.(K)}catch(z){q?.(K,z instanceof Error?z:Error(String(z)))}});await Promise.all(W)}else for(let W of U)try{await Y$(W,Z),Q?.(W)}catch(K){q?.(W,K instanceof Error?K:Error(String(K)))}G?.()}function tK($,Z){queueMicrotask(()=>{NJ($,Z).catch((X)=>{if(Z.debug)console.error("Background preload error:",X)})})}async function Y$($,Z){if({...y3,...Z.i18n}.cache&&k0[$]){let Y=k0[$],Q=Z.i18n?.cacheMaxAge??0;if(!DJ(Y,Q))return Y.translations}if(m0[$]?.state==="loading")return m0[$].promise;e0[$]="loading";let J=E3($,Z).then((Y)=>{return e0[$]="loaded",delete m0[$],Y}).catch((Y)=>{throw e0[$]="error",m0[$]={promise:J,state:"error",error:Y instanceof Error?Y:Error(String(Y))},Y});return m0[$]={promise:J,state:"loading"},J}function AJ($){return k0[$]?.translations}async function eK($,Z){let X=AJ($);if(X)return X;return Y$($,Z)}async function $z($,Z){if(k0[$])return k0[$].translations;if(m0[$]){if(Z)return Promise.race([m0[$].promise,new Promise((X,J)=>setTimeout(()=>J(Error(`Timeout waiting for locale: ${$}`)),Z))]);return m0[$].promise}throw Error(`Locale "${$}" is not loading. Call loadTranslationLazy first.`)}function Zz(){return Object.entries(e0).filter(([$,Z])=>Z==="loading").map(([$])=>$)}function Xz($){if($)delete m0[$],delete e0[$];else{for(let Z of Object.keys(m0))delete m0[Z];for(let Z of Object.keys(e0))delete e0[Z]}}async function E3($,Z){let X={...y3,...Z.i18n},J=k3.isAbsolute(X.translationsDir)?X.translationsDir:k3.resolve(Z.root||process.cwd(),X.translationsDir);try{let Y=await RJ(),Q=Y?await Y($,{translationsDir:J,defaultLocale:X.defaultLocale,sources:EJ(X.format)}):await MJ($,X,J);if(Q===void 0){if($!==X.defaultLocale)return E3(X.defaultLocale,Z);return{}}let G=Q;if(X.cache)k0[$]={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 E3(X.defaultLocale,Z);return{}}}async function MJ($,Z,X){let J=k3.join(X,`${$}${TJ(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 IJ(Q);if(Z.format==="json")return JSON.parse(Q);throw Y}catch{return}}}function TJ($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function IJ($){let Z={},X=$.split(`
3328
+ `),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,U=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(U){let[,,W,K]=U,z=W.trim(),H=K.trim();if(H==="")q[z]={},J.push({obj:q[z],indent:G});else q[z]=kJ(H)}}return Z}function kJ($){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 EJ($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function bJ($,Z){return Y$($,Z)}function yJ($,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 SJ($,Z={}){return m6($,Z)}function m6($,Z){let X="",J=0;while(J<$.length)if($[J]==="{"){let Y=CJ($,J);if(Y===-1){X+=$[J],J++;continue}let Q=$.slice(J+1,Y);X+=PJ(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 CJ($,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 PJ($,Z){let X=vJ($);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 fJ(Y,X.slice(2).join(","),Z);case"select":return gJ(Y,X.slice(2).join(","));case"selectordinal":return hJ(Y,X.slice(2).join(","));case"number":return dJ(Y,X[2]?.trim());case"date":return mJ(Y,X[2]?.trim());case"time":return lJ(Y,X[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function vJ($){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 fJ($,Z,X){let J=Number($)||0,Y=S3(Z),Q=`=${J}`;if(Y[Q])return I3(Y[Q],J,X);let G=xJ(J);if(Y[G])return I3(Y[G],J,X);if(Y.other)return I3(Y.other,J,X);return String(J)}function I3($,Z,X){let J=$.replace(/#/g,String(Z));return m6(J,X)}function xJ($){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 gJ($,Z){let X=String($||""),J=S3(Z);if(J[X])return J[X];return J.other||String($)}function hJ($,Z){let X=Number($)||0,J=S3(Z),Y=uJ(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 uJ($){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 S3($){let Z={},X=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=X.exec($);while(J!==null)Z[J[1]]=J[2],J=X.exec($);return Z}function dJ($,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 mJ($,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 lJ($,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 cJ($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function b3($,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(cJ(G))return SJ(G,J);if(G.includes("|")&&"count"in J){let q=Number(J.count),U=G.split("|");G=yJ(U,q)}for(let[q,U]of Object.entries(J)){let W=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(U))}return G}async function l6($,Z,X,J){let Y=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...y3,...J.i18n},q=await bJ(G.locale,J);Z.__translations=q,Z.__locale=G.locale,Z.__i18nConfig=G,Y=await u6(Y,Q,async(K,z,H,B,j)=>{try{let _={};if(H)try{let O=[()=>JSON.parse(H),()=>{let F=`{"data":${H}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return _0(H,Z)}];for(let F of O)try{if(_=F(),Object.keys(_).length>0)break}catch{}}catch(O){if(J.debug)console.error("Error parsing parameters for @translate directive:",O)}return b3(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 U=/@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 K=[...Y.matchAll(U)];console.warn(`Found ${K.length} @translate matches`),K.forEach((z,H)=>console.warn(`Match ${H}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Y=await u6(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,z,H,B)=>{try{let j={};if(H)try{let _=[()=>JSON.parse(H),()=>{let V=`{"data":${H}}`,O=JSON.parse(V);return typeof O.data==="object"?O.data:{}},()=>{return _0(H,Z)}];for(let V of _)try{if(j=V(),Object.keys(j).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return b3(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 u6($,Z,X){let J=[];return $.replace(Z,(Q,...G)=>{let q=X(Q,...G).then((U)=>({match:Q,replacement:U}));return J.push(q),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:q})=>Q.replace(G,q),$)}function Jz($,Z=!0){return(X,J={})=>{return b3(X,$,Z,J)}}var w5=/<\/?template\b[^>]*>/gi,pJ=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function iJ($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return pJ.test(Z)}function Q$($){w5.lastIndex=0;let Z;while((Z=w5.exec($))!==null){if(Z[0].startsWith("</")||iJ(Z[0]))continue;let X=Z.index,J=w5.lastIndex,Y=1,Q;while((Q=w5.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:X,openEnd:J,closeStart:G,end:w5.lastIndex,content:$.slice(J,G)}}}else Y++;return null}return null}import U0 from"path";function C3($,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 nJ($,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,U=1,W=q+1;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")")U--;W++}if(U!==0)break;let K=J.substring(q+1,W-1),z=`${X}(${K})`;J=J.substring(0,G)+z+J.substring(W),Y.lastIndex=G+z.length,Q=Y.exec(J)}return J}function sJ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function p6($){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++}},U=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let 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]==="`")U();else Q++;continue}Q++}},W=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3329
+ `)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},K=()=>{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(W())continue;if(Z[Q]==="'"||Z[Q]==='"'){q(Z[Q]);continue}if(Z[Q]==="`"){U();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])))K();Q++}return X.join(", ")}function i6($,Z=""){let X=p6($).split(",").map((J)=>J.trim()).filter(Boolean);return`
3330
3330
  (function() {
3331
3331
  ${l1("var",X)}
3332
3332
  var __destroyHooks = [];
@@ -3335,11 +3335,11 @@ catch { return 'Please enter a valid URL'; } },
3335
3335
 
3336
3336
  ${$}
3337
3337
  ${Z}})();
3338
- `}function p6($,Z){return`
3338
+ `}function n6($,Z){return`
3339
3339
  // Register scope variables for STX runtime
3340
3340
  if (!window.stx._scopes) window.stx._scopes = {};
3341
3341
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
3342
- ${l6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
3342
+ ${p6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
3343
3343
  `)}
3344
3344
  // #1767: when the bundler renamed a component const that collided with an
3345
3345
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -3347,38 +3347,38 @@ ${l6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
3347
3347
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
3348
3348
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
3349
3349
  window.stx._scopes['${Z}'] = __scopeRegistration;
3350
- `}function iY($,Z){let X=p6($,Z),Y=`
3350
+ `}function oJ($,Z){let X=n6($,Z),J=`
3351
3351
  (function() {
3352
3352
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
3353
3353
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
3354
3354
  if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
3355
- try {`,J=`
3355
+ try {`,Y=`
3356
3356
  } finally {
3357
3357
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3358
3358
  }
3359
- })();`;return Y+c6($,X)+`
3359
+ })();`;return J+i6($,X)+`
3360
3360
  } finally {
3361
3361
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3362
3362
  }
3363
- })();`}function nY($,Z){let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let J=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[1]};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}}return{html:$,mergedIntoExisting:null}}var m6=0,Bz=new O1(500),i6=new Set;function jz(){i6.clear()}function sY($){if($.__onceStore instanceof Set)return $.__onceStore;return i6}async function S3($,Z,X,Y,J,Q=new Set){let G=Y.partialsDir||U0.join(U0.dirname(X),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let q=cY($,"@partial","@include"),U=sY(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,V,O)=>{let F=V.trim(),L=`${X}:${F}`;if(U.has(L))return"";return U.add(L),V});{let _=/@includeIf\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+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(F+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],T=W(N,G,X),A="";if(T&&await Bun.file(T).exists())J.add(T),A=`@include(${R})`;q=q.substring(0,O)+A+q.substring(w),_.lastIndex=0}}for(let[_,V]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(q))!==null){let L=F.index,w=L+F[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 N=q.substring(w+1,D-1),T=y3(N,0);if(T===-1){O.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=D;continue}let I=k[1],y=M.substring(k[0].length),E,b=y3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${A})`,x;if(Q0(C)){let m=G0(C,Object.keys(Z));x=Boolean(m(...Object.values(Z)))}else x=Boolean(X0(C,Z));let f=V?!x:x,n="";if(f){let m=W(I,G,X);if(m&&await Bun.file(m).exists())J.add(m);n=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+n+q.substring(D),O.lastIndex=0}catch(C){let x=C instanceof Error?C.message:String(C),f=W0("Include",`Error evaluating ${_} condition: ${x}`,X,$,L);q=q.substring(0,L)+f+q.substring(D),O.lastIndex=0}}}{let _=/@each\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+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(F+1,w),D=q.substring(O,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let[,T,A,M,k]=N;try{let I,y=A.trim();if(Q0(y))I=G0(y,Object.keys(Z))(...Object.values(Z));else I=X0(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},x=await H(T,C,$,O);E+=x}else if(k)E=await H(k,{},$,O);q=q.substring(0,O)+E+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,O)+W0("Each",`Error in @each: ${y}`,X,$,O)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+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(F+1,w),D=q.substring(O,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let T=N[1],A=R.slice(N[0].length),M,k=A.match(/^\s*,\s*\{/);if(k){A=A.slice(k[0].length-1);let E=1,b=1;while(b<A.length&&E>0){if(A[b]==="{")E++;else if(A[b]==="}"){if(E--,E===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let I,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=_0(M,Z)}catch(x){let f=x instanceof Error?x.message:String(x);if(Y.debug){let n=W0("Include",`Error parsing includeFirst variables: ${f}`,X,$,O,D);q=q.replace(D,()=>n)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let x of E){let f=W(x,G,X);if(!f)continue;if(await r(f)){let n=await H(x,b,$,O);q=q.replace(D,()=>n),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(Y.debug){let x=W0("Include",`None of the includeFirst paths exist: ${T}`,X,$,O,D);q=q.replace(D,()=>x)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=W0("Include",`Error processing @includeFirst: ${b}`,X,$,O,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,V,O){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let L=U0.resolve(V),w=U0.resolve(U0.dirname(O)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=U0.resolve(V,F);else R=U0.resolve(w,F);let D=U0.normalize(R),N=D.startsWith(L+U0.sep)||D===L,T=D.startsWith(w+U0.sep)||D===w,A=!1,M=U0.dirname(w);if(D.startsWith(M+U0.sep)){if(!U0.relative(M,D).split(U0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))A=!0}if(!N&&!T&&!A)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(F){return console.error(`Error resolving path ${_}: ${F}`),null}}let K=U0.resolve(X);Q.add(K);function z(_,V,O,F){return Y.onIncludeError?.({includePath:_,templatePath:X,message:V,partialsDir:G}),W0("Include",V,X,O,F)}async function H(_,V={},O,F){let L=W(_,G,X);if(!L)return z(_,`Could not resolve path for include: ${_}`,O,F);let w=U0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>U0.basename(D)).join(" -> ");return z(_,`Circular include detected: ${R}`,O,F)}try{J.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(f){let n=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${n}`,O,F)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-a438xffx.js");R=f(R,Z)}if(R&&(Y.debug||!H5()&&!c5()))try{let{warnUnbalancedTags:f}=await import("./chunk-ehfzp7xe.js");f(R,L)}catch{}let D=R;try{let{processESImports:f}=await import("./chunk-ebrcakdt.js");await f(R,Z,L,Y,J)}catch(f){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,f instanceof Error?f.message:f)}let N=J$(D);if(N)D=N.content.trim();let A=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(A)M=`<style${A[1]}>${A[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...Z};k.__stx_signals_gate=J1(R);for(let[f,n]of Object.entries(V))k[f]=n;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(I)],E="",b=null;for(let f of y){let n=f[1]||"",m=f[2]||"",V0=n.includes("server"),A0=N1(n),M0="";try{let{extractAndStripCssImports:t,renderVendorStyleTags:K0}=await import("./chunk-qw5gmsv7.js"),q0=t(m,{filePath:L,projectRoot:process.cwd()});m=q0.code,M0=K0(q0.styles)}catch(t){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,t instanceof Error?t.message:t)}if(A0&&m.trim())m=A1(m);if(!V0)try{let{hasUserImports:t,bundleClientScript:K0}=await import("./chunk-hx338p3h.js");if(t(m))m=await K0(m,L,{projectRoot:process.cwd()})}catch(t){if(Y.debug)console.warn(`[stx] bundler skipped for ${L}:`,t instanceof Error?t.message:t)}let g0=pY(m);if(g0&&!V0){b=`stx_scope_${U0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++m6}`;let t=o0(m),K0=iY(t,b);E+=`${M0}<script data-stx-scoped data-stx-run="always">${K0}</script>
3364
- `;continue}if(V0)try{let{extractVariables:t}=await import("./chunk-8a1524ge.js");await t(m,k,L)}catch(t){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,t)}if(!V0&&!g0){let t=n.replace(/\bclient\b/i,"").trim();b=`stx_scope_${U0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++m6}`;let K0=o0(m),q0=p6(K0,b),B1=c6(K0,q0);E+=`${M0}<script data-stx-scoped data-stx-run="always"${t?` ${t}`:""}>${B1}</script>
3365
- `}}if(b){let f=nY(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await S3(D,k,L,Y,J,Q);let{processLoops:C}=await import("./chunk-79m0qkj6.js"),x=C(D,k,L);if(x=a0(x,k,L),x=_1(x,k,L),M)x+=`
3363
+ })();`}function rJ($,Z){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]};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}}return{html:$,mergedIntoExisting:null}}var c6=0,Oz=new O1(500),s6=new Set;function Vz(){s6.clear()}function aJ($){if($.__onceStore instanceof Set)return $.__onceStore;return s6}async function P3($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||U0.join(U0.dirname(X),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let q=nJ($,"@partial","@include"),U=aJ(Z);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,V,O)=>{let F=V.trim(),L=`${X}:${F}`;if(U.has(L))return"";return U.add(L),V});{let _=/@includeIf\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+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(F+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let N=D[1],T=W(N,G,X),A="";if(T&&await Bun.file(T).exists())Y.add(T),A=`@include(${R})`;q=q.substring(0,O)+A+q.substring(w),_.lastIndex=0}}for(let[_,V]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(q))!==null){let L=F.index,w=L+F[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 N=q.substring(w+1,D-1),T=C3(N,0);if(T===-1){O.lastIndex=D;continue}let A=N.substring(0,T).trim(),M=N.substring(T+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){O.lastIndex=D;continue}let I=k[1],y=M.substring(k[0].length),E,b=C3(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${A})`,x;if(Q0(C)){let m=G0(C,Object.keys(Z));x=Boolean(m(...Object.values(Z)))}else x=Boolean(X0(C,Z));let f=V?!x:x,n="";if(f){let m=W(I,G,X);if(m&&await Bun.file(m).exists())Y.add(m);n=`@include('${I}'${E?`, ${E}`:""})`}q=q.substring(0,L)+n+q.substring(D),O.lastIndex=0}catch(C){let x=C instanceof Error?C.message:String(C),f=W0("Include",`Error evaluating ${_} condition: ${x}`,X,$,L);q=q.substring(0,L)+f+q.substring(D),O.lastIndex=0}}}{let _=/@each\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+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(F+1,w),D=q.substring(O,w+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let[,T,A,M,k]=N;try{let I,y=A.trim();if(Q0(y))I=G0(y,Object.keys(Z))(...Object.values(Z));else I=X0(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},x=await H(T,C,$,O);E+=x}else if(k)E=await H(k,{},$,O);q=q.substring(0,O)+E+q.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);q=q.substring(0,O)+W0("Each",`Error in @each: ${y}`,X,$,O)+q.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,V;while((V=_.exec(q))!==null){let O=V.index,F=O+V[0].length-1,L=1,w=F+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(F+1,w),D=q.substring(O,w+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(D,"");continue}let T=N[1],A=R.slice(N[0].length),M,k=A.match(/^\s*,\s*\{/);if(k){A=A.slice(k[0].length-1);let E=1,b=1;while(b<A.length&&E>0){if(A[b]==="{")E++;else if(A[b]==="}"){if(E--,E===0)break}b++}M=A.substring(0,b+1),A=A.slice(b+1)}let I,y=A.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(T.replace(/'/g,'"')),b={};if(M)try{b=_0(M,Z)}catch(x){let f=x instanceof Error?x.message:String(x);if(J.debug){let n=W0("Include",`Error parsing includeFirst variables: ${f}`,X,$,O,D);q=q.replace(D,()=>n)}else q=q.replace(D,()=>I||"");continue}let C=!1;for(let x of E){let f=W(x,G,X);if(!f)continue;if(await r(f)){let n=await H(x,b,$,O);q=q.replace(D,()=>n),C=!0;break}}if(!C)if(I!==void 0)q=q.replace(D,()=>I);else if(J.debug){let x=W0("Include",`None of the includeFirst paths exist: ${T}`,X,$,O,D);q=q.replace(D,()=>x)}else q=q.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=W0("Include",`Error processing @includeFirst: ${b}`,X,$,O,D);q=q.replace(D,()=>C)}_.lastIndex=0}}function W(_,V,O){try{let F=_;if(!_.endsWith(".stx"))F=`${_}.stx`;let L=U0.resolve(V),w=U0.resolve(U0.dirname(O)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=U0.resolve(V,F);else R=U0.resolve(w,F);let D=U0.normalize(R),N=D.startsWith(L+U0.sep)||D===L,T=D.startsWith(w+U0.sep)||D===w,A=!1,M=U0.dirname(w);if(D.startsWith(M+U0.sep)){if(!U0.relative(M,D).split(U0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))A=!0}if(!N&&!T&&!A)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(F){return console.error(`Error resolving path ${_}: ${F}`),null}}let K=U0.resolve(X);Q.add(K);function z(_,V,O,F){return J.onIncludeError?.({includePath:_,templatePath:X,message:V,partialsDir:G}),W0("Include",V,X,O,F)}async function H(_,V={},O,F){let L=W(_,G,X);if(!L)return z(_,`Could not resolve path for include: ${_}`,O,F);let w=U0.resolve(L);if(Q.has(w)){let R=[...Q,w].map((D)=>U0.basename(D)).join(" -> ");return z(_,`Circular include detected: ${R}`,O,F)}try{Y.add(L);let R;if(!R)try{R=await Bun.file(L).text()}catch(f){let n=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${n}`,O,F)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await import("./chunk-vpwjr05r.js");R=f(R,Z)}if(R&&(J.debug||!H5()&&!c5()))try{let{warnUnbalancedTags:f}=await import("./chunk-ehfzp7xe.js");f(R,L)}catch{}let D=R;try{let{processESImports:f}=await import("./chunk-0kdc3x7v.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 N=Q$(D);if(N)D=N.content.trim();let A=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(A)M=`<style${A[1]}>${A[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...Z};k.__stx_signals_gate=Q1(R);for(let[f,n]of Object.entries(V))k[f]=n;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(I)],E="",b=null;for(let f of y){let n=f[1]||"",m=f[2]||"",V0=n.includes("server"),M0=N1(n),T0="";try{let{extractAndStripCssImports:t,renderVendorStyleTags:K0}=await import("./chunk-g9kvpgha.js"),q0=t(m,{filePath:L,projectRoot:process.cwd()});m=q0.code,T0=K0(q0.styles)}catch(t){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,t instanceof Error?t.message:t)}if(M0&&m.trim())m=A1(m);if(!V0)try{let{hasUserImports:t,bundleClientScript:K0}=await import("./chunk-02n7khen.js");if(t(m))m=await K0(m,L,{projectRoot:process.cwd()})}catch(t){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,t instanceof Error?t.message:t)}let h0=sJ(m);if(h0&&!V0){b=`stx_scope_${U0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++c6}`;let t=r0(m),K0=oJ(t,b);E+=`${T0}<script data-stx-scoped data-stx-run="always">${K0}</script>
3364
+ `;continue}if(V0)try{let{extractVariables:t}=await import("./chunk-66081bkn.js");await t(m,k,L)}catch(t){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,t)}if(!V0&&!h0){let t=n.replace(/\bclient\b/i,"").trim();b=`stx_scope_${U0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++c6}`;let K0=r0(m),q0=n6(K0,b),B1=i6(K0,q0);E+=`${T0}<script data-stx-scoped data-stx-run="always"${t?` ${t}`:""}>${B1}</script>
3365
+ `}}if(b){let f=rJ(D,b);if(D=f.html,f.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),b=f.mergedIntoExisting}if(D.includes("@include")||D.includes("@partial"))D=await P3(D,k,L,J,Y,Q);let{processLoops:C}=await import("./chunk-k25mqtht.js"),x=C(D,k,L);if(x=t0(x,k,L),x=_1(x,k,L),M)x+=`
3366
3366
  `+M;if(E)x+=`
3367
- `+E;return x}catch(R){let D=R instanceof Error?R.message:String(R);return z(_,`Error processing include ${_}: ${D}`,O,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,V=_+j[0].length-1,O=1,F=V+1;while(F<q.length&&O>0){if(q[F]==="(")O++;else if(q[F]===")")O--;F++}if(O!==0)break;let L=q.substring(_,F),w=q.substring(V+1,F-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let D=R[1],N,T=w.substring(R[0].length),A=y3(T,0);if(A!==-1)N=T.substring(A+1).trim();let M={};if(N)try{M=_0(N,Z)}catch(I){let y=I instanceof Error?I.message:String(I);q=q.replace(L,W0("Include",`Error parsing include variables for ${D}: ${y}`,X,$,_)),B.lastIndex=0;continue}let k=await H(D,M,$,_);q=q.substring(0,_)+k+q.substring(F),B.lastIndex=0}return q}function C3($,Z){let X=$;function Y(J,Q,G,q){let U=J,W=!0;while(W){W=!1;let K=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=U.match(K);if(!z||z.index===void 0)break;let H=z.index,B=z[1],j=H+z[0].length,_=new RegExp(`@${Q}\\(`),V=new RegExp(`@${G}(?![a-z])`),O=1,F=j,L=-1;while(O>0&&F<U.length){let R=U.slice(F),D=R.match(_),N=R.match(V),T=D?F+D.index:1/0,A=N?F+N.index:1/0;if(T<A)O++,F=T+(D[0].length||1);else if(A<1/0){if(O--,O===0){L=A;break}F=A+G.length+1}else break}if(L===-1)break;let w=U.slice(j,L);if(!Z[B])Z[B]=[];if(q)Z[B].unshift(w);else Z[B].push(w);U=U.substring(0,H)+U.substring(L+`@${G}`.length),W=!0}return U}return X=Y(X,"push","endpush",!1),X=Y(X,"prepend","endprepend",!0),X}function P3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,Y)=>{if(!Z[Y]||Z[Y].length===0)return"";return Z[Y].join(`
3368
- `)})}import*as v3 from"path";async function n6($,Z,X=""){if(v3.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 o6($,Z,X,"@js","@endjs")}async function s6($,Z,X=""){if(v3.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 o6($,Z,X,"@ts","@endts")}async function o6($,Z,X,Y,J){let Q=$,G=v1(`${Y}([\\s\\S]*?)${J}`,"g"),q=[],U;while((U=G.exec($))!==null)q.push({fullMatch:U[0],content:U[1]||"",index:U.index});for(let{fullMatch:W,content:K,index:z}of q)try{let H={...Z,global:Z},B=Object.keys(H),j=Object.values(H),_=K.trim();if(Y==="@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 O=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
3367
+ `+E;return x}catch(R){let D=R instanceof Error?R.message:String(R);return z(_,`Error processing include ${_}: ${D}`,O,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,V=_+j[0].length-1,O=1,F=V+1;while(F<q.length&&O>0){if(q[F]==="(")O++;else if(q[F]===")")O--;F++}if(O!==0)break;let L=q.substring(_,F),w=q.substring(V+1,F-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let D=R[1],N,T=w.substring(R[0].length),A=C3(T,0);if(A!==-1)N=T.substring(A+1).trim();let M={};if(N)try{M=_0(N,Z)}catch(I){let y=I instanceof Error?I.message:String(I);q=q.replace(L,W0("Include",`Error parsing include variables for ${D}: ${y}`,X,$,_)),B.lastIndex=0;continue}let k=await H(D,M,$,_);q=q.substring(0,_)+k+q.substring(F),B.lastIndex=0}return q}function v3($,Z){let X=$;function J(Y,Q,G,q){let U=Y,W=!0;while(W){W=!1;let K=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=U.match(K);if(!z||z.index===void 0)break;let H=z.index,B=z[1],j=H+z[0].length,_=new RegExp(`@${Q}\\(`),V=new RegExp(`@${G}(?![a-z])`),O=1,F=j,L=-1;while(O>0&&F<U.length){let R=U.slice(F),D=R.match(_),N=R.match(V),T=D?F+D.index:1/0,A=N?F+N.index:1/0;if(T<A)O++,F=T+(D[0].length||1);else if(A<1/0){if(O--,O===0){L=A;break}F=A+G.length+1}else break}if(L===-1)break;let w=U.slice(j,L);if(!Z[B])Z[B]=[];if(q)Z[B].unshift(w);else Z[B].push(w);U=U.substring(0,H)+U.substring(L+`@${G}`.length),W=!0}return U}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function f3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
3368
+ `)})}import*as x3 from"path";async function o6($,Z,X=""){if(x3.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 a6($,Z,X,"@js","@endjs")}async function r6($,Z,X=""){if(x3.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 a6($,Z,X,"@ts","@endts")}async function a6($,Z,X,J,Y){let Q=$,G=v1(`${J}([\\s\\S]*?)${Y}`,"g"),q=[],U;while((U=G.exec($))!==null)q.push({fullMatch:U[0],content:U[1]||"",index:U.index});for(let{fullMatch:W,content:K,index:z}of q)try{let H={...Z,global:Z},B=Object.keys(H),j=Object.values(H),_=K.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 O=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
3369
3369
  ${_}
3370
3370
  ${F}
3371
- `,R=Function(...B,L)(...j);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(W,"")}catch(H){console.error(`Error executing ${Y} code block in ${X}:`,H);let B=H instanceof Error?H.message:String(H),j=W0(`${Y} Directive`,`Error executing code: ${B}`,X,$,z,W);console.error(j),Q=Q.replace(W,"")}return Q}var oY=1000,rY=!1;function aY($,Z){let X=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,Q;while((Q=X.exec($))!==null){let G=Q.index+Q[0].length,q=Q.index+Q[0].indexOf("("),U=H0($,"(",")",q);if(U===-1)continue;let W=$.slice(G,U).trim();if(!W)continue;if(!Object.keys(Z).some((H)=>new RegExp(`(?:^|[^\\w$.])${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let z;try{let H=_0(W,Z);if(!H||typeof H!=="object")continue;z=JSON.stringify(H)}catch{continue}Y+=$.slice(J,G)+z,J=U,X.lastIndex=U}return J===0?$:Y+$.slice(J)}function tY($,Z){let X=/@component\s*\(/g,Y=$,J,Q=[];while((J=X.exec(Y))!==null){let G=J.index,q=G+J[0].length-1,U=1,W=q+1;while(W<Y.length&&U>0){if(Y[W]==="(")U++;else if(Y[W]===")"){if(U--,U===0)break}W++}if(U!==0)continue;let K=Y.substring(q+1,W),z=W+1,H=K.match(/^\s*['"]([^'"]+)['"]/);if(!H)continue;let B=H[1],j=K.slice(H[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let V=j.slice(_[0].length).trim();if(!V)continue;try{let O=_0(V,Z),F=JSON.stringify(O),L=`@component('${B}', ${F})`;Q.push({start:G,end:z,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:q,end:U,replacement:W}=Q[G];Y=Y.substring(0,q)+W+Y.substring(U)}return Y}function Q$($,Z,X){let Y=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=J.exec(Y))!==null){let G=Q.index,q=G+Q[0].length-1,U=1,W=q+1,K=null,z=!1;while(W<Y.length&&U>0){let j=Y[W];if(z){z=!1,W++;continue}if(j==="\\"&&K){z=!0,W++;continue}if(K){if(j===K)K=null;W++;continue}if(j==='"'||j==="'"||j==="`"){K=j,W++;continue}if(j==="(")U++;else if(j===")"){if(U--,U===0)break}W++}if(U!==0)break;let H=Y.substring(q+1,W),B=X(H);Y=Y.substring(0,G)+B+Y.substring(W+1)}return Y}function eY($,Z){let X=$;return X=X.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in Z)return`:${J}="${J}"`;return Y}),X=X.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,Q)=>{try{let G=Object.keys(Z),q=Object.values(Z);S5(Q);let W=G0(Q,G)(...q),K=JSON.stringify(W),z=Buffer.from(K,"utf8").toString("base64");return`__stx_${J}="${z}"`}catch(G){return Y}}),X}var G$="<!--__STX_BREAK__-->",q$="<!--__STX_CONTINUE__-->";function $J($,Z){let X=$;return X=Q$(X,"@break",(Y)=>{try{let Q=`!!(${Y.trim()})`,G;if(Q0(Q)){let q=G0(Q,Object.keys(Z));G=Boolean(q(...Object.values(Z)))}else G=Boolean(X0(Q,Z));return G?G$:""}catch{return""}}),X=Q$(X,"@continue",(Y)=>{try{let Q=`!!(${Y.trim()})`,G;if(Q0(Q)){let q=G0(Q,Object.keys(Z));G=Boolean(q(...Object.values(Z)))}else G=Boolean(X0(Q,Z));return G?q$:""}catch{return""}}),X}function ZJ($){let Z=$;return Z=Z.replace(/@break(?!\()/g,G$),Z=Z.replace(/@continue(?!\()/g,q$),Z}function r6($){let Z=$.includes(G$),X=Z?$.substring(0,$.indexOf(G$)):$;return{hasBreak:Z,content:X}}function a6($){let Z=$.includes(q$),X=Z?$.substring(0,$.indexOf(q$)):$;return{hasContinue:Z,content:X}}function e6($){let Z=$;return Z=Q$(Z,"@break",(X)=>{let Y=X.trim();if(!C5(Y))return"";return`\`; if (${Y}) { break; } result += \``}),Z=Q$(Z,"@continue",(X)=>{let Y=X.trim();if(!C5(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function XJ($){let Z=/@forelse\s*\(/g,X,Y=[],J=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=J.exec($))!==null)Y.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)Y.push({pos:G.index,delta:-1});Y.sort((K,z)=>K.pos-z.pos);let q=[],U=0;for(let K of Y)U+=K.delta,q.push({pos:K.pos,depth:U});function W(K){let z=0,H=q.length-1,B=0;while(z<=H){let j=z+H>>1;if(q[j].pos<=K)B=q[j].depth,z=j+1;else H=j-1}return B}while((X=Z.exec($))!==null){if(W(X.index)>0)continue;let K=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),V=$2(_);if(!V)continue;let{arrayExpr:O,itemVar:F}=V,L=j+1,w=1,R=L,D=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&R<$.length){D.lastIndex=R,N.lastIndex=R;let E=D.exec($),b=N.exec($);if(!b)break;if(E&&E.index<b.index)w++,R=E.index+E[0].length;else{if(w--,w===0){T=b.index;break}R=b.index+11}}if(T===-1)continue;let A=$.substring(L,T),M=T+11,k=-1,I=0,y=0;while(y<A.length){let E=A.indexOf("@",y);if(E===-1)break;let b=A.substring(E);if(/^@forelse\s*\(/.test(b))I++,y=E+1;else if(b.startsWith("@endforelse"))I--,y=E+11;else if(I===0&&b.startsWith("@empty")){if(A.length<=E+6||!/[a-z]/i.test(A[E+6])){k=E;break}y=E+1}else y=E+1}if(k===-1)continue;return{start:K,end:M,arrayExpr:O,itemVar:F,foreachContent:A.substring(0,k),emptyContent:A.substring(k+6)}}return null}function t6($,Z){let X=$;while(!0){let Y=XJ(X);if(!Y)break;let{start:J,end:Q,arrayExpr:G,itemVar:q,foreachContent:U,emptyContent:W}=Y;try{let K;if(Q0(G))K=G0(G,Object.keys(Z))(...Object.values(Z));else K=X0(G,Z);let z;if(!Array.isArray(K)||K.length===0)z=W;else z=`@foreach (${G} as ${q})${U}@endforeach`;X=X.substring(0,J)+z+X.substring(Q)}catch(K){let z=K instanceof Error?K.message:String(K),H=$0("Forelse",`Error in @forelse(${G} as ${q}): ${z}`,l.EVALUATION_ERROR);X=X.substring(0,J)+H+X.substring(Q)}}return X}function $2($){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 Y=X[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=X[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function Z2($,Z,X,Y){let J=$;J=t6(J,Z);function Q(U){let W=/@foreach\s*\(/g,K;while((K=W.exec(U))!==null){let z=K.index,H=K.index+K[0].length-1,B=1,j=H+1,_=-1;while(j<U.length&&B>0){if(U[j]==="(")B++;else if(U[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let V=U.substring(H+1,_),O=$2(V);if(!O)continue;let F=z,{arrayExpr:L,itemVar:w}=O,R=_+1,D=1,N=R,T=/@foreach\s*\(/g,A=/@endforeach/g;while(D>0&&N<U.length){T.lastIndex=N,A.lastIndex=N;let M=T.exec(U),k=A.exec(U);if(!k)break;if(M&&M.index<k.index)D++,N=M.index+M[0].length;else{if(D--,D===0){let I=U.substring(R,k.index),y=k.index+11;return{start:F,end:y,arrayExpr:L,itemVar:w,content:I}}N=k.index+11}}}return null}function G(U,W){let K=U;while(!0){let z=Q(K);if(!z)break;let{start:H,end:B,arrayExpr:j,itemVar:_,content:V}=z;try{let O=j.trim(),F;if(Q0(O))F=G0(O,Object.keys(W))(...Object.values(W));else F=X0(O,W);let L=!1;if(!Array.isArray(F))if(F instanceof Map)F=Array.from(F),L=!0;else if(F instanceof Set)F=Array.from(F);else if(typeof F==="string")F=Array.from(F);else if(F&&typeof F==="object"&&!(F instanceof Date)&&!(F instanceof RegExp))F=Object.entries(F),L=!0;else{console.warn(`[stx] @foreach(${O}) in ${X}: ${O} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let k=$0("Foreach",`Error in @foreach: ${O} is not iterable`,l.TYPE_ERROR);K=K.substring(0,H)+k+K.substring(B);continue}let w=Y?.loops?.useAltLoopVariable??rY,R=_.trim(),D=null,N,T=!1;if(R.includes("=>")){let k=R.split("=>").map((I)=>I.trim());if(k.length===2&&k[0]&&k[1])D=k[0],N=k[1];else N=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((I)=>I.trim());if(k.length===2&&k[0]&&k[1])N=k[0],D=k[1],T=!0;else N=R}else N=R;let A="",M=F;for(let k=0;k<M.length;k++){let I=M[k],y={index:k,iteration:k+1,first:k===0,last:k===M.length-1,count:M.length},E={...W,loop:y,$loop:y};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((n)=>n.trim());if(Array.isArray(I))f.forEach((n,m)=>{if(n)E[n]=I[m]});else E[N]=I}else E[N]=I;if(D)if(!T&&L&&Array.isArray(I)&&I.length===2)E[D]=I[0],E[N]=I[1];else E[D]=k;let b=$J(V,E),C=a6(b);if(C.hasContinue){A+=C.content;continue}let x=r6(b);if(x.hasBreak){A+=x.content;break}if(b=t6(b,E),b=G(b,E),b=a0(b,E,X),b=ZJ(b),x=r6(b),x.hasBreak){A+=x.content;break}if(C=a6(b),C.hasContinue){A+=C.content;continue}b=_1(b,E,X),b=eY(b,E),b=tY(b,E),b=aY(b,E),A+=b}K=K.substring(0,H)+A+K.substring(B)}catch(O){let F=$0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${O instanceof Error?O.message:String(O)}`,l.EVALUATION_ERROR);K=K.substring(0,H)+F+K.substring(B)}}return K}J=G(J,Z),J=Y2(J,Z,X,Y);let q=Y?.loops?.maxWhileIterations??oY;return J=QJ(J,Z,q),J}function X2($){return C5($)}function Y2($,Z,X,Y){let J=$,Q=!0;while(Q){Q=!1;let G=J.match(/@for\s*\(/);if(!G||G.index===void 0)break;let q=G.index,U=q+G[0].length-1,W=H0(J,"(",")",U);if(W===-1)break;let K=J.slice(U+1,W),z=W+1,H=Z$(J.slice(q),"for","endfor");if(H.length===0)break;let B=H[0].content,j=q+H[0].end;if(!X2(K)){let _=$0("For",`Unsafe expression in @for: ${K}`,l.UNSAFE_EXPRESSION);J=J.substring(0,q)+_+J.substring(j),Q=!0;continue}try{let _=YJ(K),V=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&V){let D=JJ({forExpr:K,content:B,iterVarNames:_,context:Z,filePath:X,options:Y});J=J.substring(0,q)+D+J.substring(j),Q=!0;continue}let O=Object.keys(Z),F=Object.values(Z),L=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(D,N)=>{return`\${${N}}`});L=e6(L);let R=Function(...O,`
3371
+ `,R=Function(...B,L)(...j);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(W,"")}catch(H){console.error(`Error executing ${J} code block in ${X}:`,H);let B=H instanceof Error?H.message:String(H),j=W0(`${J} Directive`,`Error executing code: ${B}`,X,$,z,W);console.error(j),Q=Q.replace(W,"")}return Q}var tJ=1000,eJ=!1;function $Y($,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("("),U=H0($,"(",")",q);if(U===-1)continue;let W=$.slice(G,U).trim();if(!W)continue;if(!Object.keys(Z).some((H)=>new RegExp(`(?:^|[^\\w$.])${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let z;try{let H=_0(W,Z);if(!H||typeof H!=="object")continue;z=JSON.stringify(H)}catch{continue}J+=$.slice(Y,G)+z,Y=U,X.lastIndex=U}return Y===0?$:J+$.slice(Y)}function ZY($,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,U=1,W=q+1;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")"){if(U--,U===0)break}W++}if(U!==0)continue;let K=J.substring(q+1,W),z=W+1,H=K.match(/^\s*['"]([^'"]+)['"]/);if(!H)continue;let B=H[1],j=K.slice(H[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let V=j.slice(_[0].length).trim();if(!V)continue;try{let O=_0(V,Z),F=JSON.stringify(O),L=`@component('${B}', ${F})`;Q.push({start:G,end:z,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:q,end:U,replacement:W}=Q[G];J=J.substring(0,q)+W+J.substring(U)}return J}function G$($,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,U=1,W=q+1,K=null,z=!1;while(W<J.length&&U>0){let j=J[W];if(z){z=!1,W++;continue}if(j==="\\"&&K){z=!0,W++;continue}if(K){if(j===K)K=null;W++;continue}if(j==='"'||j==="'"||j==="`"){K=j,W++;continue}if(j==="(")U++;else if(j===")"){if(U--,U===0)break}W++}if(U!==0)break;let H=J.substring(q+1,W),B=X(H);J=J.substring(0,G)+B+J.substring(W+1)}return J}function XY($,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);S5(Q);let W=G0(Q,G)(...q),K=JSON.stringify(W),z=Buffer.from(K,"utf8").toString("base64");return`__stx_${Y}="${z}"`}catch(G){return J}}),X}var q$="<!--__STX_BREAK__-->",U$="<!--__STX_CONTINUE__-->";function JY($,Z){let X=$;return X=G$(X,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(Q0(Q)){let q=G0(Q,Object.keys(Z));G=Boolean(q(...Object.values(Z)))}else G=Boolean(X0(Q,Z));return G?q$:""}catch{return""}}),X=G$(X,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(Q0(Q)){let q=G0(Q,Object.keys(Z));G=Boolean(q(...Object.values(Z)))}else G=Boolean(X0(Q,Z));return G?U$:""}catch{return""}}),X}function YY($){let Z=$;return Z=Z.replace(/@break(?!\()/g,q$),Z=Z.replace(/@continue(?!\()/g,U$),Z}function t6($){let Z=$.includes(q$),X=Z?$.substring(0,$.indexOf(q$)):$;return{hasBreak:Z,content:X}}function e6($){let Z=$.includes(U$),X=Z?$.substring(0,$.indexOf(U$)):$;return{hasContinue:Z,content:X}}function Z2($){let Z=$;return Z=G$(Z,"@break",(X)=>{let J=X.trim();if(!C5(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=G$(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 QY($){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((K,z)=>K.pos-z.pos);let q=[],U=0;for(let K of J)U+=K.delta,q.push({pos:K.pos,depth:U});function W(K){let z=0,H=q.length-1,B=0;while(z<=H){let j=z+H>>1;if(q[j].pos<=K)B=q[j].depth,z=j+1;else H=j-1}return B}while((X=Z.exec($))!==null){if(W(X.index)>0)continue;let K=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),V=X2(_);if(!V)continue;let{arrayExpr:O,itemVar:F}=V,L=j+1,w=1,R=L,D=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&R<$.length){D.lastIndex=R,N.lastIndex=R;let E=D.exec($),b=N.exec($);if(!b)break;if(E&&E.index<b.index)w++,R=E.index+E[0].length;else{if(w--,w===0){T=b.index;break}R=b.index+11}}if(T===-1)continue;let A=$.substring(L,T),M=T+11,k=-1,I=0,y=0;while(y<A.length){let E=A.indexOf("@",y);if(E===-1)break;let b=A.substring(E);if(/^@forelse\s*\(/.test(b))I++,y=E+1;else if(b.startsWith("@endforelse"))I--,y=E+11;else if(I===0&&b.startsWith("@empty")){if(A.length<=E+6||!/[a-z]/i.test(A[E+6])){k=E;break}y=E+1}else y=E+1}if(k===-1)continue;return{start:K,end:M,arrayExpr:O,itemVar:F,foreachContent:A.substring(0,k),emptyContent:A.substring(k+6)}}return null}function $2($,Z){let X=$;while(!0){let J=QY(X);if(!J)break;let{start:Y,end:Q,arrayExpr:G,itemVar:q,foreachContent:U,emptyContent:W}=J;try{let K;if(Q0(G))K=G0(G,Object.keys(Z))(...Object.values(Z));else K=X0(G,Z);let z;if(!Array.isArray(K)||K.length===0)z=W;else z=`@foreach (${G} as ${q})${U}@endforeach`;X=X.substring(0,Y)+z+X.substring(Q)}catch(K){let z=K instanceof Error?K.message:String(K),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 X2($){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 J2($,Z,X,J){let Y=$;Y=$2(Y,Z);function Q(U){let W=/@foreach\s*\(/g,K;while((K=W.exec(U))!==null){let z=K.index,H=K.index+K[0].length-1,B=1,j=H+1,_=-1;while(j<U.length&&B>0){if(U[j]==="(")B++;else if(U[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let V=U.substring(H+1,_),O=X2(V);if(!O)continue;let F=z,{arrayExpr:L,itemVar:w}=O,R=_+1,D=1,N=R,T=/@foreach\s*\(/g,A=/@endforeach/g;while(D>0&&N<U.length){T.lastIndex=N,A.lastIndex=N;let M=T.exec(U),k=A.exec(U);if(!k)break;if(M&&M.index<k.index)D++,N=M.index+M[0].length;else{if(D--,D===0){let I=U.substring(R,k.index),y=k.index+11;return{start:F,end:y,arrayExpr:L,itemVar:w,content:I}}N=k.index+11}}}return null}function G(U,W){let K=U;while(!0){let z=Q(K);if(!z)break;let{start:H,end:B,arrayExpr:j,itemVar:_,content:V}=z;try{let O=j.trim(),F;if(Q0(O))F=G0(O,Object.keys(W))(...Object.values(W));else F=X0(O,W);let L=!1;if(!Array.isArray(F))if(F instanceof Map)F=Array.from(F),L=!0;else if(F instanceof Set)F=Array.from(F);else if(typeof F==="string")F=Array.from(F);else if(F&&typeof F==="object"&&!(F instanceof Date)&&!(F instanceof RegExp))F=Object.entries(F),L=!0;else{console.warn(`[stx] @foreach(${O}) in ${X}: ${O} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let k=$0("Foreach",`Error in @foreach: ${O} is not iterable`,l.TYPE_ERROR);K=K.substring(0,H)+k+K.substring(B);continue}let w=J?.loops?.useAltLoopVariable??eJ,R=_.trim(),D=null,N,T=!1;if(R.includes("=>")){let k=R.split("=>").map((I)=>I.trim());if(k.length===2&&k[0]&&k[1])D=k[0],N=k[1];else N=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((I)=>I.trim());if(k.length===2&&k[0]&&k[1])N=k[0],D=k[1],T=!0;else N=R}else N=R;let A="",M=F;for(let k=0;k<M.length;k++){let I=M[k],y={index:k,iteration:k+1,first:k===0,last:k===M.length-1,count:M.length},E={...W,loop:y,$loop:y};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((n)=>n.trim());if(Array.isArray(I))f.forEach((n,m)=>{if(n)E[n]=I[m]});else E[N]=I}else E[N]=I;if(D)if(!T&&L&&Array.isArray(I)&&I.length===2)E[D]=I[0],E[N]=I[1];else E[D]=k;let b=JY(V,E),C=e6(b);if(C.hasContinue){A+=C.content;continue}let x=t6(b);if(x.hasBreak){A+=x.content;break}if(b=$2(b,E),b=G(b,E),b=t0(b,E,X),b=YY(b),x=t6(b),x.hasBreak){A+=x.content;break}if(C=e6(b),C.hasContinue){A+=C.content;continue}b=_1(b,E,X),b=XY(b,E),b=ZY(b,E),b=$Y(b,E),A+=b}K=K.substring(0,H)+A+K.substring(B)}catch(O){let F=$0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${O instanceof Error?O.message:String(O)}`,l.EVALUATION_ERROR);K=K.substring(0,H)+F+K.substring(B)}}return K}Y=G(Y,Z),Y=Q2(Y,Z,X,J);let q=J?.loops?.maxWhileIterations??tJ;return Y=UY(Y,Z,q),Y}function Y2($){return C5($)}function Q2($,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,U=q+G[0].length-1,W=H0(Y,"(",")",U);if(W===-1)break;let K=Y.slice(U+1,W),z=W+1,H=X$(Y.slice(q),"for","endfor");if(H.length===0)break;let B=H[0].content,j=q+H[0].end;if(!Y2(K)){let _=$0("For",`Unsafe expression in @for: ${K}`,l.UNSAFE_EXPRESSION);Y=Y.substring(0,q)+_+Y.substring(j),Q=!0;continue}try{let _=GY(K),V=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&V){let D=qY({forExpr:K,content:B,iterVarNames:_,context:Z,filePath:X,options:J});Y=Y.substring(0,q)+D+Y.substring(j),Q=!0;continue}let O=Object.keys(Z),F=Object.values(Z),L=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(D,N)=>{return`\${${N}}`});L=Z2(L);let R=Function(...O,`
3372
3372
  let result = '';
3373
3373
  for (${K}) {
3374
3374
  result += \`${L}\`;
3375
3375
  }
3376
3376
  return result;
3377
- `)(...F);J=J.substring(0,q)+R+J.substring(j),Q=!0}catch(_){let V=$0("For",`Error in @for(${K}): ${_ instanceof Error?_.message:String(_)}`,l.EVALUATION_ERROR);J=J.substring(0,q)+V+J.substring(j),Q=!0}}return J}function YJ($){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 U=q.trim();if(!U)return"";let W=U.indexOf(":");if(W>=0&&Q.startsWith("{")){let H=U.slice(W+1).trim(),B=H.indexOf("=");return(B>=0?H.slice(0,B):H).trim()}let K=U.indexOf("="),z=(K>=0?U.slice(0,K):U).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function JJ($){let{forExpr:Z,content:X,iterVarNames:Y,context:J,filePath:Q,options:G}=$,q=Object.keys(J),U=Object.values(J),W=Function(...q,"__pushIter",`
3377
+ `)(...F);Y=Y.substring(0,q)+R+Y.substring(j),Q=!0}catch(_){let V=$0("For",`Error in @for(${K}): ${_ instanceof Error?_.message:String(_)}`,l.EVALUATION_ERROR);Y=Y.substring(0,q)+V+Y.substring(j),Q=!0}}return Y}function GY($){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 U=q.trim();if(!U)return"";let W=U.indexOf(":");if(W>=0&&Q.startsWith("{")){let H=U.slice(W+1).trim(),B=H.indexOf("=");return(B>=0?H.slice(0,B):H).trim()}let K=U.indexOf("="),z=(K>=0?U.slice(0,K):U).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 qY($){let{forExpr:Z,content:X,iterVarNames:J,context:Y,filePath:Q,options:G}=$,q=Object.keys(Y),U=Object.values(Y),W=Function(...q,"__pushIter",`
3378
3378
  for (${Z}) {
3379
- __pushIter([${Y.join(", ")}])
3379
+ __pushIter([${J.join(", ")}])
3380
3380
  }
3381
- `),K=[];W(...U,(B)=>{K.push(B)});let z=Q??"inline.stx",H="";for(let B of K){let j={...J};Y.forEach((V,O)=>{j[V]=B[O]});let _=Y2(X,j,Q,G);_=a0(_,j,z),_=_1(_,j,z),H+=_}return H}function QJ($,Z,X){let Y=$,J=!0;while(J){J=!1;let Q=Y.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,q=G+Q[0].length-1,U=H0(Y,"(",")",q);if(U===-1)break;let W=Y.slice(q+1,U),K=Z$(Y.slice(G),"while","endwhile");if(K.length===0)break;let z=K[0].content,H=G+K[0].end;if(!X2(W)){let B=$0("While",`Unsafe expression in @while: ${W}`,l.UNSAFE_EXPRESSION);Y=Y.substring(0,G)+B+Y.substring(H),J=!0;continue}try{let B=Object.keys(Z),j=Object.values(Z),_=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(F,L)=>{return`\${${L}}`});_=e6(_);let O=Function(...B,`
3381
+ `),K=[];W(...U,(B)=>{K.push(B)});let z=Q??"inline.stx",H="";for(let B of K){let j={...Y};J.forEach((V,O)=>{j[V]=B[O]});let _=Q2(X,j,Q,G);_=t0(_,j,z),_=_1(_,j,z),H+=_}return H}function UY($,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,U=H0(J,"(",")",q);if(U===-1)break;let W=J.slice(q+1,U),K=X$(J.slice(G),"while","endwhile");if(K.length===0)break;let z=K[0].content,H=G+K[0].end;if(!Y2(W)){let B=$0("While",`Unsafe expression in @while: ${W}`,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,(F,L)=>{return`\${${L}}`});_=Z2(_);let O=Function(...B,`
3382
3382
  let result = '';
3383
3383
  let maxIterations = ${X}; // Configurable safety limit
3384
3384
  let counter = 0;
@@ -3390,31 +3390,31 @@ ${l6($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
3390
3390
  result += '<!-- [While Error [1104]]: Maximum iterations (${X}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3391
3391
  }
3392
3392
  return result;
3393
- `)(...j);Y=Y.substring(0,G)+O+Y.substring(H),J=!0}catch(B){let j=$0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,l.EVALUATION_ERROR);Y=Y.substring(0,G)+j+Y.substring(H),J=!0}}return Y}function GJ($,Z="_method"){let X=$.toUpperCase();if(X==="GET"||X==="POST")return"";return`<input type="hidden" name="${Z}" value="${X}">`}function J2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,X,Y,J,Q)=>{return GJ(Y,Q||"_method")})}async function Q2($,Z,X,Y,J){if(!Y.middleware||Y.middleware.length===0)return $;let Q=$,G=Y.middleware.filter((q)=>q.timing===J);if(G.length===0)return Q;for(let q of G){if(!q.name||typeof q.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",q);continue}try{let U=await q.handler(Q,Z,X,Y);if(typeof U==="string")Q=U;else if(Y.debug)console.warn(`Middleware ${q.name} did not return a string`)}catch(U){if(Y.debug)console.error(`Error in middleware ${q.name}:`,U);if(Y.debug){let W=W0("Middleware",`Error in middleware '${q.name}': ${U instanceof Error?U.message:String(U)}`,X,$);Q=Q.replace(/<body[^>]*>/,`$&
3394
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${b$(W)}</div>
3395
- `)}}}return Q}async function G2($,Z,X,Y){return Q2($,Z,X,Y,"before")}async function q2($,Z,X,Y){return Q2($,Z,X,Y,"after")}U5();U5();function U2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,X,Y,J,Q)=>{try{let G=J?_0(J,{}):{};return f3(Y,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var m0={patterns:[],exact:{}};function xz($,Z){if(!m0.exact[$])m0.exact[$]=[];m0.exact[$].push(Z)}function gz($,Z){let X=typeof $==="string"?new RegExp($):$;m0.patterns.push({pattern:X,callback:Z})}async function W2($,Z){let X=$.split("/").pop()?.split(".")[0]||"";if(m0.exact[$])for(let Y of m0.exact[$])await Promise.resolve(Y(Z,$));if(m0.exact[X])for(let Y of m0.exact[X])await Promise.resolve(Y(Z,$));for(let{pattern:Y,callback:J}of m0.patterns)if(Y.test($)||Y.test(X))await Promise.resolve(J(Z,$))}function hz(){m0.patterns=[],m0.exact={}}var qJ=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),UJ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function WJ($){let Z=[],X=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,Y;while((Y=X.exec($))!==null){let J=Y[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(J))continue;let Q=Y.index,G=Q+Y[0].length,q=Y[1].toLowerCase();if(Y[0].endsWith("/>")||UJ.has(q)){Z.push([Q,G]);continue}let U=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`<\\/?${U}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");W.lastIndex=G;let K=1,z=G,H;while((H=W.exec($))!==null)if(H[0].startsWith("</")){if(K--,K===0){z=H.index+H[0].length;break}}else if(!H[0].endsWith("/>"))K++;Z.push([Q,z])}return Z}function z2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>z2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function H2($,Z){if(!/:[\w-]+=/.test($))return $;let X=$,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],Q;while((Q=Y.exec($))!==null)J.push([Q.index,Q.index+Q[0].length]);J.push(...WJ($));function G(W){return J.some(([K,z])=>W>=K&&W<z)}let q=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,U=[];while((Q=q.exec(X))!==null){if(G(Q.index))continue;let W=Q[0],K=Q[2];if(!K||!K.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,H,B=K,j=!1;while((H=z.exec(K))!==null){let _=H[1],V=H[2];if(K2(_))continue;if(V.includes("()")&&!V.includes(".get(")||V.includes("$store")||V.includes("$ref"))continue;try{let O=Object.keys(Z),F=Object.values(Z),L=V.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!O.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let R=Function(...O,`return (${V})`)(...F);if(_==="class"){let D=z2(R);if(D){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${D}"`);else B=B.replace(H[0],` class="${D}"`)}else B=B.replace(H[0],"");j=!0;continue}if(qJ.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 _=W.endsWith("/>")?" /":"",O=`<${Q[1]}${B}${_}>`;U.push({start:Q.index,end:Q.index+W.length,replacement:O})}}for(let W=U.length-1;W>=0;W--){let{start:K,end:z,replacement:H}=U[W];X=X.slice(0,K)+H+X.slice(z)}return X}var KJ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),zJ=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 M1($,Z){let X=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;X.lastIndex=Z;let Y=X.exec($);if(!Y)return null;let J=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&KJ.has(Y[1]),Q=J?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:Q,selfClosing:J,start:Y.index,end:Y.index+Y[0].length}}function HJ($,Z,X){let Y=1,J=X,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(Y>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J;let q=Q.exec($),U=G.exec($);if(!U)return-1;if(q&&q.index<U.index)Y++,J=q.index+q[0].length;else{if(Y--,Y===0)return U.index+U[0].length;J=U.index+U[0].length}}return-1}function i0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let X=HJ($,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 B2($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function c1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=$.match(new RegExp(`${X}="([^"]*)"`,"s"))||$.match(new RegExp(`${X}='([^']*)'`,"s"));return Y?Y[1]:null}function z1($,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 H1($,Z,X){let Y=Z.selfClosing?" /":"",J=`<${Z.tag}${X}${Y}>`;return $.slice(0,Z.start)+J+$.slice(Z.end)}function BJ($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function jJ($){let Z=$,X=0;while(X<Z.length){let Y=M1(Z,X);if(!Y)break;let J=c1(Y.attrs,"v-for");if(J===null){X=Y.end;continue}let Q=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){X=Y.end;continue}let G=Q[1].trim(),q=Q[2].trim(),U;if(G.includes(",")){let V=G.split(",").map((L)=>L.trim()),O=V[0],F=V[1];U=`${q} as ${F} => ${O}`}else U=`${q} as ${G}`;let W=z1(Y.attrs,"v-for"),K=z1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=i0(Z,Y),H=Z.slice(z.outerStart,z.outerEnd),B=H1(H,{...Y,start:0,end:Y.end-Y.start},K),j=`@foreach(${U})
3393
+ `)(...j);J=J.substring(0,G)+O+J.substring(H),Y=!0}catch(B){let j=$0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,l.EVALUATION_ERROR);J=J.substring(0,G)+j+J.substring(H),Y=!0}}return J}function WY($,Z="_method"){let X=$.toUpperCase();if(X==="GET"||X==="POST")return"";return`<input type="hidden" name="${Z}" value="${X}">`}function G2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,X,J,Y,Q)=>{return WY(J,Q||"_method")})}async function q2($,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 U=await q.handler(Q,Z,X,J);if(typeof U==="string")Q=U;else if(J.debug)console.warn(`Middleware ${q.name} did not return a string`)}catch(U){if(J.debug)console.error(`Error in middleware ${q.name}:`,U);if(J.debug){let W=W0("Middleware",`Error in middleware '${q.name}': ${U instanceof Error?U.message:String(U)}`,X,$);Q=Q.replace(/<body[^>]*>/,`$&
3394
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${y$(W)}</div>
3395
+ `)}}}return Q}async function U2($,Z,X,J){return q2($,Z,X,J,"before")}async function W2($,Z,X,J){return q2($,Z,X,J,"after")}U5();U5();function K2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,X,J,Y,Q)=>{try{let G=Y?_0(Y,{}):{};return g3(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var l0={patterns:[],exact:{}};function uz($,Z){if(!l0.exact[$])l0.exact[$]=[];l0.exact[$].push(Z)}function dz($,Z){let X=typeof $==="string"?new RegExp($):$;l0.patterns.push({pattern:X,callback:Z})}async function z2($,Z){let X=$.split("/").pop()?.split(".")[0]||"";if(l0.exact[$])for(let J of l0.exact[$])await Promise.resolve(J(Z,$));if(l0.exact[X])for(let J of l0.exact[X])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:Y}of l0.patterns)if(J.test($)||J.test(X))await Promise.resolve(Y(Z,$))}function mz(){l0.patterns=[],l0.exact={}}var KY=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),zY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function HY($){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("/>")||zY.has(q)){Z.push([Q,G]);continue}let U=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`<\\/?${U}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");W.lastIndex=G;let K=1,z=G,H;while((H=W.exec($))!==null)if(H[0].startsWith("</")){if(K--,K===0){z=H.index+H[0].length;break}}else if(!H[0].endsWith("/>"))K++;Z.push([Q,z])}return Z}function B2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>B2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function j2($,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(...HY($));function G(W){return Y.some(([K,z])=>W>=K&&W<z)}let q=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,U=[];while((Q=q.exec(X))!==null){if(G(Q.index))continue;let W=Q[0],K=Q[2];if(!K||!K.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,H,B=K,j=!1;while((H=z.exec(K))!==null){let _=H[1],V=H[2];if(H2(_))continue;if(V.includes("()")&&!V.includes(".get(")||V.includes("$store")||V.includes("$ref"))continue;try{let O=Object.keys(Z),F=Object.values(Z),L=V.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!O.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let R=Function(...O,`return (${V})`)(...F);if(_==="class"){let D=B2(R);if(D){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${D}"`);else B=B.replace(H[0],` class="${D}"`)}else B=B.replace(H[0],"");j=!0;continue}if(KY.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 _=W.endsWith("/>")?" /":"",O=`<${Q[1]}${B}${_}>`;U.push({start:Q.index,end:Q.index+W.length,replacement:O})}}for(let W=U.length-1;W>=0;W--){let{start:K,end:z,replacement:H}=U[W];X=X.slice(0,K)+H+X.slice(z)}return X}var BY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),jY=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 M1($,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()&&BY.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 _Y($,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($),U=G.exec($);if(!U)return-1;if(q&&q.index<U.index)J++,Y=q.index+q[0].length;else{if(J--,J===0)return U.index+U[0].length;Y=U.index+U[0].length}}return-1}function n0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let X=_Y($,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 _2($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function c1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${X}="([^"]*)"`,"s"))||$.match(new RegExp(`${X}='([^']*)'`,"s"));return J?J[1]:null}function z1($,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 H1($,Z,X){let J=Z.selfClosing?" /":"",Y=`<${Z.tag}${X}${J}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function OY($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function VY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;let Y=c1(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(),U;if(G.includes(",")){let V=G.split(",").map((L)=>L.trim()),O=V[0],F=V[1];U=`${q} as ${F} => ${O}`}else U=`${q} as ${G}`;let W=z1(J.attrs,"v-for"),K=z1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=n0(Z,J),H=Z.slice(z.outerStart,z.outerEnd),B=H1(H,{...J,start:0,end:J.end-J.start},K),j=`@foreach(${U})
3396
3396
  `,_=`${j}${B}
3397
- @endforeach`;Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),X=z.outerStart+j.length}return Z}function _J($){let Z=$,X=0;while(X<Z.length){let Y=M1(Z,X);if(!Y)break;let J=c1(Y.attrs,"v-if");if(J===null){X=Y.end;continue}let Q=[],G=i0(Z,Y),q=z1(Y.attrs,"v-if"),U=H1(Z.slice(G.outerStart,G.outerEnd),{...Y,start:0,end:Y.end-Y.start},q);Q.push({type:"if",expr:J,outerStart:G.outerStart,outerEnd:G.outerEnd,element:U,parsedTag:Y});let W=G.outerEnd,K=!0;while(K){let _=Z.slice(W).match(/^\s*/),V=_?_[0].length:0,O=M1(Z,W+V);if(!O){K=!1;break}let F=c1(O.attrs,"v-else-if"),L=B2(O.attrs,"v-else");if(F!==null){let w=i0(Z,O),R=z1(O.attrs,"v-else-if"),D=H1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},R);Q.push({type:"else-if",expr:F,outerStart:W,outerEnd:w.outerEnd,element:D,parsedTag:O}),W=w.outerEnd}else if(L){let w=i0(Z,O),R=z1(O.attrs,"v-else"),D=H1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},R);Q.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:D,parsedTag:O}),K=!1}else K=!1}let z=[];for(let _ of Q)if(_.type==="if")z.push(`@if(${_.expr})
3397
+ @endforeach`;Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),X=z.outerStart+j.length}return Z}function FY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;let Y=c1(J.attrs,"v-if");if(Y===null){X=J.end;continue}let Q=[],G=n0(Z,J),q=z1(J.attrs,"v-if"),U=H1(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:U,parsedTag:J});let W=G.outerEnd,K=!0;while(K){let _=Z.slice(W).match(/^\s*/),V=_?_[0].length:0,O=M1(Z,W+V);if(!O){K=!1;break}let F=c1(O.attrs,"v-else-if"),L=_2(O.attrs,"v-else");if(F!==null){let w=n0(Z,O),R=z1(O.attrs,"v-else-if"),D=H1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},R);Q.push({type:"else-if",expr:F,outerStart:W,outerEnd:w.outerEnd,element:D,parsedTag:O}),W=w.outerEnd}else if(L){let w=n0(Z,O),R=z1(O.attrs,"v-else"),D=H1(Z.slice(w.outerStart,w.outerEnd),{...O,start:0,end:O.end-O.start},R);Q.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:D,parsedTag:O}),K=!1}else K=!1}let z=[];for(let _ of Q)if(_.type==="if")z.push(`@if(${_.expr})
3398
3398
  ${_.element}`);else if(_.type==="else-if")z.push(`@elseif(${_.expr})
3399
3399
  ${_.element}`);else z.push(`@else
3400
3400
  ${_.element}`);z.push("@endif");let H=z.join(`
3401
- `),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 OJ($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function VJ($){let Z=$,X=0;while(X<Z.length){let Y=M1(Z,X);if(!Y)break;let J=Y.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,q=J.match(G);while(q){Q=!0;let K=q[1],z=q[2],H=q[3];J=J.replace(q[0],""),J+=` :${K}="${H}" @update:${K}="${H} = $event"`,q=J.match(G)}if(Q){let K=i0(Z,Y),z=Z.slice(K.outerStart,K.outerEnd),H=H1(z,{...Y,start:0,end:Y.end-Y.start},J);Z=Z.slice(0,K.outerStart)+H+Z.slice(K.outerEnd),X=K.outerStart+H.length;continue}let U=c1(Y.attrs,"v-model");if(U===null){X=Y.end;continue}if(zJ.has(Y.tag)){let K=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${U}"`,z=i0(Z,Y),H=Z.slice(z.outerStart,z.outerEnd),B=H1(H,{...Y,start:0,end:Y.end-Y.start},K);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),X=z.outerStart+B.length}else{let K=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");K+=` :modelValue="${U}" @update:modelValue="${U} = $event"`;let z=i0(Z,Y),H=Z.slice(z.outerStart,z.outerEnd),B=H1(H,{...Y,start:0,end:Y.end-Y.start},K);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),X=z.outerStart+B.length}}return Z}function FJ($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function LJ($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function wJ($){let Z=$,X=0;while(X<Z.length){let Y=M1(Z,X);if(!Y)break;let J=c1(Y.attrs,"v-html");if(J===null){X=Y.end;continue}if(Y.selfClosing){X=Y.end;continue}let Q=i0(Z,Y),G=z1(Y.attrs,"v-html"),q=Y.selfClosing?" /":"",U=`<${Y.tag}${G}${q}>{!! ${J} !!}</${Y.tag}>`;Z=Z.slice(0,Q.outerStart)+U+Z.slice(Q.outerEnd),X=Q.outerStart+U.length}return Z}function RJ($){let Z=$,X=0;while(X<Z.length){let Y=M1(Z,X);if(!Y)break;let J=c1(Y.attrs,"v-text");if(J===null){X=Y.end;continue}if(Y.selfClosing){X=Y.end;continue}let Q=i0(Z,Y),G=z1(Y.attrs,"v-text"),q=Y.selfClosing?" /":"",U=`<${Y.tag}${G}${q}>{{ ${J} }}</${Y.tag}>`;Z=Z.slice(0,Q.outerStart)+U+Z.slice(Q.outerEnd),X=Q.outerStart+U.length}return Z}function DJ($){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 NJ($){let Z=$,X=0;while(X<Z.length){let Y=M1(Z,X);if(!Y)break;if(!B2(Y.attrs,"v-once")){X=Y.end;continue}let J=z1(Y.attrs,"v-once"),Q=i0(Z,Y),G=Z.slice(Q.outerStart,Q.outerEnd),U=`@once
3402
- ${H1(G,{...Y,start:0,end:Y.end-Y.start},J)}
3403
- @endonce`;Z=Z.slice(0,Q.outerStart)+U+Z.slice(Q.outerEnd),X=Q.outerStart+U.length}return Z}function AJ($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function MJ($){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 j2($){if(!BJ($))return $;let Z=$;return Z=jJ(Z),Z=_J(Z),Z=NJ(Z),Z=FJ(Z),Z=LJ(Z),Z=VJ(Z),Z=OJ(Z),Z=MJ(Z),Z=wJ(Z),Z=RJ(Z),Z=DJ(Z),Z=AJ(Z),Z}function U$($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var x3=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"]),TJ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function _2($,Z){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),Y=X?X[1]:$,J=X0(Y,Z);if(J&&typeof J==="string")return J;let Q=Y.trim();return x3.has(Q)?Q:null}function O2($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function V2($,Z,X){let Y=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=Y?`<${$} ${Y}>`:`<${$}>`;if(TJ.has($))return Y?`<${$} ${Y}>`:`<${$}>`;return`${J}${X}</${$}>`}async function F2($,Z,X,Y,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,q=[],U;while((U=G.exec(Q))!==null)q.push({full:U[0],expr:U[1],attrs:U[2],slotContent:U[3],index:U.index});for(let W=q.length-1;W>=0;W--){let K=q[W];try{let z=_2(K.expr,Z);if(!z||typeof z!=="string"){let F=`<!-- dynamic component: could not resolve "${U$(O2(K.expr))}" -->`;Q=Q.slice(0,K.index)+F+Q.slice(K.index+K.full.length);continue}if(x3.has(z)){let F=V2(z,K.attrs,K.slotContent);Q=Q.slice(0,K.index)+F+Q.slice(K.index+K.full.length);continue}let H=K.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 F=_[1]||_[2],L=_[3];if(_[1])try{B[F]=X0(L,Z)}catch{B[F]=L}else B[F]=L}let V=Y.componentsDir||"components",O=await T1(z,B,K.slotContent,V,Z,X,Y,new Set,J??new Set);Q=Q.slice(0,K.index)+O+Q.slice(K.index+K.full.length)}catch(z){let H=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${U$(H)} -->`;Q=Q.slice(0,K.index)+B+Q.slice(K.index+K.full.length)}}return Q=await IJ(Q,Z,X,Y,J),Q}async function IJ($,Z,X,Y,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,q=[],U;while((U=G.exec(Q))!==null)q.push({full:U[0],expr:U[1],attrs:U[2],index:U.index});for(let W=q.length-1;W>=0;W--){let K=q[W];try{let z=_2(K.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${U$(O2(K.expr))}" -->`;Q=Q.slice(0,K.index)+j+Q.slice(K.index+K.full.length);continue}if(x3.has(z)){let j=V2(z,K.attrs,"");Q=Q.slice(0,K.index)+j+Q.slice(K.index+K.full.length);continue}let H=Y.componentsDir||"components",B=await T1(z,{},"",H,Z,X,Y,new Set,J??new Set);Q=Q.slice(0,K.index)+B+Q.slice(K.index+K.full.length)}catch(z){let H=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${U$(H)} -->`;Q=Q.slice(0,K.index)+B+Q.slice(K.index+K.full.length)}}return Q}function L2($,Z=""){let X=`${$}${Z}`,Y=0;for(let J=0;J<X.length;J++){let Q=X.charCodeAt(J);Y=(Y<<5)-Y+Q,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function w2($,Z,X={}){let{prefix:Y="",preserveHost:J=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=X;if(!$.trim())return"";let q=g3($),U=[],W=new Map;if(Q)for(let K of q){let z=K.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let H=z[1],B=`${Z}_${H}`;W.set(H,B)}}for(let K of q){let z=R2(K,Z,Y,J,W,G);U.push(z)}return U.join(`
3401
+ `),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 LY($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function wY($){let Z=$,X=0;while(X<Z.length){let J=M1(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 K=q[1],z=q[2],H=q[3];Y=Y.replace(q[0],""),Y+=` :${K}="${H}" @update:${K}="${H} = $event"`,q=Y.match(G)}if(Q){let K=n0(Z,J),z=Z.slice(K.outerStart,K.outerEnd),H=H1(z,{...J,start:0,end:J.end-J.start},Y);Z=Z.slice(0,K.outerStart)+H+Z.slice(K.outerEnd),X=K.outerStart+H.length;continue}let U=c1(J.attrs,"v-model");if(U===null){X=J.end;continue}if(jY.has(J.tag)){let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${U}"`,z=n0(Z,J),H=Z.slice(z.outerStart,z.outerEnd),B=H1(H,{...J,start:0,end:J.end-J.start},K);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),X=z.outerStart+B.length}else{let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"");K+=` :modelValue="${U}" @update:modelValue="${U} = $event"`;let z=n0(Z,J),H=Z.slice(z.outerStart,z.outerEnd),B=H1(H,{...J,start:0,end:J.end-J.start},K);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),X=z.outerStart+B.length}}return Z}function RY($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function DY($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function NY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;let Y=c1(J.attrs,"v-html");if(Y===null){X=J.end;continue}if(J.selfClosing){X=J.end;continue}let Q=n0(Z,J),G=z1(J.attrs,"v-html"),q=J.selfClosing?" /":"",U=`<${J.tag}${G}${q}>{!! ${Y} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+U+Z.slice(Q.outerEnd),X=Q.outerStart+U.length}return Z}function AY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;let Y=c1(J.attrs,"v-text");if(Y===null){X=J.end;continue}if(J.selfClosing){X=J.end;continue}let Q=n0(Z,J),G=z1(J.attrs,"v-text"),q=J.selfClosing?" /":"",U=`<${J.tag}${G}${q}>{{ ${Y} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+U+Z.slice(Q.outerEnd),X=Q.outerStart+U.length}return Z}function MY($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function TY($){let Z=$,X=0;while(X<Z.length){let J=M1(Z,X);if(!J)break;if(!_2(J.attrs,"v-once")){X=J.end;continue}let Y=z1(J.attrs,"v-once"),Q=n0(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),U=`@once
3402
+ ${H1(G,{...J,start:0,end:J.end-J.start},Y)}
3403
+ @endonce`;Z=Z.slice(0,Q.outerStart)+U+Z.slice(Q.outerEnd),X=Q.outerStart+U.length}return Z}function IY($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function kY($){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 O2($){if(!OY($))return $;let Z=$;return Z=VY(Z),Z=FY(Z),Z=TY(Z),Z=RY(Z),Z=DY(Z),Z=wY(Z),Z=LY(Z),Z=kY(Z),Z=NY(Z),Z=AY(Z),Z=MY(Z),Z=IY(Z),Z}function W$($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var h3=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"]),EY=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function V2($,Z){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=X?X[1]:$,Y=X0(J,Z);if(Y&&typeof Y==="string")return Y;let Q=J.trim();return h3.has(Q)?Q:null}function F2($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function L2($,Z,X){let J=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(EY.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${X}</${$}>`}async function w2($,Z,X,J,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,q=[],U;while((U=G.exec(Q))!==null)q.push({full:U[0],expr:U[1],attrs:U[2],slotContent:U[3],index:U.index});for(let W=q.length-1;W>=0;W--){let K=q[W];try{let z=V2(K.expr,Z);if(!z||typeof z!=="string"){let F=`<!-- dynamic component: could not resolve "${W$(F2(K.expr))}" -->`;Q=Q.slice(0,K.index)+F+Q.slice(K.index+K.full.length);continue}if(h3.has(z)){let F=L2(z,K.attrs,K.slotContent);Q=Q.slice(0,K.index)+F+Q.slice(K.index+K.full.length);continue}let H=K.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 F=_[1]||_[2],L=_[3];if(_[1])try{B[F]=X0(L,Z)}catch{B[F]=L}else B[F]=L}let V=J.componentsDir||"components",O=await T1(z,B,K.slotContent,V,Z,X,J,new Set,Y??new Set);Q=Q.slice(0,K.index)+O+Q.slice(K.index+K.full.length)}catch(z){let H=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${W$(H)} -->`;Q=Q.slice(0,K.index)+B+Q.slice(K.index+K.full.length)}}return Q=await bY(Q,Z,X,J,Y),Q}async function bY($,Z,X,J,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,q=[],U;while((U=G.exec(Q))!==null)q.push({full:U[0],expr:U[1],attrs:U[2],index:U.index});for(let W=q.length-1;W>=0;W--){let K=q[W];try{let z=V2(K.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${W$(F2(K.expr))}" -->`;Q=Q.slice(0,K.index)+j+Q.slice(K.index+K.full.length);continue}if(h3.has(z)){let j=L2(z,K.attrs,"");Q=Q.slice(0,K.index)+j+Q.slice(K.index+K.full.length);continue}let H=J.componentsDir||"components",B=await T1(z,{},"",H,Z,X,J,new Set,Y??new Set);Q=Q.slice(0,K.index)+B+Q.slice(K.index+K.full.length)}catch(z){let H=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${W$(H)} -->`;Q=Q.slice(0,K.index)+B+Q.slice(K.index+K.full.length)}}return Q}function R2($,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 D2($,Z,X={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=X;if(!$.trim())return"";let q=u3($),U=[],W=new Map;if(Q)for(let K of q){let z=K.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let H=z[1],B=`${Z}_${H}`;W.set(H,B)}}for(let K of q){let z=N2(K,Z,J,Y,W,G);U.push(z)}return U.join(`
3404
3404
 
3405
- `)}function g3($){let Z=[],X=$.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,J="",Q=!1,G="";for(let q=0;q<X.length;q++){let U=X[q];if(U==="@"&&Y===0)Q=!0;if(U==="{")Y++;else if(U==="}"){if(Y--,Y===0){if(Q){G+=U;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,K,z,H]=W;if(K==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:H.trim()});else if(K==="media"||K==="supports"||K==="container"){let B=g3(H);Z.push({selector:`@${K} ${z.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
3406
- `)})}else Z.push({selector:`@${K} ${z.trim()}`,declarations:H.trim()})}G="",Q=!1}else if(J.trim()){J+=U;let W=J.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});J=""}continue}}if(Q)G+=U;else J+=U}return Z}function R2($,Z,X,Y,J,Q){let{selector:G,declarations:q}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let K=G.replace("@keyframes ","").trim();return`@keyframes ${J.get(K)||K} { ${q} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=g3(`x { ${q} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>R2(H,Z,X,Y,J,Q)).join(`
3405
+ `)}function u3($){let Z=[],X=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Y="",Q=!1,G="";for(let q=0;q<X.length;q++){let U=X[q];if(U==="@"&&J===0)Q=!0;if(U==="{")J++;else if(U==="}"){if(J--,J===0){if(Q){G+=U;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,K,z,H]=W;if(K==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:H.trim()});else if(K==="media"||K==="supports"||K==="container"){let B=u3(H);Z.push({selector:`@${K} ${z.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
3406
+ `)})}else Z.push({selector:`@${K} ${z.trim()}`,declarations:H.trim()})}G="",Q=!1}else if(Y.trim()){Y+=U;let W=Y.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Y=""}continue}}if(Q)G+=U;else Y+=U}return Z}function N2($,Z,X,J,Y,Q){let{selector:G,declarations:q}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let K=G.replace("@keyframes ","").trim();return`@keyframes ${Y.get(K)||K} { ${q} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=u3(`x { ${q} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>N2(H,Z,X,J,Y,Q)).join(`
3407
3407
  `);return`${G} {
3408
3408
  ${z}
3409
- }`}return`${G} { ${q} }`}let U=kJ(G,Z,X,Y),W=q;for(let[K,z]of J)W=W.replace(new RegExp(`\\b${K}\\b`,"g"),z);if(Q)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${U} { ${W} }`}function kJ($,Z,X,Y){let J=$.split(",").map((G)=>G.trim()),Q=[];for(let G of J){if(G.startsWith(":host")){if(Y)Q.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(W)}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 U=EJ(G,Z);if(U)Q.push(X?`${X} ${U}`:U)}return Q.join(", ")}function EJ($,Z){let X=0,Y=$.length;for(let U=0;U<$.length;U++){let W=$[U];if(W==="["||W==="(")X++;else if(W==="]"||W===")")X--;else if(X===0&&(W===" "||W===">"||W==="+"||W==="~")){Y=U;break}}let J=$.slice(0,Y),Q=$.slice(Y);if(!J)return"";let G=J.length,q=0;for(let U=0;U<J.length;U++){let W=J[U];if(W==="["||W==="(")q++;else if(W==="]"||W===")")q--;else if(X===0&&q===0&&W===":"){G=U;break}}return`${J.slice(0,G)}.${Z}${J.slice(G)}${Q}`}var h3=String.raw`(?<![\w-])scoped(?![\w-])`,bJ=new RegExp(`<style\\s+[^>]*${h3}`,"i");function N2($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(X)=>{let Y=X.trim();if(Z.has(Y))return"";return Z.add(Y),X})}function W$($,Z){if(!bJ.test($))return{html:$,hasScoped:!1};let X=L2(Z),Y=`data-v-${X}`,J=$,Q=new RegExp(`<style\\s+([^>]*${h3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(J=J.replace(Q,(q,U,W)=>{G=!0;let K=yJ(W,Y),z=U.replace(new RegExp(h3,"gi"),"").trim(),H=z?` ${z}`:"";return`<style data-stx-scoped="${X}"${H}>${K}</style>`}),!G)return{html:$,hasScoped:!1};return J=CJ(J,Y),{html:J,hasScoped:!0}}function yJ($,Z){return w2($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}var SJ=($)=>`\x00stx-scope-mask-${$}\x00`,D2=/\u0000stx-scope-mask-(\d+)\u0000/g;function CJ($,Z){let X=l0($,(J,Q)=>{let G=Y1(J,Q);return G>Q?G:S1(J,Q)},(J,Q)=>SJ(Q)),Y=PJ(X.output,Z);return D2.lastIndex=0,Y.replace(D2,(J,Q)=>X.tokens[Number(Q)])}function PJ($,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,(Y,J,Q)=>{if(X.has(J.toLowerCase()))return Y;if(Y.includes(Z))return Y;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return Y;if(Q)return Y.replace(`<${J}${Q}`,`<${J} ${Z}${Q}`);if(Y.endsWith("/>"))return`<${J} ${Z} />`;return`<${J} ${Z}>`})}var tz="data-stx-color-mode-boot",ez="__STX_COLOR_MODE__",vJ=new Set(["light","dark","auto","system"]),fJ=new Set(["auto","system"]),xJ=/^[a-z][\w:-]*$/i,gJ=/^[\w-]+$/;function hJ($){let Z=$.storageKey??"stx-color-mode",X=$.initialMode??"auto",Y=$.darkClass===void 0?"dark":$.darkClass,J=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!vJ.has(X))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(X)}`);if(Y!==null&&(typeof Y!=="string"||!gJ.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!xJ.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(Q!==null&&!fJ.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(Y===null&&J===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:Y,attribute:J,autoValue:Q}}function uJ($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function d3($={}){let Z=hJ($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${uJ(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 A2($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let X=u3($);if(X===null)return $;let Y=d3(Z);return`${$.slice(0,X)}
3410
- ${Y}${$.slice(X)}`}function u3($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let X=Z.index+Z[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(X));if(Y)X+=Y[0].length;return X}var dJ=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),mJ=/<meta\b[^>]*\bcharset\b[^>]*>/i;function lJ($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let X=Z.index+Z[0].length,Y=$.toLowerCase().indexOf("</head>",X),J=$.slice(X,Y===-1?$.length:Y),Q=mJ.exec(J);if(!Q||J.slice(0,Q.index).trim()==="")return $;let G=J.slice(0,Q.index)+J.slice(Q.index+Q[0].length);return $.slice(0,X)+`
3411
- ${Q[0]}`+G+$.slice(X+J.length)}function M2($){return cJ(lJ($))}function cJ($){let Z=dJ.exec($);if(!Z)return $;let X=u3($);if(X===null)return $;if(Z.index<=X||$.slice(X,Z.index).trim()==="")return $;let Y=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),J=u3(Y);if(J===null)return $;return`${Y.slice(0,J)}
3412
- ${Z[0]}${Y.slice(J)}`}var ZH="stx-build",XH="X-STX-Build",K$=null;function pJ(){if(K$===null)K$=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return K$}function YH($){K$=$}function T2($,Z=pJ()){if($.includes('name="stx-build"'))return $;let X=/<head\b[^>]*>/i.exec($);if(!X)return $;let Y=X.index+X[0].length;return`${$.slice(0,Y)}
3413
- <meta name="stx-build" content="${Z}">${$.slice(Y)}`}var I2="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",z$="data-stx-html-attrs",H$="data-stx-html-class",k2=/^[A-Za-z_:][\w:.-]*$/;function e0($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function iJ($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function i1($){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 p1($,Z){return Object.entries($).filter(([X])=>!Z?.(X)).map(([X,Y])=>`${X}="${e0(String(Y))}"`).join(" ")}function nJ($={},Z="en"){let X=[],Y=[],J="",Q=Z;for(let[q,U]of Object.entries($||{})){if(U==null)continue;let W=q.trim();if(!k2.test(W))continue;let K=W.toLowerCase();if(K==="lang"){Q=String(U);continue}if(K==="class"){J=String(U).trim();continue}X.push(` ${W}="${e0(String(U))}"`),Y.push(W)}let G=` lang="${e0(Q)}"`;if(J)G+=` class="${e0(J)}"`;if(G+=X.join(""),J)G+=` ${H$}="${e0(J)}"`;if(Y.length)G+=` ${z$}="${e0(Y.join(" "))}"`;return G}function E2($={},Z={}){let X={...$,...Z};if($.class&&Z.class){let Y=$.class.split(/\s+/).filter(Boolean);for(let J of Z.class.split(/\s+/).filter(Boolean))if(!Y.includes(J))Y.push(J);X.class=Y.join(" ")}return X}function b2($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let X=$.match(/<html\b([^>]*)>/i);if(!X)return $;let Y={},J=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(X[1]))!==null){let K=G[1];if(!(K in Y))J.push(K);Y[K]=G[2]??G[3]??G[4]??""}let q=[],U=[];for(let[K,z]of Object.entries(Z)){if(z==null)continue;let H=K.trim();if(!k2.test(H))continue;let B=H.toLowerCase();if(B==="class"){let j=(Y.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),q.push(_);if(!("class"in Y))J.push("class");Y.class=j.join(" ");continue}if(!(H in Y))J.push(H);if(Y[H]=String(z),B!=="lang")U.push(H)}if(q.length){if(!(H$ in Y))J.push(H$);Y[H$]=q.join(" ")}if(U.length){if(!(z$ in Y))J.push(z$);Y[z$]=U.join(" ")}let W=J.map((K)=>` ${K}="${e0(Y[K])}"`).join("");return $.replace(X[0],()=>`<html${W}>`)}function y2($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${I2}
3414
- ${$.slice(Z)}`}function sJ($){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 U=Q.match(/^<link\b[^>]*>/i);if(U){Z.push(U[0]),X+=U[0].length;continue}let W=Q.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),X+=W[0].length;continue}let K=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K){Z.push(K[0]),X+=K[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let Y="",J=0;while(J<$.length&&J<X){let Q=$.slice(J),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){J+=G[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q&&Z.includes(q[0])){J+=q[0].length;continue}let U=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U&&Z.includes(U[0])){J+=U[0].length;continue}Y+=$[J],J++}return Y+=$.slice(X),{body:Y,hoisted:Z}}function oJ($,Z={},X={}){let{title:Y="stx App",lang:J="en",meta:Q=[],link:G=[],script:q=[],headRaw:U="",htmlAttrs:W={},bodyClass:K="",bodyAttrs:z={}}=Z,H=X.title||Y,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(Q.map(i1).filter(Boolean)),V=[...B.filter((M)=>!j.has(i1(M))),...Q].map((M)=>{return` <meta ${p1(M)}>`}).join(`
3409
+ }`}return`${G} { ${q} }`}let U=yY(G,Z,X,J),W=q;for(let[K,z]of Y)W=W.replace(new RegExp(`\\b${K}\\b`,"g"),z);if(Q)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${U} { ${W} }`}function yY($,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 W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(W)}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 U=SY(G,Z);if(U)Q.push(X?`${X} ${U}`:U)}return Q.join(", ")}function SY($,Z){let X=0,J=$.length;for(let U=0;U<$.length;U++){let W=$[U];if(W==="["||W==="(")X++;else if(W==="]"||W===")")X--;else if(X===0&&(W===" "||W===">"||W==="+"||W==="~")){J=U;break}}let Y=$.slice(0,J),Q=$.slice(J);if(!Y)return"";let G=Y.length,q=0;for(let U=0;U<Y.length;U++){let W=Y[U];if(W==="["||W==="(")q++;else if(W==="]"||W===")")q--;else if(X===0&&q===0&&W===":"){G=U;break}}return`${Y.slice(0,G)}.${Z}${Y.slice(G)}${Q}`}var d3=String.raw`(?<![\w-])scoped(?![\w-])`,CY=new RegExp(`<style\\s+[^>]*${d3}`,"i");function M2($){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 K$($,Z){if(!CY.test($))return{html:$,hasScoped:!1};let X=R2(Z),J=`data-v-${X}`,Y=$,Q=new RegExp(`<style\\s+([^>]*${d3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Y=Y.replace(Q,(q,U,W)=>{G=!0;let K=PY(W,J),z=U.replace(new RegExp(d3,"gi"),"").trim(),H=z?` ${z}`:"";return`<style data-stx-scoped="${X}"${H}>${K}</style>`}),!G)return{html:$,hasScoped:!1};return Y=fY(Y,J),{html:Y,hasScoped:!0}}function PY($,Z){return D2($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}var vY=($)=>`\x00stx-scope-mask-${$}\x00`,A2=/\u0000stx-scope-mask-(\d+)\u0000/g;function fY($,Z){let X=c0($,(Y,Q)=>{let G=Y1(Y,Q);return G>Q?G:S1(Y,Q)},(Y,Q)=>vY(Q)),J=xY(X.output,Z);return A2.lastIndex=0,J.replace(A2,(Y,Q)=>X.tokens[Number(Q)])}function xY($,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 ZH="data-stx-color-mode-boot",XH="__STX_COLOR_MODE__",gY=new Set(["light","dark","auto","system"]),hY=new Set(["auto","system"]),uY=/^[a-z][\w:-]*$/i,dY=/^[\w-]+$/;function mY($){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(!gY.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"||!dY.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"||!uY.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!hY.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 lY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l3($={}){let Z=mY($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${lY(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 T2($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let X=m3($);if(X===null)return $;let J=l3(Z);return`${$.slice(0,X)}
3410
+ ${J}${$.slice(X)}`}function m3($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let X=Z.index+Z[0].length,J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(X));if(J)X+=J[0].length;return X}var cY=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),pY=/<meta\b[^>]*\bcharset\b[^>]*>/i;function iY($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let X=Z.index+Z[0].length,J=$.toLowerCase().indexOf("</head>",X),Y=$.slice(X,J===-1?$.length:J),Q=pY.exec(Y);if(!Q||Y.slice(0,Q.index).trim()==="")return $;let G=Y.slice(0,Q.index)+Y.slice(Q.index+Q[0].length);return $.slice(0,X)+`
3411
+ ${Q[0]}`+G+$.slice(X+Y.length)}function I2($){return nY(iY($))}function nY($){let Z=cY.exec($);if(!Z)return $;let X=m3($);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=m3(J);if(Y===null)return $;return`${J.slice(0,Y)}
3412
+ ${Z[0]}${J.slice(Y)}`}var YH="stx-build",QH="X-STX-Build",z$=null;function sY(){if(z$===null)z$=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return z$}function GH($){z$=$}function k2($,Z=sY()){if($.includes('name="stx-build"'))return $;let X=/<head\b[^>]*>/i.exec($);if(!X)return $;let J=X.index+X[0].length;return`${$.slice(0,J)}
3413
+ <meta name="stx-build" content="${Z}">${$.slice(J)}`}var E2="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",H$="data-stx-html-attrs",B$="data-stx-html-class",b2=/^[A-Za-z_:][\w:.-]*$/;function $1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function oY($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function i1($){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 p1($,Z){return Object.entries($).filter(([X])=>!Z?.(X)).map(([X,J])=>`${X}="${$1(String(J))}"`).join(" ")}function rY($={},Z="en"){let X=[],J=[],Y="",Q=Z;for(let[q,U]of Object.entries($||{})){if(U==null)continue;let W=q.trim();if(!b2.test(W))continue;let K=W.toLowerCase();if(K==="lang"){Q=String(U);continue}if(K==="class"){Y=String(U).trim();continue}X.push(` ${W}="${$1(String(U))}"`),J.push(W)}let G=` lang="${$1(Q)}"`;if(Y)G+=` class="${$1(Y)}"`;if(G+=X.join(""),Y)G+=` ${B$}="${$1(Y)}"`;if(J.length)G+=` ${H$}="${$1(J.join(" "))}"`;return G}function y2($={},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 S2($,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 K=G[1];if(!(K in J))Y.push(K);J[K]=G[2]??G[3]??G[4]??""}let q=[],U=[];for(let[K,z]of Object.entries(Z)){if(z==null)continue;let H=K.trim();if(!b2.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")U.push(H)}if(q.length){if(!(B$ in J))Y.push(B$);J[B$]=q.join(" ")}if(U.length){if(!(H$ in J))Y.push(H$);J[H$]=U.join(" ")}let W=Y.map((K)=>` ${K}="${$1(J[K])}"`).join("");return $.replace(X[0],()=>`<html${W}>`)}function C2($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${E2}
3414
+ ${$.slice(Z)}`}function aY($){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 U=Q.match(/^<link\b[^>]*>/i);if(U){Z.push(U[0]),X+=U[0].length;continue}let W=Q.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),X+=W[0].length;continue}let K=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K){Z.push(K[0]),X+=K[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 U=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U&&Z.includes(U[0])){Y+=U[0].length;continue}J+=$[Y],Y++}return J+=$.slice(X),{body:J,hoisted:Z}}function tY($,Z={},X={}){let{title:J="stx App",lang:Y="en",meta:Q=[],link:G=[],script:q=[],headRaw:U="",htmlAttrs:W={},bodyClass:K="",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(i1).filter(Boolean)),V=[...B.filter((M)=>!j.has(i1(M))),...Q].map((M)=>{return` <meta ${p1(M)}>`}).join(`
3415
3415
  `),O=G.map((M)=>{return` <link ${p1(M)}>`}).join(`
3416
3416
  `),F=q.map((M)=>{if(M.src)return` <script ${p1(M,(k)=>k==="content")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
3417
- `),L=nJ(W,J),w=Object.entries(z).map(([M,k])=>` ${M}="${e0(String(k))}"`).join(""),R=K?` class="${e0(K)}"`:"",{body:D,hoisted:N}=sJ($),T=[V,X.colorMode?` ${d3(X.colorMode)}`:"",` <title>${X.titleIsHtml?H:iJ(H)}</title>`,` ${I2}`,O,F,U?` ${U}`:"",...(X.styles||[]).map((M)=>` ${M}`),...N.map((M)=>` ${M}`),...(X.headScripts||[]).map((M)=>` ${M}`),X.headStack||""].filter(Boolean),A=[D,...(X.bodyScripts||[]).map((M)=>M),X.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3417
+ `),L=rY(W,Y),w=Object.entries(z).map(([M,k])=>` ${M}="${$1(String(k))}"`).join(""),R=K?` class="${$1(K)}"`:"",{body:D,hoisted:N}=aY($),T=[V,X.colorMode?` ${l3(X.colorMode)}`:"",` <title>${X.titleIsHtml?H:oY(H)}</title>`,` ${E2}`,O,F,U?` ${U}`:"",...(X.styles||[]).map((M)=>` ${M}`),...N.map((M)=>` ${M}`),...(X.headScripts||[]).map((M)=>` ${M}`),X.headStack||""].filter(Boolean),A=[D,...(X.bodyScripts||[]).map((M)=>M),X.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3418
3418
  <html${L}>
3419
3419
  <head>
3420
3420
  ${T.join(`
@@ -3424,9 +3424,9 @@ ${T.join(`
3424
3424
  ${A.join(`
3425
3425
  `)}
3426
3426
  </body>
3427
- </html>`}function m3($){let Z=0;while(Z<$.length){let X=$.slice(Z),Y=X.match(/^\s+/);if(Y){Z+=Y[0].length;continue}if(X.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let J=X.match(/^<(script|style)\b[^>]*>/i);if(J){let Q=`</${J[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+J[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 l3($){return m3($)}function S2($,Z={}){let X=$.lastIndexOf("</head>");if(X===-1)return $;let{meta:Y=[],link:J=[],script:Q=[],headRaw:G=""}=Z,q=$.slice(0,X),U=[];for(let W of Y){let K=i1(W);if(K&&q.includes(K))continue;U.push(` <meta ${p1(W)}>`)}for(let W of J){if(W.href&&q.includes(`href="${W.href}"`))continue;U.push(` <link ${p1(W)}>`)}for(let W of Q)if(W.src){if(q.includes(`src="${W.src}"`))continue;U.push(` <script ${p1(W,(K)=>K==="content")}></script>`)}else if(W.content){if(q.includes(W.content))continue;U.push(` <script>${W.content}</script>`)}if(G&&!q.includes(G))U.push(` ${G}`);if(U.length===0)return $;return`${$.slice(0,X)}${U.join(`
3427
+ </html>`}function c3($){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 p3($){return c3($)}function P2($,Z={}){let X=$.lastIndexOf("</head>");if(X===-1)return $;let{meta:J=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,q=$.slice(0,X),U=[];for(let W of J){let K=i1(W);if(K&&q.includes(K))continue;U.push(` <meta ${p1(W)}>`)}for(let W of Y){if(W.href&&q.includes(`href="${W.href}"`))continue;U.push(` <link ${p1(W)}>`)}for(let W of Q)if(W.src){if(q.includes(`src="${W.src}"`))continue;U.push(` <script ${p1(W,(K)=>K==="content")}></script>`)}else if(W.content){if(q.includes(W.content))continue;U.push(` <script>${W.content}</script>`)}if(G&&!q.includes(G))U.push(` ${G}`);if(U.length===0)return $;return`${$.slice(0,X)}${U.join(`
3428
3428
  `)}
3429
- ${$.slice(X)}`}function C2($,Z={},X={}){if(l3($))return $;return oJ($,Z,X)}var rJ=/<\/(script)/gi;function n1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(rJ,"<\\/$1")}U5();U5();function v2($,Z={}){return new P2($,Z).routes}function BH($,Z){let X=c3($,Z);return X?X.params:null}var f2=new Map;async function x2($){let Z=$;if(!Z)try{Z=(await U3())?.pagesDir||"pages"}catch{Z="pages"}let X=Z,Y=f2.get(X);if(Y)return Y;let J=[];try{J=v2(".",{pagesDir:X}).map((Q)=>Q.regex.source).filter(Boolean)}catch{J=[]}return f2.set(X,J),J}function aJ($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function g2($){return aJ(JSON.stringify($))}function p3(){return`
3429
+ ${$.slice(X)}`}function v2($,Z={},X={}){if(p3($))return $;return tY($,Z,X)}var eY=/<\/(script)/gi;function n1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(eY,"<\\/$1")}U5();U5();function x2($,Z={}){return new f2($,Z).routes}function OH($,Z){let X=i3($,Z);return X?X.params:null}var g2=new Map;async function h2($){let Z=$;if(!Z)try{Z=(await K3())?.pagesDir||"pages"}catch{Z="pages"}let X=Z,J=g2.get(X);if(J)return J;let Y=[];try{Y=x2(".",{pagesDir:X}).map((Q)=>Q.regex.source).filter(Boolean)}catch{Y=[]}return g2.set(X,Y),Y}function $Q($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function u2($){return $Q(JSON.stringify($))}function n3(){return`
3430
3430
  (function(){
3431
3431
  var tip=null,hideTimer=null,currentEl=null;
3432
3432
 
@@ -3529,22 +3529,22 @@ document.addEventListener("focusout",function(e){
3529
3529
  if(el) hideTip();
3530
3530
  });
3531
3531
  })();
3532
- `}function h2($){return $.includes("data-stx-runtime")}function u2($){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 Y=$.slice(Math.max(0,X.index-80),X.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}function i3($,Z){let X=$.indexOf("<script"),Y=$.search(/<!doctype\b/i);if(X!==-1&&(Y===-1||X>Y))return $.slice(0,X)+Z+`
3533
- `+$.slice(X);let J=/<head\b[^>]*>/i.exec($);if(J){let G=J.index+J[0].length;return`${$.slice(0,G)}
3532
+ `}function d2($){return $.includes("data-stx-runtime")}function m2($){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 s3($,Z){let X=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(X!==-1&&(J===-1||X>J))return $.slice(0,X)+Z+`
3533
+ `+$.slice(X);let Y=/<head\b[^>]*>/i.exec($);if(Y){let G=Y.index+Y[0].length;return`${$.slice(0,G)}
3534
3534
  ${Z}${$.slice(G)}`}if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3535
3535
  `+$.slice(G)}if(q5($))return g5($,(G)=>`${G}
3536
3536
  ${Z}`);return`${Z}
3537
- ${$}`}async function B$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return i3($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return i3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-n4v5733m.js"),Y=await X(Z.debug);return i3($,`<script data-stx-scoped data-stx-runtime>${Y}</script>`)}function tJ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function d2($){if($.includes("data-stx-tooltip-runtime")||!tJ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${p3()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
3537
+ ${$}`}async function j$($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return s3($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return s3($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-00a028s3.js"),J=await X(Z.debug);return s3($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function ZQ($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function l2($){if($.includes("data-stx-tooltip-runtime")||!ZQ($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${n3()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
3538
3538
  ${Z}`;return`${$.slice(0,X)}${Z}
3539
- ${$.slice(X)}`}async function eJ($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let X=Z?.router,Y="";{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 U=await x2(Z?.pagesDir);if(U.length>0)q.ownedRoutes=U}catch{}if(Object.keys(q).length>0)Y=`<script>window.__stxRouterConfig=${g2(q)};</script>
3540
- `}let{getCachedRouterScript:J}=await import("./chunk-n4v5733m.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 J()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+Y+Q+`
3541
- </body>`+$.slice(G+7)}var m2=Symbol.for("stx.lazy-module-promises");function $Q(){let $=globalThis;return $[m2]??=new Map,$[m2]}function a($,Z){let X=$Q(),Y=`${import.meta.url}\x00${$}`,J=X.get(Y);if(J)return J;let Q=Z();return X.set(Y,Q),Q.catch(()=>{if(X.get(Y)===Q)X.delete(Y)}),Q}var ZQ=0,s3=`(?:"[^"]*"|'[^']*'|[^>"'])*`,s2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function XQ($,Z={}){let X=[];for(let Y of f5($,Y1)){let J=Y.token.match(/^<script\b([^>]*)>/i),Q=Y.token.match(/<\/script\s*>$/i);if(!J||!Q)continue;let G=J[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let q=J[0].length,U=Y.token.length-Q[0].length;X.push({fullMatch:Y.token,attrs:G,body:Y.token.slice(q,U),start:Y.start,end:Y.end})}return X}function o2($){let Z=$.trim(),X=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(X){let J=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:q}=l2(Q);if(G)return{style:"as",iterable:J,itemVar:G,indexVar:q}}let Y=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let J=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:q}=l2(J);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function l2($){let Z=$.trim(),X=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(X)return{itemVar:X[2],indexVar:X[1]};let Y=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let J=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function r3($){return n2($)}function YQ($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,X=0,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(J.startsWith("if"))X++;else if(J==="endif")X--;else if(X===0)return!0}return!1}function JQ($){let Z=new Set,X=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=X.exec($))!==null){let Q=J[1],G;while((G=Y.exec(Q))!==null)Z.add(G[1])}return Z}function QQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${s3})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,Y=f5($,(Q,G)=>{Z.lastIndex=G;let q=Z.exec(Q);if(!q||q.index!==G||!X.test(q[2]))return-1;return Z.lastIndex}),J=[];for(let Q of Y){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let q=G[2].match(X),U=o2(q?.[1]??q?.[2]??""),W=[U.itemVar,U.indexVar].filter(Boolean);if(W.length===0)continue;let K=G[1],H=/\/\s*>$/.test(Q.token)||_$.has(K.toLowerCase())?Q.end:a2($,Q.start,K,Q.end);if(H!==-1)J.push({start:Q.start,end:H,vars:new Set(W)})}return J}var c2=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 GQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function p2($,Z,X,Y){if(!$)return!1;let J=GQ($),Q=!1,G=!1,q=!1,U=/([a-zA-Z_$][\w$]*)/g,W;while((W=U.exec(J))!==null){let B=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(c2.has(B))continue;if(Z.has(B)||Y?.has(B))Q=!0;else if(X&&B in X)G=!0}let K=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=K.exec(J))!==null){let B=z[1];if(J.slice(0,z.index).trimEnd().endsWith("."))continue;if(c2.has(B)||X&&B in X)continue;q=!0}return(Q||q)&&!G}function j$($,Z,X){let Y=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,"&quot;")}"`,J=$.trim(),Q=J.match(s2);if(Q&&qQ(Q[3],Q[1])){let[,G,q,U]=Q;return`<${G}${q}${Y}>${U}</${G}>`}return`<template${Y}>${J}</template>`}function qQ($,Z){let X=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),Y=0,J;while((J=X.exec($))!==null)if(J[1]){if(Y--,Y<0)return!1}else Y++;return!0}function r2($,Z){let X=JQ($);function Y(J){let Q=J,G=QQ(J),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},U=/@if\s*\(/g,W,K=[];while((W=U.exec(Q))!==null){let z=W.index,H=z+W[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(),V=j,O=1,F=V,L=/@(if\s*\(|endif)/g;L.lastIndex=V;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){F=w.index+w[0].length;break}}if(O!==0)continue;let R=Q.substring(V,F-6).trim(),D;if(YQ(R)){let N=_5(Q.substring(z,F));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),A=q(z);if(!(T.length>0&&T.every((I)=>p2(I.condition,X,Z,A))))continue;D=N[0].branches.map((I)=>{let y=Y(I.content);if(I.type==="elseif")return j$(y,"@else-if",I.condition??"");if(I.type==="else")return j$(y,"@else");return j$(y,"@if",I.condition??"")}).join(`
3542
- `)}else{if(!p2(_,X,Z,q(z)))continue;D=j$(Y(R),"@if",_)}K.push({start:z,end:F,replacement:D}),U.lastIndex=F}for(let z=K.length-1;z>=0;z--){let{start:H,end:B,replacement:j}=K[z];Q=Q.substring(0,H)+j+Q.substring(B)}return Q}return Y($)}function UQ($){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 J=Number(Z);return J!==0&&!Number.isNaN(J)}let X=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(X)return X[1].length>0;let Y=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}var _$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function a2($,Z,X,Y){if(_$.has(X.toLowerCase()))return Y;let J=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,U=Y;while(U<G){let W=$.indexOf("<",U);if(W===-1)return-1;if(U=W,$.startsWith("<!--",U)){let B=$.indexOf("-->",U+4);if(B===-1)return-1;U=B+3;continue}let K=/^<(script|style)\b/i.exec($.slice(U,U+8));if(K){let B=$.indexOf(">",U);if(B===-1)return-1;if($[B-1]==="/"){U=B+1;continue}let j=Q.indexOf(`</${K[1].toLowerCase()}`,U);if(j===-1)return-1;let _=$.indexOf(">",j);if(_===-1)return-1;U=_+1;continue}if($[U+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(U,U+64));if(!B){U++;continue}if(B[1].toLowerCase()===J){if(q--,U+=B[0].length,q===0)return U;continue}U+=B[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(U,U+64));if(!z){U++;continue}let H=$.indexOf(">",U);if(H===-1)return-1;if(z[1].toLowerCase()===J){let B=$.slice(U,H+1);if(!(/\/\s*>$/.test(B)||_$.has(J)))q++}U=H+1}return-1}var WQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function KQ($,Z){let X=Z,Y=$.length;for(;;){while(X<Y&&$[X]!=="<")X++;if(X>=Y)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 J=$.indexOf(">",X);if(J===-1)return!1;let Q=$.slice(X,J+1);return WQ.test(Q)}function t2($){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,Y;while((Y=X.exec($))!==null)Z.push([Y.index,Y.index+Y[0].length]);let J=(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(J(q.index))continue;let[z,H,B,j,_,V,O]=q,F=UQ(_);if(F===void 0)continue;let L=q.index,w=L+z.length,N=!!O||/\/\s*>$/.test(z)||_$.has(H.toLowerCase())?w:a2($,L,H,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&KQ($,N)){Q.lastIndex=w;continue}if(F===!0){let A=`<${H}${B}${V}${O}>`;G.push({start:L,end:w,replacement:A});continue}G.push({start:L,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((z,H)=>z.start-H.start);let U=[],W=-1;for(let z of G){if(z.start<W)continue;U.push(z),W=z.end}let K=$;for(let z=U.length-1;z>=0;z--){let{start:H,end:B,replacement:j}=U[z];K=K.substring(0,H)+j+K.substring(B)}return K}function e2($,Z){let X=$,Y=/@(for|foreach)\s*\(/g,J,Q=[],G=[];while((J=Y.exec(X))!==null){let q=J[1],U=J.index,W=U+J[0].length,K=1,z=W;while(z<X.length&&K>0){if(X[z]==="(")K++;else if(X[z]===")")K--;z++}if(K!==0)continue;let H=X.substring(W,z-1).trim(),B=z,j=o2(H),_=q==="for"?"@endfor":"@endforeach",V=1,O=B,F=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");F.lastIndex=B;let L;while((L=F.exec(X))!==null)if(L[1].startsWith(q))V++;else if(V--,V===0){O=L.index+L[0].length;break}if(V!==0)continue;let w=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)G.push({start:U,end:O,vars:T})};if(j.iterable){let T=j.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){w();continue}let A=T.split(/[.[(]/)[0].trim(),M=Z?A in Z:!1,k=G.some((I)=>U>I.start&&U<I.end&&I.vars.includes(A));if(A&&(M||k)){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,O-_.length).trim(),D=R.match(s2),N;if(D){let[,T,A,M]=D;N=`<${T}${A} @for="${H}">${M}</${T}>`}else N=`<template @for="${H}">${R}</template>`;Q.push({start:U,end:O,replacement:N})}for(let q=Q.length-1;q>=0;q--){let{start:U,end:W,replacement:K}=Q[q];X=X.substring(0,U)+K+X.substring(W)}return X}function zQ($){let Z=new Set,X=[],Y=0,J=0,Q=$.length,G=(K)=>{let z=Y+1;while(z<Q){let H=$[z];if(H==="\\"){z+=2;continue}if(H===K)return z+1;z++}return Q},q=()=>{let K=Y+2;while(K<Q&&$[K]!==`
3543
- `)K++;return K},U=()=>{let K=Y+2;while(K<Q-1){if($[K]==="*"&&$[K+1]==="/")return K+2;K++}return Q},W=(K)=>{let z=K,H=0;while(z<Q){let B=$[z];if(B==="/"&&$[z+1]==="/"){let j=z+2;while(j<Q&&$[j]!==`
3544
- `)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(Y<Q){let K=$[Y];if(K==="/"&&$[Y+1]==="/"){let z=q();X.push($.slice(Y,z)),Y=z;continue}if(K==="/"&&$[Y+1]==="*"){let z=U();X.push($.slice(Y,z)),Y=z;continue}if(K==='"'||K==="'"||K==="`"){let z=G(K);X.push($.slice(Y,z)),Y=z;continue}if(K==="{"){J++,X.push(K),Y++;continue}if(K==="}"){J--,X.push(K),Y++;continue}if(J===0){let z=Y>0?$[Y-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(Y+B[0].length);if(Z.has(j)){X.push(`/* stx: deduped const ${j} */`),Y=_;continue}Z.add(j),X.push($.slice(Y,_)),Y=_;continue}}}X.push(K),Y++}return X.join("")}async function HQ($,Z,X){let Y=XQ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|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=[];for(let V of Y){let O=V.body;if(N1(V.attrs))O=A1(O);if(J.test(O))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${ZQ++}`,{hasUserImports:q,bundleClientScript:U}=await a("stx/client-script-bundler",()=>import("./chunk-hx338p3h.js")),W=[];for(let V=0;V<Q.length;V++){let O=Q[V].content;if(O=R5(O).code,q(O))O=await U(O,Z||"",{projectRoot:process.cwd()});O=O.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L,w)=>jQ(w));let F=o0(O);W.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
3539
+ ${$.slice(X)}`}async function XQ($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))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 U=await h2(Z?.pagesDir);if(U.length>0)q.ownedRoutes=U}catch{}if(Object.keys(q).length>0)J=`<script>window.__stxRouterConfig=${u2(q)};</script>
3540
+ `}let{getCachedRouterScript:Y}=await import("./chunk-00a028s3.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+`
3541
+ </body>`+$.slice(G+7)}var c2=Symbol.for("stx.lazy-module-promises");function JQ(){let $=globalThis;return $[c2]??=new Map,$[c2]}function a($,Z){let X=JQ(),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 YQ=0,r3=`(?:"[^"]*"|'[^']*'|[^>"'])*`,r2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function QQ($,Z={}){let X=[];for(let J of f5($,Y1)){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,U=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(q,U),start:J.start,end:J.end})}return X}function a2($){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}=p2(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}=p2(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function p2($){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 t3($){return o2($)}function GQ($){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 qQ($){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 UQ($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${r3})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=f5($,(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),U=a2(q?.[1]??q?.[2]??""),W=[U.itemVar,U.indexVar].filter(Boolean);if(W.length===0)continue;let K=G[1],H=/\/\s*>$/.test(Q.token)||O$.has(K.toLowerCase())?Q.end:e2($,Q.start,K,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(W)})}return Y}var i2=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 WQ($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function n2($,Z,X,J){if(!$)return!1;let Y=WQ($),Q=!1,G=!1,q=!1,U=/([a-zA-Z_$][\w$]*)/g,W;while((W=U.exec(Y))!==null){let B=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(i2.has(B))continue;if(Z.has(B)||J?.has(B))Q=!0;else if(X&&B in X)G=!0}let K=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=K.exec(Y))!==null){let B=z[1];if(Y.slice(0,z.index).trimEnd().endsWith("."))continue;if(i2.has(B)||X&&B in X)continue;q=!0}return(Q||q)&&!G}function _$($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(r2);if(Q&&KQ(Q[3],Q[1])){let[,G,q,U]=Q;return`<${G}${q}${J}>${U}</${G}>`}return`<template${J}>${Y}</template>`}function KQ($,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 t2($,Z){let X=qQ($);function J(Y){let Q=Y,G=UQ(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},U=/@if\s*\(/g,W,K=[];while((W=U.exec(Q))!==null){let z=W.index,H=z+W[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(),V=j,O=1,F=V,L=/@(if\s*\(|endif)/g;L.lastIndex=V;let w;while((w=L.exec(Q))!==null)if(w[1].startsWith("if"))O++;else if(w[1]==="endif"){if(O--,O===0){F=w.index+w[0].length;break}}if(O!==0)continue;let R=Q.substring(V,F-6).trim(),D;if(GQ(R)){let N=_5(Q.substring(z,F));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),A=q(z);if(!(T.length>0&&T.every((I)=>n2(I.condition,X,Z,A))))continue;D=N[0].branches.map((I)=>{let y=J(I.content);if(I.type==="elseif")return _$(y,"@else-if",I.condition??"");if(I.type==="else")return _$(y,"@else");return _$(y,"@if",I.condition??"")}).join(`
3542
+ `)}else{if(!n2(_,X,Z,q(z)))continue;D=_$(J(R),"@if",_)}K.push({start:z,end:F,replacement:D}),U.lastIndex=F}for(let z=K.length-1;z>=0;z--){let{start:H,end:B,replacement:j}=K[z];Q=Q.substring(0,H)+j+Q.substring(B)}return Q}return J($)}function zQ($){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 O$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function e2($,Z,X,J){if(O$.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,q=1,U=J;while(U<G){let W=$.indexOf("<",U);if(W===-1)return-1;if(U=W,$.startsWith("<!--",U)){let B=$.indexOf("-->",U+4);if(B===-1)return-1;U=B+3;continue}let K=/^<(script|style)\b/i.exec($.slice(U,U+8));if(K){let B=$.indexOf(">",U);if(B===-1)return-1;if($[B-1]==="/"){U=B+1;continue}let j=Q.indexOf(`</${K[1].toLowerCase()}`,U);if(j===-1)return-1;let _=$.indexOf(">",j);if(_===-1)return-1;U=_+1;continue}if($[U+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(U,U+64));if(!B){U++;continue}if(B[1].toLowerCase()===Y){if(q--,U+=B[0].length,q===0)return U;continue}U+=B[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(U,U+64));if(!z){U++;continue}let H=$.indexOf(">",U);if(H===-1)return-1;if(z[1].toLowerCase()===Y){let B=$.slice(U,H+1);if(!(/\/\s*>$/.test(B)||O$.has(Y)))q++}U=H+1}return-1}var HQ=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function BQ($,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 HQ.test(Q)}function $9($){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,_,V,O]=q,F=zQ(_);if(F===void 0)continue;let L=q.index,w=L+z.length,N=!!O||/\/\s*>$/.test(z)||O$.has(H.toLowerCase())?w:e2($,L,H,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&BQ($,N)){Q.lastIndex=w;continue}if(F===!0){let A=`<${H}${B}${V}${O}>`;G.push({start:L,end:w,replacement:A});continue}G.push({start:L,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((z,H)=>z.start-H.start);let U=[],W=-1;for(let z of G){if(z.start<W)continue;U.push(z),W=z.end}let K=$;for(let z=U.length-1;z>=0;z--){let{start:H,end:B,replacement:j}=U[z];K=K.substring(0,H)+j+K.substring(B)}return K}function Z9($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let q=Y[1],U=Y.index,W=U+Y[0].length,K=1,z=W;while(z<X.length&&K>0){if(X[z]==="(")K++;else if(X[z]===")")K--;z++}if(K!==0)continue;let H=X.substring(W,z-1).trim(),B=z,j=a2(H),_=q==="for"?"@endfor":"@endforeach",V=1,O=B,F=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");F.lastIndex=B;let L;while((L=F.exec(X))!==null)if(L[1].startsWith(q))V++;else if(V--,V===0){O=L.index+L[0].length;break}if(V!==0)continue;let w=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)G.push({start:U,end:O,vars:T})};if(j.iterable){let T=j.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){w();continue}let A=T.split(/[.[(]/)[0].trim(),M=Z?A in Z:!1,k=G.some((I)=>U>I.start&&U<I.end&&I.vars.includes(A));if(A&&(M||k)){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,O-_.length).trim(),D=R.match(r2),N;if(D){let[,T,A,M]=D;N=`<${T}${A} @for="${H}">${M}</${T}>`}else N=`<template @for="${H}">${R}</template>`;Q.push({start:U,end:O,replacement:N})}for(let q=Q.length-1;q>=0;q--){let{start:U,end:W,replacement:K}=Q[q];X=X.substring(0,U)+K+X.substring(W)}return X}function jQ($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(K)=>{let z=J+1;while(z<Q){let H=$[z];if(H==="\\"){z+=2;continue}if(H===K)return z+1;z++}return Q},q=()=>{let K=J+2;while(K<Q&&$[K]!==`
3543
+ `)K++;return K},U=()=>{let K=J+2;while(K<Q-1){if($[K]==="*"&&$[K+1]==="/")return K+2;K++}return Q},W=(K)=>{let z=K,H=0;while(z<Q){let B=$[z];if(B==="/"&&$[z+1]==="/"){let j=z+2;while(j<Q&&$[j]!==`
3544
+ `)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 K=$[J];if(K==="/"&&$[J+1]==="/"){let z=q();X.push($.slice(J,z)),J=z;continue}if(K==="/"&&$[J+1]==="*"){let z=U();X.push($.slice(J,z)),J=z;continue}if(K==='"'||K==="'"||K==="`"){let z=G(K);X.push($.slice(J,z)),J=z;continue}if(K==="{"){Y++,X.push(K),J++;continue}if(K==="}"){Y--,X.push(K),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],_=W(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(K),J++}return X.join("")}async function _Q($,Z,X){let J=QQ($,{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=[];for(let V of J){let O=V.body;if(N1(V.attrs))O=A1(O);if(Y.test(O))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:O})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${YQ++}`,{hasUserImports:q,bundleClientScript:U}=await a("stx/client-script-bundler",()=>import("./chunk-02n7khen.js")),W=[];for(let V=0;V<Q.length;V++){let O=Q[V].content;if(O=R5(O).code,q(O))O=await U(O,Z||"",{projectRoot:process.cwd()});O=O.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L,w)=>VQ(w));let F=r0(O);W.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
3545
3545
  ${F}`)}let K=W.join(`
3546
3546
 
3547
- `);K=zQ(K);let z=BQ(K),H=z.split(",").map((V)=>V.trim()).filter(Boolean),B=o3(K,X),j=`
3547
+ `);K=jQ(K);let z=OQ(K),H=z.split(",").map((V)=>V.trim()).filter(Boolean),B=a3(K,X),j=`
3548
3548
  <script data-stx-scoped>
3549
3549
  function ${G}() {
3550
3550
  ${l1("const",H)}
@@ -3553,24 +3553,24 @@ ${n1(`${B}${K}`)}
3553
3553
  }
3554
3554
  window.__stx_latestSetup=${G};
3555
3555
  if(window.stx)window.stx._latestSetup=${G};
3556
- </script>`,_=$;for(let V of Q)_=_.split(V.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${s3})>`),`<body$1 data-stx="${G}">`);else{let V=["script","style","html","head","meta","link","title","!doctype"],O=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${s3})>`,"gi"),(F,L,w)=>{if(O||V.includes(L.toLowerCase()))return F;return O=!0,`<${L}${w} data-stx="${G}">`})}return{output:_,setupCode:j}}function BQ($){let Z=$,X=[],Y=new Set,J=0,Q=0,G=Z.length,q="",U=()=>{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(_===`
3556
+ </script>`,_=$;for(let V of Q)_=_.split(V.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${r3})>`),`<body$1 data-stx="${G}">`);else{let V=["script","style","html","head","meta","link","title","!doctype"],O=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${r3})>`,"gi"),(F,L,w)=>{if(O||V.includes(L.toLowerCase()))return F;return O=!0,`<${L}${w} data-stx="${G}">`})}return{output:_,setupCode:j}}function OQ($){let Z=$,X=[],J=new Set,Y=0,Q=0,G=Z.length,q="",U=()=>{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(_===`
3557
3557
  `)return;Q++}},W=()=>{if(!q)return!0;if(/[\w)\]]/.test(q))return!1;return!0},K=(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]==='"')K(Z[Q]);else if(Z[Q]==="`")z();else Q++;continue}Q++}},H=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3558
- `)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(J!==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(!Y.has(L))X.push(L),Y.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(":"),N=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(N&&!Y.has(N))X.push(N),Y.add(N)});return}let V=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(V){V[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!Y.has(R))X.push(R),Y.add(R)});return}let O=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!Y.has(L))X.push(L),Y.add(L);return}let F=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let L=F[1];if(!Y.has(L))X.push(L),Y.add(L)}};while(Q<G){if(H())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]),q=Z[Q-1];continue}if(Z[Q]==="`"){z(),q="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&W()){U(),q="/";continue}if(Z[Q]==="{"){J++,q="{",Q++;continue}if(Z[Q]==="}"){J--,q="}",Q++;continue}if(J===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 $9($,Z,X,Y){if(!r3($))return $;let J=$;if(Z.skipSignalsRuntime)return J;let{output:Q,setupCode:G}=await HQ(J,X,Y);if(J=Q,J=await B$(J,Z),G){let K=n3(J,/<\/head>/i),z=K===-1?n3(J,/<body[^>]*>/i):-1;if(K!==-1)J=`${J.slice(0,K)}${G}
3559
- ${J.slice(K)}`;else if(z!==-1){let H=/<body[^>]*>/i.exec(J.slice(z))[0],B=z+H.length;J=`${J.slice(0,B)}
3560
- ${G}${J.slice(B)}`}else J=`${J}
3561
- ${G}`}let U=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=U&&/data-stx/.test(U[1]);if(!G&&!W&&U&&!/data-stx-auto/.test(U[1])){let K=/<body[^>]*>/i,z=n3(J,K);if(z!==-1){let H=J.slice(0,z),B=J.slice(z).replace(K,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=H+B}}return J}function n3($,Z){let X=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=X.exec($))!==null)Y.push([J.index,J.index+J[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 U=G+q.index;if(!Y.some(([K,z])=>U>=K&&U<z))return U;G=U+Math.max(q[0].length,1)}return-1}var i2="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function jQ($){let Z=[];for(let X of $.split(",")){let Y=X.trim();if(!Y||Y.startsWith("type "))continue;let J=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])Z.push(`${J[2]} = ${J[1]}`)}if(Z.length===0)return i2;return`var ${Z.join(", ")}; ${i2}`}import x0 from"path";import a3 from"fs";function Z9($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function X9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class Y9{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,Y){let J=$.endsWith(".stx")?$.slice(0,-4):$,Q=Y?.__importedComponents;if(Q){let B=[J,J.toLowerCase(),Z9(J),X9(J)];for(let j of B)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${J}.stx`,`${Z9(J)}.stx`,`${X9(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=x0.resolve(x0.dirname(Z),`${J}.stx`);if(await r(B))return B;return null}let q=[],U=X.componentsDir||"",W=Y?.__originalFilePath;if(W)q.push(x0.join(x0.dirname(W),"components"));if(U)q.push(U);let K=x0.join(x0.dirname(Z),"components");if(!q.includes(K))q.push(K);let z=process.cwd(),H=[x0.resolve(z,"src/components"),x0.resolve(z,"components"),x0.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 _=x0.join(B,j);if(await r(_))return _}try{if(!a3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let _=a3.readdirSync(B,{withFileTypes:!0});for(let V of _)if(V.isDirectory()){let O=x0.join(B,V.name);for(let F of G){let L=x0.join(O,F);if(await r(L))return L}}}catch{}}return null}}var k0=new Y9;function j0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var I1="\x00stx-boolean-attribute";function t3($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function s1($,Z){let X=[];for(let[Y,J]of Object.entries($.static)){if(Z.has(Y))continue;let Q=$.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)X.push(j0(Q));continue}if(J===I1){X.push(j0(Q));continue}X.push(`${j0(Q)}="${j0(t3(String(J)))}"`)}return X}function o1($,Z){let X=[];for(let[Y,J]of Object.entries($.serverDynamic??{})){if(Z.has(Y))continue;if(J===null||J===void 0||J===!1)continue;let Q=$.serverDynamicNames?.[Y]??Y;if(J===!0){X.push(j0(Q));continue}if(typeof J==="object")continue;X.push(`${j0(Q)}="${j0(t3(String(J)))}"`)}return X}function D5($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _Q($){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 e3={name:"StxLink",aliases:["stx-link"],render($,Z,X){let Y=_Q($),J=(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,U=[];if(Y.reactive)U.push(`:href="${D5(Y.value)}"`);else U.push(`href="${D5(Y.value)}"`);if(J)U.push(`class="${D5(J)}"`);if(U.push("data-stx-link"),U.push(`data-stx-active-class="${D5(Q)}"`),U.push(`data-stx-exact-active-class="${D5(G)}"`),q)U.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return U.push(...s1($,W)),U.push(...o1($,W)),`<a ${U.join(" ")}>${Z}</a>`}};var OQ={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},$4=[320,640,768,1024,1280,1536,1920];function w0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function N0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function Z4($,Z,X=!1){let Y=$.serverDynamic[Z];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=$.static[Z];if(J!==void 0)return J!=="false"&&J!==!1;return X}function J9($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),X=[];for(let Y of Z)if(Y.includes(":")){let[J,Q]=Y.split(":"),G=OQ[J];if(G)X.push(`(max-width: ${G}px) ${Q}`);else{let q=Number.parseInt(J);if(!Number.isNaN(q))X.push(`(max-width: ${q}px) ${Q}`)}}else X.push(Y);return X.join(", ")}function X4($,Z,X,Y){return Z.map((J)=>`${N5($,J,void 0,X,Y)} ${J}w`).join(", ")}function VQ($,Z,X,Y,J){return Z.map((Q)=>{let G=X?X*Q:void 0;return`${N5($,G,void 0,Y,J)} ${Q}x`}).join(", ")}function N5($,Z,X,Y,J){if(!Y||Y==="local"||Y==="static")return $;if(Y==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(X)Q.push(`h_${X}`);if(J)Q.push(`f_${J}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(Y==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(X)Q.set("h",String(X));if(J)Q.set("fm",J);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(Y==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(X)Q.set("height",String(X));if(J)Q.set("format",J);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function FQ($,Z,X="#e5e7eb"){let Y=`<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(Y)}`}var Y4={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,X){let Y=N0($,"src")||"",J=N0($,"alt")||"",Q=N0($,"width"),G=N0($,"height"),q=N0($,"sizes"),U=N0($,"srcset"),W=N0($,"densities"),K=N0($,"format"),z=N0($,"placeholder"),H=N0($,"placeholderColor")||"#e5e7eb",B=N0($,"provider"),j=N0($,"class")||N0($,"className")||"",_=N0($,"style")||"",V=N0($,"quality"),O=Z4($,"lazy",!0),F=Z4($,"preload",!1),L=Z4($,"picture",!1)||!!K,w=Q?Number.parseInt(Q):void 0,R=G?Number.parseInt(G):void 0,D=U||"",N="";if(!D&&q)D=X4(Y,$4,B,K),N=J9(q);else if(!D&&W){let E=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));D=VQ(Y,E,w,B,K)}else if(q)N=J9(q);let T=[];if(_)T.push(_);if(w&&R)T.push(`aspect-ratio:${w}/${R}`);if(z==="blur"||z==="color"||z==="thumbhash"){let E=FQ(w||16,R||9,H);T.push(`background-image:url(${E})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${w0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let A=N5(Y,w,R,B,K),M=[];if(M.push(`src="${w0(A)}"`),M.push(`alt="${w0(J)}"`),Q)M.push(`width="${w0(Q)}"`);if(G)M.push(`height="${w0(G)}"`);if(O)M.push('loading="lazy"');if(M.push('decoding="async"'),j)M.push(`class="${w0(j)}"`);if(T.length>0)M.push(`style="${w0(T.join(";"))}"`);if(D)M.push(`srcset="${w0(D)}"`);if(N)M.push(`sizes="${w0(N)}"`);let k=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);M.push(...s1($,k)),M.push(...o1($,k));let I=`<img ${M.join(" ")} />`,y="";if(F){let b=K==="webp"?"image/webp":K==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${w0(A)}"${b?` type="${b}"`:""}${D?` imagesrcset="${w0(D)}"`:""}${N?` imagesizes="${w0(N)}"`:""} />
3562
- `}if(L){let E=[];if(K==="avif"||K==="auto"){let b=N5(Y,w,R,B,"avif"),C=D?X4(Y,$4,B,"avif"):`${b}`;E.push(`<source type="image/avif" srcset="${w0(C)}"${N?` sizes="${w0(N)}"`:""} />`)}if(K==="webp"||K==="auto"){let b=N5(Y,w,R,B,"webp"),C=D?X4(Y,$4,B,"webp"):`${b}`;E.push(`<source type="image/webp" srcset="${w0(C)}"${N?` sizes="${w0(N)}"`:""} />`)}return`${y}<picture>
3558
+ `)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(":"),N=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(N&&!J.has(N))X.push(N),J.add(N)});return}let V=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(V){V[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 O=Z.slice(Q).match(/^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);return}let F=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let L=F[1];if(!J.has(L))X.push(L),J.add(L)}};while(Q<G){if(H())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]),q=Z[Q-1];continue}if(Z[Q]==="`"){z(),q="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&W()){U(),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 X9($,Z,X,J){if(!t3($))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await _Q(Y,X,J);if(Y=Q,Y=await j$(Y,Z),G){let K=o3(Y,/<\/head>/i),z=K===-1?o3(Y,/<body[^>]*>/i):-1;if(K!==-1)Y=`${Y.slice(0,K)}${G}
3559
+ ${Y.slice(K)}`;else if(z!==-1){let H=/<body[^>]*>/i.exec(Y.slice(z))[0],B=z+H.length;Y=`${Y.slice(0,B)}
3560
+ ${G}${Y.slice(B)}`}else Y=`${Y}
3561
+ ${G}`}let U=Y.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=U&&/data-stx/.test(U[1]);if(!G&&!W&&U&&!/data-stx-auto/.test(U[1])){let K=/<body[^>]*>/i,z=o3(Y,K);if(z!==-1){let H=Y.slice(0,z),B=Y.slice(z).replace(K,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Y=H+B}}return Y}function o3($,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 U=G+q.index;if(!J.some(([K,z])=>U>=K&&U<z))return U;G=U+Math.max(q[0].length,1)}return-1}var s2="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function VQ($){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 s2;return`var ${Z.join(", ")}; ${s2}`}import g0 from"path";import e3 from"fs";function J9($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function Y9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class Q9{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(),J9(Y),Y9(Y)];for(let j of B)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${Y}.stx`,`${J9(Y)}.stx`,`${Y9(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let B=g0.resolve(g0.dirname(Z),`${Y}.stx`);if(await r(B))return B;return null}let q=[],U=X.componentsDir||"",W=J?.__originalFilePath;if(W)q.push(g0.join(g0.dirname(W),"components"));if(U)q.push(U);let K=g0.join(g0.dirname(Z),"components");if(!q.includes(K))q.push(K);let z=process.cwd(),H=[g0.resolve(z,"src/components"),g0.resolve(z,"components"),g0.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 _=g0.join(B,j);if(await r(_))return _}try{if(!e3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let _=e3.readdirSync(B,{withFileTypes:!0});for(let V of _)if(V.isDirectory()){let O=g0.join(B,V.name);for(let F of G){let L=g0.join(O,F);if(await r(L))return L}}}catch{}}return null}}var E0=new Q9;function j0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var I1="\x00stx-boolean-attribute";function $4($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function s1($,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(j0(Q));continue}if(Y===I1){X.push(j0(Q));continue}X.push(`${j0(Q)}="${j0($4(String(Y)))}"`)}return X}function o1($,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(j0(Q));continue}if(typeof Y==="object")continue;X.push(`${j0(Q)}="${j0($4(String(Y)))}"`)}return X}function D5($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function FQ($){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 Z4={name:"StxLink",aliases:["stx-link"],render($,Z,X){let J=FQ($),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,U=[];if(J.reactive)U.push(`:href="${D5(J.value)}"`);else U.push(`href="${D5(J.value)}"`);if(Y)U.push(`class="${D5(Y)}"`);if(U.push("data-stx-link"),U.push(`data-stx-active-class="${D5(Q)}"`),U.push(`data-stx-exact-active-class="${D5(G)}"`),q)U.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return U.push(...s1($,W)),U.push(...o1($,W)),`<a ${U.join(" ")}>${Z}</a>`}};var LQ={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},X4=[320,640,768,1024,1280,1536,1920];function w0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function J4($,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 G9($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),X=[];for(let J of Z)if(J.includes(":")){let[Y,Q]=J.split(":"),G=LQ[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 Y4($,Z,X,J){return Z.map((Y)=>`${N5($,Y,void 0,X,J)} ${Y}w`).join(", ")}function wQ($,Z,X,J,Y){return Z.map((Q)=>{let G=X?X*Q:void 0;return`${N5($,G,void 0,J,Y)} ${Q}x`}).join(", ")}function N5($,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 RQ($,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 Q4={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,X){let J=A0($,"src")||"",Y=A0($,"alt")||"",Q=A0($,"width"),G=A0($,"height"),q=A0($,"sizes"),U=A0($,"srcset"),W=A0($,"densities"),K=A0($,"format"),z=A0($,"placeholder"),H=A0($,"placeholderColor")||"#e5e7eb",B=A0($,"provider"),j=A0($,"class")||A0($,"className")||"",_=A0($,"style")||"",V=A0($,"quality"),O=J4($,"lazy",!0),F=J4($,"preload",!1),L=J4($,"picture",!1)||!!K,w=Q?Number.parseInt(Q):void 0,R=G?Number.parseInt(G):void 0,D=U||"",N="";if(!D&&q)D=Y4(J,X4,B,K),N=G9(q);else if(!D&&W){let E=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));D=wQ(J,E,w,B,K)}else if(q)N=G9(q);let T=[];if(_)T.push(_);if(w&&R)T.push(`aspect-ratio:${w}/${R}`);if(z==="blur"||z==="color"||z==="thumbhash"){let E=RQ(w||16,R||9,H);T.push(`background-image:url(${E})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${w0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let A=N5(J,w,R,B,K),M=[];if(M.push(`src="${w0(A)}"`),M.push(`alt="${w0(Y)}"`),Q)M.push(`width="${w0(Q)}"`);if(G)M.push(`height="${w0(G)}"`);if(O)M.push('loading="lazy"');if(M.push('decoding="async"'),j)M.push(`class="${w0(j)}"`);if(T.length>0)M.push(`style="${w0(T.join(";"))}"`);if(D)M.push(`srcset="${w0(D)}"`);if(N)M.push(`sizes="${w0(N)}"`);let k=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);M.push(...s1($,k)),M.push(...o1($,k));let I=`<img ${M.join(" ")} />`,y="";if(F){let b=K==="webp"?"image/webp":K==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${w0(A)}"${b?` type="${b}"`:""}${D?` imagesrcset="${w0(D)}"`:""}${N?` imagesizes="${w0(N)}"`:""} />
3562
+ `}if(L){let E=[];if(K==="avif"||K==="auto"){let b=N5(J,w,R,B,"avif"),C=D?Y4(J,X4,B,"avif"):`${b}`;E.push(`<source type="image/avif" srcset="${w0(C)}"${N?` sizes="${w0(N)}"`:""} />`)}if(K==="webp"||K==="auto"){let b=N5(J,w,R,B,"webp"),C=D?Y4(J,X4,B,"webp"):`${b}`;E.push(`<source type="image/webp" srcset="${w0(C)}"${N?` sizes="${w0(N)}"`:""} />`)}return`${y}<picture>
3563
3563
  ${E.join(`
3564
3564
  `)}
3565
3565
  ${I}
3566
- </picture>`}return`${y}${I}`}};var Q9="/images/safe-image-default.svg";function A5($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function r1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var LQ=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${Q9}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,J4={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,X){let Y=r1($,"src")||"",J=r1($,"alt")||"",Q=r1($,"fallback")||Q9,G=r1($,"class")||r1($,"className")||"",q=r1($,"fallbackClassName")||"",U=[];if(U.push(`src="${A5(Y)}"`),U.push(`alt="${A5(J)}"`),G)U.push(`class="${A5(G)}"`);if(U.push(`data-fallback="${A5(Q)}"`),q)U.push(`data-fallback-class="${A5(q)}"`);U.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);U.push(...s1($,W)),U.push(...o1($,W));let K=`<img ${U.join(" ")} />`,z=X.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${LQ}${K}`;return K}};function Q4($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function M5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function O$($,Z,X){let Y=M5($,Z);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return X}var G4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,X){let Y=Q4(M5($,"color")||"#6366f1"),J=Q4(M5($,"initialColor")||M5($,"initial-color")||""),Q=Q4(M5($,"height")||"3px"),G=O$($,"duration",2000),q=O$($,"throttle",200),U=O$($,"zIndex",999999)||O$($,"z-index",999999),W=J?`linear-gradient(to right, ${J}, ${Y})`:Y;return`
3566
+ </picture>`}return`${y}${I}`}};var q9="/images/safe-image-default.svg";function A5($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function r1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var DQ=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${q9}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,G4={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,X){let J=r1($,"src")||"",Y=r1($,"alt")||"",Q=r1($,"fallback")||q9,G=r1($,"class")||r1($,"className")||"",q=r1($,"fallbackClassName")||"",U=[];if(U.push(`src="${A5(J)}"`),U.push(`alt="${A5(Y)}"`),G)U.push(`class="${A5(G)}"`);if(U.push(`data-fallback="${A5(Q)}"`),q)U.push(`data-fallback-class="${A5(q)}"`);U.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);U.push(...s1($,W)),U.push(...o1($,W));let K=`<img ${U.join(" ")} />`,z=X.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${DQ}${K}`;return K}};function q4($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function M5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function V$($,Z,X){let J=M5($,Z);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return X}var U4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,X){let J=q4(M5($,"color")||"#6366f1"),Y=q4(M5($,"initialColor")||M5($,"initial-color")||""),Q=q4(M5($,"height")||"3px"),G=V$($,"duration",2000),q=V$($,"throttle",200),U=V$($,"zIndex",999999)||V$($,"z-index",999999),W=Y?`linear-gradient(to right, ${Y}, ${J})`:J;return`
3567
3567
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${W};z-index:${U};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
3568
3568
  <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>
3569
3569
  </div>
3570
3570
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
3571
3571
  <script>
3572
3572
  (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()})})();
3573
- </script>`}};function q9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function wQ($,Z,X){let Y=q9($,Z);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return X}var G9={"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%)"},q4={name:"StxToast",aliases:["stx-toast"],render($,Z,X){let Y=j0(q9($,"position")||"top-right"),J=wQ($,"max",5),Q=G9[Y]||G9["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${J}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3573
+ </script>`}};function W9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function NQ($,Z,X){let J=W9($,Z);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return X}var U9={"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%)"},W4={name:"StxToast",aliases:["stx-toast"],render($,Z,X){let J=j0(W9($,"position")||"top-right"),Y=NQ($,"max",5),Q=U9[J]||U9["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>
3574
3574
  <style>
3575
3575
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
3576
3576
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -3578,7 +3578,7 @@ ${I}
3578
3578
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
3579
3579
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
3580
3580
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
3581
- </style>`}};function V$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var U9={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)"},U4={name:"StxModal",aliases:["stx-modal"],render($,Z,X){let Y=V$($,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=j0(Y),Q=V$($,"size")||"md",G=V$($,"closeOnBackdrop")!=="false",q=V$($,"closeOnEscape")!=="false",U=U9[Q]||U9.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" 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">
3581
+ </style>`}};function F$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var K9={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)"},K4={name:"StxModal",aliases:["stx-modal"],render($,Z,X){let J=F$($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=j0(J),Q=F$($,"size")||"md",G=F$($,"closeOnBackdrop")!=="false",q=F$($,"closeOnEscape")!=="false",U=K9[Q]||K9.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">
3582
3582
  <div class="stx-modal-panel" style="${U};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)">
3583
3583
  <div style="padding:1.5rem">${Z}</div>
3584
3584
  </div>
@@ -3587,7 +3587,7 @@ ${I}
3587
3587
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
3588
3588
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
3589
3589
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
3590
- </style>`}};function a1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var W9={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},W4={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,X){let Y=a1($,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=j0(Y),Q=a1($,"side")||"right",G=a1($,"size")||"md",q=a1($,"closeOnBackdrop")!=="false",U=a1($,"closeOnEscape")!=="false",W=a1($,"overlay")!=="false",K=W9[G]||W9.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-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${q}" data-close-escape="${U}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"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">
3590
+ </style>`}};function a1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var z9={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},z4={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,X){let J=a1($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=j0(J),Q=a1($,"side")||"right",G=a1($,"size")||"md",q=a1($,"closeOnBackdrop")!=="false",U=a1($,"closeOnEscape")!=="false",W=a1($,"overlay")!=="false",K=z9[G]||z9.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="${U}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"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">
3591
3591
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${H};width:${K};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">
3592
3592
  <div style="padding:1.5rem">${Z}</div>
3593
3593
  </div>
@@ -3596,81 +3596,81 @@ ${I}
3596
3596
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
3597
3597
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3598
3598
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3599
- </style>`}};import{existsSync as RQ,readFileSync as DQ}from"fs";var k1=new Map,K9=new Set;function z9($){if(K9.has($))return;K9.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function H9($){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(RQ(X))return X;for(let X of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return h.resolve(X)}catch{}return null}function NQ($){if(k1.has($))return k1.get($);let Z=H9($);if(!Z)return z9($),null;try{let X=JSON.parse(DQ(Z,"utf8"));return k1.set($,X.icons),X.icons}catch{return null}}async function AQ($,Z=!1){if(k1.has($))return k1.get($);let X=H9($);if(!X){if(!Z)z9($);return null}try{let Y=await Bun.file(X).json();return k1.set($,Y.icons),Y.icons}catch{return null}}function t1($,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 K4={name:"Icon",aliases:["icon","stx-icon"],render($,Z,X){let Y=t1($,"name")??t1($,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",Q=Y;if(Y.includes(":")){let F=Y.split(":");J=F[0],Q=F[1]}let G=j0(t1($,"size")||"24"),q=j0(t1($,"color")||"currentColor"),U=j0(t1($,"class")||""),W=j0(t1($,"style")||""),K=k1.get(J)??NQ(J);if(!K)return`<!-- Icon: collection "${J}" not loaded -->`;let z=K[Q];if(!z)return`<!-- Icon: "${Q}" not found in ${J} -->`;let H=z.width||24,B=z.height||24,j=`0 0 ${H} ${B}`,_=z.body;if(q!=="currentColor")_=_.replace(/currentColor/g,q);let V=U?` class="${U}"`:"",O=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${V}${O}>${_}</svg>`}};async function MQ($="lucide",Z={}){await AQ($,Z.speculative??!0)}function B9($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Y=$.static[X];if(typeof Y==="string")return Y}return}function j9($,Z){let X=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=$.match(X);if(!Y)return{region:null,rest:$};return{region:Y[2],rest:$.replace(Y[0],"")}}var z4={name:"Suspense",aliases:["suspense"],render($,Z,X){let Y=j9(Z,"fallback"),J=Y.rest,Q=j9(J,"error"),G=Q.rest,q=Y.region??B9($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',U=Q.region??B9($,"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>${U}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function F$($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Y=$.static[X];if(typeof Y==="string")return Y}return}var H4={name:"TransitionGroup",aliases:["transition-group"],render($,Z,X){let Y=(F$($,"name")||"v").replace(/["'<>]/g,""),J=(F$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=F$($,"class"),G=F$($,"id"),q=[`data-stx-transition-group="${Y}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${J} ${q}>${Z}</${J}>`}};function _9(){k0.registerBuiltin(e3),k0.registerBuiltin(Y4),k0.registerBuiltin(J4),k0.registerBuiltin(G4),k0.registerBuiltin(q4),k0.registerBuiltin(U4),k0.registerBuiltin(W4),k0.registerBuiltin(K4),k0.registerBuiltin(z4),k0.registerBuiltin(H4)}function L$($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function O9($,Z,X){let Y=[],J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;let q=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!q){J=Q+1;continue}let U=q[1];if(X&&X.has(U.toLowerCase())){let _=Q+1+U.length;while(_<$.length&&$[_]!==">")_++;J=_+1;continue}let W=Q+1+U.length,K=null,z=W,H=-1,B=!1;while(W<$.length){let _=$[W];if(K){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===K)K=null;W++;continue}if(_==='"'||_==="'"){K=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){H=W+2,B=!0;break}if(_===">"){H=W+1;break}W++}if(H===-1){J=Q+1;continue}let j=$.slice(z,B?H-2:H-1).trim();if(B)Y.push({fullMatch:$.slice(Q,H),tagName:U,attributes:j,content:"",startIndex:Q,endIndex:H,isSelfClosing:!0}),J=H;else{let _=`<${U}`,V=`</${U}>`,O=1,F=H,L=-1;while(O>0&&F<$.length){let D=$.indexOf(_,F),N=$.indexOf(V,F);if(N===-1)break;if(D!==-1&&D<N){let T=$[D+_.length];if(T===" "||T===">"||T==="/"||T===`
3600
- `||T==="\t")O++;F=D+_.length}else{if(O--,O===0){L=N;break}F=N+V.length}}if(L===-1){J=H;continue}let w=$.slice(H,L),R=L+V.length;Y.push({fullMatch:$.slice(Q,R),tagName:U,attributes:j,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),J=R}}return Y}function V9($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function F9($,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 R$ from"fs";import C0 from"path";var L9=!1,TQ=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 IQ($,Z,X){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},J=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),Q=(W)=>{if(J.size===0)return!1;let K=p0(W),z=K.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(z&&J.has(z))return!0;for(let H of J){let B=H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(K))return!0}return!1},G=new Set(N9),q=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(K,z)=>z.toUpperCase())},U=(W,K)=>{let z=q(W);if(Y.static[z]=K,z!==W)Y.staticNames[z]=W};for(let[W,K]of Object.entries($)){let z=W.startsWith("x-")&&!G.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(z.startsWith("@")){Y.events[z]=K;continue}if(z.startsWith("__stx_")){let H=q(z.slice(6));Y.serverDynamic[H]=F9(K,X);continue}if(z.startsWith(":")){let H=q(z.slice(1)),B=K===I1?H:K;if(H==="if"||H==="for"||H==="show"){Y.clientReactive[H]=B;continue}if(Q(B)){Y.clientReactive[H]=B;continue}try{if(!Q0(B)){if(X.debug)console.error(`Unsafe expression in :${H} binding: ${B}`);Y.clientReactive[H]=B;continue}let j=Object.keys(Z),V=G0(B,j)(...Object.values(Z));if(V===void 0){let O=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],F=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(O.some((w)=>!F.has(w)&&!j.includes(w))){Y.clientReactive[H]=B;continue}}if(Y.serverDynamic[H]=V,H!==z.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[H]=z.slice(1)}catch{Y.clientReactive[H]=B}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let H=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(H)try{let B=H[1];if(Q0(B)){let _=G0(B,Object.keys(Z))(...Object.values(Z));U(z,_!=null?String(_):"")}else{if(X.debug)console.error(`Unsafe expression in ${z}: ${B}`);U(z,K)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${z}:`,B);U(z,K)}else{let B=K,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(K))!==null)try{let V=_[1];if(!Q0(V)){if(X.debug)console.error(`Unsafe expression in ${z}: ${V}`);continue}let F=G0(V,Object.keys(Z))(...Object.values(Z));B=B.replace(_[0],String(F??""))}catch(V){if(X.debug)console.error(`Error evaluating expression in ${z}:`,V)}U(z,B)}continue}U(z,K===I1?"true":V9(K))}return Y}var kQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function EQ($,Z,X){if(!$.includes("@"))return $;if(!kQ.some(([J,Q])=>J.test($)&&$.includes(Q)))return $;try{return a0($,Z,X)}catch{return $}}function bQ($){let Z={},X=0,Y=$.length;while(X<Y){while(X<Y&&/\s/.test($[X]))X++;if(X>=Y)break;let J="";while(X<Y&&!/[\s=]/.test($[X]))J+=$[X],X++;if(!J)break;while(X<Y&&/\s/.test($[X]))X++;if(X<Y&&$[X]==="="){X++;while(X<Y&&/\s/.test($[X]))X++;let Q="";if(X<Y&&($[X]==='"'||$[X]==="'")){let G=$[X];X++;while(X<Y){let q=$[X];if(q==="\\"&&X+1<Y){X++,Q+=$[X],X++;continue}if(q===G){X++;break}Q+=q,X++}}else while(X<Y&&!/\s/.test($[X]))Q+=$[X],X++;Z[J]=Q}else Z[J]=I1}return Z}function w9($){return Object.entries($).map(([Z,X])=>X===I1?Z:`${Z}="${yQ(X)}"`).join(" ")}function yQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function SQ($){let Z=new Set,X=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=X.exec($))!==null){let J=Y[1];if(k0.isBuiltin(J))Z.add(J)}return[...Z].sort()}var R9=new Map;function CQ($){let Z=R9.get($);if(Z)return Z;let X=new Map,Y=[C0.join($,"src"),C0.join($,"dist"),$];function J(Q,G){if(G>6)return;let q;try{q=R$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let U of q){let W=C0.join(Q,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;J(W,G+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let K=U.name.slice(0,-4);if(!X.has(K))X.set(K,W);let z=K.toLowerCase();if(!X.has(z))X.set(z,W);let H=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,W)}}}for(let Q of Y)if(J(Q,0),X.size>0)break;return R9.set($,X),X}function PQ($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let Y=C0.join(X,"node_modules",$);try{if(R$.statSync(Y).isDirectory())return Y}catch{}let J=C0.dirname(X);if(J===X)return null;X=J}}async function vQ($,Z,X,Y,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=C0.dirname(X),q=$,U=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(U,(W,K,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[V,O,F,L]=j,w=null,R=null;if(L.startsWith(".")||L.startsWith("/")){let T=C0.resolve(G,L);if(T.endsWith(".stx"))R=T;else{let A=`${T}.stx`;try{if(R$.statSync(A).isFile())R=A}catch{try{if(R$.statSync(T).isDirectory())w=T}catch{}}}}else w=PQ(L,G);if(!w&&!R)continue;let D=!1,N=(T,A)=>{Q.set(T,A),Q.set(T.toLowerCase(),A);let M=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,A),J.add(A)};if(F&&R)N(F,R),D=!0;else if(O){let T=O.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let k=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:M,local:M}}),A=w?CQ(w):null;for(let{source:M,local:k}of T){let I=null;if(R)I=R;else if(A)I=A.get(M)??A.get(M.toLowerCase())??A.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(k,I),D=!0}}if(D)_.push({start:j.index,end:j.index+V.length})}if(_.length===0)return W;for(let V=_.length-1;V>=0;V--)B=B.slice(0,_[V].start)+B.slice(_[V].end);return`<script${K}>${B}</script>`}),q}async function fQ($,Z,X,Y,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,U;while((U=q.exec(Q))!==null){let[W,K]=U,z=K.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$/,""),V=_.includes("-")?_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),O=null,F=[C0.resolve(C0.dirname(X),`${H}.stx`),C0.resolve(C0.dirname(X),H),C0.resolve(Y.componentsDir||"components",`${H}.stx`),C0.resolve(Y.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let L of F)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(V,O),G.set(_,O),G.set(_.toLowerCase(),O);let L=V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),J.add(O),Y.debug)console.log(`Imported component: ${V} -> ${O}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(W,""),q.lastIndex=0}return Q}async function xQ($,Z,X,Y,J){let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=/@component\s*\(/g,W;while((W=U.exec(Q))!==null){let K=W.index,z=K+W[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,V=j.match(/^\s*['"]([^'"]+)['"]/);if(!V){U.lastIndex=0;continue}let O=V[1],F,L=j.slice(V[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let R={};if(F)try{R=_0(F,Z)}catch(k){let I=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(K,_),`[Error parsing component props: ${I}]`);continue}let D="",N=_,A=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(A)D=A[1].trim(),N=_+A[0].length;let M=await T1(O,R,D,G,Z,X,Y,q,J);Q=Q.substring(0,K)+M+Q.substring(N),U.lastIndex=0}return Q}async function gQ($,Z,X,Y,J){if(!$)return $;let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=c0(Q);return Q=U.output,Q=await H(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await H(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await H(Q,/[a-z][a-z0-9]*/,!1,TQ),Q=C1(Q,U.scripts),Q;async function H(B,j,_,V){if(!B)return B;let O=B,F=O9(O,j,V);for(let L=F.length-1;L>=0;L--){let w=F[L],R=_?L$(w.tagName):w.tagName,D=bQ(EQ(w.attributes,Z,X)),N=IQ(D,Z,Y),T=k0.getBuiltin(w.tagName),A=T?await w$(R,G,Z,X,Y):!1;if(T&&!A){let y={context:Z,filePath:X,options:Y,dependencies:J},E=T.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)E=D9(E,N.clientReactive);if(Object.keys(N.events).length>0){let b=w9(N.events);E=E.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,w.startIndex)+E+O.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await w$(R,G,Z,X,Y))continue;let M={};for(let[y,E]of Object.entries(N.static))M[y]=E;for(let[y,E]of Object.entries(N.serverDynamic))M[y]=E;let I=await T1(R,M,C1(w.content,U.scripts),G,Z,X,Y,q,J);if(Object.keys(N.clientReactive).length>0)I=D9(I,N.clientReactive);if(Object.keys(N.events).length>0){let y=A9(I);if(y){let E=w9(N.events),b=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${E}`+I.substring(y.insertPos)}}O=O.substring(0,w.startIndex)+I+O.substring(w.endIndex)}return O}}function D9($,Z){let X=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries(Z).filter(([K])=>!X.has(K)),Q=J.filter(([K])=>!Y.has(K)).map(([K])=>L$(K)).join(" "),G=$,q=J.length>0?A9(G):null;if(q){let K=J.map(([H,B])=>`:${L$(H)}="${B.replace(/"/g,"&quot;")}"`).join(" "),z=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,q.insertPos)+`${z} ${K}`+G.substring(q.insertPos)}let U=Z.if;if(U)G=`<template :if="${U.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function A9($){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 Y=$.slice(X),J=Y.match(/^\s+/);if(J){X+=J[0].length;continue}if(Y.startsWith("<!--")){let q=$.indexOf("-->",X+4);if(q===-1)return null;X=q+3;continue}let Q=Y.match(/^<(script|style)\b[^>]*>/i);if(Q){let q=`</${Q[1].toLowerCase()}>`,U=$.toLowerCase().indexOf(q,X+Q[0].length);if(U===-1)return null;X=U+q.length;continue}let G=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:X+1+G[1].length}}return null}async function B4($,Z,X,Y,J){if(!L9)_9(),L9=!0;let Q=await vQ($,Z,X,Y,J);Q=await fQ(Q,Z,X,Y,J),Q=await xQ(Q,Z,X,Y,J);let G=[];for(let q=0;q<3;q++){let U=l0(Q,Q5,(K,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...U.tokens);let W=Q;if(Q=await gQ(U.output,Z,X,Y,J),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,U)=>G[Number(U)]??"");if(Y.debug){let q=SQ(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 $5 from"path";import M9 from"process";function e1($="STX_PUBLIC_"){let Z={},X={};for(let[Y,J]of Object.entries(M9.env)){if(!Y.startsWith($)||J===void 0)continue;Z[`import.meta.env.${Y}`]=JSON.stringify(J),X[Y]=J}return Z["import.meta.env"]=JSON.stringify(X),Z}function $j($="STX_PUBLIC_"){let Z={};for(let[X,Y]of Object.entries(M9.env))if(X.startsWith($)&&Y!==void 0)Z[X]=Y;return Z}function T9($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function I9($,Z,X){try{let Y;if($.startsWith("/")){let J=Z;for(let Q=0;Q<5;Q++){let G=$5.join(J,$);if(await Bun.file(G).exists())return G;J=$5.dirname(J)}Y=$5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))Y=$5.resolve(Z,$);else Y=$5.resolve(Z,$);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function k9($,Z,X){let Y=$,J=$5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(Y))!==null){let[W,K,z,H]=G;if(T9(z))continue;let B=await I9(z,J,Z);if(B)try{let j=await Bun.file(B).text();if(X.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let V=await Bun.build({entrypoints:[B],target:"browser",minify:!0,define:e1()});if(V.outputs.length>0)j=await V.outputs[0].text()}let _=`<script>
3599
+ </style>`}};import{existsSync as AQ,readFileSync as MQ}from"fs";var k1=new Map,H9=new Set;function B9($){if(H9.has($))return;H9.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function j9($){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(AQ(X))return X;for(let X of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return h.resolve(X)}catch{}return null}function TQ($){if(k1.has($))return k1.get($);let Z=j9($);if(!Z)return B9($),null;try{let X=JSON.parse(MQ(Z,"utf8"));return k1.set($,X.icons),X.icons}catch{return null}}async function IQ($,Z=!1){if(k1.has($))return k1.get($);let X=j9($);if(!X){if(!Z)B9($);return null}try{let J=await Bun.file(X).json();return k1.set($,J.icons),J.icons}catch{return null}}function t1($,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 H4={name:"Icon",aliases:["icon","stx-icon"],render($,Z,X){let J=t1($,"name")??t1($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=J;if(J.includes(":")){let F=J.split(":");Y=F[0],Q=F[1]}let G=j0(t1($,"size")||"24"),q=j0(t1($,"color")||"currentColor"),U=j0(t1($,"class")||""),W=j0(t1($,"style")||""),K=k1.get(Y)??TQ(Y);if(!K)return`<!-- Icon: collection "${Y}" not loaded -->`;let z=K[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 V=U?` class="${U}"`:"",O=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${V}${O}>${_}</svg>`}};async function kQ($="lucide",Z={}){await IQ($,Z.speculative??!0)}function _9($,...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 B4={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??_9($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',U=Q.region??_9($,"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>${U}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function L$($,...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 j4={name:"TransitionGroup",aliases:["transition-group"],render($,Z,X){let J=(L$($,"name")||"v").replace(/["'<>]/g,""),Y=(L$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=L$($,"class"),G=L$($,"id"),q=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${q}>${Z}</${Y}>`}};function V9(){E0.registerBuiltin(Z4),E0.registerBuiltin(Q4),E0.registerBuiltin(G4),E0.registerBuiltin(U4),E0.registerBuiltin(W4),E0.registerBuiltin(K4),E0.registerBuiltin(z4),E0.registerBuiltin(H4),E0.registerBuiltin(B4),E0.registerBuiltin(j4)}function w$($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function F9($,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 U=q[1];if(X&&X.has(U.toLowerCase())){let _=Q+1+U.length;while(_<$.length&&$[_]!==">")_++;Y=_+1;continue}let W=Q+1+U.length,K=null,z=W,H=-1,B=!1;while(W<$.length){let _=$[W];if(K){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===K)K=null;W++;continue}if(_==='"'||_==="'"){K=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){H=W+2,B=!0;break}if(_===">"){H=W+1;break}W++}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:U,attributes:j,content:"",startIndex:Q,endIndex:H,isSelfClosing:!0}),Y=H;else{let _=`<${U}`,V=`</${U}>`,O=1,F=H,L=-1;while(O>0&&F<$.length){let D=$.indexOf(_,F),N=$.indexOf(V,F);if(N===-1)break;if(D!==-1&&D<N){let T=$[D+_.length];if(T===" "||T===">"||T==="/"||T===`
3600
+ `||T==="\t")O++;F=D+_.length}else{if(O--,O===0){L=N;break}F=N+V.length}}if(L===-1){Y=H;continue}let w=$.slice(H,L),R=L+V.length;J.push({fullMatch:$.slice(Q,R),tagName:U,attributes:j,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),Y=R}}return J}function L9($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function w9($,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 D$ from"fs";import C0 from"path";var R9=!1,EQ=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 bQ($,Z,X){let J={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Y=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),Q=(W)=>{if(Y.size===0)return!1;let K=i0(W),z=K.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(z&&Y.has(z))return!0;for(let H of Y){let B=H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(K))return!0}return!1},G=new Set(M9),q=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(K,z)=>z.toUpperCase())},U=(W,K)=>{let z=q(W);if(J.static[z]=K,z!==W)J.staticNames[z]=W};for(let[W,K]of Object.entries($)){let z=W.startsWith("x-")&&!G.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(z.startsWith("@")){J.events[z]=K;continue}if(z.startsWith("__stx_")){let H=q(z.slice(6));J.serverDynamic[H]=w9(K,X);continue}if(z.startsWith(":")){let H=q(z.slice(1)),B=K===I1?H:K;if(H==="if"||H==="for"||H==="show"){J.clientReactive[H]=B;continue}if(Q(B)){J.clientReactive[H]=B;continue}try{if(!Q0(B)){if(X.debug)console.error(`Unsafe expression in :${H} binding: ${B}`);J.clientReactive[H]=B;continue}let j=Object.keys(Z),V=G0(B,j)(...Object.values(Z));if(V===void 0){let O=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],F=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(O.some((w)=>!F.has(w)&&!j.includes(w))){J.clientReactive[H]=B;continue}}if(J.serverDynamic[H]=V,H!==z.slice(1)&&J.serverDynamicNames)J.serverDynamicNames[H]=z.slice(1)}catch{J.clientReactive[H]=B}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let H=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(H)try{let B=H[1];if(Q0(B)){let _=G0(B,Object.keys(Z))(...Object.values(Z));U(z,_!=null?String(_):"")}else{if(X.debug)console.error(`Unsafe expression in ${z}: ${B}`);U(z,K)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${z}:`,B);U(z,K)}else{let B=K,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(K))!==null)try{let V=_[1];if(!Q0(V)){if(X.debug)console.error(`Unsafe expression in ${z}: ${V}`);continue}let F=G0(V,Object.keys(Z))(...Object.values(Z));B=B.replace(_[0],String(F??""))}catch(V){if(X.debug)console.error(`Error evaluating expression in ${z}:`,V)}U(z,B)}continue}U(z,K===I1?"true":L9(K))}return J}var yQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function SQ($,Z,X){if(!$.includes("@"))return $;if(!yQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return t0($,Z,X)}catch{return $}}function CQ($){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]=I1}return Z}function D9($){return Object.entries($).map(([Z,X])=>X===I1?Z:`${Z}="${PQ(X)}"`).join(" ")}function PQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vQ($){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(E0.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}var N9=new Map;function fQ($){let Z=N9.get($);if(Z)return Z;let X=new Map,J=[C0.join($,"src"),C0.join($,"dist"),$];function Y(Q,G){if(G>6)return;let q;try{q=D$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let U of q){let W=C0.join(Q,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;Y(W,G+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let K=U.name.slice(0,-4);if(!X.has(K))X.set(K,W);let z=K.toLowerCase();if(!X.has(z))X.set(z,W);let H=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,W)}}}for(let Q of J)if(Y(Q,0),X.size>0)break;return N9.set($,X),X}function xQ($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let J=C0.join(X,"node_modules",$);try{if(D$.statSync(J).isDirectory())return J}catch{}let Y=C0.dirname(X);if(Y===X)return null;X=Y}}async function gQ($,Z,X,J,Y){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=C0.dirname(X),q=$,U=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(U,(W,K,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[V,O,F,L]=j,w=null,R=null;if(L.startsWith(".")||L.startsWith("/")){let T=C0.resolve(G,L);if(T.endsWith(".stx"))R=T;else{let A=`${T}.stx`;try{if(D$.statSync(A).isFile())R=A}catch{try{if(D$.statSync(T).isDirectory())w=T}catch{}}}}else w=xQ(L,G);if(!w&&!R)continue;let D=!1,N=(T,A)=>{Q.set(T,A),Q.set(T.toLowerCase(),A);let M=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,A),Y.add(A)};if(F&&R)N(F,R),D=!0;else if(O){let T=O.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let k=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:M,local:M}}),A=w?fQ(w):null;for(let{source:M,local:k}of T){let I=null;if(R)I=R;else if(A)I=A.get(M)??A.get(M.toLowerCase())??A.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(k,I),D=!0}}if(D)_.push({start:j.index,end:j.index+V.length})}if(_.length===0)return W;for(let V=_.length-1;V>=0;V--)B=B.slice(0,_[V].start)+B.slice(_[V].end);return`<script${K}>${B}</script>`}),q}async function hQ($,Z,X,J,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,U;while((U=q.exec(Q))!==null){let[W,K]=U,z=K.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$/,""),V=_.includes("-")?_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),O=null,F=[C0.resolve(C0.dirname(X),`${H}.stx`),C0.resolve(C0.dirname(X),H),C0.resolve(J.componentsDir||"components",`${H}.stx`),C0.resolve(J.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let L of F)try{if(await Bun.file(L).exists()){O=L;break}}catch{}if(O){G.set(V,O),G.set(_,O),G.set(_.toLowerCase(),O);let L=V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,O),Y.add(O),J.debug)console.log(`Imported component: ${V} -> ${O}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(W,""),q.lastIndex=0}return Q}async function uQ($,Z,X,J,Y){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=/@component\s*\(/g,W;while((W=U.exec(Q))!==null){let K=W.index,z=K+W[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,V=j.match(/^\s*['"]([^'"]+)['"]/);if(!V){U.lastIndex=0;continue}let O=V[1],F,L=j.slice(V[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let R={};if(F)try{R=_0(F,Z)}catch(k){let I=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(K,_),`[Error parsing component props: ${I}]`);continue}let D="",N=_,A=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(A)D=A[1].trim(),N=_+A[0].length;let M=await T1(O,R,D,G,Z,X,J,q,Y);Q=Q.substring(0,K)+M+Q.substring(N),U.lastIndex=0}return Q}async function dQ($,Z,X,J,Y){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let q=Z.__processedComponents,U=p0(Q);return Q=U.output,Q=await H(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await H(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await H(Q,/[a-z][a-z0-9]*/,!1,EQ),Q=C1(Q,U.scripts),Q;async function H(B,j,_,V){if(!B)return B;let O=B,F=F9(O,j,V);for(let L=F.length-1;L>=0;L--){let w=F[L],R=_?w$(w.tagName):w.tagName,D=CQ(SQ(w.attributes,Z,X)),N=bQ(D,Z,J),T=E0.getBuiltin(w.tagName),A=T?await R$(R,G,Z,X,J):!1;if(T&&!A){let y={context:Z,filePath:X,options:J,dependencies:Y},E=T.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)E=A9(E,N.clientReactive);if(Object.keys(N.events).length>0){let b=D9(N.events);E=E.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,w.startIndex)+E+O.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await R$(R,G,Z,X,J))continue;let M={};for(let[y,E]of Object.entries(N.static))M[y]=E;for(let[y,E]of Object.entries(N.serverDynamic))M[y]=E;let I=await T1(R,M,C1(w.content,U.scripts),G,Z,X,J,q,Y);if(Object.keys(N.clientReactive).length>0)I=A9(I,N.clientReactive);if(Object.keys(N.events).length>0){let y=T9(I);if(y){let E=D9(N.events),b=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,y.insertPos)+` data-stx-parent-events="${b}" ${E}`+I.substring(y.insertPos)}}O=O.substring(0,w.startIndex)+I+O.substring(w.endIndex)}return O}}function A9($,Z){let X=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(Z).filter(([K])=>!X.has(K)),Q=Y.filter(([K])=>!J.has(K)).map(([K])=>w$(K)).join(" "),G=$,q=Y.length>0?T9(G):null;if(q){let K=Y.map(([H,B])=>`:${w$(H)}="${B.replace(/"/g,"&quot;")}"`).join(" "),z=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,q.insertPos)+`${z} ${K}`+G.substring(q.insertPos)}let U=Z.if;if(U)G=`<template :if="${U.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function T9($){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()}>`,U=$.toLowerCase().indexOf(q,X+Q[0].length);if(U===-1)return null;X=U+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 _4($,Z,X,J,Y){if(!R9)V9(),R9=!0;let Q=await gQ($,Z,X,J,Y);Q=await hQ(Q,Z,X,J,Y),Q=await uQ(Q,Z,X,J,Y);let G=[];for(let q=0;q<3;q++){let U=c0(Q,Q5,(K,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...U.tokens);let W=Q;if(Q=await dQ(U.output,Z,X,J,Y),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,U)=>G[Number(U)]??"");if(J.debug){let q=vQ(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 $5 from"path";import I9 from"process";function e1($="STX_PUBLIC_"){let Z={},X={};for(let[J,Y]of Object.entries(I9.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 Jj($="STX_PUBLIC_"){let Z={};for(let[X,J]of Object.entries(I9.env))if(X.startsWith($)&&J!==void 0)Z[X]=J;return Z}function k9($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function E9($,Z,X){try{let J;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=$5.join(Y,$);if(await Bun.file(G).exists())return G;Y=$5.dirname(Y)}J=$5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=$5.resolve(Z,$);else J=$5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function b9($,Z,X){let J=$,Y=$5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[W,K,z,H]=G;if(k9(z))continue;let B=await E9(z,Y,Z);if(B)try{let j=await Bun.file(B).text();if(X.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let V=await Bun.build({entrypoints:[B],target:"browser",minify:!0,define:e1()});if(V.outputs.length>0)j=await V.outputs[0].text()}let _=`<script>
3601
3601
  // Source: ${z}
3602
3602
  ${j}
3603
- </script>`;Y=Y.replace(W,_),Q.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,U;while((U=q.exec(Y))!==null){let[W,K,z,H]=U,B=K+H;if(T9(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let _=await I9(z,J,Z);if(_)try{let V=await Bun.file(_).text();X.add(_);let O=`<style>
3603
+ </script>`;J=J.replace(W,_),Q.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,U;while((U=q.exec(J))!==null){let[W,K,z,H]=U,B=K+H;if(k9(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let _=await E9(z,Y,Z);if(_)try{let V=await Bun.file(_).text();X.add(_);let O=`<style>
3604
3604
  /* Source: ${z} */
3605
3605
  ${V}
3606
- </style>`;Y=Y.replace(W,O),q.lastIndex=0}catch(V){}}}return Y}function j4($,Z){let X=$,Y=/@json\s*\(/g,J;while((J=Y.exec(X))!==null){let Q=J.index,G=Q+J[0].length-1,q=1,U=G+1,W=null,K=!1;while(U<X.length&&q>0){let L=X[U];if(K){K=!1,U++;continue}if(L==="\\"&&W){K=!0,U++;continue}if(W){if(L===W)W=null;U++;continue}if(L==='"'||L==="'"||L==="`"){W=L,U++;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0)break}U++}if(q!==0)break;let z=X.substring(G+1,U).trim(),H=X.substring(Q,U+1),B=-1,j=0,_=null,V=!1;for(let L=0;L<z.length;L++){let w=z[L];if(V){V=!1;continue}if(w==="\\"&&_){V=!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 O=B>=0?z.substring(0,B).trim():z,F=B>=0?z.substring(B+1).trim():void 0;try{let L=O.trim(),w;if(Q0(L))w=G0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(F==="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(U+1),Y.lastIndex=Q+D.length}catch(L){u0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),Y.lastIndex=Q+H.length}}return X}function _4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function E9($){let Z=$,X=/@memo\s*\(/g,Y,J=[];while((Y=X.exec(Z))!==null){let Q=Y.index,G=Q+Y[0].length,q=1,U=G;while(U<Z.length&&q>0){if(Z[U]==="(")q++;else if(Z[U]===")")q--;U++}if(q!==0)continue;let W=Z.slice(G,U-1).trim(),K=U,z=Z.slice(K),H=z.indexOf("@endmemo");if(H===-1)continue;let B=z.slice(0,H),j=K+H+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),V=_?_[0].length:0,O=B.slice(V),F=B.match(/(\s*)$/),L=F?F[0].length:0,w=O.slice(0,O.length-L),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),D;if(R){let[N,T,A="",M]=R,k=`<${T}${A} data-stx-memo="${W}"${M}>`;D=B.slice(0,V)+k+w.slice(N.length)+B.slice(V+w.length)}else D=`${B.slice(0,V)}<div data-stx-memo="${W}">${w}</div>${B.slice(V+w.length)}`;J.push({start:Q,end:j,replacement:D}),X.lastIndex=j}for(let Q=J.length-1;Q>=0;Q--){let G=J[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function O4($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function b9($){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"),Y="",J=0,Q;while((Q=X.exec($))!==null){let G=Q.index,q=G+Q[0].length,U=!1,W=!1,K=-1;while(q<$.length){let _=$[q];if(U){if(_==="'")U=!1}else if(W){if(_==='"')W=!1}else if(_==="'")U=!0;else if(_==='"')W=!0;else if(_===">"){K=q;break}q++}if(K===-1)continue;if($.slice(G,K+1).includes("x-cloak"))continue;let H=$.slice(K+1),B=H.indexOf("</"),j=B>=0?H.slice(0,B):H.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))Y+=$.slice(J,K)+" x-cloak>",J=K+1}return Y+=$.slice(J),Y}var hQ=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/;function y9($){let Z=/<[a-z][\w-]*/gi,X="",Y=0,J;while((J=Z.exec($))!==null){let Q=J.index,G=J[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+J[0].length,U=!1,W=!1,K=-1;while(q<$.length){let j=$[q];if(U){if(j==="'")U=!1}else if(W){if(j==='"')W=!1}else if(j==="'")U=!0;else if(j==='"')W=!0;else if(j===">"){K=q;break}q++}if(K===-1)continue;let z=$.slice(Q+J[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!hQ.test(z))continue;let H=$[K-1]==="/",B=H?K-1:K;X+=`${$.slice(Y,B)} x-cloak${H?" ":""}`,Y=B}return X+=$.slice(Y),X}var uQ=[{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 V4($,Z,X,Y){let J=typeof X==="boolean"?{enabled:X,failOnViolation:X}:X??{enabled:!1},Q=J.allowPatterns??[],G=[],q=p0($.replace(/\{\{--[\s\S]*?--\}\}/g,(U)=>U.replace(/[^\n]/g," ")));for(let{pattern:U,message:W,suggestion:K}of uQ){if(Q.some((H)=>/\w/.test(H)&&W.includes(H)))continue;U.lastIndex=0;let z=q.match(U);if(z&&z.length>0){let H=q.split(`
3606
+ </style>`;J=J.replace(W,O),q.lastIndex=0}catch(V){}}}return J}function O4($,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,U=G+1,W=null,K=!1;while(U<X.length&&q>0){let L=X[U];if(K){K=!1,U++;continue}if(L==="\\"&&W){K=!0,U++;continue}if(W){if(L===W)W=null;U++;continue}if(L==='"'||L==="'"||L==="`"){W=L,U++;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0)break}U++}if(q!==0)break;let z=X.substring(G+1,U).trim(),H=X.substring(Q,U+1),B=-1,j=0,_=null,V=!1;for(let L=0;L<z.length;L++){let w=z[L];if(V){V=!1;continue}if(w==="\\"&&_){V=!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 O=B>=0?z.substring(0,B).trim():z,F=B>=0?z.substring(B+1).trim():void 0;try{let L=O.trim(),w;if(Q0(L))w=G0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(F==="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(U+1),J.lastIndex=Q+D.length}catch(L){d0.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),J.lastIndex=Q+H.length}}return X}function V4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function y9($){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,U=G;while(U<Z.length&&q>0){if(Z[U]==="(")q++;else if(Z[U]===")")q--;U++}if(q!==0)continue;let W=Z.slice(G,U-1).trim(),K=U,z=Z.slice(K),H=z.indexOf("@endmemo");if(H===-1)continue;let B=z.slice(0,H),j=K+H+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),V=_?_[0].length:0,O=B.slice(V),F=B.match(/(\s*)$/),L=F?F[0].length:0,w=O.slice(0,O.length-L),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),D;if(R){let[N,T,A="",M]=R,k=`<${T}${A} data-stx-memo="${W}"${M}>`;D=B.slice(0,V)+k+w.slice(N.length)+B.slice(V+w.length)}else D=`${B.slice(0,V)}<div data-stx-memo="${W}">${w}</div>${B.slice(V+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 F4($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function S9($){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,U=!1,W=!1,K=-1;while(q<$.length){let _=$[q];if(U){if(_==="'")U=!1}else if(W){if(_==='"')W=!1}else if(_==="'")U=!0;else if(_==='"')W=!0;else if(_===">"){K=q;break}q++}if(K===-1)continue;if($.slice(G,K+1).includes("x-cloak"))continue;let H=$.slice(K+1),B=H.indexOf("</"),j=B>=0?H.slice(0,B):H.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(Y,K)+" x-cloak>",Y=K+1}return J+=$.slice(Y),J}var mQ=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/;function C9($){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,U=!1,W=!1,K=-1;while(q<$.length){let j=$[q];if(U){if(j==="'")U=!1}else if(W){if(j==='"')W=!1}else if(j==="'")U=!0;else if(j==='"')W=!0;else if(j===">"){K=q;break}q++}if(K===-1)continue;let z=$.slice(Q+Y[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!mQ.test(z))continue;let H=$[K-1]==="/",B=H?K-1:K;X+=`${$.slice(J,B)} x-cloak${H?" ":""}`,J=B}return X+=$.slice(J),X}var lQ=[{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 L4($,Z,X,J){let Y=typeof X==="boolean"?{enabled:X,failOnViolation:X}:X??{enabled:!1},Q=Y.allowPatterns??[],G=[],q=i0($.replace(/\{\{--[\s\S]*?--\}\}/g,(U)=>U.replace(/[^\n]/g," ")));for(let{pattern:U,message:W,suggestion:K}of lQ){if(Q.some((H)=>/\w/.test(H)&&W.includes(H)))continue;U.lastIndex=0;let z=q.match(U);if(z&&z.length>0){let H=q.split(`
3607
3607
  `),B=$.split(`
3608
3608
  `),j=[];H.forEach((F,L)=>{if(U.lastIndex=0,U.test(F))j.push(L+1)});let _=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",V=j.slice(0,3).map((F)=>` ${F} | ${(B[F-1]??"").trim().slice(0,100)}`).join(`
3609
3609
  `),O=V?`
3610
3610
  ${V}`:"";G.push(` \u2717 ${W}${_}
3611
- \u2192 ${K}${O}`)}}if(G.length>0&&J.enabled){let U=(z)=>{let H=`${process.cwd()}/`;return z.startsWith(H)?z.slice(H.length):z},K=`[STX] DOM API violation in ${Y&&Y!==Z?`${U(Y)} (composed into ${U(Z)})`:U(Z)}:
3611
+ \u2192 ${K}${O}`)}}if(G.length>0&&Y.enabled){let U=(z)=>{let H=`${process.cwd()}/`;return z.startsWith(H)?z.slice(H.length):z},K=`[STX] DOM API violation in ${J&&J!==Z?`${U(J)} (composed into ${U(Z)})`:U(Z)}:
3612
3612
  ${G.join(`
3613
3613
  `)}
3614
- Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}dQ();var E1="<!--PARENT_CONTENT_PLACEHOLDER-->";function S9($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lQ($,Z){let X=$.length,Y=Z,J=!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(Y<X){let q=$[Y];if(G(Y))return Y;if(q==="/"&&$[Y+1]==="/"){if(Y=$.indexOf(`
3615
- `,Y+2),Y===-1)return-1;Y+=1,J=!0;continue}if(q==="/"&&$[Y+1]==="*"){let U=$.indexOf("*/",Y+2);if(U===-1)return-1;Y=U+2,J=!0;continue}if(q==="/"&&J){let U=Y+1,W=!1;while(U<X){let K=$[U];if(K==="\\"){U+=2;continue}if(K==="[")W=!0;else if(K==="]")W=!1;else if(K==="/"&&!W){U++;break}else if(K===`
3616
- `){U=-1;break}U++}if(U===-1){Y++,J=!1;continue}while(U<X&&/[a-z]/.test($[U]))U++;Y=U,J=!1;continue}if(q==="'"||q==='"'){let U=q;Y++;while(Y<X){if($[Y]==="\\"){Y+=2;continue}if($[Y]===U){Y++;break}if($[Y]===`
3617
- `)break;Y++}J=!1;continue}if(q==="`"){Y++;while(Y<X){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;break}if($[Y]==="$"&&$[Y+1]==="{"){Q.push(!0),Y+=2,J=!0;break}Y++}if(Q.length===0)J=!1;continue}if(q==="}"&&Q.length>0){Q.pop(),Y++;while(Y<X){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++,J=!1;break}if($[Y]==="$"&&$[Y+1]==="{"){Q.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(q));else if(/[)\].\w$]/.test(q))J=!1;else J=!0;Y++}return-1}function Z5($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${X}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!Y)return null;let J=Y.index+Y[0].length,Q=$.indexOf("</script>",J);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:Y.index,end:G+1}}function C9($){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 Y=$.slice(X),J=/^<style\b[^>]*>/i.exec(Y);if(J){let Q=$.toLowerCase().indexOf("</style>",X+J[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(Y))return X;Z=X+1}return-1}function cQ($){let Z=Z5($,"data-stx-runtime");if(!Z)return $;let X=C9($);if(X===-1||X===Z.start)return $;let Y=$.slice(Z.start,Z.end),J=$.slice(0,Z.start)+$.slice(Z.end),Q=C9(J);if(Q===-1)return Y+`
3618
- `+J;return J.slice(0,Q)+Y+`
3619
- `+J.slice(Q)}async function F4($,Z,X,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=J1($);let Q=!Z.__stxProcessingDepth;if(Q)P4(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((Y.debug||!H5()&&!c5())&&X&&X.endsWith(".stx"))h9($,X);try{return await $7.timeAsync("template-processing",async()=>{let G=await pQ($,Z,X,Y,J);if(Q)G=O4(G);if(Q&&Y.autoShell&&Y.buildMode!=="compile"){let q=Y.app?.head||{},W=(Z.__stx_runtime_head||null)??g9(),K=(Z.__stx_head_raw||"").trim(),z,H=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)z=H[1].trim(),K=K.replace(H[0],"").trim();let B=Z.__sections?.title,j=W.title||z||B,_=!W.title&&(!!z||!!B),V=W.meta||[],O=new Set(V.map((N)=>i1(N)).filter(Boolean)),F={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!O.has(i1(N))),...V],link:[...q.link||[],...W.link||[]],script:[...q.script||[],...W.script||[]],headRaw:[q.headRaw,K].filter(Boolean).join(`
3620
- `),...W.htmlAttrs&&{htmlAttrs:E2(q.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...W.bodyAttrs}}},L=l3(G);if(G=C2(G,F,{..._&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),L)G=S2(G,q),G=b2(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],T=f9(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
3621
- <meta name="stx-layout" content="${S9(N)}">
3622
- <meta name="stx-layout-group" content="${S9(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?q5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=g5(G,(T,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=y2(G);let q=Y.app?.colorMode;if(q)G=A2(G,q);G=T2(G),G=cQ(G)}if(Q)try{let{getStoreScript:q}=await a("stx/store-loader",()=>import("./chunk-8gf8p3hq.js")),U=Y.storesDir,W=await q(U);if(W){let K=`<script data-stx-stores>${W}</script>`,z=Z5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
3623
- `+K+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await a("stx/framework-composables",()=>import("./chunk-hdtca0hs.js")),U=await q(G);if(U){let W=Z5(G,"data-stx-stores")||Z5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
3624
- `+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await a("stx/composable-loader",()=>import("./chunk-seac724e.js")),U=Y.composablesDir,W=await q(U,G);if(W){let K=`<script data-stx-composables>${W}</script>`,z=Z5(G,"data-stx-stores")||Z5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
3625
- `+K+G.slice(z.end)}}catch{}if(Q)G=M2(G);if(Q&&Z.__stx_inject_css!==!1)G=await x9(G,void 0,Y.buildMode==="serve");if(Q)G=N2(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof n5)throw G;let q=G instanceof Error?G.message:String(G),U=new L1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(u0.log(U,{filePath:X,context:Z}),Z3.logDetailedError(U,{filePath:X,template:$.substring(0,500)}),Y.debug)throw U;return e$.createFallbackContent("Template Processing",U)}}async function pQ($,Z,X,Y,J){let Q=process.cwd(),G={...Y,partialsDir:Y.partialsDir&&!R0.isAbsolute(Y.partialsDir)?R0.resolve(Q,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!R0.isAbsolute(Y.componentsDir)?R0.resolve(Q,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!R0.isAbsolute(Y.layoutsDir)?R0.resolve(Q,Y.layoutsDir):Y.layoutsDir},q=G,U=$;await sQ(X,Z),nQ(Z,q),U=await h1(()=>G2(U,Z,X,q),U,(L)=>{u0.log(L,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${L.message}`)}),U=U.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=l0(U,Q5,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);U=W.output;let K=W.tokens,z=(L)=>K.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>K[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";U=U.replace(/@@/g,H),U=U.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),U=j2(U),U=await k9(U,X,J);let B={};U=C3(U,B);let j={...Z.__sections||{}},_="",V=O7(_7($)),O=/@nolayout\b/.test(U)||V===!1;if(/@nolayout\b/.test(U))U=U.replace(/@nolayout\b\s*/g,"");let F=U.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)_=F[1],U=U.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof V==="string"){if(_=V,!/@section\s*\(/.test(U))U=`@section('content')
3614
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}cQ();var E1="<!--PARENT_CONTENT_PLACEHOLDER-->";function P9($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function iQ($,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(`
3615
+ `,J+2),J===-1)return-1;J+=1,Y=!0;continue}if(q==="/"&&$[J+1]==="*"){let U=$.indexOf("*/",J+2);if(U===-1)return-1;J=U+2,Y=!0;continue}if(q==="/"&&Y){let U=J+1,W=!1;while(U<X){let K=$[U];if(K==="\\"){U+=2;continue}if(K==="[")W=!0;else if(K==="]")W=!1;else if(K==="/"&&!W){U++;break}else if(K===`
3616
+ `){U=-1;break}U++}if(U===-1){J++,Y=!1;continue}while(U<X&&/[a-z]/.test($[U]))U++;J=U,Y=!1;continue}if(q==="'"||q==='"'){let U=q;J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]===U){J++;break}if($[J]===`
3617
+ `)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 Z5($,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 v9($){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 nQ($){let Z=Z5($,"data-stx-runtime");if(!Z)return $;let X=v9($);if(X===-1||X===Z.start)return $;let J=$.slice(Z.start,Z.end),Y=$.slice(0,Z.start)+$.slice(Z.end),Q=v9(Y);if(Q===-1)return J+`
3618
+ `+Y;return Y.slice(0,Q)+J+`
3619
+ `+Y.slice(Q)}async function w4($,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=Q1($);let Q=!Z.__stxProcessingDepth;if(Q)f4(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!H5()&&!c5())&&X&&X.endsWith(".stx"))d9($,X);try{return await X7.timeAsync("template-processing",async()=>{let G=await sQ($,Z,X,J,Y);if(Q)G=F4(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let q=J.app?.head||{},W=(Z.__stx_runtime_head||null)??u9(),K=(Z.__stx_head_raw||"").trim(),z,H=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)z=H[1].trim(),K=K.replace(H[0],"").trim();let B=Z.__sections?.title,j=W.title||z||B,_=!W.title&&(!!z||!!B),V=W.meta||[],O=new Set(V.map((N)=>i1(N)).filter(Boolean)),F={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!O.has(i1(N))),...V],link:[...q.link||[],...W.link||[]],script:[...q.script||[],...W.script||[]],headRaw:[q.headRaw,K].filter(Boolean).join(`
3620
+ `),...W.htmlAttrs&&{htmlAttrs:y2(q.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...W.bodyAttrs}}},L=p3(G);if(G=v2(G,F,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)G=P2(G,q),G=S2(G,F.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let N=w[1],T=g9(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
3621
+ <meta name="stx-layout" content="${P9(N)}">
3622
+ <meta name="stx-layout-group" content="${P9(T)}">`)}let R=G.match(/function (__stx_setup_\d+_\d+)\(/),D=R?q5(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=g5(G,(T,A)=>`<body${A} data-stx="${R[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=C2(G);let q=J.app?.colorMode;if(q)G=T2(G,q);G=k2(G),G=nQ(G)}if(Q)try{let{getStoreScript:q}=await a("stx/store-loader",()=>import("./chunk-2z6br22w.js")),U=J.storesDir,W=await q(U);if(W){let K=`<script data-stx-stores>${W}</script>`,z=Z5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
3623
+ `+K+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:q}=await a("stx/framework-composables",()=>import("./chunk-e0bk1mqp.js")),U=await q(G);if(U){let W=Z5(G,"data-stx-stores")||Z5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
3624
+ `+U+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:q}=await a("stx/composable-loader",()=>import("./chunk-btgrvrxy.js")),U=J.composablesDir,W=await q(U,G);if(W){let K=`<script data-stx-composables>${W}</script>`,z=Z5(G,"data-stx-stores")||Z5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
3625
+ `+K+G.slice(z.end)}}catch{}if(Q)G=I2(G);if(Q&&Z.__stx_inject_css!==!1)G=await h9(G,void 0,J.buildMode==="serve");if(Q)G=M2(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof n5)throw G;let q=G instanceof Error?G.message:String(G),U=new L1(`Template processing failed: ${q}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(d0.log(U,{filePath:X,context:Z}),X3.logDetailedError(U,{filePath:X,template:$.substring(0,500)}),J.debug)throw U;return $3.createFallbackContent("Template Processing",U)}}async function sQ($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!R0.isAbsolute(J.partialsDir)?R0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!R0.isAbsolute(J.componentsDir)?R0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!R0.isAbsolute(J.layoutsDir)?R0.resolve(Q,J.layoutsDir):J.layoutsDir},q=G,U=$;await aQ(X,Z),rQ(Z,q),U=await h1(()=>U2(U,Z,X,q),U,(L)=>{d0.log(L,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${L.message}`)}),U=U.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=c0(U,Q5,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);U=W.output;let K=W.tokens,z=(L)=>K.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>K[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";U=U.replace(/@@/g,H),U=U.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),U=O2(U),U=await b9(U,X,Y);let B={};U=v3(U,B);let j={...Z.__sections||{}},_="",V=F7(V7($)),O=/@nolayout\b/.test(U)||V===!1;if(/@nolayout\b/.test(U))U=U.replace(/@nolayout\b\s*/g,"");let F=U.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)_=F[1],U=U.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof V==="string"){if(_=V,!/@section\s*\(/.test(U))U=`@section('content')
3626
3626
  ${U.trim()}
3627
- @endsection`}if(!_&&!O&&q.defaultLayout){let L=m3(U),w=/@section\s*\(/.test(U);if(!L||w){let R="",D=R0.dirname(X),N=q.layoutsDir?R0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let A=R0.join(D,"_layout.stx");if(await r(A)){R=A;break}let M=R0.dirname(D);if(M===D||M.length<N.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let T=R0.isAbsolute(q.layoutsDir)?q.layoutsDir:R0.resolve(process.cwd(),q.layoutsDir),A=R0.join(T,`${q.defaultLayout}.stx`);if(await r(A))_=A}if(_&&!w)U=`@section('content')
3627
+ @endsection`}if(!_&&!O&&q.defaultLayout){let L=c3(U),w=/@section\s*\(/.test(U);if(!L||w){let R="",D=R0.dirname(X),N=q.layoutsDir?R0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let A=R0.join(D,"_layout.stx");if(await r(A)){R=A;break}let M=R0.dirname(D);if(M===D||M.length<N.length)break;D=M}if(R)_=R;else if(q.layoutsDir){let T=R0.isAbsolute(q.layoutsDir)?q.layoutsDir:R0.resolve(process.cwd(),q.layoutsDir),A=R0.join(T,`${q.defaultLayout}.stx`);if(await r(A))_=A}if(_&&!w)U=`@section('content')
3628
3628
  ${U.trim()}
3629
- @endsection`}}if(U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return j[w]=R,""}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=X0(R.trim(),Z);if(D===void 0)return L;return j[w]=String(D??""),""}catch{return L}}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))j[w]=R.replace("@parent",E1);else j[w]=R.trim();return""}),Z.__sections=j,U=U.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return j[w]||R||""}),!("slot"in Z)||Z.slot===void 0)U=U.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(U=P3(U,B),_){let L=[],w=c0(U),R=l0(w.output,S1,(D,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(U=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,N,T)=>{let A=N==="SCRIPT"?w.scripts[Number(T)]:R.tokens[Number(T)];if(A)L.push(A);return""}),L.length>0){let D=L.join(`
3629
+ @endsection`}}if(U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,R)=>{return j[w]=R,""}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return L;try{let D=X0(R.trim(),Z);if(D===void 0)return L;return j[w]=String(D??""),""}catch{return L}}),U=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,R)=>{if(R.includes("@parent"))j[w]=R.replace("@parent",E1);else j[w]=R.trim();return""}),Z.__sections=j,U=U.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,R)=>{return j[w]||R||""}),!("slot"in Z)||Z.slot===void 0)U=U.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(U=f3(U,B),_){let L=[],w=p0(U),R=c0(w.output,S1,(D,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(U=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,N,T)=>{let A=N==="SCRIPT"?w.scripts[Number(T)]:R.tokens[Number(T)];if(A)L.push(A);return""}),L.length>0){let D=L.join(`
3630
3630
  `);j.content=j.content?`${j.content}
3631
- ${D}`:D,Z.__sections=j}}if(_)try{let L;if(R0.isAbsolute(_))L=_,J.add(_);else L=await h1(()=>r5(_,X,G,J),null,()=>{throw new L1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!L){let A=(I)=>{if(!I)return[];try{let y=R0.isAbsolute(I)?I:R0.resolve(process.cwd(),I);return mQ.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...A(G.layoutsDir),...A(G.fallbackLayoutsDir)].filter((I,y,E)=>E.indexOf(I)===y).sort(),k=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(u0.log(Error(k),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${k}`),G.debug)throw new L1(k,X);return U}let w=await h1(()=>Bun.file(L).text(),"",()=>{throw new L1(`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 A={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return A[E]=b.trim(),""});for(let[y,E]of Object.entries(A))if(j[y]&&j[y].includes(E1)){let b=j[y].indexOf(E1);j[y]=j[y].slice(0,b)+E+j[y].slice(b+E1.length)}else if(!j[y])j[y]=E;let k={...Z,__sections:j},I=`@layout('${R[1]}')${M}`;return await F4(I,k,L,G,J)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=C3(D,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(A,M,k)=>{return T[M]=k.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(A,M,k)=>{if(j[M]){let I=j[M];if(I.includes(E1)){let y=T[M]||"",E=I.indexOf(E1);I=I.slice(0,E)+y+I.slice(E+E1.length)}return I}return k||""}),N=iQ(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=P3(N,B),Z.__originalFilePath=X,U=await P9(N,Z,L,G,J),U=`<!-- stx-layout: ${_} -->
3632
- ${U}`,z(U)}catch(L){return u0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return z(await P9(U,Z,X,G,J))}function iQ($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,Y,J)=>{let Q=Z[Y];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return J||""})}function nQ($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",Y={};for(let[J,Q]of Object.entries(process.env))if(J.startsWith(X)&&Q!==void 0)Y[J]=Q;$.$env=Y}async function sQ($,Z){await h1(()=>W2($,Z),void 0,(X)=>{u0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function oQ($,Z,X){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec($))!==null){let Q=J[1],G=J[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:U}=await a("stx/variable-extractor",()=>import("./chunk-8a1524ge.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));u0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function rQ($,Z,X){try{let{interpolateScriptsInTemplate:Y}=await a("stx/expressions",()=>import("./chunk-gfgpf7h8.js"));return Y($,Z,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return u0.log(J,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${J.message}`),$}}async function P9($,Z,X,Y,J){let Q=$,G=Y;if(await oQ(Q,Z,X),Q=await rQ(Q,Z,X),Q=await n6(Q,Z,X),Q=await s6(Q,Z,X),Q=await b6(Q,Z,X,G),J1(Q))Q=r2(Q,Z),Q=e2(Q,Z);Q=t2(Q);let{processStreamDirectives:q}=await a("stx/streaming",()=>import("./chunk-a438xffx.js"));Q=q(Q,Z),Q=Z2(Q,Z,X,G),Q=await F2(Q,Z,X,G,J),Q=await B4(Q,Z,X,G,J),Q=j7(Q,Z,X,G);let{processDeferDirectives:U}=await a("stx/defer",()=>import("./chunk-3vy1q9da.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await a("stx/teleport",()=>import("./chunk-rs2fa3g1.js"));Q=W(Q,Z,X);let{processTransitionDirectives:K,processTransitionAttributes:z}=await a("stx/transitions",()=>import("./chunk-7w4c5w2b.js"));Q=K(Q,Z,X),Q=z(Q);let{processErrorBoundaryDirectives:H}=await a("stx/error-boundaries",()=>import("./chunk-qz75kx6n.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await a("stx/suspense",()=>import("./chunk-jr5tp4ks.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await a("stx/async-components",()=>import("./chunk-va9k88da.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await a("stx/keep-alive",()=>import("./chunk-dhpy0h9y.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:V,processVirtualGridDirectives:O,processInfiniteListDirectives:F}=await a("stx/virtual-scrolling",()=>import("./chunk-4pf61rcb.js"));Q=V(Q,Z,X),Q=O(Q,Z,X),Q=F(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await a("stx/partial-hydration",()=>import("./chunk-wtengj6h.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await a("stx/computed",()=>import("./chunk-zda3hvde.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await a("stx/forms-validation",()=>import("./chunk-5s2y052b.js"));Q=N(Q,Z,X);let{processHeadDirective:T,processTitleDirective:A,processMetaDirective:M,resetHead:k}=await a("stx/head",()=>import("./chunk-jpbk42j7.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let I=T(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
3633
- `;if(Q=A(Q,Z),Q=M(Q,Z),Q=U2(Q),Q=B3(Q,Z),Q=E6(Q),Q=J2(Q),Q=await S3(Q,Z,X,G,J),Q=await B4(Q,Z,X,G,J),Z.__stxProcessingDepth===1)Q=f4(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=O4(Q),Q=a0(Q,Z,X),Q=j3(Q,Z),Q=_3(Q,Z),Q=F5(Q,Z),Q=D3(Q,Z),Q=N3(Q,Z),Q=await O6(Q,Z,X,G),Q=await N7(Q,Z,X),Q=await d6(Q,Z,X,G),Q=v9(Q,Z,X,G),Q=Z6(Q,Z,X,G),Q=X6(Q,Z,X),Q=Y6(Q,Z,X,G),Q=I6(Q,Z,X,G),Q=j4(Q,Z),Q=_4(Q),Q=E9(Q),!G.skipEventDirectives)Q=S4(Q,Z,X);if(Q=L7(Q,Z,X),G.debug){let p=/\bx-data\s*=/.test(Q),e=r3($);if(p&&e)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3631
+ ${D}`:D,Z.__sections=j}}if(_)try{let L;if(R0.isAbsolute(_))L=_,Y.add(_);else L=await h1(()=>r5(_,X,G,Y),null,()=>{throw new L1(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!L){let A=(I)=>{if(!I)return[];try{let y=R0.isAbsolute(I)?I:R0.resolve(process.cwd(),I);return pQ.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...A(G.layoutsDir),...A(G.fallbackLayoutsDir)].filter((I,y,E)=>E.indexOf(I)===y).sort(),k=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(d0.log(Error(k),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${k}`),G.debug)throw new L1(k,X);return U}let w=await h1(()=>Bun.file(L).text(),"",()=>{throw new L1(`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 A={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return A[E]=b.trim(),""});for(let[y,E]of Object.entries(A))if(j[y]&&j[y].includes(E1)){let b=j[y].indexOf(E1);j[y]=j[y].slice(0,b)+E+j[y].slice(b+E1.length)}else if(!j[y])j[y]=E;let k={...Z,__sections:j},I=`@layout('${R[1]}')${M}`;return await w4(I,k,L,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=v3(D,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(A,M,k)=>{return T[M]=k.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(A,M,k)=>{if(j[M]){let I=j[M];if(I.includes(E1)){let y=T[M]||"",E=I.indexOf(E1);I=I.slice(0,E)+y+I.slice(E+E1.length)}return I}return k||""}),N=oQ(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=f3(N,B),Z.__originalFilePath=X,U=await f9(N,Z,L,G,Y),U=`<!-- stx-layout: ${_} -->
3632
+ ${U}`,z(U)}catch(L){return d0.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return z(await f9(U,Z,X,G,Y))}function oQ($,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 rQ($,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 aQ($,Z){await h1(()=>z2($,Z),void 0,(X)=>{d0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function tQ($,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:U}=await a("stx/variable-extractor",()=>import("./chunk-66081bkn.js"));await U(G,Z,X,{preserveExisting:!0})}catch(U){let W=U instanceof Error?U:Error(String(U));d0.log(W,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${W.message}`)}}}async function eQ($,Z,X){try{let{interpolateScriptsInTemplate:J}=await a("stx/expressions",()=>import("./chunk-5xpp3z95.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return d0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function f9($,Z,X,J,Y){let Q=$,G=J;if(await tQ(Q,Z,X),Q=await eQ(Q,Z,X),Q=await o6(Q,Z,X),Q=await r6(Q,Z,X),Q=await S6(Q,Z,X,G),Q1(Q))Q=t2(Q,Z),Q=Z9(Q,Z);Q=$9(Q);let{processStreamDirectives:q}=await a("stx/streaming",()=>import("./chunk-vpwjr05r.js"));Q=q(Q,Z),Q=J2(Q,Z,X,G),Q=await w2(Q,Z,X,G,Y),Q=await _4(Q,Z,X,G,Y),Q=O7(Q,Z,X,G);let{processDeferDirectives:U}=await a("stx/defer",()=>import("./chunk-3vy1q9da.js"));Q=U(Q,Z,X);let{processTeleportDirectives:W}=await a("stx/teleport",()=>import("./chunk-rs2fa3g1.js"));Q=W(Q,Z,X);let{processTransitionDirectives:K,processTransitionAttributes:z}=await a("stx/transitions",()=>import("./chunk-7w4c5w2b.js"));Q=K(Q,Z,X),Q=z(Q);let{processErrorBoundaryDirectives:H}=await a("stx/error-boundaries",()=>import("./chunk-qz75kx6n.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:B}=await a("stx/suspense",()=>import("./chunk-jr5tp4ks.js"));Q=B(Q,Z,X);let{processAsyncDirectives:j}=await a("stx/async-components",()=>import("./chunk-va9k88da.js"));Q=j(Q,Z,X);let{processKeepAliveDirectives:_}=await a("stx/keep-alive",()=>import("./chunk-dhpy0h9y.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:V,processVirtualGridDirectives:O,processInfiniteListDirectives:F}=await a("stx/virtual-scrolling",()=>import("./chunk-4pf61rcb.js"));Q=V(Q,Z,X),Q=O(Q,Z,X),Q=F(Q,Z,X);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await a("stx/partial-hydration",()=>import("./chunk-wtengj6h.js"));Q=L(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await a("stx/computed",()=>import("./chunk-zda3hvde.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:N}=await a("stx/forms-validation",()=>import("./chunk-5s2y052b.js"));Q=N(Q,Z,X);let{processHeadDirective:T,processTitleDirective:A,processMetaDirective:M,resetHead:k}=await a("stx/head",()=>import("./chunk-jpbk42j7.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let I=T(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
3633
+ `;if(Q=A(Q,Z),Q=M(Q,Z),Q=K2(Q),Q=_3(Q,Z),Q=y6(Q),Q=G2(Q),Q=await P3(Q,Z,X,G,Y),Q=await _4(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=g4(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=F4(Q),Q=t0(Q,Z,X),Q=O3(Q,Z),Q=V3(Q,Z),Q=F5(Q,Z),Q=A3(Q,Z),Q=M3(Q,Z),Q=await F6(Q,Z,X,G),Q=await M7(Q,Z,X),Q=await l6(Q,Z,X,G),Q=x9(Q,Z,X,G),Q=J6(Q,Z,X,G),Q=Y6(Q,Z,X),Q=Q6(Q,Z,X,G),Q=E6(Q,Z,X,G),Q=O4(Q,Z),Q=V4(Q),Q=y9(Q),!G.skipEventDirectives)Q=P4(Q,Z,X);if(Q=R7(Q,Z,X),G.debug){let p=/\bx-data\s*=/.test(Q),e=t3($);if(p&&e)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3634
3634
  Both work on the same page, but they manage separate scopes.
3635
- Prefer signals (state/derived/effect) for new components.`)}Q=H2(Q,Z),Q=await _1(Q,Z,X),Q=b9(Q),Q=y9(Q),Q=G7(Q);let{processXElementDirectives:y}=await a("stx/x-element",()=>import("./chunk-wnaddtv3.js"));Q=y(Q);let E=Z.__originalFilePath||X,b=D$(Z);if(Q=await $9(Q,G,E,b),Q=P6(Q,Z),Q=await q2(Q,Z,X,G),G.media?.image?.autoSiblings){let p=G.publicDir||"public",{rewriteImagesWithSiblings:e}=await a("stx/image-optimization/auto-sibling",()=>import("./chunk-6bxcjdp4.js"));Q=await e(Q,{publicDir:p})}if(G.seo?.enabled)Q=J6(Q,Z,G);let C=(p,e,J0=!0)=>{if(!e)return p;let T0=e.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),F0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(T0&&F0){if(J0)p=p.replace(F0[0],T0[0]);if(e=e.replace(T0[0],"").trim(),!e)return p}if(/<\/head>/i.test(p))return p.replace(/<\/head>/i,`${e}
3635
+ Prefer signals (state/derived/effect) for new components.`)}Q=j2(Q,Z),Q=await _1(Q,Z,X),Q=S9(Q),Q=C9(Q),Q=U7(Q);let{processXElementDirectives:y}=await a("stx/x-element",()=>import("./chunk-wnaddtv3.js"));Q=y(Q);let E=Z.__originalFilePath||X,b=N$(Z);if(Q=await X9(Q,G,E,b),Q=f6(Q,Z),Q=await W2(Q,Z,X,G),G.media?.image?.autoSiblings){let p=G.publicDir||"public",{rewriteImagesWithSiblings:e}=await a("stx/image-optimization/auto-sibling",()=>import("./chunk-6bxcjdp4.js"));Q=await e(Q,{publicDir:p})}if(G.seo?.enabled)Q=G6(Q,Z,G);let C=(p,e,Y0=!0)=>{if(!e)return p;let I0=e.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),F0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(I0&&F0){if(Y0)p=p.replace(F0[0],I0[0]);if(e=e.replace(I0[0],"").trim(),!e)return p}if(/<\/head>/i.test(p))return p.replace(/<\/head>/i,`${e}
3636
3636
  </head>`);if(/<head\b[^>]*>/i.test(p))return p.replace(/(<head\b[^>]*>)/i,`$1
3637
3637
  ${e}`);if(/<html\b[^>]*>/i.test(p))return p.replace(/(<html\b[^>]*>)/i,`$1
3638
3638
  <head>
3639
3639
  ${e}
3640
- </head>`);return p},{renderHead:x,getHead:f}=await a("stx/head",()=>import("./chunk-jpbk42j7.js")),m=Z.__stx_runtime_head??f();if(m.title||m.meta?.length||m.link?.length){let p=x(m);if(p)Q=C(Q,p)}if(I.headContent)Q=C(Q,I.headContent,!m.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=M6(Q,G.csp,Z);if(G.analytics?.enabled)Q=U7(Q,G);if(G.heatmap?.enabled)Q=K7(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:p}=await a("stx/pwa/inject",()=>import("./chunk-mtr2f82n.js"));Q=p(Q,G)}let V0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),A0=/\bSTX\.\w+/.test(Q),M0=/window\.STX\s*=/.test(Q);if(V0&&A0&&!M0){let e=`<script data-stx-scoped data-stx-run="once">
3641
- ${Y7()}
3642
- </script>`;if(Q.includes("</head>")){let J0=Q.indexOf("</head>"),F0=Q.slice(0,J0).indexOf("<script");if(F0!==-1){let P0=Q.slice(0,F0),S=Q.slice(F0);Q=P0+e+`
3640
+ </head>`);return p},{renderHead:x,getHead:f}=await a("stx/head",()=>import("./chunk-jpbk42j7.js")),m=Z.__stx_runtime_head??f();if(m.title||m.meta?.length||m.link?.length){let p=x(m);if(p)Q=C(Q,p)}if(I.headContent)Q=C(Q,I.headContent,!m.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=I6(Q,G.csp,Z);if(G.analytics?.enabled)Q=K7(Q,G);if(G.heatmap?.enabled)Q=H7(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:p}=await a("stx/pwa/inject",()=>import("./chunk-mtr2f82n.js"));Q=p(Q,G)}let V0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),M0=/\bSTX\.\w+/.test(Q),T0=/window\.STX\s*=/.test(Q);if(V0&&M0&&!T0){let e=`<script data-stx-scoped data-stx-run="once">
3641
+ ${Q7()}
3642
+ </script>`;if(Q.includes("</head>")){let Y0=Q.indexOf("</head>"),F0=Q.slice(0,Y0).indexOf("<script");if(F0!==-1){let P0=Q.slice(0,F0),S=Q.slice(F0);Q=P0+e+`
3643
3643
  `+S}else Q=Q.replace("</head>",`${e}
3644
3644
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
3645
3645
  ${e}`);else Q=e+`
3646
- `+Q}{let{scanScriptTags:p}=await a("stx/signal-processing",()=>import("./chunk-wzytd8fh.js")),e=[];for(let J0 of p(Q)){if(!/\bserver\b/i.test(J0.attrs))continue;let T0=J0.start+J0.fullMatch.indexOf(">")+1,F0=lQ(Q,T0);if(F0===-1)continue;let P0=F0+9;while(P0<Q.length&&/\s/.test(Q[P0]))P0++;e.push({start:J0.start,end:P0})}for(let J0=e.length-1;J0>=0;J0--){let{start:T0,end:F0}=e[J0];Q=Q.substring(0,T0)+Q.substring(F0)}}let g0=W$(Q,X);if(g0.hasScoped)Q=g0.html;let t=Z.__stx_event_bindings||[],K0=!1,q0=[],B1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:Y5}=await a("stx/signal-processing",()=>import("./chunk-wzytd8fh.js"));for(let p of Y5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))q0.push({match:p.fullMatch,attrs:p.attrs,content:p.body});for(let{match:p,attrs:e,content:J0}of q0){K0=!0;let T0=J0;V4(J0,X,Y.strict,Z.__originalFilePath);let F0=await N$(J0,{eventBindings:t,attrs:e,hasColonDirectives:B1,templateContent:$,filePath:X,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:b});Q=Q.replace(p,()=>F0)}if(K0)Z.__stx_event_bindings=[];if(!K0&&Z.__stxProcessingDepth===1){let p=Z.__stx_event_bindings||[];if(p.length>0){let e=k$(p);if(e){let J0=Q.lastIndexOf("</body>");Q=J0===-1?Q+e:Q.slice(0,J0)+e+`
3647
- `+Q.slice(J0)}Z.__stx_event_bindings=[]}}if(!h2(Q)&&u2(Q))Q=await B$(Q,G);if(Q=d2(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=T6(Q,Z.cspNonce);return Q}var aQ=[{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"}],tQ=[{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')"}],eQ=[{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 $G($){let Z=[],X=[];return ZG($,Z),XG($,Z,X),YG($,X),JG($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function ZG($,Z){let X=($.match(/\{\{/g)||[]).length,Y=($.match(/\}\}/g)||[]).length;if(X!==Y)Z.push({type:"expression",message:`Unclosed expression brackets: found ${X} opening '{{' and ${Y} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function XG($,Z,X){for(let Y of aQ){let J=new RegExp(`${Y.open}(?:\\s|\\()`,"g"),Q=new RegExp(Y.close,"g"),G=($.match(J)||[]).length,q=($.match(Q)||[]).length;if(Y.altClose){let U=new RegExp(Y.altClose,"g");q+=($.match(U)||[]).length}if(G>q)Z.push({type:"directive",message:`Unclosed @${Y.name} directive: found ${G} opening and ${q} closing`,suggestion:`Add ${G-q} missing ${Y.close} tag(s)`});else if(q>G)X.push({type:"directive",message:`Extra ${Y.close} found: ${q-G} more closing than opening`,suggestion:`Check for orphaned ${Y.close} tags`})}}function YG($,Z){for(let X of tQ)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function JG($,Z){for(let X of eQ)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function QG($,Z){let X=$.slice(0,Z).split(`
3648
- `);return{line:X.length,column:X[X.length-1].length+1}}function GG($,Z,X){let Y=[];switch($){case"if":case"elseif":case"unless":if(X.length===0)Y.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(X.length===0||!X[0].includes(" as "))Y.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)Y.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(X.length===0)Y.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(X.length===0)Y.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(X.length===0)Y.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return Y}function qG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function UG($){let Z=$.matchAll(/@([a-z]+)/gi),X=new Set;for(let Y of Z){let J=Y[1].toLowerCase();if(!J.startsWith("end"))X.add(J)}return Array.from(X)}import n0 from"path";import X5 from"process";var n9=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","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"],u9=new Set(n9),WG=new Set(["props","$props","defineProps"]),KG=new Set(["stx","@stacksjs/stx"]);function zG($){let Z=[],X=0,Y=$.split(`
3649
- `);for(let J of Y){let Q=X,G=null,q=!1;for(let U=0;U<J.length;U++){let W=J[U];if(q){q=!1;continue}if(W==="\\"){q=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&U+1<J.length&&J[U+1]==="/")break;if(W==="{")X++;else if(W==="}")X--}if(Q===0){let U=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(U)Z.push(U[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let W=J.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[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 HG($){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(Y){if(!Y.includes(":"))return Y;let J=[],Q="",G=0,q=0,U=null;for(let W=0;W<Y.length;W++){let K=Y[W];if(U){if(Q+=K,K===U)U=null;continue}if(K==='"'||K==="'"||K==="`"){U=K,Q+=K;continue}if(K==="<")G++;else if(K===">"&&G>0)G--;else if(K==="(")q++;else if(K===")")q--;if(K===","&&G===0&&q===0){J.push(Q),Q="";continue}Q+=K}if(Q)J.push(Q);return J.map((W)=>{let K=W.trim(),z=K.startsWith("..."),H=z?K.slice(3):K,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 W;let V=H.substring(0,B).trim().replace(/\?$/,""),O=H.substring(B+1),F=-1,L=0;for(let R=0;R<O.length;R++)if(O[R]==="<")L++;else if(O[R]===">")L--;else if(O[R]==="="&&L===0){F=R;break}let w=z?"...":"";if(F!==-1)return`${w}${V} = ${O.substring(F+1).trim()}`;return`${w}${V}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,Q)=>{if(!Q.includes(":"))return Y;return`${J}(${X(Q)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,Q=[];while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,q=1,U=G+1,W=0,K=null;while(U<Z.length&&q>0){let B=Z[U];if(K){if(B===K)K=null;U++;continue}if(B==='"'||B==="'"||B==="`"){K=B,U++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")q++;else if(B===")")q--}if(q>0)U++}if(q!==0)continue;let z=Z.substring(G+1,U);if(!z.includes(":"))continue;let H=X(z);Q.push({start:G+1,end:U,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:q,end:U,replacement:W}=Q[G];Z=Z.substring(0,q)+W+Z.substring(U)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((G)=>{let[q,...U]=G.split("="),W=q.split(":")[0].trim();if(U.length>0)return`${W} = ${U.join("=").trim()}`;return W}).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,`
3646
+ `+Q}{let{scanScriptTags:p}=await a("stx/signal-processing",()=>import("./chunk-5dxctm6h.js")),e=[];for(let Y0 of p(Q)){if(!/\bserver\b/i.test(Y0.attrs))continue;let I0=Y0.start+Y0.fullMatch.indexOf(">")+1,F0=iQ(Q,I0);if(F0===-1)continue;let P0=F0+9;while(P0<Q.length&&/\s/.test(Q[P0]))P0++;e.push({start:Y0.start,end:P0})}for(let Y0=e.length-1;Y0>=0;Y0--){let{start:I0,end:F0}=e[Y0];Q=Q.substring(0,I0)+Q.substring(F0)}}let h0=K$(Q,X);if(h0.hasScoped)Q=h0.html;let t=Z.__stx_event_bindings||[],K0=!1,q0=[],B1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:J5}=await a("stx/signal-processing",()=>import("./chunk-5dxctm6h.js"));for(let p of J5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))q0.push({match:p.fullMatch,attrs:p.attrs,content:p.body});for(let{match:p,attrs:e,content:Y0}of q0){K0=!0;let I0=Y0;L4(Y0,X,J.strict,Z.__originalFilePath);let F0=await A$(Y0,{eventBindings:t,attrs:e,hasColonDirectives:B1,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(p,()=>F0)}if(K0)Z.__stx_event_bindings=[];if(!K0&&Z.__stxProcessingDepth===1){let p=Z.__stx_event_bindings||[];if(p.length>0){let e=E$(p);if(e){let Y0=Q.lastIndexOf("</body>");Q=Y0===-1?Q+e:Q.slice(0,Y0)+e+`
3647
+ `+Q.slice(Y0)}Z.__stx_event_bindings=[]}}if(!d2(Q)&&m2(Q))Q=await j$(Q,G);if(Q=l2(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=k6(Q,Z.cspNonce);return Q}var $G=[{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"}],ZG=[{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')"}],XG=[{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 JG($){let Z=[],X=[];return YG($,Z),QG($,Z,X),GG($,X),qG($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function YG($,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 QG($,Z,X){for(let J of $G){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 U=new RegExp(J.altClose,"g");q+=($.match(U)||[]).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 GG($,Z){for(let X of ZG)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function qG($,Z){for(let X of XG)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function UG($,Z){let X=$.slice(0,Z).split(`
3648
+ `);return{line:X.length,column:X[X.length-1].length+1}}function WG($,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 KG($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function zG($){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 s0 from"path";import X5 from"process";var o9=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","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"],m9=new Set(o9),HG=new Set(["props","$props","defineProps"]),BG=new Set(["stx","@stacksjs/stx"]);function jG($){let Z=[],X=0,J=$.split(`
3649
+ `);for(let Y of J){let Q=X,G=null,q=!1;for(let U=0;U<Y.length;U++){let W=Y[U];if(q){q=!1;continue}if(W==="\\"){q=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&U+1<Y.length&&Y[U+1]==="/")break;if(W==="{")X++;else if(W==="}")X--}if(Q===0){let U=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(U)Z.push(U[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let W=Y.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[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 _G($){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,U=null;for(let W=0;W<J.length;W++){let K=J[W];if(U){if(Q+=K,K===U)U=null;continue}if(K==='"'||K==="'"||K==="`"){U=K,Q+=K;continue}if(K==="<")G++;else if(K===">"&&G>0)G--;else if(K==="(")q++;else if(K===")")q--;if(K===","&&G===0&&q===0){Y.push(Q),Q="";continue}Q+=K}if(Q)Y.push(Q);return Y.map((W)=>{let K=W.trim(),z=K.startsWith("..."),H=z?K.slice(3):K,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 W;let V=H.substring(0,B).trim().replace(/\?$/,""),O=H.substring(B+1),F=-1,L=0;for(let R=0;R<O.length;R++)if(O[R]==="<")L++;else if(O[R]===">")L--;else if(O[R]==="="&&L===0){F=R;break}let w=z?"...":"";if(F!==-1)return`${w}${V} = ${O.substring(F+1).trim()}`;return`${w}${V}`}).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,U=G+1,W=0,K=null;while(U<Z.length&&q>0){let B=Z[U];if(K){if(B===K)K=null;U++;continue}if(B==='"'||B==="'"||B==="`"){K=B,U++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")q++;else if(B===")")q--}if(q>0)U++}if(q!==0)continue;let z=Z.substring(G+1,U);if(!z.includes(":"))continue;let H=X(z);Q.push({start:G+1,end:U,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:q,end:U,replacement:W}=Q[G];Z=Z.substring(0,q)+W+Z.substring(U)}}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,...U]=G.split("="),W=q.split(":")[0].trim();if(U.length>0)return`${W} = ${U.join("=").trim()}`;return W}).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,`
3650
3650
 
3651
- `),Z}function BG($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function jG($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function _G($,Z,X,Y={}){if(!$.trim())return;let J;try{let S=w4({loader:"ts",target:"browser",define:e1()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=S.transformSync(v)}catch{J=HG($)}let Q={exports:{}},G=Q.exports,q=X5.cwd(),U={},W=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S)),K=new Map;for(let S of W)try{if(S.startsWith(".")){U[S]=await import(n0.resolve(n0.dirname(X),S));continue}let v=n0.resolve(q,"node_modules",S),d=n0.join(v,"package.json"),P=JSON.parse(h("fs").readFileSync(d,"utf8")),u=P.main||"index.js";if(P.exports){let s=typeof P.exports==="string"?P.exports:P.exports["."];if(typeof s==="string")u=s;else if(s?.bun)u=s.bun;else if(s?.import)u=s.import;else if(s?.default)u=s.default}U[S]=await import(n0.resolve(v,u))}catch(v){if(S.startsWith("."))K.set(S,v instanceof Error?v.message:String(v))}let z=(S)=>{if(U[S])return U[S];let v=K.get(S);if(v!==void 0)throw Error(`Cannot require '${S}' from ${X}: ${v}`);return h(S)},H=Z.props||{},B=(S)=>{if(!S)return H;let v={};for(let[d,P]of Object.entries(S)){let u=H[d];if(u!==void 0)v[d]=u;else if(typeof P==="function")v[d]=P();else v[d]=P}return v};for(let[S,v]of Object.entries(H))Object.defineProperty(B,S,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(H,S))continue;try{Object.defineProperty(B,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let j=(S)=>{if(!S)return H;let v={...H};for(let[d,P]of Object.entries(S)){let u=P&&typeof P==="object"&&!Array.isArray(P)?P:{type:P};if(v[d]===void 0&&u.default!==void 0)v[d]=typeof u.default==="function"?u.default():u.default}return v},_=()=>Z.slots||{},V=(S,v)=>{let d={...S};for(let[P,u]of Object.entries(v))if(d[P]===void 0)if(typeof u==="function")d[P]=u();else d[P]=u;return d},O=(S)=>{let v=()=>S;return v.set=(d)=>{},v.update=(d)=>{},v},F=(S)=>{let v,d=!1;return()=>{if(!d)try{v=S(),d=!0}catch{v=void 0}return v}},L=(S)=>{},w=(S)=>S(),R=(S)=>{},D=(S)=>{};function N(S){let v=S||{};if(v.title!==void 0||v.description!==void 0)I({title:v.title,description:v.description})}function T(S){if(!S||typeof S!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,S),Z.__stxClientPayload=v}let A=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",d=S?.path??"",P=Object.fromEntries(new URLSearchParams(v)),u=Z.query,s=Object.keys(P).length>0?P:u??{},o=v||(Object.keys(s).length>0?`?${new URLSearchParams(s).toString()}`:"");return{params:Z.params??{},query:s,path:d,name:"",fullPath:d+o,hash:"",matched:[]}},M=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),k=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=o5(v,S||{})},I=(S)=>{k(i9(S||{}))},y=(S)=>({value:S}),E=(S)=>S,b=(S)=>({value:typeof S==="function"?S():S}),C=(S,v)=>{},x=(S)=>{},f=(S)=>{},n=(S)=>S?S():Promise.resolve(),m=(S)=>(v,...d)=>{},V0=(S)=>{},A0=(S,v)=>{},M0=(S,v)=>v,g0=()=>({value:"light"}),t=()=>O(!1),K0=(S)=>O(!1),q0=()=>O(!1),B1=()=>K0("(prefers-color-scheme: dark)"),Y5=()=>K0("(prefers-color-scheme: light)"),p=()=>K0("(prefers-reduced-motion: reduce)"),e=()=>K0("(prefers-contrast: more)"),J0={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:{}},T0=new Proxy(J0,{get(S,v){if(v in S)return S[v];return},set(S,v,d){return S[v]=d,!0}}),F0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},P0=console;try{let S=s9(J,X),v=new Set(Object.keys(H)),d=(i)=>/^[a-z_$][\w$]*$/i.test(i),P=Object.keys(Z).filter((i)=>!v.has(i)&&!WG.has(i)&&d(i)),u=P.map((i)=>Z[i]);if(!P.includes("__stxServeContext"))P.push("__stxServeContext"),u.push(void 0);let s=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"]),o=[],z0=[];for(let[i,Y0]of Object.entries(H)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(s.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(S))continue;o.push(i),z0.push(Y0)}let $1=zG(S).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
3652
- `),E0=Z.params??{},D0=[],v0=[];for(let i=0;i<P.length;i++){if(P[i]==="params")continue;D0.push(P[i]),v0.push(u[i])}let Z1=await Function(...n9,...o,...D0,`return (async () => {
3651
+ `),Z}function OG($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function VG($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function FG($,Z,X,J={}){if(!$.trim())return;let Y;try{let S=D4({loader:"ts",target:"browser",define:e1()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=S.transformSync(v)}catch{Y=_G($)}let Q={exports:{}},G=Q.exports,q=X5.cwd(),U={},W=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S)),K=new Map;for(let S of W)try{if(S.startsWith(".")){U[S]=await import(s0.resolve(s0.dirname(X),S));continue}let v=s0.resolve(q,"node_modules",S),d=s0.join(v,"package.json"),P=JSON.parse(h("fs").readFileSync(d,"utf8")),u=P.main||"index.js";if(P.exports){let s=typeof P.exports==="string"?P.exports:P.exports["."];if(typeof s==="string")u=s;else if(s?.bun)u=s.bun;else if(s?.import)u=s.import;else if(s?.default)u=s.default}U[S]=await import(s0.resolve(v,u))}catch(v){if(S.startsWith("."))K.set(S,v instanceof Error?v.message:String(v))}let z=(S)=>{if(U[S])return U[S];let v=K.get(S);if(v!==void 0)throw Error(`Cannot require '${S}' from ${X}: ${v}`);return h(S)},H=Z.props||{},B=(S)=>{if(!S)return H;let v={};for(let[d,P]of Object.entries(S)){let u=H[d];if(u!==void 0)v[d]=u;else if(typeof P==="function")v[d]=P();else v[d]=P}return v};for(let[S,v]of Object.entries(H))Object.defineProperty(B,S,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(H,S))continue;try{Object.defineProperty(B,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let j=(S)=>{if(!S)return H;let v={...H};for(let[d,P]of Object.entries(S)){let u=P&&typeof P==="object"&&!Array.isArray(P)?P:{type:P};if(v[d]===void 0&&u.default!==void 0)v[d]=typeof u.default==="function"?u.default():u.default}return v},_=()=>Z.slots||{},V=(S,v)=>{let d={...S};for(let[P,u]of Object.entries(v))if(d[P]===void 0)if(typeof u==="function")d[P]=u();else d[P]=u;return d},O=(S)=>{let v=()=>S;return v.set=(d)=>{},v.update=(d)=>{},v},F=(S)=>{let v,d=!1;return()=>{if(!d)try{v=S(),d=!0}catch{v=void 0}return v}},L=(S)=>{},w=(S)=>S(),R=(S)=>{},D=(S)=>{};function N(S){let v=S||{};if(v.title!==void 0||v.description!==void 0)I({title:v.title,description:v.description})}function T(S){if(!S||typeof S!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,S),Z.__stxClientPayload=v}let A=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",d=S?.path??"",P=Object.fromEntries(new URLSearchParams(v)),u=Z.query,s=Object.keys(P).length>0?P:u??{},o=v||(Object.keys(s).length>0?`?${new URLSearchParams(s).toString()}`:"");return{params:Z.params??{},query:s,path:d,name:"",fullPath:d+o,hash:"",matched:[]}},M=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),k=(S)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=o5(v,S||{})},I=(S)=>{k(s9(S||{}))},y=(S)=>({value:S}),E=(S)=>S,b=(S)=>({value:typeof S==="function"?S():S}),C=(S,v)=>{},x=(S)=>{},f=(S)=>{},n=(S)=>S?S():Promise.resolve(),m=(S)=>(v,...d)=>{},V0=(S)=>{},M0=(S,v)=>{},T0=(S,v)=>v,h0=()=>({value:"light"}),t=()=>O(!1),K0=(S)=>O(!1),q0=()=>O(!1),B1=()=>K0("(prefers-color-scheme: dark)"),J5=()=>K0("(prefers-color-scheme: light)"),p=()=>K0("(prefers-reduced-motion: reduce)"),e=()=>K0("(prefers-contrast: more)"),Y0={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:{}},I0=new Proxy(Y0,{get(S,v){if(v in S)return S[v];return},set(S,v,d){return S[v]=d,!0}}),F0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},P0=console;try{let S=r9(Y,X),v=new Set(Object.keys(H)),d=(i)=>/^[a-z_$][\w$]*$/i.test(i),P=Object.keys(Z).filter((i)=>!v.has(i)&&!HG.has(i)&&d(i)),u=P.map((i)=>Z[i]);if(!P.includes("__stxServeContext"))P.push("__stxServeContext"),u.push(void 0);let s=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"]),o=[],z0=[];for(let[i,J0]of Object.entries(H)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(s.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(S))continue;o.push(i),z0.push(J0)}let Z1=jG(S).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
3652
+ `),b0=Z.params??{},D0=[],v0=[];for(let i=0;i<P.length;i++){if(P[i]==="params")continue;D0.push(P[i]),v0.push(u[i])}let X1=await Function(...o9,...o,...D0,`return (async () => {
3653
3653
  ${S}
3654
- ${$1}
3654
+ ${Z1}
3655
3655
  return module.exports
3656
- })()`)(Q,G,z,H,B,j,V,T,O,F,L,w,R,D,N,A,M,k,I,y,E,b,C,x,f,n,m,V0,_,A0,M0,g0,t,K0,q0,B1,Y5,p,e,T0,F0,P0,J0.confirm,J0.alert,J0.fetch,E0,...z0,...v0);if(Y.preserveExisting){for(let[i,Y0]of Object.entries(Z1))if(!(i in Z)||Z[i]===void 0)Z[i]=Y0}else Object.assign(Z,Z1);for(let[i,Y0]of Object.entries(H))if(!(i in Z))Z[i]=Y0}catch(S){let v=S instanceof Error?S.message:String(S);if(BG(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(jG(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(X5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${X??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await NG(J,Z,X)}catch(d){if(X5.env.STX_DEBUG){let P=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${X??"<unknown>"}: ${P}`)}}}}function OG($){let Z=0,X=null,Y=!1,J=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G===X){if(X=null,Y||Z===0)J=!0}continue}if(G==="'"||G==='"'||G==="`"){X=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)Y=!0}return X===null&&Z===0&&J}var VG=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function s9($,Z){let X=Z?n0.dirname(Z):X5.cwd(),Y=X5.cwd(),J=$.split(`
3657
- `),Q=[],G=0;while(G<J.length){let q=J[G].trim();if(q.startsWith("interface ")||q.startsWith("export interface ")||q.startsWith("type ")||q.startsWith("export type ")){if(q.includes("{")&&!q.includes("}")){let U=0;for(;G<J.length;G++){for(let W of J[G])if(W==="{")U++;else if(W==="}")U--;if(U<=0)break}}G++;continue}if(q.startsWith("definePageMeta(")){let U=0,W=!1,K=G;for(let B=G;B<J.length&&!W;B++){let j=null,_=!1,V=J[B];for(let O=0;O<V.length;O++){let F=V[O];if(_){_=!1;continue}if(F==="\\"){_=!0;continue}if(j){if(F===j)j=null;continue}if(F==='"'||F==="'"||F==="`"){j=F;continue}if(F==="(")U++;else if(F===")"){if(U--,U===0){G=B+1,W=!0;break}}}}if(!W)G=J.length;let z=J.slice(K,G).join(`
3658
- `),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 U=q,W=0;while(!OG(U)&&G+W+1<J.length)W++,U=`${U} ${J[G+W].trim()}`;G+=W;let K=U.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=U.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=U.match(/^import\s+['"](.+?)['"]/),B=U,j=(_)=>{if(_.startsWith("."))return n0.resolve(X,_);if(_.startsWith("~/")||_.startsWith("@/"))return n0.resolve(Y,_.slice(2));return _};if(K){let[,_,V]=K,O=j(V);Q.push(`const ${_} = (await import('${O}')).default`),Q.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,V]=z,O=j(V),F=[],L=[],w=KG.has(V);for(let R of _.split(",")){let D=R.trim();if(!D)continue;let N=D.split(/\s+as\s+/);if(N.length===2){let[T,A]=[N[0].trim(),N[1].trim()];if(w&&u9.has(T)){Q.push(`const ${A} = ${T};`);continue}F.push(`${T}: ${A}`),L.push(A)}else{if(w&&u9.has(D))continue;F.push(D),L.push(D)}}if(F.length>0)Q.push(`const { ${F.join(", ")} } = await import('${O}')`);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(VG.test(q))Q.push(J[G]),G++;else if(q.startsWith("export const ")||q.startsWith("export let ")||q.startsWith("export var ")){let U=m9(J,G),{type:W,name:K,value:z}=U;Q.push(`${W} ${K} = ${z};`),Q.push(`module.exports.${K} = ${K};`),G=U.nextIndex}else if(q.startsWith("export function ")||q.startsWith("export async function ")){let U=L4(J,G);Q.push(U.functionCode),Q.push(`module.exports.${U.name} = ${U.name};`),G=U.nextIndex}else if(q.startsWith("const ")||q.startsWith("let ")||q.startsWith("var ")){let U=m9(J,G),{type:W,name:K,value:z}=U;Q.push(`${W} ${K} = ${z};`),Q.push(`module.exports.${K} = ${K};`),G=U.nextIndex}else if(q.startsWith("function ")||q.startsWith("async function ")){let U=L4(J,G);Q.push(U.functionCode),Q.push(`module.exports.${U.name} = ${U.name};`),G=U.nextIndex}else if(q.startsWith("export default function ")||q.startsWith("export default async function ")){let U=J[G].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...J];W[G]=U;let K=L4(W,G);if(Q.push(K.functionCode),K.name)Q.push(`module.exports.default = ${K.name};`);G=K.nextIndex}else if(q.startsWith("export default ")){let U=q.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${U};`),G++}else if(q.startsWith("class ")||q.startsWith("export class ")){let U=q.match(/(?:export\s+)?class\s+(\w+)/);if(U){let W=U[1],K=J[G].replace(/^export\s+/,""),z=0,H=G;for(;H<J.length;H++){let B=J[H];for(let j of B)if(j==="{")z++;else if(j==="}")z--;if(H>G)K+=`
3659
- `+B;if(z<=0&&H>=G)break}Q.push(K),Q.push(`module.exports.${W} = ${W};`),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 FG(Q.join(`
3660
- `),X,Y)}function FG($,Z,X){let Y=$.length,J="",Q=0,G=null,q=!1,U=!1,W=0;while(Q<Y){let K=$[Q],z=$[Q+1];if(q){if(J+=K,K===`
3661
- `)q=!1;Q++;continue}if(U){if(J+=K,K==="*"&&z==="/"){J+=z,Q+=2,U=!1;continue}Q++;continue}if(!G&&K==="/"&&z==="/"){q=!0,J+=K,Q++;continue}if(!G&&K==="/"&&z==="*"){U=!0,J+=K,Q++;continue}if(G){if(J+=K,K==="\\"){J+=z,Q+=2;continue}if(K===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(K==="$"&&z==="{"){W++,J+=z,Q+=2;continue}if(K==="`"){G=null,Q++;continue}}Q++;continue}if(W>0){if(K==="{")W++;else if(K==="}")W--}if(K==='"'||K==="'"||K==="`"){G=K,J+=K,Q++;continue}if(K==="a"&&$.startsWith("await",Q)){let H=LG($,Q);if(H){let{quote:B,path:j,end:_}=H;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let V=j.startsWith(".")?n0.resolve(Z,j):n0.resolve(X,j.slice(2));J+=`await import(${B}${V}${B})`,Q=_;continue}}}J+=K,Q++}return J}function LG($,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 Y=$[X];if(Y!=="'"&&Y!=='"')return null;X++;let J=X;while(X<$.length&&$[X]!==Y)if($[X]==="\\")X+=2;else X++;if(X>=$.length)return null;let Q=$.slice(J,X);X++;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!==")")return null;return{quote:Y,path:Q,end:X+1}}function o9($,Z){let X=$[Z];if(X!=="{"&&X!=="[")return null;let J=H0($,X,X==="{"?"}":"]",Z);if(J===-1)return null;return{pattern:$.slice(Z,J+1),endPos:J+1}}function r9($){let Z=[],X=$.slice(1,-1).trim();if(!X)return Z;let Y=0,J=0,Q="";while(Y<X.length){let G=X[Y];if(G==="{"||G==="["){let q=J===0?o9(X,Y):null;if(q){Z.push(...r9(q.pattern)),Y=q.endPos,Q="";continue}J++}else if(G==="}"||G==="]")J--;if(J>0){Y++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",Y++;continue}if(G===":"){Q="",Y++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",Y++;while(Y<X.length&&X[Y]!==","&&J===0){if(X[Y]==="{"||X[Y]==="[")J++;else if(X[Y]==="}"||X[Y]==="]")J--;Y++}continue}if(/[\w$]/.test(G))Q+=G;Y++}if(Q.trim())Z.push(Q.trim());return Z}function wG($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let X=Z[0].length,Y=(J)=>J===" "||J==="\t";while(X<$.length&&Y($[X]))X++;if($[X]===":"){let J=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==="<"){J++;continue}if(G===")"||G==="]"||G==="}"||G===">"){J--;continue}if(G==="="&&J<=0){let q=$[X+1],U=$[X-1];if(q!=="="&&q!==">"&&U!=="="&&U!=="!"&&U!=="<"&&U!==">")break}}if($[X]!=="=")return null}while(X<$.length&&Y($[X]))X++;if($[X]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(X+1).trim()}}function d9($,Z,X,Y){let J=null,Q=!1;for(let G of $){if(Q){Q=!1;continue}if(G==="\\"){Q=!0;continue}if(J){if(G===J)J=null;continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G===Z)Y++;else if(G===X)Y--}return Y}function m9($,Z){let X=$[Z].trim(),Y=wG(X),J=Y?[X,Y.type,Y.name,Y.value]:null;if(!J){let K=X.match(/^(?:export\s+)?(const|let|var)\s+/);if(K){let z=X.slice(K[0].length),H=Z;if(z.startsWith("{")||z.startsWith("[")){let j=z[0],_=j==="{"?"}":"]",V=d9(z,j,_,0),O=z;for(let F=Z+1;F<$.length&&V>0;F++)O+=` ${$[F].trim()}`,H=F,V=d9($[F],j,_,V);if(V>0)O=z,H=Z;z=O}let B=o9(z,0);if(B){let j=K[1],_=B.pattern,V=z.slice(B.endPos).trim();if(V.startsWith("=")){let O=V.slice(1).trim(),F=O,L=Math.max(H,Z);if(l9(O)){let N=c9($,L,O);F=N.value,L=N.nextIndex}else L=L+1;F=F.trim().replace(/;$/,"");let w=r9(_),R=`__stx_src_${Z}`,D=w.map((N)=>`module.exports.${N} = ${N};`).join(`
3656
+ })()`)(Q,G,z,H,B,j,V,T,O,F,L,w,R,D,N,A,M,k,I,y,E,b,C,x,f,n,m,V0,_,M0,T0,h0,t,K0,q0,B1,J5,p,e,I0,F0,P0,Y0.confirm,Y0.alert,Y0.fetch,b0,...z0,...v0);if(J.preserveExisting){for(let[i,J0]of Object.entries(X1))if(!(i in Z)||Z[i]===void 0)Z[i]=J0}else Object.assign(Z,X1);for(let[i,J0]of Object.entries(H))if(!(i in Z))Z[i]=J0}catch(S){let v=S instanceof Error?S.message:String(S);if(OG(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(VG(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(X5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${X??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await TG(Y,Z,X)}catch(d){if(X5.env.STX_DEBUG){let P=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${X??"<unknown>"}: ${P}`)}}}}function LG($){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 wG=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function r9($,Z){let X=Z?s0.dirname(Z):X5.cwd(),J=X5.cwd(),Y=$.split(`
3657
+ `),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 U=0;for(;G<Y.length;G++){for(let W of Y[G])if(W==="{")U++;else if(W==="}")U--;if(U<=0)break}}G++;continue}if(q.startsWith("definePageMeta(")){let U=0,W=!1,K=G;for(let B=G;B<Y.length&&!W;B++){let j=null,_=!1,V=Y[B];for(let O=0;O<V.length;O++){let F=V[O];if(_){_=!1;continue}if(F==="\\"){_=!0;continue}if(j){if(F===j)j=null;continue}if(F==='"'||F==="'"||F==="`"){j=F;continue}if(F==="(")U++;else if(F===")"){if(U--,U===0){G=B+1,W=!0;break}}}}if(!W)G=Y.length;let z=Y.slice(K,G).join(`
3658
+ `),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 U=q,W=0;while(!LG(U)&&G+W+1<Y.length)W++,U=`${U} ${Y[G+W].trim()}`;G+=W;let K=U.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=U.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=U.match(/^import\s+['"](.+?)['"]/),B=U,j=(_)=>{if(_.startsWith("."))return s0.resolve(X,_);if(_.startsWith("~/")||_.startsWith("@/"))return s0.resolve(J,_.slice(2));return _};if(K){let[,_,V]=K,O=j(V);Q.push(`const ${_} = (await import('${O}')).default`),Q.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,V]=z,O=j(V),F=[],L=[],w=BG.has(V);for(let R of _.split(",")){let D=R.trim();if(!D)continue;let N=D.split(/\s+as\s+/);if(N.length===2){let[T,A]=[N[0].trim(),N[1].trim()];if(w&&m9.has(T)){Q.push(`const ${A} = ${T};`);continue}F.push(`${T}: ${A}`),L.push(A)}else{if(w&&m9.has(D))continue;F.push(D),L.push(D)}}if(F.length>0)Q.push(`const { ${F.join(", ")} } = await import('${O}')`);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(wG.test(q))Q.push(Y[G]),G++;else if(q.startsWith("export const ")||q.startsWith("export let ")||q.startsWith("export var ")){let U=c9(Y,G),{type:W,name:K,value:z}=U;Q.push(`${W} ${K} = ${z};`),Q.push(`module.exports.${K} = ${K};`),G=U.nextIndex}else if(q.startsWith("export function ")||q.startsWith("export async function ")){let U=R4(Y,G);Q.push(U.functionCode),Q.push(`module.exports.${U.name} = ${U.name};`),G=U.nextIndex}else if(q.startsWith("const ")||q.startsWith("let ")||q.startsWith("var ")){let U=c9(Y,G),{type:W,name:K,value:z}=U;Q.push(`${W} ${K} = ${z};`),Q.push(`module.exports.${K} = ${K};`),G=U.nextIndex}else if(q.startsWith("function ")||q.startsWith("async function ")){let U=R4(Y,G);Q.push(U.functionCode),Q.push(`module.exports.${U.name} = ${U.name};`),G=U.nextIndex}else if(q.startsWith("export default function ")||q.startsWith("export default async function ")){let U=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...Y];W[G]=U;let K=R4(W,G);if(Q.push(K.functionCode),K.name)Q.push(`module.exports.default = ${K.name};`);G=K.nextIndex}else if(q.startsWith("export default ")){let U=q.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${U};`),G++}else if(q.startsWith("class ")||q.startsWith("export class ")){let U=q.match(/(?:export\s+)?class\s+(\w+)/);if(U){let W=U[1],K=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)K+=`
3659
+ `+B;if(z<=0&&H>=G)break}Q.push(K),Q.push(`module.exports.${W} = ${W};`),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 RG(Q.join(`
3660
+ `),X,J)}function RG($,Z,X){let J=$.length,Y="",Q=0,G=null,q=!1,U=!1,W=0;while(Q<J){let K=$[Q],z=$[Q+1];if(q){if(Y+=K,K===`
3661
+ `)q=!1;Q++;continue}if(U){if(Y+=K,K==="*"&&z==="/"){Y+=z,Q+=2,U=!1;continue}Q++;continue}if(!G&&K==="/"&&z==="/"){q=!0,Y+=K,Q++;continue}if(!G&&K==="/"&&z==="*"){U=!0,Y+=K,Q++;continue}if(G){if(Y+=K,K==="\\"){Y+=z,Q+=2;continue}if(K===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(K==="$"&&z==="{"){W++,Y+=z,Q+=2;continue}if(K==="`"){G=null,Q++;continue}}Q++;continue}if(W>0){if(K==="{")W++;else if(K==="}")W--}if(K==='"'||K==="'"||K==="`"){G=K,Y+=K,Q++;continue}if(K==="a"&&$.startsWith("await",Q)){let H=DG($,Q);if(H){let{quote:B,path:j,end:_}=H;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let V=j.startsWith(".")?s0.resolve(Z,j):s0.resolve(X,j.slice(2));Y+=`await import(${B}${V}${B})`,Q=_;continue}}}Y+=K,Q++}return Y}function DG($,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 a9($,Z){let X=$[Z];if(X!=="{"&&X!=="[")return null;let Y=H0($,X,X==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function t9($){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?a9(X,J):null;if(q){Z.push(...t9(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 NG($){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],U=$[X-1];if(q!=="="&&q!==">"&&U!=="="&&U!=="!"&&U!=="<"&&U!==">")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 l9($,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 c9($,Z){let X=$[Z].trim(),J=NG(X),Y=J?[X,J.type,J.name,J.value]:null;if(!Y){let K=X.match(/^(?:export\s+)?(const|let|var)\s+/);if(K){let z=X.slice(K[0].length),H=Z;if(z.startsWith("{")||z.startsWith("[")){let j=z[0],_=j==="{"?"}":"]",V=l9(z,j,_,0),O=z;for(let F=Z+1;F<$.length&&V>0;F++)O+=` ${$[F].trim()}`,H=F,V=l9($[F],j,_,V);if(V>0)O=z,H=Z;z=O}let B=a9(z,0);if(B){let j=K[1],_=B.pattern,V=z.slice(B.endPos).trim();if(V.startsWith("=")){let O=V.slice(1).trim(),F=O,L=Math.max(H,Z);if(p9(O)){let N=i9($,L,O);F=N.value,L=N.nextIndex}else L=L+1;F=F.trim().replace(/;$/,"");let w=t9(_),R=`__stx_src_${Z}`,D=w.map((N)=>`module.exports.${N} = ${N};`).join(`
3662
3662
  `);return{type:j,name:R,value:`${F}; ${j} ${_} = ${R};
3663
- ${D}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${X}`)}let[,Q,G,q]=J,U=q,W=Z;if(l9(q)){let K=c9($,Z,q);U=K.value,W=K.nextIndex}else W=Z+1;while(W<$.length){let K=$[W].trim();if(K.startsWith(".")||K.startsWith("?."))U+=`
3664
- ${$[W]}`,W++;else break}return U=U.trim().replace(/;$/,""),{type:Q,name:G,value:U,nextIndex:W}}function L4($,Z){let X=$[Z].trim(),Y=X.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${X}`);let[,J]=Y,Q=X.replace(/^export\s+/,""),G=Z;if(RG(X)){let q=DG($,Z,Q);Q=q.functionCode,G=q.nextIndex}else G=Z+1;return{name:J,functionCode:Q,nextIndex:G}}function l9($){let Z=$.trim();if(Z.startsWith("{"))return H0(Z,"{","}",0)===-1;if(Z.startsWith("["))return H0(Z,"[","]",0)===-1;return!a9(Z)}function a9($){let Z={paren:0,bracket:0,brace:0},X=null,Y=0;for(let J=0;J<$.length;J++){let Q=$[J];if((J>0?$[J-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==="`"&&Y===0){X=null;continue}if(X==="`"&&Q==="$"&&$[J+1]==="{"){Y++,J++;continue}if(Y>0&&Q==="{"){Y++;continue}if(Y>0&&Q==="}"){Y--;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 t9($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let X=H0($,"(",")",Z);if(X===-1)return-1;return $.indexOf("{",X)}function RG($){let Z=t9($);if(Z===-1)return!0;return H0($,"{","}",Z)===-1}function c9($,Z,X){let Y=X,J=Z+1;while(J<$.length&&!a9(Y)){let Q=$[J];Y+=`
3665
- ${Q}`,J++}while(J<$.length){let Q=$[J].trim();if(Q.startsWith(".")||Q.startsWith("?."))Y+=`
3666
- ${$[J]}`,J++;else break}return{value:Y,nextIndex:J}}function DG($,Z,X){let Y=X,J=Z+1;while(J<$.length){let Q=t9(Y);if(Q!==-1){if(H0(Y,"{","}",Q)!==-1)break}let G=$[J];Y+=`
3667
- ${G}`,J++}return{functionCode:Y,nextIndex:J}}function p9($,Z){let X=X0($,Z)??X0(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let Y={...Z,process:Object.freeze({env:{...X5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${$});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${$};`)(...Object.values(Y))}catch{return}}}async function NG($,Z,X){let Y=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of Y){let[,,G,q]=Q;try{let U=q.trim().replace(/;$/,""),W=p9(U,Z);if(W!==void 0)Z[G]=W}catch(U){console.warn(`Failed to parse export ${G} in fallback:`,U)}}let J=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of J){let[,,G,q]=Q;if(!(G in Z))try{let U=q.trim().replace(/;$/,""),W=p9(U,Z);if(W!==void 0)Z[G]=W}catch{}}}function AG($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",Y=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:Y}}function MG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var T5=new O1(500),M$=new O1(1000),R4=new O1(2000),IG=0;function kG($){let Z=new WeakSet;try{let X=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if(Z.has(Y))throw TypeError("Circular component input");if(Z.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(X);let J={};for(let Q of Object.keys(Y).sort())J[Q]=X(Y[Q]);return J};return JSON.stringify(X($))}catch{return null}}function e9($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function EG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function N1($){return!EG($)}var A$=new Map;function w4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=A$.get(Z);if(X)return X;if(A$.size>=16)A$.clear();let Y=new Bun.Transpiler($);return A$.set(Z,Y),Y}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 J=w4({loader:"ts",target:"browser",define:e1()}).transformSync(Z);for(let Q=0;Q<X.length;Q++)J=J.replace(`"__STX_EXPR_${Q}__"`,X[Q]),J=J.replace(`'__STX_EXPR_${Q}__'`,X[Q]);return J}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function bG($){let Z=[],X=new Set,Y=0,J=0,Q=$.length,G=(K)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===K){J++;return}J++}},q=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let K=1;while(J<Q&&K>0)if($[J]==="{")K++,J++;else if($[J]==="}")K--,J++;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")q();else J++;continue}J++}},U=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
3668
- `)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(Y!==0)return;let K=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let j=K[2].split(",").map((_)=>{let V=_.trim().split(":");return V[V.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(J).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(J).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(J).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(J<Q){if(U())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){q();continue}if($[J]==="{"){Y++,J++;continue}if($[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))W();J++}return Z}function yG($){let Z=[],X=0,Y=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G==="\\"){Q++;continue}if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(Y,Q)),Y=Q+1}if(Y<$.length)Z.push($.slice(Y));return Z}function SG($){let Z=0,X=null;for(let Y=0;Y<$.length;Y++){let J=$[Y];if(X){if(J==="\\"){Y++;continue}if(J===X)X=null;continue}if(J==='"'||J==="'"||J==="`"){X=J;continue}if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J==="="&&Z===0){let Q=$[Y-1],G=$[Y+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return Y}}return-1}function CG($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let Y=X.index-1;while(Y>=0&&/\s/.test($[Y]))Y--;if($[Y]!=="}")return;let J=Y,Q=0,G=-1;for(;Y>=0;Y--){let U=$[Y];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=Y;break}}}if(G===-1)return;let q=$.slice(G+1,J);for(let U of yG(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let K=SG(W);if(K===-1)continue;let z=W.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let H=W.slice(K+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 w$($,Z,X,Y,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(V)=>V.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),q=(V)=>V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let V of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(V))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],K=typeof J.root==="string"?g.resolve(J.root):void 0,z=K??g.dirname(Y),H=[],B=(V)=>{if(V&&!H.includes(V))H.push(V)},j=X.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));B(Z),B(J._rootComponentsDir),B(g.join(g.dirname(Y),"components")),B(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let V of _)B(typeof V==="string"?V:null);if(K)B(g.resolve(K,"resources/views/components")),B(g.resolve(K,"resources/components")),B(g.resolve(K,"src/components")),B(g.resolve(K,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return r(g.resolve(g.dirname(Y),`${Q}.stx`));for(let V of H){let O=g.isAbsolute(V)?V:g.resolve(z,V);for(let F of W)if(await r(g.join(O,F)))return!0}return!1}function PG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function vG($){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 fG($){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 Y of $){let J;while((J=X.exec(Y))!==null)Z.add(J[1]);X.lastIndex=0}return[...Z]}async function T1($,Z,X,Y,J,Q,G,q=new Set,U){let{extractVariables:W}=await a("stx/variable-extractor",()=>import("./chunk-8a1524ge.js")),K=q??new Set;if(K.has($))return`[Circular component reference: ${$}]`;let z=new Set(K);z.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=H&&H!=="load"&&PG(H)?H:"";try{let j=(P)=>P.split("-").map((u)=>u.charAt(0).toUpperCase()+u.slice(1)).join(""),_=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),V=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=J.__importedComponents;if(F){let P=[V,V.toLowerCase(),j(V),_(V)];for(let u of P)if(F.has(u)){O=F.get(u);break}}let L=[];if(!O){let P=[`${V}.stx`,`${j(V)}.stx`,`${_(V)}.stx`],u=[...new Set(P)],s=J.__originalFilePath,o=[];if(s){let Y0=g.join(g.dirname(s),"components");o.push(Y0)}if(Y)o.push(Y);let z0=G._rootComponentsDir;if(typeof z0==="string"&&!o.includes(z0))o.push(z0);let L0=g.join(g.dirname(Q),"components");if(!o.includes(L0))o.push(L0);if(G.componentsDir&&G.componentsDir!==Y&&!o.includes(G.componentsDir))o.push(G.componentsDir);let $1=G._pluginComponentDirs;if(Array.isArray($1)){for(let Y0 of $1)if(typeof Y0==="string"&&!o.includes(Y0))o.push(Y0)}let E0=typeof G.root==="string"?g.resolve(G.root):void 0,D0=E0??g.dirname(Q),v0=[];if(E0)v0.push(g.resolve(E0,"resources/views/components")),v0.push(g.resolve(E0,"resources/components")),v0.push(g.resolve(E0,"src/components")),v0.push(g.resolve(E0,"components"));v0.push(g.resolve(import.meta.dir,"components"));for(let Y0 of v0)if(!o.includes(Y0))o.push(Y0);let J5=[...new Set(o.map((Y0)=>{if(!Y0)return Y0;return g.isAbsolute(Y0)?Y0:g.resolve(D0,Y0)}))];o.length=0,o.push(...J5);let Z1=`${V}\x00${Q}\x00${J5.join("\x00")}`,i=M$.get(Z1);if(i)if(await r(i))O=i;else M$.delete(Z1);if(!O&&(V.startsWith("./")||V.startsWith("../")))O=g.resolve(g.dirname(Q),`${V}.stx`),L.push(O);else if(!O)for(let Y0 of o){if(!Y0)continue;for(let X1 of u){let j1=g.join(Y0,X1);if(L.push(j1),await r(j1)){O=j1;break}}if(O)break;if(!O)try{let X1=await import("fs");if(!X1.statSync(Y0,{throwIfNoEntry:!1})?.isDirectory())continue;let k5=8,y1=[{path:Y0,depth:0}];while(y1.length>0&&!O){let s0=y1.pop();if(s0.depth>=k5)continue;let E5;try{E5=X1.readdirSync(s0.path,{withFileTypes:!0})}catch{continue}for(let b5 of E5){if(!b5.isDirectory())continue;if(b5.name==="node_modules"||b5.name.startsWith("."))continue;let M4=g.join(s0.path,b5.name);for(let z8 of u){let T$=g.join(M4,z8);if(L.push(T$),await r(T$)){O=T$;break}}if(O)break;y1.push({path:M4,depth:s0.depth+1})}}}catch{}if(O)break}if(O)M$.set(Z1,O)}if(!O||!await r(O)){let P=L.length>0?`
3663
+ ${D}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${X}`)}let[,Q,G,q]=Y,U=q,W=Z;if(p9(q)){let K=i9($,Z,q);U=K.value,W=K.nextIndex}else W=Z+1;while(W<$.length){let K=$[W].trim();if(K.startsWith(".")||K.startsWith("?."))U+=`
3664
+ ${$[W]}`,W++;else break}return U=U.trim().replace(/;$/,""),{type:Q,name:G,value:U,nextIndex:W}}function R4($,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(AG(X)){let q=MG($,Z,Q);Q=q.functionCode,G=q.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function p9($){let Z=$.trim();if(Z.startsWith("{"))return H0(Z,"{","}",0)===-1;if(Z.startsWith("["))return H0(Z,"[","]",0)===-1;return!e9(Z)}function e9($){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 $8($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let X=H0($,"(",")",Z);if(X===-1)return-1;return $.indexOf("{",X)}function AG($){let Z=$8($);if(Z===-1)return!0;return H0($,"{","}",Z)===-1}function i9($,Z,X){let J=X,Y=Z+1;while(Y<$.length&&!e9(J)){let Q=$[Y];J+=`
3665
+ ${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
3666
+ ${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function MG($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=$8(J);if(Q!==-1){if(H0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
3667
+ ${G}`,Y++}return{functionCode:J,nextIndex:Y}}function n9($,Z){let X=X0($,Z)??X0(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...X5.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 TG($,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 U=q.trim().replace(/;$/,""),W=n9(U,Z);if(W!==void 0)Z[G]=W}catch(U){console.warn(`Failed to parse export ${G} in fallback:`,U)}}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 U=q.trim().replace(/;$/,""),W=n9(U,Z);if(W!==void 0)Z[G]=W}catch{}}}function IG($){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 kG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var T5=new O1(500),T$=new O1(1000),N4=new O1(2000),bG=0;function yG($){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 Z8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function SG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function N1($){return!SG($)}var M$=new Map;function D4($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=M$.get(Z);if(X)return X;if(M$.size>=16)M$.clear();let J=new Bun.Transpiler($);return M$.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=D4({loader:"ts",target:"browser",define:e1()}).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 CG($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(K)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===K){Y++;return}Y++}},q=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let K=1;while(Y<Q&&K>0)if($[Y]==="{")K++,Y++;else if($[Y]==="}")K--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")q();else Y++;continue}Y++}},U=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
3668
+ `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},W=()=>{if(J!==0)return;let K=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let j=K[2].split(",").map((_)=>{let V=_.trim().split(":");return V[V.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(U())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])))W();Y++}return Z}function PG($){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 vG($){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 fG($,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 U=$[J];if(U==="}")Q++;else if(U==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let q=$.slice(G+1,Y);for(let U of PG(q)){let W=U.trim();if(!W||W.startsWith("..."))continue;let K=vG(W);if(K===-1)continue;let z=W.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let H=W.slice(K+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 R$($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(V)=>V.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),q=(V)=>V.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=X.__importedComponents;if(U){for(let V of[Q,Q.toLowerCase(),G(Q),q(Q)])if(U.has(V))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${q(Q)}.stx`])],K=typeof Y.root==="string"?g.resolve(Y.root):void 0,z=K??g.dirname(J),H=[],B=(V)=>{if(V&&!H.includes(V))H.push(V)},j=X.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));B(Z),B(Y._rootComponentsDir),B(g.join(g.dirname(J),"components")),B(Y.componentsDir);let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let V of _)B(typeof V==="string"?V:null);if(K)B(g.resolve(K,"resources/views/components")),B(g.resolve(K,"resources/components")),B(g.resolve(K,"src/components")),B(g.resolve(K,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return r(g.resolve(g.dirname(J),`${Q}.stx`));for(let V of H){let O=g.isAbsolute(V)?V:g.resolve(z,V);for(let F of W)if(await r(g.join(O,F)))return!0}return!1}function xG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function gG($){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 hG($){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 T1($,Z,X,J,Y,Q,G,q=new Set,U){let{extractVariables:W}=await a("stx/variable-extractor",()=>import("./chunk-66081bkn.js")),K=q??new Set;if(K.has($))return`[Circular component reference: ${$}]`;let z=new Set(K);z.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=H&&H!=="load"&&xG(H)?H:"";try{let j=(P)=>P.split("-").map((u)=>u.charAt(0).toUpperCase()+u.slice(1)).join(""),_=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),V=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=Y.__importedComponents;if(F){let P=[V,V.toLowerCase(),j(V),_(V)];for(let u of P)if(F.has(u)){O=F.get(u);break}}let L=[];if(!O){let P=[`${V}.stx`,`${j(V)}.stx`,`${_(V)}.stx`],u=[...new Set(P)],s=Y.__originalFilePath,o=[];if(s){let J0=g.join(g.dirname(s),"components");o.push(J0)}if(J)o.push(J);let z0=G._rootComponentsDir;if(typeof z0==="string"&&!o.includes(z0))o.push(z0);let L0=g.join(g.dirname(Q),"components");if(!o.includes(L0))o.push(L0);if(G.componentsDir&&G.componentsDir!==J&&!o.includes(G.componentsDir))o.push(G.componentsDir);let Z1=G._pluginComponentDirs;if(Array.isArray(Z1)){for(let J0 of Z1)if(typeof J0==="string"&&!o.includes(J0))o.push(J0)}let b0=typeof G.root==="string"?g.resolve(G.root):void 0,D0=b0??g.dirname(Q),v0=[];if(b0)v0.push(g.resolve(b0,"resources/views/components")),v0.push(g.resolve(b0,"resources/components")),v0.push(g.resolve(b0,"src/components")),v0.push(g.resolve(b0,"components"));v0.push(g.resolve(import.meta.dir,"components"));for(let J0 of v0)if(!o.includes(J0))o.push(J0);let Y5=[...new Set(o.map((J0)=>{if(!J0)return J0;return g.isAbsolute(J0)?J0:g.resolve(D0,J0)}))];o.length=0,o.push(...Y5);let X1=`${V}\x00${Q}\x00${Y5.join("\x00")}`,i=T$.get(X1);if(i)if(await r(i))O=i;else T$.delete(X1);if(!O&&(V.startsWith("./")||V.startsWith("../")))O=g.resolve(g.dirname(Q),`${V}.stx`),L.push(O);else if(!O)for(let J0 of o){if(!J0)continue;for(let J1 of u){let j1=g.join(J0,J1);if(L.push(j1),await r(j1)){O=j1;break}}if(O)break;if(!O)try{let J1=await import("fs");if(!J1.statSync(J0,{throwIfNoEntry:!1})?.isDirectory())continue;let k5=8,y1=[{path:J0,depth:0}];while(y1.length>0&&!O){let o0=y1.pop();if(o0.depth>=k5)continue;let E5;try{E5=J1.readdirSync(o0.path,{withFileTypes:!0})}catch{continue}for(let b5 of E5){if(!b5.isDirectory())continue;if(b5.name==="node_modules"||b5.name.startsWith("."))continue;let I4=g.join(o0.path,b5.name);for(let B8 of u){let I$=g.join(I4,B8);if(L.push(I$),await r(I$)){O=I$;break}}if(O)break;y1.push({path:I4,depth:o0.depth+1})}}}catch{}if(O)break}if(O)T$.set(X1,O)}if(!O||!await r(O)){let P=L.length>0?`
3669
3669
  Searched paths:
3670
3670
  ${L.map((u)=>` - ${u}`).join(`
3671
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(O);let w;if(T5.has(O))w=T5.get(O);else try{w=await Bun.file(O).text(),T5.set(O,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",y5,"__stx_client_signal_names","__stxServeContext"]),D={};for(let[P,u]of Object.entries(J))if(!P.startsWith("__")||R.has(P))D[P]=u;let N=c0(X),T=[],A=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let s=N.scripts[Number(u)]||"",o=s.match(/^<script\b([^>]*)>/i)?.[1]||"",z0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),L0=!z0||["module","text/javascript","application/javascript"].includes(z0);if(!/\bserver\b/i.test(o)&&L0)return T.push(s),"";return s}),{extractSlotContent:M}=await a("stx/slots",()=>import("./chunk-241d3ex6.js")),k=M(A),I={};if(k.defaultSlot?.trim())I.default=k.defaultSlot;for(let[P,u]of k.namedSlots)I[P]=u.content;let y={...D,...Z,props:Z,slot:A,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:J1(w)||vG(X)};CG(w,y);let E=w,b=J$(E);if(b)E=b.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...w.matchAll(C)],f=[],n=x.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&x.every((P)=>/\bserver\b/.test(P[1]||"")),m=null,V0=null;if(n){let P=kG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){m=`${O}\x00${P}`;let u=R4.get(m);if(u){for(let s of u.dependencies)U.add(s);return u.output}V0=new Set(U)}}for(let P of x){let u=P[1]||"",s=P[2]||"",o=u.includes("server");if(N1(u)&&s.trim())s=A1(s);if(o&&s)try{await W(s,y,O)}catch(L0){}if(!o){let L0=s.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),$1=L0.includes("{{")&&L0.includes("}}"),E0=L0.includes("{!!")&&L0.includes("!!}");if($1||E0)L0=y$(L0,y);let D0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");f.push(`<script${D0}>${L0}</script>`)}}let A0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M0=A0?A0[1]:"",g0=A0?A0[2]:"",t="",K0=M0&&/\bscoped\b/i.test(M0);if(A0)t=`<style${M0}>${g0}</style>`;let q0=E;if(q0=q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A0)q0=q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(q0=q0.replace(P,(s,o)=>{let z0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(z0)u.push(`<style${z0[1]}>${z0[2]}</style>`);return""}),q0=q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)t=`${t}${u.join(`
3672
- `)}`}if(X&&q0.includes("{{ text || slot }}"))q0=q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:B1}=await a("stx/slots",()=>import("./chunk-241d3ex6.js")),{defaultSlot:Y5,namedSlots:p}=k;q0=await B1(q0,Y5,p,y);let e=f.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),J0=fG(f),T0=Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[];if(J0.length>0||T0.length>0)y.__stx_client_signal_names=[...new Set([...T0,...J0])];let F0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:e||f.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let P0=await F4(q0,y,O,F0,U),S=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let P of P0.matchAll(/\{\{([\s\S]*?)\}\}/g))S.add(P[1].trim());if(S.size>0)J.__stx_preserved_client_expressions=[...S];let v=`stx_${V.replace(/[^a-zA-Z0-9]/g,"_")}_${++IG}_${Math.random().toString(36).slice(2,8)}`,d=P0;if(e){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${e9(JSON.stringify(Z))}"`}catch{}let u=B?` stx-hydrate="${e9(B)}"`:"";d=`<div data-stx-scope="${v}"${P}${u}>${P0}</div>`;let s=await Promise.all(f.map(async(o)=>{let z0=o.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!z0)return o;let[,L0,$1]=z0,E0=N4($1,{filePath:O,projectRoot:process.cwd()}),D0=E0.code,v0=A4(E0.styles);D0=R5(D0).code;let{hasUserImports:J5,bundleClientScript:Z1}=await a("stx/client-script-bundler",()=>import("./chunk-hx338p3h.js"));if(J5(D0))D0=await Z1(D0,O,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:i}=await a("stx/signal-processing",()=>import("./chunk-wzytd8fh.js"));D0=D0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(s0,E5)=>i(E5));let Y0=o0(D0),X1=bG(Y0),j1=`function(__scopeId) {
3673
- ${l1("const",[...$8,...X1],Y0)}
3671
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}U.add(O);let w;if(T5.has(O))w=T5.get(O);else try{w=await Bun.file(O).text(),T5.set(O,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let R=new Set(["__originalFilePath","__importedComponents",y5,"__stx_client_signal_names","__stxServeContext"]),D={};for(let[P,u]of Object.entries(Y))if(!P.startsWith("__")||R.has(P))D[P]=u;let N=p0(X),T=[],A=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(P,u)=>{let s=N.scripts[Number(u)]||"",o=s.match(/^<script\b([^>]*)>/i)?.[1]||"",z0=o.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),L0=!z0||["module","text/javascript","application/javascript"].includes(z0);if(!/\bserver\b/i.test(o)&&L0)return T.push(s),"";return s}),{extractSlotContent:M}=await a("stx/slots",()=>import("./chunk-bpvp21dd.js")),k=M(A),I={};if(k.defaultSlot?.trim())I.default=k.defaultSlot;for(let[P,u]of k.namedSlots)I[P]=u.content;let y={...D,...Z,props:Z,slot:A,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:Q1(w)||gG(X)};fG(w,y);let E=w,b=Q$(E);if(b)E=b.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...w.matchAll(C)],f=[],n=x.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&x.every((P)=>/\bserver\b/.test(P[1]||"")),m=null,V0=null;if(n){let P=yG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){m=`${O}\x00${P}`;let u=N4.get(m);if(u){for(let s of u.dependencies)U.add(s);return u.output}V0=new Set(U)}}for(let P of x){let u=P[1]||"",s=P[2]||"",o=u.includes("server");if(N1(u)&&s.trim())s=A1(s);if(o&&s)try{await W(s,y,O)}catch(L0){}if(!o){let L0=s.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Z1=L0.includes("{{")&&L0.includes("}}"),b0=L0.includes("{!!")&&L0.includes("!!}");if(Z1||b0)L0=S$(L0,y);let D0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");f.push(`<script${D0}>${L0}</script>`)}}let M0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T0=M0?M0[1]:"",h0=M0?M0[2]:"",t="",K0=T0&&/\bscoped\b/i.test(T0);if(M0)t=`<style${T0}>${h0}</style>`;let q0=E;if(q0=q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),M0)q0=q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(q0=q0.replace(P,(s,o)=>{let z0=o.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(z0)u.push(`<style${z0[1]}>${z0[2]}</style>`);return""}),q0=q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)t=`${t}${u.join(`
3672
+ `)}`}if(X&&q0.includes("{{ text || slot }}"))q0=q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:B1}=await a("stx/slots",()=>import("./chunk-bpvp21dd.js")),{defaultSlot:J5,namedSlots:p}=k;q0=await B1(q0,J5,p,y);let e=f.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),Y0=hG(f),I0=Array.isArray(y.__stx_client_signal_names)?y.__stx_client_signal_names:[];if(Y0.length>0||I0.length>0)y.__stx_client_signal_names=[...new Set([...I0,...Y0])];let F0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:e||f.length===0,defaultLayout:void 0};y.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let P0=await w4(q0,y,O,F0,U),S=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let P of P0.matchAll(/\{\{([\s\S]*?)\}\}/g))S.add(P[1].trim());if(S.size>0)Y.__stx_preserved_client_expressions=[...S];let v=`stx_${V.replace(/[^a-zA-Z0-9]/g,"_")}_${++bG}_${Math.random().toString(36).slice(2,8)}`,d=P0;if(e){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${Z8(JSON.stringify(Z))}"`}catch{}let u=B?` stx-hydrate="${Z8(B)}"`:"";d=`<div data-stx-scope="${v}"${P}${u}>${P0}</div>`;let s=await Promise.all(f.map(async(o)=>{let z0=o.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!z0)return o;let[,L0,Z1]=z0,b0=M4(Z1,{filePath:O,projectRoot:process.cwd()}),D0=b0.code,v0=T4(b0.styles);D0=R5(D0).code;let{hasUserImports:Y5,bundleClientScript:X1}=await a("stx/client-script-bundler",()=>import("./chunk-02n7khen.js"));if(Y5(D0))D0=await X1(D0,O,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:i}=await a("stx/signal-processing",()=>import("./chunk-5dxctm6h.js"));D0=D0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(o0,E5)=>i(E5));let J0=r0(D0),J1=CG(J0),j1=`function(__scopeId) {
3673
+ ${l1("const",[...X8,...J1],J0)}
3674
3674
  const __scope = window.stx._scopes = window.stx._scopes || {};
3675
3675
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
3676
3676
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -3684,12 +3684,12 @@ ${L.map((u)=>` - ${u}`).join(`
3684
3684
  const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
3685
3685
 
3686
3686
  try {
3687
- ${Y0}
3687
+ ${J0}
3688
3688
 
3689
3689
  // Register all defined signals and functions in this scope
3690
3690
  const __localVars = {};
3691
3691
  try {
3692
- ${X1.map((s0)=>`if (typeof ${s0} !== 'undefined') __localVars['${s0}'] = ${s0};`).join(`
3692
+ ${J1.map((o0)=>`if (typeof ${o0} !== 'undefined') __localVars['${o0}'] = ${o0};`).join(`
3693
3693
  `)}
3694
3694
  }
3695
3695
  catch (e) {}
@@ -3698,18 +3698,18 @@ catch (e) {}
3698
3698
  finally {
3699
3699
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
3700
3700
  }
3701
- }`,k5=B?null:v4(J,j1),y1=k5?`window.__stxComponentFactories[${JSON.stringify(k5)}](${JSON.stringify(v)});`:`(${j1})(${JSON.stringify(v)});`;if(B)return`${v0}<script type="stx/island" data-stx-island="${v}" data-stx-scoped${L0}>${y1}</script>`;return`${v0}<script data-stx-scoped data-stx-run="always"${L0}>${y1}</script>`}));if(d=d+`
3701
+ }`,k5=B?null:x4(Y,j1),y1=k5?`window.__stxComponentFactories[${JSON.stringify(k5)}](${JSON.stringify(v)});`:`(${j1})(${JSON.stringify(v)});`;if(B)return`${v0}<script type="stx/island" data-stx-island="${v}" data-stx-scoped${L0}>${y1}</script>`;return`${v0}<script data-stx-scoped data-stx-run="always"${L0}>${y1}</script>`}));if(d=d+`
3702
3702
  `+s.join(`
3703
3703
  `),t)d+=`
3704
3704
  `+t}else{if(t)d+=`
3705
- `+t;if(f.length>0){let P=y.__stx_event_bindings||[],u=D$(y),s=await Promise.all(f.map(async(o)=>{let z0=o.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!z0)return o;return await N$(z0[1],{eventBindings:P,templateContent:d,filePath:O,projectRoot:process.cwd(),serverData:u})}));d+=`
3705
+ `+t;if(f.length>0){let P=y.__stx_event_bindings||[],u=N$(y),s=await Promise.all(f.map(async(o)=>{let z0=o.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!z0)return o;return await A$(z0[1],{eventBindings:P,templateContent:d,filePath:O,projectRoot:process.cwd(),serverData:u})}));d+=`
3706
3706
  `+s.join(`
3707
- `),y.__stx_event_bindings=[]}}if(K0){let P=W$(d,O);if(P.hasScoped)d=P.html}if(m&&V0)R4.set(m,{output:d,dependencies:[...U].filter((P)=>!V0.has(P))});return T.length>0?`${d}
3707
+ `),y.__stx_event_bindings=[]}}if(K0){let P=K$(d,O);if(P.hasScoped)d=P.html}if(m&&V0)N4.set(m,{output:d,dependencies:[...U].filter((P)=>!V0.has(P))});return T.length>0?`${d}
3708
3708
  ${T.join(`
3709
- `)}`:d}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{K.delete($)}}async function r($){return Bun.file($).exists()}function D4($,Z){let X=g.resolve(Z),Y=g.resolve($),J=X.endsWith(g.sep)?X:X+g.sep;if(Y===X||Y.startsWith(J))return Y;return null}async function xG($,Z,X,Y){let J=Z.startsWith("layouts/")?Z.slice(8):Z,Q=g.join($,J);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await r(G)){if(Y)console.log(`Found layout in ${$}: ${G}`);return X?.add(G),G}return null}async function r5($,Z,X,Y){let J=await gG($,Z,X,Y);if(J===null)return null;let Q=D4(J,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 U=g.isAbsolute(q)?q:g.resolve(process.cwd(),q);if(D4(J,U))return g.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${$}, from: ${Z})`),null}async function gG($,Z,X,Y){if(X.debug)console.log(`Resolving template path: ${$} from ${Z}`);let J=g.dirname(Z),Q=process.cwd();if($.startsWith("/")){let H=g.join(Q,$),B=D4(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 r(B)&&Y)Y.add(B);return B}let G=g.join(J,$);if(await r(G)){if(X.debug)console.log(`Found direct path: ${G}`);if(Y)Y.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let H of[".stx",".tsx",".jsx"]){let B=`${G}${H}`;if(await r(B)){if(X.debug)console.log(`Found direct path with extension: ${B}`);if(Y)Y.add(B);return B}}let q=[];if(X.layoutsDir)q.push(g.isAbsolute(X.layoutsDir)?X.layoutsDir:g.resolve(process.cwd(),X.layoutsDir));let U=g.resolve(J),W=process.cwd();for(let H=0;H<10;H++){let B=g.join(U,"layouts"),j=!1;try{j=TG.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){q.push(B);break}let _=g.dirname(U);if(_===U||_.length<W.length)break;U=_}for(let H of q){let B=await xG(H,$,Y,X.debug);if(B)return B}if(X.fallbackLayoutsDir){let H=g.isAbsolute(X.fallbackLayoutsDir)?X.fallbackLayoutsDir:g.resolve(process.cwd(),X.fallbackLayoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=[g.join(H,B)];if(!$.endsWith(".stx"))j.push(`${j[0]}.stx`);for(let _ of j)if(await r(_)){if(X.debug)console.log(`Found in options.fallbackLayoutsDir: ${_}`);if(Y)Y.add(_);return _}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),B=g.join(X.partialsDir||J,"layouts",H[1]);if(await r(B)){if(X.debug)console.log(`Found in layouts path: ${B}`);if(Y)Y.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await r(j)){if(X.debug)console.log(`Found in layouts path with extension: ${j}`);if(Y)Y.add(j);return j}}}if(X.partialsDir){let H=g.join(X.partialsDir,"layouts");if(await r(H)){let B=g.join(H,$);if(await r(B)){if(X.debug)console.log(`Found in partials layouts dir: ${B}`);if(Y)Y.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await r(j)){if(X.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}}let K=X.partialsDir||g.join(process.cwd(),"views"),z=g.join(K,$);if(await r(z)){if(X.debug)console.log(`Found in views path: ${z}`);if(Y)Y.add(z);return z}if(!$.endsWith(".stx")){let H=`${z}.stx`;if(await r(H)){if(X.debug)console.log(`Found in views path with extension: ${H}`);if(Y)Y.add(H);return H}}if(J.includes("temp")){let H=g.join(g.dirname(J),"layouts",$);if(await r(H)){if(X.debug)console.log(`Found in temp layouts dir: ${H}`);if(Y)Y.add(H);return H}if(!$.endsWith(".stx")){let B=`${H}.stx`;if(await r(B)){if(X.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(Y)Y.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 Z8($,Z,X){let Y=0,J="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
3710
- `),q=0;for(let U=0;U<G.length;U++)if(q+=G[U].length+1,q>=Z){Y=U+1,J=G[U].trim();let W=Math.max(0,U-2),K=Math.min(G.length,U+3);Q=G.slice(W,K).map((z,H)=>{let B=W+H+1;return`${B===Y?"> ":" "}${B}: ${z}`}).join(`
3711
- `);break}}else if(X){let G=$.indexOf(X);if(G>=0)return Z8($,G)}}catch{}return{lineNumber:Y,lineContent:J,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 W0($,Z,X,Y,J,Q){let{lineNumber:G,context:q}=Z8(Y,J,Q),U=X.split("/").pop(),W=0;if(typeof J==="number"&&J>=0&&Y){let z=Y.lastIndexOf(`
3712
- `,Math.max(0,J-1));W=J-(z+1)+1}let K="";if(G>0)K+=`
3709
+ `)}`:d}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{K.delete($)}}async function r($){return Bun.file($).exists()}function A4($,Z){let X=g.resolve(Z),J=g.resolve($),Y=X.endsWith(g.sep)?X:X+g.sep;if(J===X||J.startsWith(Y))return J;return null}async function uG($,Z,X,J){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=g.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await r(G)){if(J)console.log(`Found layout in ${$}: ${G}`);return X?.add(G),G}return null}async function r5($,Z,X,J){let Y=await dG($,Z,X,J);if(Y===null)return null;let Q=A4(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 U=g.isAbsolute(q)?q:g.resolve(process.cwd(),q);if(A4(Y,U))return g.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function dG($,Z,X,J){if(X.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=g.dirname(Z),Q=process.cwd();if($.startsWith("/")){let H=g.join(Q,$),B=A4(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 r(B)&&J)J.add(B);return B}let G=g.join(Y,$);if(await r(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 r(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(g.isAbsolute(X.layoutsDir)?X.layoutsDir:g.resolve(process.cwd(),X.layoutsDir));let U=g.resolve(Y),W=process.cwd();for(let H=0;H<10;H++){let B=g.join(U,"layouts"),j=!1;try{j=EG.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){q.push(B);break}let _=g.dirname(U);if(_===U||_.length<W.length)break;U=_}for(let H of q){let B=await uG(H,$,J,X.debug);if(B)return B}if(X.fallbackLayoutsDir){let H=g.isAbsolute(X.fallbackLayoutsDir)?X.fallbackLayoutsDir:g.resolve(process.cwd(),X.fallbackLayoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=[g.join(H,B)];if(!$.endsWith(".stx"))j.push(`${j[0]}.stx`);for(let _ of j)if(await r(_)){if(X.debug)console.log(`Found in options.fallbackLayoutsDir: ${_}`);if(J)J.add(_);return _}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),B=g.join(X.partialsDir||Y,"layouts",H[1]);if(await r(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 r(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=g.join(X.partialsDir,"layouts");if(await r(H)){let B=g.join(H,$);if(await r(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 r(j)){if(X.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}}let K=X.partialsDir||g.join(process.cwd(),"views"),z=g.join(K,$);if(await r(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 r(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=g.join(g.dirname(Y),"layouts",$);if(await r(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 r(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 J8($,Z,X){let J=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
3710
+ `),q=0;for(let U=0;U<G.length;U++)if(q+=G[U].length+1,q>=Z){J=U+1,Y=G[U].trim();let W=Math.max(0,U-2),K=Math.min(G.length,U+3);Q=G.slice(W,K).map((z,H)=>{let B=W+H+1;return`${B===J?"> ":" "}${B}: ${z}`}).join(`
3711
+ `);break}}else if(X){let G=$.indexOf(X);if(G>=0)return J8($,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 W0($,Z,X,J,Y,Q){let{lineNumber:G,context:q}=J8(J,Y,Q),U=X.split("/").pop(),W=0;if(typeof Y==="number"&&Y>=0&&J){let z=J.lastIndexOf(`
3712
+ `,Math.max(0,Y-1));W=Y-(z+1)+1}let K="";if(G>0)K+=`
3713
3713
  ${X}:${G}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${Z}
3714
3714
  `;if(K+=`
3715
3715
  ${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}
@@ -3721,18 +3721,18 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
3721
3721
  `,q)K+=`
3722
3722
  ${Z0.blue}${Z0.bold}Context:${Z0.reset}
3723
3723
  ${Z0.dim}${q}${Z0.reset}
3724
- `;return K}function d_(){T5.clear(),M$.clear(),R4.clear()}function m_(){return{size:T5.size,maxSize:500}}var hG=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function uG($){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 dG($,Z){let X=Z;while(!0){let Y=b1.join(X,"node_modules",$,"package.json");if(I5.existsSync(Y))return b1.dirname(Y);let J=b1.dirname(X);if(J===X)return null;X=J}}function mG($,Z){if(!$||typeof $!=="object")return null;let X=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return X(J.import);if(typeof J.default==="object")return X(J.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return X($[Z]);let Y=null;for(let J of Object.keys($)){let Q=J.indexOf("*");if(Q===-1)continue;let G=J.slice(0,Q),q=J.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(q))continue;if(Z.length<G.length+q.length)continue;if(!Y||G.length>Y.prefix.length)Y={pattern:J,prefix:G,suffix:q}}if(Y){let J=Z.slice(Y.prefix.length,Z.length-Y.suffix.length),Q=X($[Y.pattern]);if(Q)return Q.replace("*",J)}return null}function lG($,Z){let X=uG($);if(!X||!X.subpath)return null;let Y=dG(X.pkg,Z);if(!Y)return null;let J;try{J=JSON.parse(I5.readFileSync(b1.join(Y,"package.json"),"utf8"))}catch{return null}let Q=`.${X.subpath}`,G=mG(J.exports,Q);if(!G)return null;let q=b1.resolve(Y,G);return I5.existsSync(q)?q:null}function N4($,Z){let X=Z.filePath?b1.dirname(Z.filePath):Z.projectRoot||process.cwd(),Y=Z.projectRoot||process.cwd(),J=new Set,Q=[];return{code:$.replace(hG,(q,U)=>{let W;try{if(U.startsWith("./")||U.startsWith("../")||U.startsWith("/")){if(W=U.startsWith("/")?U:b1.resolve(X,U),!I5.existsSync(W))throw Error(`file not found: ${W}`)}else{let K=null;try{K=Bun.resolveSync(U,Y)}catch{K=lG(U,Y)}if(!K)throw Error(`could not resolve ${U} (Bun.resolveSync + exports fallback both failed)`);W=K}}catch(K){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(U)} (from ${Z.filePath||"<unknown>"}): ${K?.message||K}`),""}if(J.has(W))return"";J.add(W);try{let K=I5.readFileSync(W,"utf8");Q.push({source:U,resolvedPath:W,contents:K})}catch(K){console.warn(`[stx:vendor-css] could not read ${W}: ${K?.message||K}`)}return""}),styles:Q}}function cG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A4($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${cG(Z.source)}" data-stx-layer="vendor">
3724
+ `;return K}function c_(){T5.clear(),T$.clear(),N4.clear()}function p_(){return{size:T5.size,maxSize:500}}var mG=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function lG($){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 cG($,Z){let X=Z;while(!0){let J=b1.join(X,"node_modules",$,"package.json");if(I5.existsSync(J))return b1.dirname(J);let Y=b1.dirname(X);if(Y===X)return null;X=Y}}function pG($,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 iG($,Z){let X=lG($);if(!X||!X.subpath)return null;let J=cG(X.pkg,Z);if(!J)return null;let Y;try{Y=JSON.parse(I5.readFileSync(b1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${X.subpath}`,G=pG(Y.exports,Q);if(!G)return null;let q=b1.resolve(J,G);return I5.existsSync(q)?q:null}function M4($,Z){let X=Z.filePath?b1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),Y=new Set,Q=[];return{code:$.replace(mG,(q,U)=>{let W;try{if(U.startsWith("./")||U.startsWith("../")||U.startsWith("/")){if(W=U.startsWith("/")?U:b1.resolve(X,U),!I5.existsSync(W))throw Error(`file not found: ${W}`)}else{let K=null;try{K=Bun.resolveSync(U,J)}catch{K=iG(U,J)}if(!K)throw Error(`could not resolve ${U} (Bun.resolveSync + exports fallback both failed)`);W=K}}catch(K){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(U)} (from ${Z.filePath||"<unknown>"}): ${K?.message||K}`),""}if(Y.has(W))return"";Y.add(W);try{let K=I5.readFileSync(W,"utf8");Q.push({source:U,resolvedPath:W,contents:K})}catch(K){console.warn(`[stx:vendor-css] could not read ${W}: ${K?.message||K}`)}return""}),styles:Q}}function nG($){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="${nG(Z.source)}" data-stx-layer="vendor">
3725
3725
  @layer vendor {
3726
3726
  ${Z.contents}
3727
3727
  }
3728
3728
  </style>`}).join(`
3729
3729
  `)}
3730
- `}var pG=Q8,q8=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useTimeoutFn"];function R5($){let Z=p0($),X=new Set;for(let q of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let U of q[1].split(",")){let W=U.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)X.add(W)}let Y=new Set;for(let q of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(q[1]);for(let q of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let U of q[1].split(",")){let W=U.trim().split(/[:=]/).pop()?.trim();if(W)Y.add(W)}let J=q8.filter((q)=>{if(X.has(q)||Y.has(q))return!1;return new RegExp(`\\b${q}\\s*\\(`).test(Z)}),Q=U8(Z).filter((q)=>!X.has(q)&&!Y.has(q));if(J.length===0&&Q.length===0)return{code:$,imports:J,models:Q};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
3730
+ `}var sG=q8,W8=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useTimeoutFn"];function R5($){let Z=i0($),X=new Set;for(let q of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let U of q[1].split(",")){let W=U.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)X.add(W)}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 U of q[1].split(",")){let W=U.trim().split(/[:=]/).pop()?.trim();if(W)J.add(W)}let Y=W8.filter((q)=>{if(X.has(q)||J.has(q))return!1;return new RegExp(`\\b${q}\\s*\\(`).test(Z)}),Q=K8(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(`
3731
3731
  `)}
3732
- ${$}`,imports:J,models:Q}}var iG=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 U8($){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,Y;while((Y=X.exec($))!==null)if(!iG.has(Y[1]))Z.add(Y[1]);return Array.from(Z)}function nG($){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 Y of X[1].split(",")){let J=Y.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function W8($){let Z=new Set,X=new Set,Y=$;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=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 W=G[1],K=G[2];if(G[0].includes("import type"))continue;let z=[];for(let B of W.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let _=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let V=_[1],O=_[2]||V;if(J.add(V),J.add(O),K==="stx"||K==="@stacksjs/stx")Z.add(V);else X.add(V);if(O!==V)z.push(`${O} = ${V}`)}let H=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";Y=Y.replace(G[0],H)}let q=nG(Y);for(let W of pG){if(J.has(W)||q.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))Z.add(W)}for(let W of q8){if(J.has(W)||q.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(Y))X.add(W)}let U=U8(Y);for(let W of U)if(!J.has(W)&&!q.has(W))X.add(W);return{code:Y,stxImports:Array.from(Z),browserImports:Array.from(X)}}function K8($,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
3732
+ ${$}`,imports:Y,models:Q}}var oG=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 K8($){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(!oG.has(J[1]))Z.add(J[1]);return Array.from(Z)}function rG($){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 z8($){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 W=G[1],K=G[2];if(G[0].includes("import type"))continue;let z=[];for(let B of W.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let _=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let V=_[1],O=_[2]||V;if(Y.add(V),Y.add(O),K==="stx"||K==="@stacksjs/stx")Z.add(V);else X.add(V);if(O!==V)z.push(`${O} = ${V}`)}let H=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(G[0],H)}let q=rG(J);for(let W of sG){if(Y.has(W)||q.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))Z.add(W)}for(let W of W8){if(Y.has(W)||q.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(J))X.add(W)}let U=K8(J);for(let W of U)if(!Y.has(W)&&!q.has(W))X.add(W);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(X)}}function H8($,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
3733
3733
  ${X.join(`
3734
3734
  `)}
3735
- ${sG($,Z)}`;return""}function YO($,Z=[]){let{browserImports:X}=W8($),Y=new Set(Z);return K8([],X.filter((J)=>!Y.has(J)))}function sG($,Z){let X=[...$.map((Y)=>`['${Y}', typeof ${Y}, 'stx']`),...Z.map((Y)=>`['${Y}', typeof ${Y}, '@stacksjs/browser']`)];if(X.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
3735
+ ${aG($,Z)}`;return""}function GO($,Z=[]){let{browserImports:X}=z8($),J=new Set(Z);return H8([],X.filter((Y)=>!J.has(Y)))}function aG($,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
3736
3736
  [${X.join(", ")}].forEach(function (e) {
3737
3737
  if (e[1] !== 'undefined') return;
3738
3738
  console.error(
@@ -3741,10 +3741,10 @@ ${sG($,Z)}`;return""}function YO($,Z=[]){let{browserImports:X}=W8($),Y=new Set(Z
3741
3741
  + 'or it should be imported from a relative path so the bundler includes it.'
3742
3742
  );
3743
3743
  });
3744
- `}function D$($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let Y={};for(let J in Z){let Q=Z[J];if(typeof Q==="function")continue;Y[J]=Q}return Y.__stxDeclaredPayload=!0,Y}let X={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;X[Y]=J}return X}function X8($,Z){let X=new Set;for(let Y of $.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if(Z){let Q=J.lastIndexOf(":");if(Q!==-1)J=J.slice(Q+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))X.add(J)}return X}function oG($,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(X8(X[1],!0).has(Z))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(X8(X[1],!1).has(Z))return!0;return!1}function rG($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var aG=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Y8=new Set;function tG($,Z){let X=aG.test($),Y=Z.length>32768;if(!X&&!Y)return;if(Y8.has($))return;if(Y8.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(Y)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 o3($,Z){if(!Z)return"";let X=p0($),Y=Z.__stxDeclaredPayload===!0,J=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!Y&&!rG(X,Q))continue;if(oG($,Q))continue;let q;try{q=JSON.stringify(G)}catch{continue}if(q===void 0)continue;tG(Q,q),J.push(` var ${Q} = ${q.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3745
- ${J.join(`
3744
+ `}function N$($){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 Y8($,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 tG($,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(Y8(X[1],!0).has(Z))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(Y8(X[1],!1).has(Z))return!0;return!1}function eG($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var $q=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Q8=new Set;function Zq($,Z){let X=$q.test($),J=Z.length>32768;if(!X&&!J)return;if(Q8.has($))return;if(Q8.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 a3($,Z){if(!Z)return"";let X=i0($),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&&!eG(X,Q))continue;if(tG($,Q))continue;let q;try{q=JSON.stringify(G)}catch{continue}if(q===void 0)continue;Zq(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)
3745
+ ${Y.join(`
3746
3746
  `)}
3747
- `}var eG={left:0,middle:1,right:2};function $q($){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((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${X})) return`)}if($.mouse!==null){let X=eG[$.mouse];Z.push(`if ($event.button !== ${X}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Zq($,Z){let{elementId:X,event:Y,modifiers:J}=$,Q=I$($.handler),G=$q(J),q=[];if(J.once)q.push("once: true");if(J.capture)q.push("capture: true");if(J.passive)q.push("passive: true");let U=q.length>0?`, { ${q.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
3747
+ `}var Xq={left:0,middle:1,right:2};function Jq($){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=Xq[$.mouse];Z.push(`if ($event.button !== ${X}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Yq($,Z){let{elementId:X,event:J,modifiers:Y}=$,Q=k$($.handler),G=Jq(Y),q=[];if(Y.once)q.push("once: true");if(Y.capture)q.push("capture: true");if(Y.passive)q.push("passive: true");let U=q.length>0?`, { ${q.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
3748
3748
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
3749
3749
  };`;function H(B){if(/\$emit\s*\(/.test(B))return`${z}
3750
3750
  ${B}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -3753,33 +3753,33 @@ ${J.join(`
3753
3753
  }
3754
3754
  else {
3755
3755
  ${B}
3756
- }`}if(J.debounce!==null)return` ;(function() {
3756
+ }`}if(Y.debounce!==null)return` ;(function() {
3757
3757
  // eslint-disable-next-line pickier/no-unused-vars
3758
3758
  var $el = document.getElementById('${X}')
3759
3759
  if (!$el) return
3760
3760
  var __timer
3761
- $el.addEventListener('${Y}', function($event) {
3761
+ $el.addEventListener('${J}', function($event) {
3762
3762
  ${G?G+"; ":""}clearTimeout(__timer)
3763
- __timer = setTimeout(function() { ${H(Q)} }, ${J.debounce})
3763
+ __timer = setTimeout(function() { ${H(Q)} }, ${Y.debounce})
3764
3764
  }${U})
3765
- })()`;if(J.throttle!==null)return` ;(function() {
3765
+ })()`;if(Y.throttle!==null)return` ;(function() {
3766
3766
  // eslint-disable-next-line pickier/no-unused-vars
3767
3767
  var $el = document.getElementById('${X}')
3768
3768
  if (!$el) return
3769
3769
  var __last = 0
3770
- $el.addEventListener('${Y}', function($event) {
3770
+ $el.addEventListener('${J}', function($event) {
3771
3771
  ${G?G+"; ":""}var __now = Date.now()
3772
- if (__now - __last >= ${J.throttle}) {
3772
+ if (__now - __last >= ${Y.throttle}) {
3773
3773
  __last = __now
3774
3774
  ${H(Q)}
3775
3775
  }
3776
3776
  }${U})
3777
3777
  })()`;if(/\$emit\s*\(/.test(Q))return` var $el = document.getElementById('${X}')
3778
- if ($el) $el.addEventListener('${Y}', function($event) {
3778
+ if ($el) $el.addEventListener('${J}', function($event) {
3779
3779
  ${W}${z}
3780
3780
  ${Q}
3781
3781
  }${U})`;return` var $el = document.getElementById('${X}')
3782
- if ($el) $el.addEventListener('${Y}', function($event) {
3782
+ if ($el) $el.addEventListener('${J}', function($event) {
3783
3783
  ${W}var scope = $el.closest('[data-stx-scope]');
3784
3784
  if (scope && scope.__stx_execute) {
3785
3785
  scope.__stx_execute('${K}', $event, $el);
@@ -3787,23 +3787,23 @@ else {
3787
3787
  else {
3788
3788
  ${Q}
3789
3789
  }
3790
- }${U})`}function Xq($){if($.length===0)return"";return`
3790
+ }${U})`}function Qq($){if($.length===0)return"";return`
3791
3791
  // STX: auto-generated event bindings
3792
- ${$.map((X,Y)=>Zq(X,Y)).join(`
3793
- `)}`}function J8($){let Z=[],X=new Set,Y=$.replace(/^\s*import\s+.*$/gm,""),J=0,Q=Y.length,G=0;while(G<Q){let q=Y[G];if(q==="'"||q==='"'||q==="`"){let U=q;if(G++,U==="`"){let W=0;while(G<Q){if(Y[G]==="\\"){G+=2;continue}if(Y[G]==="`"&&W===0){G++;break}if(Y[G]==="$"&&Y[G+1]==="{"){W++,G+=2;continue}if(Y[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<Q){if(Y[G]==="\\"){G+=2;continue}if(Y[G]===U){G++;break}G++}continue}if(q==="/"&&Y[G+1]==="/"){while(G<Q&&Y[G]!==`
3794
- `)G++;continue}if(q==="/"&&Y[G+1]==="*"){G+=2;while(G<Q-1&&!(Y[G]==="*"&&Y[G+1]==="/"))G++;G+=2;continue}if(q==="{"){J++,G++;continue}if(q==="}"){J--,G++;continue}if(J===0){let U=Y.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let K=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[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+=K[0].length;continue}let z=U.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 Yq=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 Jq($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(H){let B;while((B=X.exec(H))!==null){let j=B[0];if(!Yq.has(j))Z.add(j)}}let J=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=J.exec($))!==null)Y(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)Y(Q[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)Y(Q[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)Y(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)Y(Q[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=K.exec($))!==null)Y(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)Y(Q[1]);return Z}async function N$($,Z={}){let X=$,Y="",J=!1,Q=[],G=N4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=A4(G.styles),U=R5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:K}=await a("stx/client-script-bundler",()=>import("./chunk-hx338p3h.js"));if(W(X))X=await K(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),J=!0;if(Z.autoImports!==!1){let F=W8(X);X=F.code,Y=K8(F.stxImports,F.browserImports.filter((L)=>!Q.includes(L)))}if(Y=`${o3(X,Z.serverData)}${Y}`,X=o0(X),!J&&N1(Z.attrs||""))X=A1(X);let z=Xq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let F=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${F?` ${F}`:""}`;return`${q}<script ${L}>
3795
- ${n1(`${Y}${X}
3792
+ ${$.map((X,J)=>Yq(X,J)).join(`
3793
+ `)}`}function G8($){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 U=q;if(G++,U==="`"){let W=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&W===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){W++,G+=2;continue}if(J[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===U){G++;break}G++}continue}if(q==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
3794
+ `)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 U=J.slice(G),W=U.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}let K=U.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[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+=K[0].length;continue}let z=U.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 Gq=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 qq($){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(!Gq.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 U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=K.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 A$($,Z={}){let X=$,J="",Y=!1,Q=[],G=M4(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let q=T4(G.styles),U=R5(X);X=U.code,Q=[...U.imports,...U.models];let{hasUserImports:W,bundleClientScript:K}=await a("stx/client-script-bundler",()=>import("./chunk-02n7khen.js"));if(W(X))X=await K(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let F=z8(X);X=F.code,J=H8(F.stxImports,F.browserImports.filter((L)=>!Q.includes(L)))}if(J=`${a3(X,Z.serverData)}${J}`,X=r0(X),!Y&&N1(Z.attrs||""))X=A1(X);let z=Qq(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let F=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${F?` ${F}`:""}`;return`${q}<script ${L}>
3795
+ ${n1(`${J}${X}
3796
3796
  ${z}`)}
3797
- </script>`}let j=G8($),_=/function __stx_setup_/.test(X),V=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function O(F){let L=F.length>0?`
3797
+ </script>`}let j=U8($),_=/function __stx_setup_/.test(X),V=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function O(F){let L=F.length>0?`
3798
3798
  return { ${F.join(", ")} };`:"";return`${q}<script data-stx-scoped data-stx-run="always">
3799
3799
  window.stx.mount(function() {
3800
3800
  'use strict';
3801
- ${n1(`${Y}${X}
3801
+ ${n1(`${J}${X}
3802
3802
  ${z}${L}`)}
3803
- })</script>`}if(!V&&!_){if(j)return O(J8($));if(Z.templateContent){let F=J8($);if(F.length>0){let L=Jq(Z.templateContent);if(F.some((R)=>L.has(R)))return O(F)}}}return`${q}<script data-stx-scoped data-stx-run="always">
3803
+ })</script>`}if(!V&&!_){if(j)return O(G8($));if(Z.templateContent){let F=G8($);if(F.length>0){let L=qq(Z.templateContent);if(F.some((R)=>L.has(R)))return O(F)}}}return`${q}<script data-stx-scoped data-stx-run="always">
3804
3804
  ;(function() {
3805
3805
  'use strict';
3806
- ${n1(`${Y}${X}
3806
+ ${n1(`${J}${X}
3807
3807
  ${z}`)}
3808
3808
  })()</script>`}
3809
- export{r8 as dl,a8 as el,t8 as fl,r0 as gl,v$ as hl,f$ as il,x$ as jl,g$ as kl,j7 as ll,B7 as ml,GZ as nl,UZ as ol,KZ as pl,lq as ql,cq as rl,pq as sl,iq as tl,nq as ul,s8 as vl,W7 as wl,K7 as xl,z7 as yl,H7 as zl,dq as Al,D7 as Bl,W5 as Cl,I$ as Dl,k$ as El,O8 as Fl,S4 as Gl,Gq as Hl,o0 as Il,Uq as Jl,e1 as Kl,$j as Ll,N4 as Ml,A4 as Nl,pG as Ol,R5 as Pl,K8 as Ql,YO as Rl,D$ as Sl,o3 as Tl,N$ as Ul,Q0 as Vl,_0 as Wl,G0 as Xl,Bq as Yl,v5 as Zl,jq as _l,_q as $l,Oq as am,Vq as bm,Y1 as cm,Q5 as dm,x5 as em,I8 as fm,Mq as gm,k8 as hm,Tq as im,b$ as jm,r4 as km,J1 as lm,y$ as mm,y8 as nm,Iq as om,_1 as pm,S8 as qm,b0 as rm,kq as sm,$7 as tm,Cq as um,d8 as vm,m8 as wm,G7 as xm,q7 as ym,U7 as zm,hq as Am,_7 as Bm,U1 as Cm,pZ as Dm,iZ as Em,nZ as Fm,sZ as Gm,i7 as Hm,oZ as Im,l as Jm,a$ as Km,H5 as Lm,B5 as Mm,c5 as Nm,aZ as Om,p5 as Pm,tZ as Qm,i5 as Rm,F1 as Sm,s7 as Tm,L1 as Um,o7 as Vm,r7 as Wm,n5 as Xm,t$ as Ym,$0 as Zm,JX as _m,QX as $m,GX as an,h1 as bn,e$ as cn,$3 as dn,u0 as en,Z3 as fn,Y3 as gn,s5 as hn,UX as in,WX as jn,KX as kn,e7 as ln,$$ as mn,H0 as nn,V6 as on,z3 as pn,W1 as qn,w1 as rn,F6 as sn,_5 as tn,Z$ as un,H3 as vn,gX as wn,uX as xn,R6 as yn,mX as zn,lX as An,N6 as Bn,R1 as Cn,VK as Dn,A6 as En,F3 as Fn,sX as Gn,V3 as Hn,oX as In,rX as Jn,FK as Kn,LK as Ln,M6 as Mn,T6 as Nn,I6 as On,aX as Pn,tX as Qn,wK as Rn,RK as Sn,eX as Tn,DK as Un,NK as Vn,b6 as Wn,P6 as Xn,R3 as Yn,PK as Zn,F5 as _n,D3 as $n,N3 as ao,vK as bo,_Y as co,fK as do,OY as eo,x6 as fo,xK as go,VY as ho,gK as io,hK as jo,E3 as ko,cK as lo,pK as mo,iK as no,nK as oo,sK as po,wY as qo,oK as ro,Y$ as so,RY as to,rK as uo,aK as vo,tK as wo,eK as xo,IY as yo,EY as zo,dY as Ao,k3 as Bo,d6 as Co,$z as Do,J$ as Eo,MQ as Fo,vQ as Go,B4 as Ho,n9 as Io,HG as Jo,BG as Ko,jG as Lo,_G as Mo,OG as No,s9 as Oo,wG as Po,AG as Qo,MG as Ro,$2 as So,Z2 as To,Bz as Uo,i6 as Vo,jz as Wo,S3 as Xo,C3 as Yo,P3 as Zo,Q2 as _o,G2 as $o,q2 as ap,Z6 as bp,X6 as cp,Y6 as dp,J6 as ep,J3 as fp,Q3 as gp,HW as hp,BW as ip,jW as jp,HX as kp,_W as lp,xz as mp,gz as np,W2 as op,hz as pp,H2 as qp,BJ as rp,j2 as sp,F2 as tp,N2 as up,W$ as vp,tz as wp,ez as xp,d3 as yp,A2 as zp,M2 as Ap,cJ as Bp,ZH as Cp,XH as Dp,pJ as Ep,YH as Fp,T2 as Gp,I2 as Hp,z$ as Ip,H$ as Jp,i1 as Kp,nJ as Lp,E2 as Mp,b2 as Np,y2 as Op,sJ as Pp,oJ as Qp,m3 as Rp,l3 as Sp,S2 as Tp,C2 as Up,v2 as Vp,BH as Wp,h2 as Xp,eJ as Yp,XQ as Zp,o2 as _p,r3 as $p,r2 as aq,t2 as bq,e2 as cq,HQ as dq,BQ as eq,$9 as fq,n3 as gq,jQ as hq,j4 as iq,_4 as jq,V4 as kq,F4 as lq,$G as mq,QG as nq,GG as oq,qG as pq,UG as qq,EG as rq,N1 as sq,w4 as tq,A1 as uq,w$ as vq,PG as wq,vG as xq,fG as yq,T1 as zq,r as Aq,r5 as Bq,Z8 as Cq,W0 as Dq,d_ as Eq,m_ as Fq,N7 as Gq,A7 as Hq,V1 as Iq,M7 as Jq,f1 as Kq,T7 as Lq,K5 as Mq,qU as Nq,NZ as Oq,u$ as Pq,UU as Qq,d$ as Rq,WU as Sq,KU as Tq,G1 as Uq,zU as Vq,HU as Wq,BU as Xq,jU as Yq,_U as Zq,OU as _q,AZ as $q,l$ as ar,I7 as br,FU as cr,LU as dr,wU as er,RU as fr,DU as gr,E7 as hr,NU as ir,b7 as jr,AU as kr,MU as lr,z5 as mr,bZ as nr,EU as or,SZ as pr,f7 as qr,m5 as rr,vU as sr,l7 as tr,r$ as ur,RW as vr,q3 as wr,FX as xr,DX as yr,DW as zr,NW as Ar,AW as Br,MW as Cr,TW as Dr,IW as Er,NX as Fr,AX as Gr,Q6 as Hr,j6 as Ir,kX as Jr,U3 as Kr,_6 as Lr,lW as Mr,cW as Nr,K3 as Or,CX as Pr,O6 as Qr};
3809
+ export{t8 as dl,e8 as el,$Z as fl,a0 as gl,f$ as hl,x$ as il,g$ as jl,h$ as kl,O7 as ll,_7 as ml,UZ as nl,KZ as ol,HZ as pl,iq as ql,nq as rl,sq as sl,oq as tl,rq as ul,r8 as vl,z7 as wl,H7 as xl,B7 as yl,j7 as zl,cq as Al,A7 as Bl,W5 as Cl,k$ as Dl,E$ as El,F8 as Fl,P4 as Gl,Wq as Hl,r0 as Il,zq as Jl,e1 as Kl,Jj as Ll,M4 as Ml,T4 as Nl,sG as Ol,R5 as Pl,H8 as Ql,GO as Rl,N$ as Sl,a3 as Tl,A$ as Ul,Q0 as Vl,_0 as Wl,G0 as Xl,Oq as Yl,v5 as Zl,Vq as _l,Fq as $l,Lq as am,wq as bm,Y1 as cm,Q5 as dm,x5 as em,E8 as fm,kq as gm,b8 as hm,Eq as im,y$ as jm,t4 as km,Q1 as lm,S$ as mm,C8 as nm,bq as om,_1 as pm,P8 as qm,y0 as rm,yq as sm,X7 as tm,fq as um,l8 as vm,c8 as wm,U7 as xm,W7 as ym,K7 as zm,mq as Am,V7 as Bm,U1 as Cm,nZ as Dm,sZ as Em,oZ as Fm,rZ as Gm,s7 as Hm,aZ as Im,l as Jm,t$ as Km,H5 as Lm,B5 as Mm,c5 as Nm,eZ as Om,p5 as Pm,$X as Qm,i5 as Rm,F1 as Sm,r7 as Tm,L1 as Um,a7 as Vm,t7 as Wm,n5 as Xm,e$ as Ym,$0 as Zm,GX as _m,qX as $m,UX as an,h1 as bn,$3 as cn,Z3 as dn,d0 as en,X3 as fn,Y3 as gn,s5 as hn,KX as in,zX as jn,HX as kn,Z6 as ln,Z$ as mn,H0 as nn,L6 as on,B3 as pn,W1 as qn,w1 as rn,w6 as sn,_5 as tn,X$ as un,j3 as vn,dX as wn,lX as xn,N6 as yn,pX as zn,iX as An,M6 as Bn,R1 as Cn,wK as Dn,T6 as En,w3 as Fn,aX as Gn,L3 as Hn,tX as In,eX as Jn,RK as Kn,DK as Ln,I6 as Mn,k6 as Nn,E6 as On,$J as Pn,ZJ as Qn,NK as Rn,AK as Sn,XJ as Tn,MK as Un,TK as Vn,S6 as Wn,f6 as Xn,N3 as Yn,xK as Zn,F5 as _n,A3 as $n,M3 as ao,gK as bo,FJ as co,hK as do,LJ as eo,h6 as fo,uK as go,wJ as ho,dK as io,mK as jo,y3 as ko,nK as lo,sK as mo,oK as no,rK as oo,aK as po,NJ as qo,tK as ro,Y$ as so,AJ as to,eK as uo,$z as vo,Zz as wo,Xz as xo,bJ as yo,SJ as zo,cJ as Ao,b3 as Bo,l6 as Co,Jz as Do,Q$ as Eo,kQ as Fo,gQ as Go,_4 as Ho,o9 as Io,_G as Jo,OG as Ko,VG as Lo,FG as Mo,LG as No,r9 as Oo,NG as Po,IG as Qo,kG as Ro,X2 as So,J2 as To,Oz as Uo,s6 as Vo,Vz as Wo,P3 as Xo,v3 as Yo,f3 as Zo,q2 as _o,U2 as $o,W2 as ap,J6 as bp,Y6 as cp,Q6 as dp,G6 as ep,Q3 as fp,G3 as gp,_W as hp,OW as ip,VW as jp,jX as kp,FW as lp,uz as mp,dz as np,z2 as op,mz as pp,j2 as qp,OY as rp,O2 as sp,w2 as tp,M2 as up,K$ as vp,ZH as wp,XH as xp,l3 as yp,T2 as zp,I2 as Ap,nY as Bp,YH as Cp,QH as Dp,sY as Ep,GH as Fp,k2 as Gp,E2 as Hp,H$ as Ip,B$ as Jp,i1 as Kp,rY as Lp,y2 as Mp,S2 as Np,C2 as Op,aY as Pp,tY as Qp,c3 as Rp,p3 as Sp,P2 as Tp,v2 as Up,x2 as Vp,OH as Wp,d2 as Xp,XQ as Yp,QQ as Zp,a2 as _p,t3 as $p,t2 as aq,$9 as bq,Z9 as cq,_Q as dq,OQ as eq,X9 as fq,o3 as gq,VQ as hq,O4 as iq,V4 as jq,L4 as kq,w4 as lq,JG as mq,UG as nq,WG as oq,KG as pq,zG as qq,SG as rq,N1 as sq,D4 as tq,A1 as uq,R$ as vq,xG as wq,gG as xq,hG as yq,T1 as zq,r as Aq,r5 as Bq,J8 as Cq,W0 as Dq,c_ as Eq,p_ as Fq,M7 as Gq,T7 as Hq,V1 as Iq,I7 as Jq,f1 as Kq,k7 as Lq,K5 as Mq,KU as Nq,MZ as Oq,d$ as Pq,zU as Qq,m$ as Rq,HU as Sq,BU as Tq,q1 as Uq,jU as Vq,_U as Wq,OU as Xq,VU as Yq,FU as Zq,LU as _q,TZ as $q,c$ as ar,E7 as br,RU as cr,DU as dr,NU as er,AU as fr,MU as gr,y7 as hr,TU as ir,S7 as jr,IU as kr,kU as lr,z5 as mr,SZ as nr,SU as or,PZ as pr,g7 as qr,m5 as rr,gU as sr,p7 as tr,a$ as ur,AW as vr,U3 as wr,wX as xr,AX as yr,MW as zr,TW as Ar,IW as Br,kW as Cr,EW as Dr,bW as Er,MX as Fr,TX as Gr,q6 as Hr,O6 as Ir,bX as Jr,K3 as Kr,V6 as Lr,iW as Mr,nW as Nr,H3 as Or,fX as Pr,F6 as Qr};