@stacksjs/stx 0.2.173 → 0.2.175

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.
package/dist/craft.js CHANGED
@@ -2289,7 +2289,7 @@ ${j}
2289
2289
  `:`
2290
2290
  `)}</p>`);if(J=w.join(`
2291
2291
  `),Y)J=J.replace(/\n/g,`<br />
2292
- `);for(let U=0;U<G.length;U++)J=J.replace(`\x00CODEBLOCK${U}\x00`,G[U]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function k5(X="const",$=[],Z){let Y=$.length?j1.filter((J)=>!$.includes(J)):j1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${X} { ${Y.join(", ")} } = window.stx;`}function g$(X){if(!X)return!1;return HU.some(($)=>new RegExp(`\\b${$}\\s*(?:<[^>]*>)?\\s*\\(`).test(X))}function h$(X){if(!X)return!1;let $=z6(X);if(LU.some((Z)=>Z.test($)))return!0;return g$($)}function q6(X){if(!X)return!1;return OU.test(z6(X))||h$(X)}function K6(){return`{${W6.map((X)=>`'${X}':1`).join(",")}}`}function z6(X){if(!X)return X;let $=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(Y,J,G)=>J??" ".repeat(G.length));return X.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var j1,w6,jU,HU,LU,OU,W6,FU,U6;var J1=D(()=>{j1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],w6=["onMount","onDestroy"];jU=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],HU=j1.filter((X)=>!jU.includes(X));LU=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],OU=/\s@[a-z][\w.:-]*\s*=/i;W6=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],FU=["x-init","x-transition","x-effect","x-on"],U6=[...W6,...FU]});function j6(X){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of X){let Y=Z.toLowerCase();if(Y==="prevent")$.prevent=!0;else if(Y==="stop")$.stop=!0;else if(Y==="once")$.once=!0;else if(Y==="capture")$.capture=!0;else if(Y==="self")$.self=!0;else if(Y==="passive")$.passive=!0;else if(VU.has(Y))$.systemKeys.push(Y);else if(Y in H6)$.mouse=Y;else if(Y in B6||/^[a-z]$/.test(Y))$.keys.push(B6[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);$.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);$.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return $}function L6(X){let $=[],Z=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec(X))!==null){let[G,Q,w]=J,q=J.index,W=q+G.length,U=`__stx_evt_${Z++}`,K=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=z.exec(w))!==null){let[,j,H]=B,O=j.split("."),L=O[0];if(!_6.has(L))continue;K.push({attribute:`@${j}`,event:L,handler:H,modifiers:j6(O.slice(1)),elementId:U})}let _=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=_.exec(w))!==null){let[,j,H]=B,O=j.split("."),L=O[0];if(!_6.has(L))continue;K.push({attribute:`@${j}`,event:L,handler:H,modifiers:j6(O.slice(1)),elementId:U})}if(K.length>0)$.push({originalTag:G,elementId:U,events:K,startIndex:q,endIndex:W})}return $}function AU(X){let $=[],{modifiers:Z}=X;if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=H6[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function RU(X,$){let Z=X;if($.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${$.debounce})`;else if($.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${$.throttle})`;return Z}function u$(X){let $=X.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test($))return X;return`if (typeof ${$} === 'function' && !${$}._isSignal) ${$}($event);`}function TU(X){let{modifiers:$}=X,Z=X.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=AU(X),J=RU(u$(X.handler),$),G=[];if($.once)G.push("once: true");if($.capture)G.push("capture: true");if($.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",w=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(X.event==="mounted")return`
2292
+ `);for(let U=0;U<G.length;U++)J=J.replace(`\x00CODEBLOCK${U}\x00`,G[U]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function k5(X="const",$=[],Z){let Y=$.length?j1.filter((J)=>!$.includes(J)):j1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${X} { ${Y.join(", ")} } = window.stx;`}function g$(X){if(!X)return!1;return HU.some(($)=>new RegExp(`\\b${$}\\s*(?:<[^>]*>)?\\s*\\(`).test(X))}function h$(X){if(!X)return!1;let $=z6(X);if(LU.some((Z)=>Z.test($)))return!0;return g$($)}function q6(X){if(!X)return!1;return OU.test(z6(X))||h$(X)}function K6(){return`{${W6.map((X)=>`'${X}':1`).join(",")}}`}function z6(X){if(!X)return X;let $=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(Y,J,G)=>J??" ".repeat(G.length));return X.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var j1,w6,jU,HU,LU,OU,W6,FU,U6;var G1=D(()=>{j1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],w6=["onMount","onDestroy"];jU=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],HU=j1.filter((X)=>!jU.includes(X));LU=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],OU=/\s@[a-z][\w.:-]*\s*=/i;W6=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],FU=["x-init","x-transition","x-effect","x-on"],U6=[...W6,...FU]});function j6(X){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of X){let Y=Z.toLowerCase();if(Y==="prevent")$.prevent=!0;else if(Y==="stop")$.stop=!0;else if(Y==="once")$.once=!0;else if(Y==="capture")$.capture=!0;else if(Y==="self")$.self=!0;else if(Y==="passive")$.passive=!0;else if(VU.has(Y))$.systemKeys.push(Y);else if(Y in H6)$.mouse=Y;else if(Y in B6||/^[a-z]$/.test(Y))$.keys.push(B6[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);$.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);$.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return $}function L6(X){let $=[],Z=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec(X))!==null){let[G,Q,w]=J,q=J.index,W=q+G.length,U=`__stx_evt_${Z++}`,K=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=z.exec(w))!==null){let[,j,H]=B,O=j.split("."),L=O[0];if(!_6.has(L))continue;K.push({attribute:`@${j}`,event:L,handler:H,modifiers:j6(O.slice(1)),elementId:U})}let _=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=_.exec(w))!==null){let[,j,H]=B,O=j.split("."),L=O[0];if(!_6.has(L))continue;K.push({attribute:`@${j}`,event:L,handler:H,modifiers:j6(O.slice(1)),elementId:U})}if(K.length>0)$.push({originalTag:G,elementId:U,events:K,startIndex:q,endIndex:W})}return $}function AU(X){let $=[],{modifiers:Z}=X;if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=H6[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function RU(X,$){let Z=X;if($.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${$.debounce})`;else if($.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${$.throttle})`;return Z}function u$(X){let $=X.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test($))return X;return`if (typeof ${$} === 'function' && !${$}._isSignal) ${$}($event);`}function TU(X){let{modifiers:$}=X,Z=X.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=AU(X),J=RU(u$(X.handler),$),G=[];if($.once)G.push("once: true");if($.capture)G.push("capture: true");if($.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",w=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(X.event==="mounted")return`
2293
2293
  (function() {
2294
2294
  var $el = document.getElementById('${Z}');
2295
2295
  if (!$el) return;
@@ -2402,15 +2402,15 @@ else {
2402
2402
  `)}
2403
2403
  })();
2404
2404
  </script>`}function MU(X){let $=L6(X);if($.length===0)return{template:X,bindings:[]};let Z=X,Y=[];for(let J=$.length-1;J>=0;J--){let G=$[J],Q=G.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let w=Q.match(/id=["']([^"']+)["']/);if(w)for(let q of G.events)q.elementId=w[1]}for(let w of G.events){let q=w.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(W,""),Q=Q.replace(U,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),Y.push(...G.events)}return{template:Z,bindings:Y}}function O6(X,$,Z){if(h$(X))return X;if($.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(X))return X;let{template:w,bindings:q}=MU(X),W=$.__stx_event_bindings||[];return $.__stx_event_bindings=[...W,...q],w}let Y=L6(X);if(Y.length===0)return X;let J=X;for(let w=Y.length-1;w>=0;w--){let q=Y[w],W=q.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let U=W.match(/id=["']([^"']+)["']/);if(U)for(let K of q.events)K.elementId=U[1]}for(let U of q.events){let K=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");W=W.replace(z,""),W=W.replace(B,"")}J=J.slice(0,q.startIndex)+W+J.slice(q.endIndex)}let G=d$(Y.flatMap((w)=>w.events)),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
2405
- `+J.slice(Q);else J+=G;return J}var _6,B6,VU,H6;var m$=D(()=>{J1();_6=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"]),B6={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"},VU=new Set(["ctrl","alt","shift","meta"]),H6={left:0,middle:1,right:2}});function h0(X){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;X=X.replace($,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2405
+ `+J.slice(Q);else J+=G;return J}var _6,B6,VU,H6;var m$=D(()=>{G1();_6=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"]),B6={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"},VU=new Set(["ctrl","alt","shift","meta"]),H6={left:0,middle:1,right:2}});function h0(X){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;X=X.replace($,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2406
2406
  `});let Z=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return X=X.replace(Z,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__composables
2407
2407
  `}),X}function OX(X){return X.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function NU(X,$){let Z=X[$],Y=$+1;while(Y<X.length){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===Z)return Y+1;Y++}return X.length}function kU(X,$){let Z=$+1;while(Z<X.length){if(X[Z]==="\\"){Z+=2;continue}if(X[Z]==="`")return Z+1;if(X[Z]==="$"&&X[Z+1]==="{"){if(Z=FX(X,Z+2),Z<X.length)Z++;continue}Z++}return X.length}function FX(X,$){let Z=1,Y=$;while(Y<X.length){let J=X[Y];if(J==="\\"){Y+=2;continue}if(J==='"'||J==="'"){Y=NU(X,Y);continue}if(J==="`"){Y=kU(X,Y);continue}if(J==="/"&&X[Y+1]==="/"){while(Y<X.length&&X[Y]!==`
2408
- `)Y++;continue}if(J==="/"&&X[Y+1]==="*"){Y+=2;while(Y<X.length&&X.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(J==="{"){Z++,Y++;continue}if(J==="}"){if(Z--,Z===0)return Y;Y++;continue}Y++}return X.length}function G1(X){let $="",Z=0;while(Z<X.length){let Y=X.slice(Z,Z+2);if(Y==="//"){while(Z<X.length&&X[Z]!==`
2408
+ `)Y++;continue}if(J==="/"&&X[Y+1]==="*"){Y+=2;while(Y<X.length&&X.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(J==="{"){Z++,Y++;continue}if(J==="}"){if(Z--,Z===0)return Y;Y++;continue}Y++}return X.length}function p0(X){let $="",Z=0;while(Z<X.length){let Y=X.slice(Z,Z+2);if(Y==="//"){while(Z<X.length&&X[Z]!==`
2409
2409
  `)$+=" ",Z++;continue}if(Y==="/*"){while(Z<X.length&&X.slice(Z,Z+2)!=="*/")$+=X[Z]===`
2410
2410
  `?`
2411
2411
  `:" ",Z++;$+=" ",Z+=2;continue}let J=X[Z];if(J==='"'||J==="'"){let G=J;$+=" ",Z++;while(Z<X.length&&X[Z]!==G){if(X[Z]==="\\"){$+=" ",Z+=2;continue}$+=X[Z]===`
2412
2412
  `?`
2413
- `:" ",Z++}$+=" ",Z++;continue}if(J==="`"){$+=" ",Z++;while(Z<X.length&&X[Z]!=="`"){if(X[Z]==="\\"){$+=" ",Z+=2;continue}if(X[Z]==="$"&&X[Z+1]==="{"){let G=Z+2,Q=FX(X,G);if($+=" ",$+=G1(X.slice(G,Q)),Q<X.length)$+=" ";Z=Q+1;continue}$+=X[Z]===`
2413
+ `:" ",Z++}$+=" ",Z++;continue}if(J==="`"){$+=" ",Z++;while(Z<X.length&&X[Z]!=="`"){if(X[Z]==="\\"){$+=" ",Z+=2;continue}if(X[Z]==="$"&&X[Z+1]==="{"){let G=Z+2,Q=FX(X,G);if($+=" ",$+=p0(X.slice(G,Q)),Q<X.length)$+=" ";Z=Q+1;continue}$+=X[Z]===`
2414
2414
  `?`
2415
2415
  `:" ",Z++}$+=" ",Z++;continue}$+=J,Z++}return $}function IU(){let X=globalThis;return X[F6]??=new Map,X[F6]}function e(X,$){let Z=IU(),Y=`${import.meta.url}\x00${X}`,J=Z.get(Y);if(J)return J;let G=$();return Z.set(Y,G),G.catch(()=>{if(Z.get(Y)===G)Z.delete(Y)}),G}var F6;var V7=D(()=>{F6=Symbol.for("stx.lazy-module-promises")});function I5(X){if(!X||X.indexOf("</")===-1)return X;return X.replace(EU,"<\\/$1")}var EU;var l$=D(()=>{EU=/<\/(script)/gi});import DU from"process";function C0(X="STX_PUBLIC_"){let $={},Z={};for(let[Y,J]of Object.entries(DU.env)){if(!Y.startsWith(X)||J===void 0)continue;$[`import.meta.env.${Y}`]=JSON.stringify(J),Z[Y]=J}return $["import.meta.env"]=JSON.stringify(Z),$}var E1=()=>{};import A7 from"path";function A6(X){V6=X?.trim()||null}function R7(){return process.env[yU]?.trim()||V6||E5}function T7(X=process.cwd(),...$){let Z=R7();return A7.isAbsolute(Z)?A7.join(Z,...$):A7.join(X,Z,...$)}function M7(X){if(!X||A7.isAbsolute(X))return X;let $=X.replace(/\\/g,"/");if($!==E5&&!$.startsWith(`${E5}/`))return X;let Z=$.slice(E5.length+1);return Z?A7.join(R7(),Z):R7()}var E5=".stx",yU="STX_DIR",V6=null;var VX=()=>{};function bU(X){if(!X||typeof X!=="object")return!1;let $=X;return typeof $.message==="string"&&($.name==="BuildMessage"||$.name==="ResolveMessage"||("position"in $))}function SU(X){if(X&&typeof X==="object"&&Array.isArray(X.errors))return X.errors;return[X]}function c$(X,$){let Z=[];for(let Y of SU(X)){if(bU(Y)){let J=Y.position||void 0;Z.push({file:$||J?.file,line:J?.line,column:J?.column,message:Y.message??"",lineText:J?.lineText});continue}Z.push({file:$,message:Y instanceof Error?Y.message:String(Y)})}return Z}function R6(X,$){return c$(X,$).map((Z)=>{let Y=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",J=Z.lineText?`
2416
2416
  ${Z.lineText.trim()}`:"";return Y?`${Y}: ${Z.message}${J}`:`${Z.message}${J}`}).join(`
@@ -2424,13 +2424,13 @@ var ${T} = (function() {
2424
2424
  ${V}
2425
2425
  return { ${M} };
2426
2426
  })();
2427
- ${N}`.trim(),s1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${L0.basename($)} (${Q}); serving the unbundled source and not caching this result`),X;P0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let y=Array.from(L).map((I)=>{try{return{path:I,mtimeMs:P0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(q,JSON.stringify({metadataVersion:N6,files:y})),V}catch(F){let V=c$(F,$||void 0),A=R6(F,$||void 0);if(console.warn(`[stx:bundler] error: ${A}`),I6($||"",A,V),E6()==="error")throw F;return X}finally{try{P0.rmSync(U,{force:!0}),P0.rmSync(K,{recursive:!0,force:!0})}catch{}}}var CU=5,N6=1,n$,i$,T6,p$,M6;var k7=D(()=>{E1();VX();H1();n$=[];T6=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];p$=new Map,M6=Symbol.for("stx.client-bundle-build-queue")});var f6={};t(f6,{stripCommentsAndLiterals:()=>G1,renderVendorStyleTags:()=>RX,processClientScript:()=>t1,injectBrowserCoreAutoImports:()=>D5,generateServerDataBridge:()=>TX,generateBrowserAutoImportDestructuring:()=>sU,generateAutoImportDestructuring:()=>r$,findInterpolationEnd:()=>FX,extractBridgeData:()=>a1,extractAndStripCssImports:()=>AX,STX_AUTO_IMPORTS:()=>C6});import o1 from"path";import E7 from"fs";function mU(X){if(X.startsWith(".")||X.startsWith("/"))return null;if(X.startsWith("@")){let Z=X.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let $=X.match(/^([^/]+)(\/.*)?$/);if(!$)return null;return{pkg:$[1],subpath:$[2]||""}}function lU(X,$){let Z=$;while(!0){let Y=o1.join(Z,"node_modules",X,"package.json");if(E7.existsSync(Y))return o1.dirname(Y);let J=o1.dirname(Z);if(J===Z)return null;Z=J}}function cU(X,$){if(!X||typeof X!=="object")return null;let Z=(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 Z(J.import);if(typeof J.default==="object")return Z(J.default)}return null};if(Object.prototype.hasOwnProperty.call(X,$))return Z(X[$]);let Y=null;for(let J of Object.keys(X)){let G=J.indexOf("*");if(G===-1)continue;let Q=J.slice(0,G),w=J.slice(G+1);if(!$.startsWith(Q)||!$.endsWith(w))continue;if($.length<Q.length+w.length)continue;if(!Y||Q.length>Y.prefix.length)Y={pattern:J,prefix:Q,suffix:w}}if(Y){let J=$.slice(Y.prefix.length,$.length-Y.suffix.length),G=Z(X[Y.pattern]);if(G)return G.replace("*",J)}return null}function pU(X,$){let Z=mU(X);if(!Z||!Z.subpath)return null;let Y=lU(Z.pkg,$);if(!Y)return null;let J;try{J=JSON.parse(E7.readFileSync(o1.join(Y,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=cU(J.exports,G);if(!Q)return null;let w=o1.resolve(Y,Q);return E7.existsSync(w)?w:null}function AX(X,$){let Z=$.filePath?o1.dirname($.filePath):$.projectRoot||process.cwd(),Y=$.projectRoot||process.cwd(),J=new Set,G=[];return{code:X.replace(dU,(w,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:o1.resolve(Z,q),!E7.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,Y)}catch{U=pU(q,Y)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${$.filePath||"<unknown>"}): ${U?.message||U}`),""}if(J.has(W))return"";J.add(W);try{let U=E7.readFileSync(W,"utf8");G.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:G}}function iU(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function RX(X){if(X.length===0)return"";return`${X.map(($)=>{return`<style data-stx-vendor="${iU($.source)}" data-stx-layer="vendor">
2427
+ ${N}`.trim(),s1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${L0.basename($)} (${Q}); serving the unbundled source and not caching this result`),X;P0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let y=Array.from(L).map((I)=>{try{return{path:I,mtimeMs:P0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(q,JSON.stringify({metadataVersion:N6,files:y})),V}catch(F){let V=c$(F,$||void 0),A=R6(F,$||void 0);if(console.warn(`[stx:bundler] error: ${A}`),I6($||"",A,V),E6()==="error")throw F;return X}finally{try{P0.rmSync(U,{force:!0}),P0.rmSync(K,{recursive:!0,force:!0})}catch{}}}var CU=5,N6=1,n$,i$,T6,p$,M6;var k7=D(()=>{E1();VX();H1();n$=[];T6=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];p$=new Map,M6=Symbol.for("stx.client-bundle-build-queue")});var f6={};t(f6,{stripCommentsAndLiterals:()=>p0,renderVendorStyleTags:()=>RX,processClientScript:()=>t1,injectBrowserCoreAutoImports:()=>D5,generateServerDataBridge:()=>TX,generateBrowserAutoImportDestructuring:()=>sU,generateAutoImportDestructuring:()=>r$,findInterpolationEnd:()=>FX,extractBridgeData:()=>a1,extractAndStripCssImports:()=>AX,STX_AUTO_IMPORTS:()=>C6});import o1 from"path";import E7 from"fs";function mU(X){if(X.startsWith(".")||X.startsWith("/"))return null;if(X.startsWith("@")){let Z=X.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let $=X.match(/^([^/]+)(\/.*)?$/);if(!$)return null;return{pkg:$[1],subpath:$[2]||""}}function lU(X,$){let Z=$;while(!0){let Y=o1.join(Z,"node_modules",X,"package.json");if(E7.existsSync(Y))return o1.dirname(Y);let J=o1.dirname(Z);if(J===Z)return null;Z=J}}function cU(X,$){if(!X||typeof X!=="object")return null;let Z=(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 Z(J.import);if(typeof J.default==="object")return Z(J.default)}return null};if(Object.prototype.hasOwnProperty.call(X,$))return Z(X[$]);let Y=null;for(let J of Object.keys(X)){let G=J.indexOf("*");if(G===-1)continue;let Q=J.slice(0,G),w=J.slice(G+1);if(!$.startsWith(Q)||!$.endsWith(w))continue;if($.length<Q.length+w.length)continue;if(!Y||Q.length>Y.prefix.length)Y={pattern:J,prefix:Q,suffix:w}}if(Y){let J=$.slice(Y.prefix.length,$.length-Y.suffix.length),G=Z(X[Y.pattern]);if(G)return G.replace("*",J)}return null}function pU(X,$){let Z=mU(X);if(!Z||!Z.subpath)return null;let Y=lU(Z.pkg,$);if(!Y)return null;let J;try{J=JSON.parse(E7.readFileSync(o1.join(Y,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=cU(J.exports,G);if(!Q)return null;let w=o1.resolve(Y,Q);return E7.existsSync(w)?w:null}function AX(X,$){let Z=$.filePath?o1.dirname($.filePath):$.projectRoot||process.cwd(),Y=$.projectRoot||process.cwd(),J=new Set,G=[];return{code:X.replace(dU,(w,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:o1.resolve(Z,q),!E7.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,Y)}catch{U=pU(q,Y)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${$.filePath||"<unknown>"}): ${U?.message||U}`),""}if(J.has(W))return"";J.add(W);try{let U=E7.readFileSync(W,"utf8");G.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:G}}function iU(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function RX(X){if(X.length===0)return"";return`${X.map(($)=>{return`<style data-stx-vendor="${iU($.source)}" data-stx-layer="vendor">
2428
2428
  @layer vendor {
2429
2429
  ${$.contents}
2430
2430
  }
2431
2431
  </style>`}).join(`
2432
2432
  `)}
2433
- `}function D5(X){let $=G1(X),Z=new Set;for(let w of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of w[1].split(",")){let W=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)Z.add(W)}let Y=new Set;for(let w of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(w[1]);for(let w of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of w[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)Y.add(W)}let J=P6.filter((w)=>{if(Z.has(w)||Y.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test($)}),G=v6($).filter((w)=>!Z.has(w)&&!Y.has(w));if(J.length===0&&G.length===0)return{code:X,imports:J,models:G};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2433
+ `}function D5(X){let $=p0(X),Z=new Set;for(let w of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of w[1].split(",")){let W=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)Z.add(W)}let Y=new Set;for(let w of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(w[1]);for(let w of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of w[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)Y.add(W)}let J=P6.filter((w)=>{if(Z.has(w)||Y.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test($)}),G=v6($).filter((w)=>!Z.has(w)&&!Y.has(w));if(J.length===0&&G.length===0)return{code:X,imports:J,models:G};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2434
2434
  `)}
2435
2435
  ${X}`,imports:J,models:G}}function v6(X){let $=new Set,Z=/\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=Z.exec(X))!==null)if(!nU.has(Y[1]))$.add(Y[1]);return Array.from($)}function rU(X){let $=new Set;for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Y of Z[1].split(",")){let J=Y.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))$.add(J)}return $}function x6(X){let $=new Set,Z=new Set,Y=X;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,G=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,Q;while((Q=G.exec(X))!==null){let W=Q[1],U=Q[2];if(Q[0].includes("import type"))continue;let K=[];for(let B of W.split(",")){let _=B.trim();if(!_||_.startsWith("type "))continue;let j=_.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!j)continue;let H=j[1],O=j[2]||H;if(J.add(H),J.add(O),U==="stx"||U==="@stacksjs/stx")$.add(H);else Z.add(H);if(O!==H)K.push(`${O} = ${H}`)}let z=K.length>0?`var ${K.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";Y=Y.replace(Q[0],z)}let w=rU(Y);for(let W of C6){if(J.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))$.add(W)}for(let W of P6){if(J.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(Y))Z.add(W)}let q=v6(Y);for(let W of q)if(!J.has(W)&&!w.has(W))Z.add(W);return{code:Y,stxImports:Array.from($),browserImports:Array.from(Z)}}function r$(X,$){let Z=[];if(X.length>0)Z.push(` var { ${X.join(", ")} } = window.stx || window;`);if($.length>0)Z.push(` var { ${$.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
2436
2436
  ${Z.join(`
@@ -2444,7 +2444,7 @@ ${oU(X,$)}`;return""}function sU(X,$=[]){let{browserImports:Z}=x6(X),Y=new Set($
2444
2444
  + 'or it should be imported from a relative path so the bundler includes it.'
2445
2445
  );
2446
2446
  });
2447
- `}function a1(X){let $=X.__stxClientPayload;if($&&typeof $==="object"){let Y={};for(let J in $){let G=$[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in X){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=X[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function y6(X,$){let Z=new Set;for(let Y of X.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if($){let G=J.lastIndexOf(":");if(G!==-1)J=J.slice(G+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function aU(X,$){if(new RegExp(`(?:const|let|var|function|class)\\s+${$}\\b`).test(X))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(y6(Z[1],!0).has($))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(y6(Z[1],!1).has($))return!0;return!1}function tU(X,$){return new RegExp(`(?<![.#\\w$])${$}(?![\\w$])`).test(X)}function XK(X,$){let Z=eU.test(X),Y=$.length>32768;if(!Z&&!Y)return;if(b6.has(X))return;if(b6.add(X),Z)console.warn(`[stx] server\u2192client bridge is publishing "${X}" 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 ${($.length/1024).toFixed(1)}KB under "${X}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function TX(X,$){if(!$)return"";let Z=G1(X),Y=$.__stxDeclaredPayload===!0,J=[];for(let[G,Q]of Object.entries($)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!Y&&!tU(Z,G))continue;if(aU(X,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;XK(G,w),J.push(` var ${G} = ${w.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2447
+ `}function a1(X){let $=X.__stxClientPayload;if($&&typeof $==="object"){let Y={};for(let J in $){let G=$[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in X){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=X[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function y6(X,$){let Z=new Set;for(let Y of X.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if($){let G=J.lastIndexOf(":");if(G!==-1)J=J.slice(G+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function aU(X,$){if(new RegExp(`(?:const|let|var|function|class)\\s+${$}\\b`).test(X))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(y6(Z[1],!0).has($))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(y6(Z[1],!1).has($))return!0;return!1}function tU(X,$){return new RegExp(`(?<![.#\\w$])${$}(?![\\w$])`).test(X)}function XK(X,$){let Z=eU.test(X),Y=$.length>32768;if(!Z&&!Y)return;if(b6.has(X))return;if(b6.add(X),Z)console.warn(`[stx] server\u2192client bridge is publishing "${X}" 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 ${($.length/1024).toFixed(1)}KB under "${X}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function TX(X,$){if(!$)return"";let Z=p0(X),Y=$.__stxDeclaredPayload===!0,J=[];for(let[G,Q]of Object.entries($)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!Y&&!tU(Z,G))continue;if(aU(X,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;XK(G,w),J.push(` var ${G} = ${w.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2448
2448
  ${J.join(`
2449
2449
  `)}
2450
2450
  `}function ZK(X){let $=[];if(X.self)$.push("if ($event.target !== $el) return");for(let Z of X.systemKeys)$.push(`if (!$event.${Z}Key) return`);if(X.keys.length>0){let Z=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");$.push(`if (!(${Z})) return`)}if(X.mouse!==null){let Z=$K[X.mouse];$.push(`if ($event.button !== ${Z}) return`)}if(X.prevent)$.push("$event.preventDefault()");if(X.stop)$.push("$event.stopPropagation()");return $.join("; ")}function YK(X,$){let{elementId:Z,event:Y,modifiers:J}=X,G=u$(X.handler),Q=ZK(J),w=[];if(J.once)w.push("once: true");if(J.capture)w.push("capture: true");if(J.passive)w.push("passive: true");let q=w.length>0?`, { ${w.join(", ")} }`:"",W="";if(Q)W+=`${Q}; `;let U=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),K=`var $emit = function(name, detail) {
@@ -2508,7 +2508,7 @@ ${K}${F}`)}
2508
2508
  'use strict';
2509
2509
  ${I5(`${Y}${Z}
2510
2510
  ${K}`)}
2511
- })()</script>`}var dU,C6,P6,nU,eU,b6,$K,GK;var y5=D(()=>{m$();T0();V7();J1();l$();dU=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;C6=j1,P6=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];nU=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"]);eU=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,b6=new Set;$K={left:0,middle:1,right:2};GK=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"])});import{createHash as wK}from"crypto";function g6(X){let $=X[MX];return $ instanceof Map?$:null}function h6(X){X[MX]=new Map}function u6(X,$){let Z=g6(X);if(!Z)return null;let Y=wK("sha256").update($).digest("hex").slice(0,16),J=Z.get(Y);if(J)J.instances++;else Z.set(Y,{body:$,instances:1});return Y}function d6(X,$){let Z=g6($);if(!Z?.size)return X;let Y=X;for(let[q,W]of Z){if(W.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(U,(K,z)=>`(${W.body})(${z});`)}let J=[...Z].filter(([,q])=>q.instances>1);if(J.length===0)return Y;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2511
+ })()</script>`}var dU,C6,P6,nU,eU,b6,$K,GK;var y5=D(()=>{m$();T0();V7();G1();l$();dU=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;C6=j1,P6=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn"];nU=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"]);eU=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,b6=new Set;$K={left:0,middle:1,right:2};GK=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"])});import{createHash as wK}from"crypto";function g6(X){let $=X[MX];return $ instanceof Map?$:null}function h6(X){X[MX]=new Map}function u6(X,$){let Z=g6(X);if(!Z)return null;let Y=wK("sha256").update($).digest("hex").slice(0,16),J=Z.get(Y);if(J)J.instances++;else Z.set(Y,{body:$,instances:1});return Y}function d6(X,$){let Z=g6($);if(!Z?.size)return X;let Y=X;for(let[q,W]of Z){if(W.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(U,(K,z)=>`(${W.body})(${z});`)}let J=[...Z].filter(([,q])=>q.instances>1);if(J.length===0)return Y;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2512
2512
  (function() {
2513
2513
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
2514
2514
  ${J.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${W.body}; }
@@ -2528,7 +2528,7 @@ catch (e) {
2528
2528
  }
2529
2529
  throw e;
2530
2530
  }
2531
- `),w=Q([]);if(G.length===$.length)return m6(w,G,Q);return m6((...W)=>{let U=Array(J.length);for(let K=0;K<J.length;K++)U[K]=W[J[K]];return w(...U)},G,Q,(W)=>{w=Q(W)})}function m6(X,$,Z,Y){let G=/^(\w+) is not defined$/,Q=X,w=[],q=new Set($);return(...W)=>{for(let U=0;U<=8;U++)try{return Q(...W)}catch(K){let z=K instanceof Error?K.message:"",B=G.exec(z);if(!(K instanceof ReferenceError)||!B)return;let _=B[1];if(q.has(_)||i6.has(_))return;q.add(_),w.push(_),Q=Z(w),Y?.(w)}return}}function kX(X){let $=X.trim(),Z=[/\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 Z)if(Y.test($))return!1;return!0}var qK,l6,c6,WK,p6,UK,i6;var F0=D(()=>{qK={maxSanitizeDepth:10,allowBracketNotation:!1},l6={...qK},c6=[/\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/],WK=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"]),p6=new Set(["__proto__","constructor","prototype"]),UK=/[\w)\]]\s*\[\s*['"]/;i6=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 IX(X,$){let Z=jK++,Y=`<!--__STX_${X.toUpperCase()}_${Z}__-->`;return HK.set(Y,{type:X,expression:$}),Y}var jK=0,HK;var n6=D(()=>{HK=new Map});function t6(X,$,Z,Y){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);if(!G)return-1;return G.index+G[0].length}function D1(X,$){return t6(X,$,r6,s6)}function b5(X,$){return t6(X,$,o6,a6)}function D7(X,$){if(!X.startsWith("<!--",$))return-1;let Z=X.indexOf("-->",$+4);if(Z===-1)return-1;return Z+3}function LK(X,$){if(X.startsWith("<!--",$)){let Z=D7(X,$);return Z===-1?X.length:Z}for(let[Z,Y]of[[r6,s6],[o6,a6]]){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);return G?G.index+G[0].length:X.length}return-1}function a$(X,$){let Z=[],Y=0,J=X.length,G=!1,Q=null;while(Y<J){let w=X[Y];if(G){if(Q){if(w===Q)Q=null}else if(w==='"'||w==="'")Q=w;else if(w===">")G=!1;Y++;continue}if(w!=="<"){Y++;continue}let q=$(X,Y);if(q>Y){Z.push({start:Y,end:q,token:X.slice(Y,q)}),Y=q;continue}let W=LK(X,Y);if(W>Y){Y=W;continue}if(/^<\/?[a-zA-Z]/.test(X.slice(Y,Y+2)))G=!0;Y++}return Z}function Q1(X,$,Z){let Y=a$(X,$);if(Y.length===0)return{output:X,tokens:[]};let J=Y.map((w)=>w.token),G="",Q=0;for(let w=0;w<Y.length;w++){let q=Y[w];G+=X.slice(Q,q.start),G+=Z(q.token,w),Q=q.end}return G+=X.slice(Q),{output:G,tokens:J}}function y1(X){let{output:$,tokens:Z}=Q1(X,D1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:$,scripts:Z}}function y7(X,$){if($.length===0)return X;return X.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>$[+Y]??"")}var r6,s6,o6,a6;var $5=D(()=>{r6=/<script\b[^>]*>/iy,s6=/<\/script\s*>/ig,o6=/<style\b[^>]*>/iy,a6=/<\/style\s*>/ig});var GZ={};t(GZ,{usesSignalsInScript:()=>L1,unescapeHtml:()=>kK,registerFilters:()=>FK,registerFilter:()=>$Z,processExpressions:()=>b1,interpolateScriptsInTemplate:()=>RK,interpolateScriptExpressions:()=>EX,interpolateScriptAttributes:()=>YZ,getAllFilters:()=>ZZ,evaluateExpression:()=>v0,escapeHtml:()=>a0,defaultFilters:()=>S7,clearCustomFilters:()=>VK,applyFilters:()=>JZ});function OK(X){let $=e6.get(X);if(!$){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${Z}(?!\\w)`,"g"),e6.set(X,$)}return $.lastIndex=0,$}function $Z(X,$){if(X in S7)console.warn(`Filter "${X}" already exists as a built-in filter. Custom filter will take precedence.`);b7[X]=$}function FK(X){for(let[$,Z]of Object.entries(X))$Z($,Z)}function ZZ(){return{...S7,...b7}}function VK(){for(let X of Object.keys(b7))delete b7[X]}function a0(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function L1(X){let{scripts:$}=y1(X);for(let Z of $){let Y=Z.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(X))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(X))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(X))return!0;return!1}function XZ(X,$){let Z=["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=X.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let W=0;W<Y.length;W++){let U=Y[W];if(!G&&U==="`"){G=!0,Q=0;continue}if(G){if(U==="`"&&Q===0){G=!1;continue}if(U==="$"&&Y[W+1]==="{"){Q++,W++,J+=" ";continue}if(U==="}"&&Q>0){Q--;continue}if(Q>0){J+=U;continue}continue}J+=U}Y=J;let w=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=w.exec(Y))!==null){let W=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(W)&&!(W in $))return!1}}return!0}function AK(X,$){let Z=$.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let Y=G1(X);for(let J of Z)if(new RegExp(`(?<![.#\\w$])${J}(?![\\w$])`).test(Y))return!0;return!1}function EX(X,$){let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=v0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=v0(J,$);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function YZ(X,$){if(!X.includes("{"))return X;let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=v0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=v0(J,$);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return Y}}),Z}function RK(X,$,Z={}){let{output:Y,scripts:J}=y1(X),G=J.map((Q)=>{let w=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=Q.match(/^<script\b[^>]*>/i),W=Q.search(/<\/script\s*>$/i);if(!w||!q||W===-1)return Q;let U=w[1],K=w[2];if(/\bdata-raw\b/.test(U))return Q;if(Z.skipServer&&/\bserver\b/.test(U))return Q;let B=`<script${YZ(U,$)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return B+K+Q.slice(W);return B+EX(K,$)+Q.slice(W)});return y7(Y,G)}function b1(X,$,Z){let Y=X,J=(K,z)=>{let B=b5(K,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K.slice(z,B))?-1:B},G=(K,z,B,_)=>{let j=B.length,{output:H,tokens:O}=Q1(K,z,(L,F)=>_(j+F));return B.push(...O),H},Q=[];Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`);let w=[];Y=G(Y,D1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`);let q=$?.__stx_signals_gate===!0||L1(X),W=new Set(Array.isArray($?.__stx_client_signal_names)?$.__stx_client_signal_names:[]),U=new Set(Array.isArray($?.__stx_preserved_client_expressions)?$.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,z,B)=>{try{let _=v0(z,$);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return K0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Z,X,B,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,z,B)=>{try{let _=v0(z,$);if(_===void 0&&$.__stx_buildMode==="compile")return IX("raw",z.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if($.__stx_buildMode==="compile")return IX("raw",z.trim());let j=_ instanceof Error?_.message:String(_);return K0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Z,X,B,K)}}),Y=G(Y,D1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`),Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(K,z,B)=>{let _=z.trim();if(U.has(_))return K;let j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=_.match(H)?.[1],F=L&&((L in $)||j.includes(L)),V=Boolean(L&&W.has(L)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=_.match(A),T=R&&!j.includes(R[1])&&!(R[1]in $);if(/^__[A-Z_]+__$/.test(_))return"";try{let M=v0(z,$);if(V)return K;if(q&&!XZ(_,$))return K;if($.__stx_buildMode==="compile"&&!q&&(M===void 0||AK(_,$)))return IX("expr",_);return M!==void 0&&M!==null?a0(String(M)):""}catch(M){if(V)return K;if(q&&!XZ(_,$))return K;if(T)return K;let k=M instanceof Error?M.message:String(M);return K0("Expression",`Error evaluating: {{ ${_} }}: ${k}`,Z,X,B,K)}});for(let K=0;K<w.length;K++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>w[K]);for(let K=0;K<Q.length;K++)Y=Y.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return Y}function JZ(X,$,Z){if(!$.trim())return X;let Y=X,J=$.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let w=b7[Q]||S7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(ZZ()).join(", ")}`);let q=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let K=Number(U);q=[Number.isNaN(K)?U:K]}catch{q=[U]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,U=1;while(W>0&&U<J.length){if(J[U]==="(")W++;if(J[U]===")")W--;U++}if(W===0){let K=J.substring(1,U-1).trim();if(K)try{if(K.startsWith("{")&&K.endsWith("}"))q=[v0(`(${K})`,Z,!0)];else{let z=[],B="",_=null,j=0,H=0,O=0,L=!1;for(let F=0;F<K.length;F++){let V=K[F];if(L){B+=V,L=!1;continue}if(V==="\\"){B+=V,L=!0;continue}if(_){if(B+=V,V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V,B+=V;continue}if(V==="(")j++;else if(V===")")j--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")O++;else if(V==="}")O--;if(V===","&&j===0&&H===0&&O===0){z.push(B),B="";continue}B+=V}if(B)z.push(B);q=z.map((F)=>{let V=F.trim();return v0(V,Z,!0)})}}catch{q=[K]}J=J.substring(U).trim()}}try{Y=w(Y,Z,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${Q}': ${U}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function TK(X){let $=!1,Z="",Y=0,J=0,G=0,Q=!1;for(let w=0;w<X.length;w++){let q=X[w],W=X[w+1];if($&&Q){Q=!1;continue}if($&&q==="\\"){Q=!0;continue}if(Q=!1,(q==='"'||q==="'"||q==="`")&&!Q){if(!$)$=!0,Z=q;else if(q===Z)$=!1,Z="";continue}if($&&Z==="`"&&q==="$"&&W==="{"){let U=1;w+=2;while(w<X.length&&U>0){if(X[w]==="{")U++;else if(X[w]==="}")U--;if(U>0)w++}continue}if($)continue;if(q==="(")Y++;else if(q===")")Y--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")G++;else if(q==="}")G--;if(q==="|"&&Y===0&&J===0&&G===0){if(W==="|"){w++;continue}if(W==="="){w++;continue}return w}}return-1}function v0(X,$,Z=!1){try{let Y=X.trim(),J=TK(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),w=v0(G,$,!0);return JZ(w,Q,$)}if(!q0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Y0(Y,$)}try{let G=Object.keys($),Q=Object.values($);return W0(Y,G)(...Q)}catch{return Y0(Y,$)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=MK(G,Object.keys($));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${X}`,Y);throw Y}}function MK(X,$){let Z=null;for(let J of $){if(J===X)continue;let G=NK(X,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max(X.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function NK(X,$){if(X===$)return 0;if(X.length===0)return $.length;if($.length===0)return X.length;let[Z,Y]=X.length<$.length?[X,$]:[$,X],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let w=1;w<=Z.length;w++){let q=Z[w-1]===Y[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,J[w]+1,J[w-1]+q)}for(let w=0;w<=Z.length;w++)J[w]=G[w]}return J[Z.length]}function kK(X){if(!X)return"";return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var b7,e6,S7;var w1=D(()=>{F0();T0();n6();$5();b7={},e6=new Map;S7={uppercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toUpperCase():""},lowercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toLowerCase():""},capitalize:(X,$)=>{if(X===void 0||X===null)return"";let Z=String(X);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:(X,$,Z=0)=>{if(X===void 0||X===null)return"";try{let Y=Number(X);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:(X,$,Z="en-US")=>{if(X===void 0||X===null)return"";try{let Y=Number(X);if(Number.isNaN(Y))return String(X);return Y.toLocaleString(Z)}catch{return String(X)}},join:(X,$,Z=",")=>{if(!Array.isArray(X))return"";return X.join(String(Z))},escape:(X,$)=>{if(X===void 0||X===null)return"";return a0(String(X))},translate:(X,$,Z={})=>{if(!$||!$.__translations)return X;let Y=$.__translations,J=$.__i18nConfig?.fallbackToKey??!0,G=String(X).split("."),Q=Y;for(let q of G){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return J?X:"";let w=String(Q);return Object.entries(Z).forEach(([q,W])=>{w=w.replace(OK(q),String(W))}),w},t:(X,$,Z={})=>{return S7.translate(X,$,Z)},truncate:(X,$,Z=50,Y="...")=>{if(X===void 0||X===null)return"";let J=String(X);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:(X,$,Z="short",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=X instanceof Date?X:new Date(X);if(Number.isNaN(J.getTime()))return String(X);let G={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Z==="iso")return J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String(X)}},currency:(X,$,Z="USD",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=Number(X);if(Number.isNaN(J))return String(X);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String(X)}},pluralize:(X,$,Z,Y)=>{let J=Number(X);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===1?Z:G},first:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[0];return String(X).charAt(0)},last:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[X.length-1];let Z=String(X);return Z.charAt(Z.length-1)},length:(X,$)=>{if(X===void 0||X===null)return 0;if(Array.isArray(X)||typeof X==="string")return X.length;if(X instanceof Map||X instanceof Set)return X.size;if(typeof X==="object")return Object.keys(X).length;return 0},json:(X,$,Z=!1)=>{if(X===void 0)return"undefined";if(X===null)return"null";try{return Z?JSON.stringify(X,null,2):JSON.stringify(X)}catch{return String(X)}},default:(X,$,Z="")=>{return X===void 0||X===null||X===""?Z:X},reverse:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return[...X].reverse();return String(X).split("").reverse().join("")},slice:(X,$,Z=0,Y)=>{if(X===void 0||X===null)return"";if(Array.isArray(X)||typeof X==="string")return X.slice(Z,Y);return X},replace:(X,$,Z,Y="")=>{if(X===void 0||X===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(X).replace(new RegExp(J,"g"),()=>Y)},stripTags:(X,$)=>{if(X===void 0||X===null)return"";return String(X).replace(/<[^>]*>/g,"")},urlencode:(X,$)=>{if(X===void 0||X===null)return"";return encodeURIComponent(String(X))},abs:(X,$)=>{let Z=Number(X);return Number.isNaN(Z)?0:Math.abs(Z)},round:(X,$,Z=0)=>{let Y=Number(X);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class Z5{cache=new Map;maxSize;constructor(X=100){this.maxSize=X}get(X){if(!this.cache.has(X))return;let $=this.cache.get(X);return this.cache.delete(X),this.cache.set(X,$),$}set(X,$){if(this.cache.has(X))this.cache.delete(X);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set(X,$)}has(X){return this.cache.has(X)}delete(X){return this.cache.delete(X)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function C5(X,$){if($?.includes("g"))return new RegExp(X,$);let Z=`${X}:${$||""}`;if(!S5.has(Z)){if(S5.size>=IK){let Y=S5.keys().next().value;if(Y)S5.delete(Y)}S5.set(Z,new RegExp(X,$))}return S5.get(Z)}class QZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(X){let $=Array.from(new Set(X)),Z=$.sort().join(","),Y=this.pool.find((w)=>w.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...w)=>{return(q)=>{try{let W=`${Z}:${q}`,U=J.get(W);if(!U){if(J.size>=G){let K=J.keys().next().value;if(K)J.delete(K)}U=Function(...$,`
2531
+ `),w=Q([]);if(G.length===$.length)return m6(w,G,Q);return m6((...W)=>{let U=Array(J.length);for(let K=0;K<J.length;K++)U[K]=W[J[K]];return w(...U)},G,Q,(W)=>{w=Q(W)})}function m6(X,$,Z,Y){let G=/^(\w+) is not defined$/,Q=X,w=[],q=new Set($);return(...W)=>{for(let U=0;U<=8;U++)try{return Q(...W)}catch(K){let z=K instanceof Error?K.message:"",B=G.exec(z);if(!(K instanceof ReferenceError)||!B)return;let _=B[1];if(q.has(_)||i6.has(_))return;q.add(_),w.push(_),Q=Z(w),Y?.(w)}return}}function kX(X){let $=X.trim(),Z=[/\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 Z)if(Y.test($))return!1;return!0}var qK,l6,c6,WK,p6,UK,i6;var F0=D(()=>{qK={maxSanitizeDepth:10,allowBracketNotation:!1},l6={...qK},c6=[/\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/],WK=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"]),p6=new Set(["__proto__","constructor","prototype"]),UK=/[\w)\]]\s*\[\s*['"]/;i6=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 IX(X,$){let Z=jK++,Y=`<!--__STX_${X.toUpperCase()}_${Z}__-->`;return HK.set(Y,{type:X,expression:$}),Y}var jK=0,HK;var n6=D(()=>{HK=new Map});function t6(X,$,Z,Y){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);if(!G)return-1;return G.index+G[0].length}function D1(X,$){return t6(X,$,r6,s6)}function b5(X,$){return t6(X,$,o6,a6)}function D7(X,$){if(!X.startsWith("<!--",$))return-1;let Z=X.indexOf("-->",$+4);if(Z===-1)return-1;return Z+3}function LK(X,$){if(X.startsWith("<!--",$)){let Z=D7(X,$);return Z===-1?X.length:Z}for(let[Z,Y]of[[r6,s6],[o6,a6]]){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);return G?G.index+G[0].length:X.length}return-1}function a$(X,$){let Z=[],Y=0,J=X.length,G=!1,Q=null;while(Y<J){let w=X[Y];if(G){if(Q){if(w===Q)Q=null}else if(w==='"'||w==="'")Q=w;else if(w===">")G=!1;Y++;continue}if(w!=="<"){Y++;continue}let q=$(X,Y);if(q>Y){Z.push({start:Y,end:q,token:X.slice(Y,q)}),Y=q;continue}let W=LK(X,Y);if(W>Y){Y=W;continue}if(/^<\/?[a-zA-Z]/.test(X.slice(Y,Y+2)))G=!0;Y++}return Z}function Q1(X,$,Z){let Y=a$(X,$);if(Y.length===0)return{output:X,tokens:[]};let J=Y.map((w)=>w.token),G="",Q=0;for(let w=0;w<Y.length;w++){let q=Y[w];G+=X.slice(Q,q.start),G+=Z(q.token,w),Q=q.end}return G+=X.slice(Q),{output:G,tokens:J}}function y1(X){let{output:$,tokens:Z}=Q1(X,D1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:$,scripts:Z}}function y7(X,$){if($.length===0)return X;return X.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>$[+Y]??"")}var r6,s6,o6,a6;var $5=D(()=>{r6=/<script\b[^>]*>/iy,s6=/<\/script\s*>/ig,o6=/<style\b[^>]*>/iy,a6=/<\/style\s*>/ig});var GZ={};t(GZ,{usesSignalsInScript:()=>L1,unescapeHtml:()=>kK,registerFilters:()=>FK,registerFilter:()=>$Z,processExpressions:()=>b1,interpolateScriptsInTemplate:()=>RK,interpolateScriptExpressions:()=>EX,interpolateScriptAttributes:()=>YZ,getAllFilters:()=>ZZ,evaluateExpression:()=>v0,escapeHtml:()=>t0,defaultFilters:()=>S7,clearCustomFilters:()=>VK,applyFilters:()=>JZ});function OK(X){let $=e6.get(X);if(!$){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${Z}(?!\\w)`,"g"),e6.set(X,$)}return $.lastIndex=0,$}function $Z(X,$){if(X in S7)console.warn(`Filter "${X}" already exists as a built-in filter. Custom filter will take precedence.`);b7[X]=$}function FK(X){for(let[$,Z]of Object.entries(X))$Z($,Z)}function ZZ(){return{...S7,...b7}}function VK(){for(let X of Object.keys(b7))delete b7[X]}function t0(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function L1(X){let{scripts:$}=y1(X);for(let Z of $){let Y=Z.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(X))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(X))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(X))return!0;return!1}function XZ(X,$){let Z=["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=X.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let W=0;W<Y.length;W++){let U=Y[W];if(!G&&U==="`"){G=!0,Q=0;continue}if(G){if(U==="`"&&Q===0){G=!1;continue}if(U==="$"&&Y[W+1]==="{"){Q++,W++,J+=" ";continue}if(U==="}"&&Q>0){Q--;continue}if(Q>0){J+=U;continue}continue}J+=U}Y=J;let w=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=w.exec(Y))!==null){let W=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(W)&&!(W in $))return!1}}return!0}function AK(X,$){let Z=$.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let Y=p0(X);for(let J of Z)if(new RegExp(`(?<![.#\\w$])${J}(?![\\w$])`).test(Y))return!0;return!1}function EX(X,$){let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=v0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=v0(J,$);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function YZ(X,$){if(!X.includes("{"))return X;let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=v0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=v0(J,$);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return Y}}),Z}function RK(X,$,Z={}){let{output:Y,scripts:J}=y1(X),G=J.map((Q)=>{let w=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=Q.match(/^<script\b[^>]*>/i),W=Q.search(/<\/script\s*>$/i);if(!w||!q||W===-1)return Q;let U=w[1],K=w[2];if(/\bdata-raw\b/.test(U))return Q;if(Z.skipServer&&/\bserver\b/.test(U))return Q;let B=`<script${YZ(U,$)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return B+K+Q.slice(W);return B+EX(K,$)+Q.slice(W)});return y7(Y,G)}function b1(X,$,Z){let Y=X,J=(K,z)=>{let B=b5(K,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K.slice(z,B))?-1:B},G=(K,z,B,_)=>{let j=B.length,{output:H,tokens:O}=Q1(K,z,(L,F)=>_(j+F));return B.push(...O),H},Q=[];Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`);let w=[];Y=G(Y,D1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`);let q=$?.__stx_signals_gate===!0||L1(X),W=new Set(Array.isArray($?.__stx_client_signal_names)?$.__stx_client_signal_names:[]),U=new Set(Array.isArray($?.__stx_preserved_client_expressions)?$.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,z,B)=>{try{let _=v0(z,$);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return K0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Z,X,B,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,z,B)=>{try{let _=v0(z,$);if(_===void 0&&$.__stx_buildMode==="compile")return IX("raw",z.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if($.__stx_buildMode==="compile")return IX("raw",z.trim());let j=_ instanceof Error?_.message:String(_);return K0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Z,X,B,K)}}),Y=G(Y,D1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`),Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(K,z,B)=>{let _=z.trim();if(U.has(_))return K;let j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=_.match(H)?.[1],F=L&&((L in $)||j.includes(L)),V=Boolean(L&&W.has(L)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=_.match(A),T=R&&!j.includes(R[1])&&!(R[1]in $);if(/^__[A-Z_]+__$/.test(_))return"";try{let M=v0(z,$);if(V)return K;if(q&&!XZ(_,$))return K;if($.__stx_buildMode==="compile"&&!q&&(M===void 0||AK(_,$)))return IX("expr",_);return M!==void 0&&M!==null?t0(String(M)):""}catch(M){if(V)return K;if(q&&!XZ(_,$))return K;if(T)return K;let k=M instanceof Error?M.message:String(M);return K0("Expression",`Error evaluating: {{ ${_} }}: ${k}`,Z,X,B,K)}});for(let K=0;K<w.length;K++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>w[K]);for(let K=0;K<Q.length;K++)Y=Y.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return Y}function JZ(X,$,Z){if(!$.trim())return X;let Y=X,J=$.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let w=b7[Q]||S7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(ZZ()).join(", ")}`);let q=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let K=Number(U);q=[Number.isNaN(K)?U:K]}catch{q=[U]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,U=1;while(W>0&&U<J.length){if(J[U]==="(")W++;if(J[U]===")")W--;U++}if(W===0){let K=J.substring(1,U-1).trim();if(K)try{if(K.startsWith("{")&&K.endsWith("}"))q=[v0(`(${K})`,Z,!0)];else{let z=[],B="",_=null,j=0,H=0,O=0,L=!1;for(let F=0;F<K.length;F++){let V=K[F];if(L){B+=V,L=!1;continue}if(V==="\\"){B+=V,L=!0;continue}if(_){if(B+=V,V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V,B+=V;continue}if(V==="(")j++;else if(V===")")j--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")O++;else if(V==="}")O--;if(V===","&&j===0&&H===0&&O===0){z.push(B),B="";continue}B+=V}if(B)z.push(B);q=z.map((F)=>{let V=F.trim();return v0(V,Z,!0)})}}catch{q=[K]}J=J.substring(U).trim()}}try{Y=w(Y,Z,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${Q}': ${U}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function TK(X){let $=!1,Z="",Y=0,J=0,G=0,Q=!1;for(let w=0;w<X.length;w++){let q=X[w],W=X[w+1];if($&&Q){Q=!1;continue}if($&&q==="\\"){Q=!0;continue}if(Q=!1,(q==='"'||q==="'"||q==="`")&&!Q){if(!$)$=!0,Z=q;else if(q===Z)$=!1,Z="";continue}if($&&Z==="`"&&q==="$"&&W==="{"){let U=1;w+=2;while(w<X.length&&U>0){if(X[w]==="{")U++;else if(X[w]==="}")U--;if(U>0)w++}continue}if($)continue;if(q==="(")Y++;else if(q===")")Y--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")G++;else if(q==="}")G--;if(q==="|"&&Y===0&&J===0&&G===0){if(W==="|"){w++;continue}if(W==="="){w++;continue}return w}}return-1}function v0(X,$,Z=!1){try{let Y=X.trim(),J=TK(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),w=v0(G,$,!0);return JZ(w,Q,$)}if(!q0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Y0(Y,$)}try{let G=Object.keys($),Q=Object.values($);return W0(Y,G)(...Q)}catch{return Y0(Y,$)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=MK(G,Object.keys($));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${X}`,Y);throw Y}}function MK(X,$){let Z=null;for(let J of $){if(J===X)continue;let G=NK(X,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max(X.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function NK(X,$){if(X===$)return 0;if(X.length===0)return $.length;if($.length===0)return X.length;let[Z,Y]=X.length<$.length?[X,$]:[$,X],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let w=1;w<=Z.length;w++){let q=Z[w-1]===Y[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,J[w]+1,J[w-1]+q)}for(let w=0;w<=Z.length;w++)J[w]=G[w]}return J[Z.length]}function kK(X){if(!X)return"";return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var b7,e6,S7;var w1=D(()=>{F0();T0();n6();$5();b7={},e6=new Map;S7={uppercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toUpperCase():""},lowercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toLowerCase():""},capitalize:(X,$)=>{if(X===void 0||X===null)return"";let Z=String(X);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:(X,$,Z=0)=>{if(X===void 0||X===null)return"";try{let Y=Number(X);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:(X,$,Z="en-US")=>{if(X===void 0||X===null)return"";try{let Y=Number(X);if(Number.isNaN(Y))return String(X);return Y.toLocaleString(Z)}catch{return String(X)}},join:(X,$,Z=",")=>{if(!Array.isArray(X))return"";return X.join(String(Z))},escape:(X,$)=>{if(X===void 0||X===null)return"";return t0(String(X))},translate:(X,$,Z={})=>{if(!$||!$.__translations)return X;let Y=$.__translations,J=$.__i18nConfig?.fallbackToKey??!0,G=String(X).split("."),Q=Y;for(let q of G){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return J?X:"";let w=String(Q);return Object.entries(Z).forEach(([q,W])=>{w=w.replace(OK(q),String(W))}),w},t:(X,$,Z={})=>{return S7.translate(X,$,Z)},truncate:(X,$,Z=50,Y="...")=>{if(X===void 0||X===null)return"";let J=String(X);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:(X,$,Z="short",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=X instanceof Date?X:new Date(X);if(Number.isNaN(J.getTime()))return String(X);let G={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Z==="iso")return J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String(X)}},currency:(X,$,Z="USD",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=Number(X);if(Number.isNaN(J))return String(X);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String(X)}},pluralize:(X,$,Z,Y)=>{let J=Number(X);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===1?Z:G},first:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[0];return String(X).charAt(0)},last:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[X.length-1];let Z=String(X);return Z.charAt(Z.length-1)},length:(X,$)=>{if(X===void 0||X===null)return 0;if(Array.isArray(X)||typeof X==="string")return X.length;if(X instanceof Map||X instanceof Set)return X.size;if(typeof X==="object")return Object.keys(X).length;return 0},json:(X,$,Z=!1)=>{if(X===void 0)return"undefined";if(X===null)return"null";try{return Z?JSON.stringify(X,null,2):JSON.stringify(X)}catch{return String(X)}},default:(X,$,Z="")=>{return X===void 0||X===null||X===""?Z:X},reverse:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return[...X].reverse();return String(X).split("").reverse().join("")},slice:(X,$,Z=0,Y)=>{if(X===void 0||X===null)return"";if(Array.isArray(X)||typeof X==="string")return X.slice(Z,Y);return X},replace:(X,$,Z,Y="")=>{if(X===void 0||X===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(X).replace(new RegExp(J,"g"),()=>Y)},stripTags:(X,$)=>{if(X===void 0||X===null)return"";return String(X).replace(/<[^>]*>/g,"")},urlencode:(X,$)=>{if(X===void 0||X===null)return"";return encodeURIComponent(String(X))},abs:(X,$)=>{let Z=Number(X);return Number.isNaN(Z)?0:Math.abs(Z)},round:(X,$,Z=0)=>{let Y=Number(X);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class Z5{cache=new Map;maxSize;constructor(X=100){this.maxSize=X}get(X){if(!this.cache.has(X))return;let $=this.cache.get(X);return this.cache.delete(X),this.cache.set(X,$),$}set(X,$){if(this.cache.has(X))this.cache.delete(X);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set(X,$)}has(X){return this.cache.has(X)}delete(X){return this.cache.delete(X)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function C5(X,$){if($?.includes("g"))return new RegExp(X,$);let Z=`${X}:${$||""}`;if(!S5.has(Z)){if(S5.size>=IK){let Y=S5.keys().next().value;if(Y)S5.delete(Y)}S5.set(Z,new RegExp(X,$))}return S5.get(Z)}class QZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(X){let $=Array.from(new Set(X)),Z=$.sort().join(","),Y=this.pool.find((w)=>w.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...w)=>{return(q)=>{try{let W=`${Z}:${q}`,U=J.get(W);if(!U){if(J.size>=G){let K=J.keys().next().value;if(K)J.delete(K)}U=Function(...$,`
2532
2532
  'use strict';
2533
2533
  try {
2534
2534
  return ${q};
@@ -2539,14 +2539,14 @@ catch (e) {
2539
2539
  }
2540
2540
  throw e;
2541
2541
  }
2542
- `),J.set(W,U)}return U(...w)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:$.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class wZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(X){this.enabled=X}isEnabled(){return this.enabled}setBudget(X,$){this.budgets.set(X,{warnThreshold:0.8,action:"warn",...$})}setBudgets(X){for(let[$,Z]of Object.entries(X))this.setBudget($,Z)}removeBudget(X){this.budgets.delete(X)}getBudgets(){let X={};for(let[$,Z]of this.budgets.entries())X[$]=Z;return X}onViolation(X){this.violationHandlers.push(X)}offViolation(X){let $=this.violationHandlers.indexOf(X);if($!==-1)this.violationHandlers.splice($,1)}time(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=$(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}async timeAsync(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=await $(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}checkBudget(X,$){let Z=this.budgets.get(X);if(!Z)return;let Y=$/Z.maxTime*100,J=Z.warnThreshold!==void 0?$>=Z.maxTime*Z.warnThreshold&&$<Z.maxTime:!1,G=$>=Z.maxTime;if(!J&&!G)return;let Q={label:X,actualTime:$,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(Q)}catch{}let w=J?`[Performance Warning] "${X}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${X}" took ${$.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(w);break;case"warn":console.warn(w);break;case"error":console.error(w);break;case"throw":if(G)throw Error(w);else console.warn(w);break}}recordTime(X,$){let Z=this.metrics.get(X);if(Z)Z.count++,Z.totalTime+=$,Z.maxTime=Math.max(Z.maxTime,$),Z.minTime=Math.min(Z.minTime,$);else this.metrics.set(X,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(X){if(X){let Z=this.metrics.get(X);if(!Z)return{};let Y=this.budgets.get(X);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let $={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);$[Z]={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 $}getViolations(X){if(X)return this.violations.filter(($)=>$.label===X);return[...this.violations]}getViolationStats(){let X={},$=0,Z=0;for(let Y of this.violations)if(X[Y.label]=(X[Y.label]||0)+1,Y.isWarning)$++;else Z++;return{total:this.violations.length,byLabel:X,warnings:$,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function EK(){if(!t$)t$=new wZ;return t$}var S5,IK=500,oA,t$=null,qZ;var P5=D(()=>{S5=new Map;oA=new QZ;qZ=new Proxy({},{get(X,$){return EK()[$]}})});function WZ(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function e$(X,$){let Z={...X};for(let[Y,J]of Object.entries($))Z[Y]=WZ(J)&&WZ(Z[Y])?e$(Z[Y],J):J;return Z}function UZ(X={},$={}){let Z=X.theme||{},Y=$.theme||{},{extend:J,...G}=Y,{extend:Q,...w}=Z,q=e$(w,G),W=e$(Q||{},J||{});if(Object.keys(W).length>0)q.extend=W;let U=[...X.safelist||[],...$.safelist||[]],K={...X.shortcuts||{},...$.shortcuts||{}},z=[...X.preflights||[],...$.preflights||[]];return{config:{...X,...$,theme:q,safelist:U,shortcuts:K,...z.length>0?{preflights:z}:{},content:[],output:""},safelist:U,shortcuts:K,includePreflight:$.preflight!==!1,minify:$.minify===!0}}var B0;var KZ=D(()=>{B0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});var LZ={};t(LZ,{resetCssCache:()=>xK,resetCrosswindCache:()=>fK,rebuildCrosswindCSS:()=>gK,loadCrosswindConfig:()=>Y9,loadCrosswind:()=>Z9,injectCrosswindCSS:()=>J9,getCrosswindServeAsset:()=>bK,getCachedCSS:()=>hK,generateCrosswindCSS:()=>HZ,extractClassNames:()=>jZ,buildCrosswindCSS:()=>BZ});import J0 from"path";import{hasLocalConfig as DK}from"bunfig";function yX(X){return Bun.hash(X).toString(16).padStart(16,"0").slice(0,16)}function X9(X,$){if(O1.has(X))O1.delete(X);else if(O1.size>=_Z)O1.delete(O1.keys().next().value);O1.set(X,$)}function yK(X){let $=yX(X);if(t0.has($))t0.delete($);else if(t0.size>=_Z)t0.delete(t0.keys().next().value);return t0.set($,X),$}function bK(X){let $=t0.get(X);if($===void 0)return;return t0.delete(X),t0.set(X,$),$}async function SK(X){if(!S1)return null;try{let $=Bun.file(J0.join(S1,`cw-${yX(X)}.css`));if(!await $.exists())return null;return await $.text()}catch{return null}}async function CK(X,$){if(!S1)return;try{if(!fs.existsSync(S1))fs.mkdirSync(S1,{recursive:!0});await Bun.write(J0.join(S1,`cw-${yX(X)}.css`),$)}catch{}}async function zZ(X){try{let $=await import(X);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig,extractClasses:$.extractClasses}}catch{}return null}function PK(){let X=[],$=process.cwd();while($!==J0.dirname($))X.push(J0.join($,"node_modules","@cwcss","crosswind","dist","index.js")),X.push(J0.join($,"node_modules","@cwcss","crosswind","src","index.ts")),X.push(J0.join($,"pantry","@cwcss","crosswind","dist","index.js")),X.push(J0.join($,"pantry","@cwcss","crosswind","src","index.ts")),X.push(J0.join($,"node_modules","@stacksjs","crosswind","dist","index.js")),X.push(J0.join($,"pantry","@stacksjs","crosswind","dist","index.js")),$=J0.dirname($);return X}function vK(){let X=[],$=process.env.HOME||process.env.USERPROFILE||"";if($){let Z=[J0.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),J0.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),J0.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),J0.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),J0.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),J0.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];X.push(...Z)}return X.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),X.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),X}async function Z9(){if($9)return q1;$9=!0;try{let X=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await zZ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded from ${J0.dirname(J0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=J0.resolve(process.env.CROSSWIND_SRC),G=await X([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return q1=G,q1}let $=await X(PK());if($)return q1=$,q1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await zZ(J);if(G){if(q1=G,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded`);return q1}}let Y=await X(vK());if(Y)return q1=Y,q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${B0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${B0.reset}`),console.warn(`${B0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${B0.reset}`),null}}function xK(){O1.clear(),t0.clear()}function fK(){q1=null,$9=!1,e0=null,C7="",O1.clear(),t0.clear(),DX=null}async function Y9(X){try{if(!DK({name:"crosswind",cwd:X}))return null;let{loadConfigWithResult:$}=await import("bunfig"),Z=await $({name:"crosswind",cwd:X,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let Y=J0.relative(X,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch($){if($ instanceof Error&&$.name==="ConfigNotFoundError")return null;return console.warn(`${B0.yellow}[Crosswind]${B0.reset} Failed to load crosswind config:`,$ instanceof Error?$.message:$),null}}async function BZ(X){if(v5)return C7;v5=!0;try{let $=await Z9();if(!$||!$.build)return v5=!1,"";if(!e0)e0=await Y9(X);if(!e0)return v5=!1,"";let Z=$.defaultConfig?.theme||{},Y=e0.theme||{},J={...$.defaultConfig,...e0,theme:{...Z,...Y,extend:{...Z.extend||{},...Y.extend||{}}}},G=performance.now(),Q=await $.build(J),w=performance.now()-G;if(C7=Q.css,console.log(`${B0.cyan}[Crosswind]${B0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),J.output){let q=J0.isAbsolute(J.output)?J.output:J0.join(X,J.output),W=J0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,Q.css)}return v5=!1,Q.css}catch($){return console.error(`${B0.red}[Crosswind]${B0.reset} Build error:`,$),v5=!1,C7}}async function gK(X){e0=null,await BZ(X)}function hK(){return C7}function jZ(X){let $=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec(X);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())$.add(Q.trim());Y=Z.exec(X)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.exec(X);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let w of Q)for(let q of w.slice(1,-1).split(/\s+/))if(q.trim())$.add(q.trim())}G=J.exec(X)}return $}async function HZ(X,$){try{let Z=await Z9();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses(X):jZ(X);if(Y.size===0)return"";let J=$?J0.resolve($):process.cwd();if(!S1)S1=T7(J,"cache");let G=[...Y].sort().join(" "),Q=`${DX||"default"}::${G}`,w=O1.get(Q);if(w!==void 0)return X9(Q,w),w;let q=await SK(Q);if(q!==null)return X9(Q,q),q;if(!e0){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (H1(),OZ)),R=await A(J);if(R.css)if(typeof R.css==="string"){let T=J0.isAbsolute(R.css)?R.css:J0.resolve(J,R.css);if(await Bun.file(T).exists()){let M=await import(T);V=M.default||M,console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=J0.isAbsolute(R.css.config)?R.css.config:J0.resolve(J,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);V={...M.default||M,...V}}}console.log(`${B0.green}[Crosswind]${B0.reset} Using inline CSS config from stx.config.ts`)}}catch{}e0=V||await Y9(J);try{DX=yX(JSON.stringify(e0??{}))}catch{DX="unhashable"}}let W=Z.defaultConfig||Z.config,U=e0||{},K=UZ(W,U),{safelist:z,includePreflight:B,minify:_}=K,j=K.config,H=new Z.CSSGenerator(j);for(let V of z)H.generate(V);for(let V of Y)H.generate(V);let O=H.toCSS(B,_),L=j.shortcuts||U.shortcuts||{};for(let[V,A]of Object.entries(L)){if(!Y.has(V)&&!z.includes(V))continue;let R=A.split(/\s+/).filter(Boolean);for(let T of R)H.generate(T)}O=H.toCSS(B,_);let F=O.split(`
2542
+ `),J.set(W,U)}return U(...w)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:$.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class wZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(X){this.enabled=X}isEnabled(){return this.enabled}setBudget(X,$){this.budgets.set(X,{warnThreshold:0.8,action:"warn",...$})}setBudgets(X){for(let[$,Z]of Object.entries(X))this.setBudget($,Z)}removeBudget(X){this.budgets.delete(X)}getBudgets(){let X={};for(let[$,Z]of this.budgets.entries())X[$]=Z;return X}onViolation(X){this.violationHandlers.push(X)}offViolation(X){let $=this.violationHandlers.indexOf(X);if($!==-1)this.violationHandlers.splice($,1)}time(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=$(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}async timeAsync(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=await $(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}checkBudget(X,$){let Z=this.budgets.get(X);if(!Z)return;let Y=$/Z.maxTime*100,J=Z.warnThreshold!==void 0?$>=Z.maxTime*Z.warnThreshold&&$<Z.maxTime:!1,G=$>=Z.maxTime;if(!J&&!G)return;let Q={label:X,actualTime:$,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(Q)}catch{}let w=J?`[Performance Warning] "${X}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${X}" took ${$.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(w);break;case"warn":console.warn(w);break;case"error":console.error(w);break;case"throw":if(G)throw Error(w);else console.warn(w);break}}recordTime(X,$){let Z=this.metrics.get(X);if(Z)Z.count++,Z.totalTime+=$,Z.maxTime=Math.max(Z.maxTime,$),Z.minTime=Math.min(Z.minTime,$);else this.metrics.set(X,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(X){if(X){let Z=this.metrics.get(X);if(!Z)return{};let Y=this.budgets.get(X);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let $={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);$[Z]={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 $}getViolations(X){if(X)return this.violations.filter(($)=>$.label===X);return[...this.violations]}getViolationStats(){let X={},$=0,Z=0;for(let Y of this.violations)if(X[Y.label]=(X[Y.label]||0)+1,Y.isWarning)$++;else Z++;return{total:this.violations.length,byLabel:X,warnings:$,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function EK(){if(!t$)t$=new wZ;return t$}var S5,IK=500,oA,t$=null,qZ;var P5=D(()=>{S5=new Map;oA=new QZ;qZ=new Proxy({},{get(X,$){return EK()[$]}})});function WZ(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function e$(X,$){let Z={...X};for(let[Y,J]of Object.entries($))Z[Y]=WZ(J)&&WZ(Z[Y])?e$(Z[Y],J):J;return Z}function UZ(X={},$={}){let Z=X.theme||{},Y=$.theme||{},{extend:J,...G}=Y,{extend:Q,...w}=Z,q=e$(w,G),W=e$(Q||{},J||{});if(Object.keys(W).length>0)q.extend=W;let U=[...X.safelist||[],...$.safelist||[]],K={...X.shortcuts||{},...$.shortcuts||{}},z=[...X.preflights||[],...$.preflights||[]];return{config:{...X,...$,theme:q,safelist:U,shortcuts:K,...z.length>0?{preflights:z}:{},content:[],output:""},safelist:U,shortcuts:K,includePreflight:$.preflight!==!1,minify:$.minify===!0}}var B0;var KZ=D(()=>{B0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});var LZ={};t(LZ,{resetCssCache:()=>xK,resetCrosswindCache:()=>fK,rebuildCrosswindCSS:()=>gK,loadCrosswindConfig:()=>Y9,loadCrosswind:()=>Z9,injectCrosswindCSS:()=>J9,getCrosswindServeAsset:()=>bK,getCachedCSS:()=>hK,generateCrosswindCSS:()=>HZ,extractClassNames:()=>jZ,buildCrosswindCSS:()=>BZ});import J0 from"path";import{hasLocalConfig as DK}from"bunfig";function yX(X){return Bun.hash(X).toString(16).padStart(16,"0").slice(0,16)}function X9(X,$){if(O1.has(X))O1.delete(X);else if(O1.size>=_Z)O1.delete(O1.keys().next().value);O1.set(X,$)}function yK(X){let $=yX(X);if(e0.has($))e0.delete($);else if(e0.size>=_Z)e0.delete(e0.keys().next().value);return e0.set($,X),$}function bK(X){let $=e0.get(X);if($===void 0)return;return e0.delete(X),e0.set(X,$),$}async function SK(X){if(!S1)return null;try{let $=Bun.file(J0.join(S1,`cw-${yX(X)}.css`));if(!await $.exists())return null;return await $.text()}catch{return null}}async function CK(X,$){if(!S1)return;try{if(!fs.existsSync(S1))fs.mkdirSync(S1,{recursive:!0});await Bun.write(J0.join(S1,`cw-${yX(X)}.css`),$)}catch{}}async function zZ(X){try{let $=await import(X);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig,extractClasses:$.extractClasses}}catch{}return null}function PK(){let X=[],$=process.cwd();while($!==J0.dirname($))X.push(J0.join($,"node_modules","@cwcss","crosswind","dist","index.js")),X.push(J0.join($,"node_modules","@cwcss","crosswind","src","index.ts")),X.push(J0.join($,"pantry","@cwcss","crosswind","dist","index.js")),X.push(J0.join($,"pantry","@cwcss","crosswind","src","index.ts")),X.push(J0.join($,"node_modules","@stacksjs","crosswind","dist","index.js")),X.push(J0.join($,"pantry","@stacksjs","crosswind","dist","index.js")),$=J0.dirname($);return X}function vK(){let X=[],$=process.env.HOME||process.env.USERPROFILE||"";if($){let Z=[J0.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),J0.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),J0.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),J0.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),J0.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),J0.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];X.push(...Z)}return X.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),X.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),X}async function Z9(){if($9)return q1;$9=!0;try{let X=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await zZ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded from ${J0.dirname(J0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=J0.resolve(process.env.CROSSWIND_SRC),G=await X([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return q1=G,q1}let $=await X(PK());if($)return q1=$,q1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await zZ(J);if(G){if(q1=G,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded`);return q1}}let Y=await X(vK());if(Y)return q1=Y,q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${B0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${B0.reset}`),console.warn(`${B0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${B0.reset}`),null}}function xK(){O1.clear(),e0.clear()}function fK(){q1=null,$9=!1,X1=null,C7="",O1.clear(),e0.clear(),DX=null}async function Y9(X){try{if(!DK({name:"crosswind",cwd:X}))return null;let{loadConfigWithResult:$}=await import("bunfig"),Z=await $({name:"crosswind",cwd:X,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let Y=J0.relative(X,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch($){if($ instanceof Error&&$.name==="ConfigNotFoundError")return null;return console.warn(`${B0.yellow}[Crosswind]${B0.reset} Failed to load crosswind config:`,$ instanceof Error?$.message:$),null}}async function BZ(X){if(v5)return C7;v5=!0;try{let $=await Z9();if(!$||!$.build)return v5=!1,"";if(!X1)X1=await Y9(X);if(!X1)return v5=!1,"";let Z=$.defaultConfig?.theme||{},Y=X1.theme||{},J={...$.defaultConfig,...X1,theme:{...Z,...Y,extend:{...Z.extend||{},...Y.extend||{}}}},G=performance.now(),Q=await $.build(J),w=performance.now()-G;if(C7=Q.css,console.log(`${B0.cyan}[Crosswind]${B0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),J.output){let q=J0.isAbsolute(J.output)?J.output:J0.join(X,J.output),W=J0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,Q.css)}return v5=!1,Q.css}catch($){return console.error(`${B0.red}[Crosswind]${B0.reset} Build error:`,$),v5=!1,C7}}async function gK(X){X1=null,await BZ(X)}function hK(){return C7}function jZ(X){let $=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec(X);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())$.add(Q.trim());Y=Z.exec(X)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.exec(X);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let w of Q)for(let q of w.slice(1,-1).split(/\s+/))if(q.trim())$.add(q.trim())}G=J.exec(X)}return $}async function HZ(X,$){try{let Z=await Z9();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses(X):jZ(X);if(Y.size===0)return"";let J=$?J0.resolve($):process.cwd();if(!S1)S1=T7(J,"cache");let G=[...Y].sort().join(" "),Q=`${DX||"default"}::${G}`,w=O1.get(Q);if(w!==void 0)return X9(Q,w),w;let q=await SK(Q);if(q!==null)return X9(Q,q),q;if(!X1){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (H1(),OZ)),R=await A(J);if(R.css)if(typeof R.css==="string"){let T=J0.isAbsolute(R.css)?R.css:J0.resolve(J,R.css);if(await Bun.file(T).exists()){let M=await import(T);V=M.default||M,console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=J0.isAbsolute(R.css.config)?R.css.config:J0.resolve(J,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);V={...M.default||M,...V}}}console.log(`${B0.green}[Crosswind]${B0.reset} Using inline CSS config from stx.config.ts`)}}catch{}X1=V||await Y9(J);try{DX=yX(JSON.stringify(X1??{}))}catch{DX="unhashable"}}let W=Z.defaultConfig||Z.config,U=X1||{},K=UZ(W,U),{safelist:z,includePreflight:B,minify:_}=K,j=K.config,H=new Z.CSSGenerator(j);for(let V of z)H.generate(V);for(let V of Y)H.generate(V);let O=H.toCSS(B,_),L=j.shortcuts||U.shortcuts||{};for(let[V,A]of Object.entries(L)){if(!Y.has(V)&&!z.includes(V))continue;let R=A.split(/\s+/).filter(Boolean);for(let T of R)H.generate(T)}O=H.toCSS(B,_);let F=O.split(`
2543
2543
  `);for(let[V,A]of Object.entries(L)){if(!Y.has(V)&&!z.includes(V))continue;let R=A.split(/\s+/).filter(Boolean),T=[],M=[];for(let k of R){let N=k.startsWith("dark:"),C=`.${(N?k.slice(5):k).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let S=0;S<F.length;S++){let b=F[S].trim();if(b===`${C} {`||b.startsWith(`${C} {`)){let P=S,x="";while(P<F.length){if(x+=F[P],F[P].includes("}"))break;P++}let m=x.match(/\{([^}]+)\}/);if(m)if(N)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
2544
2544
  .${V} { ${T.join(" ")} }`;if(M.length)O+=`
2545
2545
  @media (prefers-color-scheme: dark) { .dark .${V} { ${M.join(" ")} } }`}return X9(Q,O),CK(Q,O),O}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function J9(X,$,Z=!1){let Y=await HZ(X,$);if(!Y)return X;let J=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${yK(Y)}.css">`:`<style data-crosswind="generated">
2546
2546
  ${Y}
2547
2547
  </style>`,G=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(G.test(X)){let Q=!1;return X.replace(G,()=>{if(Q)return"";return Q=!0,J})}if(X.includes("</head>"))return X.replace("</head>",`${J}
2548
2548
  </head>`);if(X.includes("<body"))return X.replace(/<body([^>]*)>/,`<body$1>
2549
- ${J}`);return J+X}var q1=null,$9=!1,e0=null,C7="",v5=!1,_Z=256,O1,t0,S1=null,DX=null;var G9=D(()=>{VX();KZ();O1=new Map,t0=new Map});function P7(X){let $=0,Z,Y=Q9.map(()=>{return});while($<X.length){if(Z===void 0||Z!==null&&Z.index<$)FZ.lastIndex=$,Z=FZ.exec(X);if(!Z)return null;let J=Z.index,G=-1,Q=null;for(let q=0;q<Q9.length;q++){let W=Q9[q],U=Y[q];if(U===void 0||U!==null&&U.index<$)W.open.lastIndex=$,U=W.open.exec(X),Y[q]=U;if(!U)continue;if(U.index<J&&(G===-1||U.index<G))G=U.index,Q=W.close}if(G===-1||!Q)return{index:J,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let w=Q.exec(X);if(!w)return null;$=w.index+w[0].length}return null}function bX(X,$){let Z=P7(X);if(!Z)return X;return X.slice(0,Z.index)+$(Z.tag,Z.attrs)+X.slice(Z.index+Z.tag.length)}var Q9,FZ;var w9=D(()=>{Q9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],FZ=/<body\b([^>]*)>/gi});function VZ(){return`
2549
+ ${J}`);return J+X}var q1=null,$9=!1,X1=null,C7="",v5=!1,_Z=256,O1,e0,S1=null,DX=null;var G9=D(()=>{VX();KZ();O1=new Map,e0=new Map});function P7(X){let $=0,Z,Y=Q9.map(()=>{return});while($<X.length){if(Z===void 0||Z!==null&&Z.index<$)FZ.lastIndex=$,Z=FZ.exec(X);if(!Z)return null;let J=Z.index,G=-1,Q=null;for(let q=0;q<Q9.length;q++){let W=Q9[q],U=Y[q];if(U===void 0||U!==null&&U.index<$)W.open.lastIndex=$,U=W.open.exec(X),Y[q]=U;if(!U)continue;if(U.index<J&&(G===-1||U.index<G))G=U.index,Q=W.close}if(G===-1||!Q)return{index:J,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let w=Q.exec(X);if(!w)return null;$=w.index+w[0].length}return null}function bX(X,$){let Z=P7(X);if(!Z)return X;return X.slice(0,Z.index)+$(Z.tag,Z.attrs)+X.slice(Z.index+Z.tag.length)}var Q9,FZ;var w9=D(()=>{Q9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],FZ=/<body\b([^>]*)>/gi});function VZ(){return`
2550
2550
  // STX Lifecycle Runtime
2551
2551
  (function() {
2552
2552
  if (typeof window === 'undefined') return;
@@ -3349,14 +3349,14 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
3349
3349
  `)}writeToFile(X){this.writeQueue=this.writeQueue.then(async()=>{try{let $=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!$.existsSync(Y))$.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded($);let J=`${this.formatEntry(X)}
3350
3350
  `;$.appendFileSync(this.logFilePath,J,"utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",$)}})}async rotateIfNeeded(X){try{if(!X.existsSync(this.logFilePath))return;if(X.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Z=this.maxLogFiles-1;Z>=1;Z--){let Y=`${this.logFilePath}.${Z}`,J=`${this.logFilePath}.${Z+1}`;if(X.existsSync(Y))if(Z>=this.maxLogFiles-1)X.unlinkSync(Y);else X.renameSync(Y,J)}if(this.maxLogFiles<=1)X.writeFileSync(this.logFilePath,"");else X.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",$)}}getRecentErrors(X=10){return this.errors.slice(-X)}getErrorsByType(X){return this.errors.filter(($)=>$.error.constructor.name===X)}getErrorsByLevel(X){return this.errors.filter(($)=>$.level===X)}clear(){this.errors.length=0}async clearLogFile(){try{let X=await import("fs");if(X.existsSync(this.logFilePath))X.writeFileSync(this.logFilePath,"","utf-8")}catch(X){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",X)}}getStats(){let X={},$={error:0,warning:0,info:0};for(let Z of this.errors){let Y=Z.error.constructor.name;X[Y]=(X[Y]||0)+1;let J=Z.level||"error";$[J]=($[J]||0)+1}return{total:this.errors.length,byType:X,byLevel:$}}async exportToFile(X,$="json"){let Z=await import("fs"),J=(await import("path")).dirname(X);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});if($==="json"){let G=this.errors.map((Q)=>({timestamp:Q.timestamp.toISOString(),level:Q.level||"error",type:Q.error.constructor.name,message:Q.error.message,stack:Q.error.stack,context:Q.context}));Z.writeFileSync(X,JSON.stringify(G,null,2),"utf-8")}else{let G=this.errors.map((Q)=>this.formatEntry(Q));Z.writeFileSync(X,G.join(`
3351
3351
 
3352
- `),"utf-8")}}async flush(){await this.writeQueue}}var _9,X1,j9;var dZ=D(()=>{hX();_9={isEnabled(){return vX().enableAutoRecovery},fixCommonSyntaxErrors(X){let $=vX();if(!$.enableAutoRecovery)return{fixed:X,fixes:[]};let Z=X,Y=[],J=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(J>G){let w=J-G;Z+="}}".repeat(w),Y.push(`Added ${w} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let w of Q){let q=(Z.match(new RegExp(`@${w}\\b`,"g"))||[]).length,W=(Z.match(new RegExp(`@end${w}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let K=0;K<U;K++)Z+=`
3353
- @end${w}`;Y.push(`Added ${U} missing @end${w}`)}}if(Y.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((w)=>console.warn(` - ${w}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent(X,$){if(x7())return`<!-- ${X} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};X1=new B9,j9={isDevelopment(){return x7()},logDetailedError(X,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",X.message),console.error("Stack:",X.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(X,$){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${X.message}`,`Type: ${X.constructor.name}`,`Stack: ${X.stack}`];if($)Z.push(`Context: ${JSON.stringify($,null,2)}`);return Z.push("========================"),Z.join(`
3352
+ `),"utf-8")}}async flush(){await this.writeQueue}}var _9,$1,j9;var dZ=D(()=>{hX();_9={isEnabled(){return vX().enableAutoRecovery},fixCommonSyntaxErrors(X){let $=vX();if(!$.enableAutoRecovery)return{fixed:X,fixes:[]};let Z=X,Y=[],J=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(J>G){let w=J-G;Z+="}}".repeat(w),Y.push(`Added ${w} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let w of Q){let q=(Z.match(new RegExp(`@${w}\\b`,"g"))||[]).length,W=(Z.match(new RegExp(`@end${w}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let K=0;K<U;K++)Z+=`
3353
+ @end${w}`;Y.push(`Added ${U} missing @end${w}`)}}if(Y.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((w)=>console.warn(` - ${w}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent(X,$){if(x7())return`<!-- ${X} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};$1=new B9,j9={isDevelopment(){return x7()},logDetailedError(X,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",X.message),console.error("Stack:",X.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(X,$){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${X.message}`,`Type: ${X.constructor.name}`,`Stack: ${X.stack}`];if($)Z.push(`Context: ${JSON.stringify($,null,2)}`);return Z.push("========================"),Z.join(`
3354
3354
  `)}}});var mZ=()=>{};var lZ=D(()=>{CX();uZ();dZ();mZ();hX()});var F1=D(()=>{lZ()});function N0(X,$,Z,Y=0){let J=0,G=Y,Q=null,w=0,q=!1;while(G<X.length){let W=X[G];if(Q&&q){q=!1,G++;continue}if(Q&&W==="\\"){q=!0,G++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!Q){Q=W,G++;continue}if(W===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&W==="$"&&X[G+1]==="{"){w++,G+=2;continue}if(w>0&&W==="}"){w--,G++;continue}if(W==="`"&&Q==="`"&&w===0){Q=null,G++;continue}if(Q){G++;continue}if(W===$)J++;else if(W===Z){if(J--,J===0)return G}G++}return-1}function P1(X,$){let Z=Oz(X,$);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function Oz(X,$){let Z=$;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=N0(X,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:X.slice(Z+1,Y),endPos:Y+1}}function Fz(X,$){let Z=X.lastIndexOf("<",$);if(Z===-1)return!1;return Z>X.lastIndexOf(">",$)}function J5(X,$,Z,Y){let J=1,G=Y,Q=new RegExp(`@${$}\\s*\\(`,"g"),w=new RegExp(`@${Z}(?![a-z])`,"g");while(G<X.length&&J>0){Q.lastIndex=G,w.lastIndex=G;let q=Q.exec(X),W=w.exec(X),U=q?q.index:1/0,K=W?W.index:1/0;if(U<K)J++,G=U+q[0].length;else if(K<1/0){if(J--,J===0)return K;G=K+W[0].length}else break}return-1}function cZ(X,$){let Z=X.slice($).match(/^@if\s*/);if(!Z)return null;let Y=$+Z[0].length,J=P1(X,Y);if(!J)return null;let G=J.endPos,Q=J5(X,"if","endif",G);if(Q===-1)return null;let w=X.slice(G,Q),q=[],W=0,U="if",K=J.expression,z=0,B=0;while(W<w.length){let _=w.indexOf("@",W);if(_===-1)break;W=_;let j=w.substring(_);if(Fz(w,_)){W++;continue}if(/^@if\s*\(/.test(j)){B++,W++;continue}if(/^@endif(?![a-z])/.test(j)){B--,W+=6;continue}if(B===0){let H=j.match(/^@elseif\s*/);if(H){q.push({type:U,condition:K,content:w.substring(z,W),start:G+z,end:G+W});let O=W+H[0].length,L=P1(w,O);if(!L){W++;continue}U="elseif",K=L.expression,W=L.endPos,z=W;continue}else if(/^@else(?![a-z])/.test(j)){q.push({type:U,condition:K,content:w.substring(z,W),start:G+z,end:G+W}),U="else",K=void 0,W+=5,z=W;continue}}W++}return q.push({type:U,condition:K,content:w.slice(z),start:G+z,end:G+w.length}),{fullMatch:X.slice($,Q+6),branches:q,start:$,end:Q+6}}function f7(X){let $=[],Z=/@if\s*\(/g,Y=Z.exec(X);while(Y!==null){if($.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec(X);continue}let G=cZ(X,Y.index);if(G)$.push(G),Z.lastIndex=G.end;Y=Z.exec(X)}return $}function uX(X,$,Z){let Y=[],J=new RegExp(`@${$}\\s*\\(`,"g"),G=J.exec(X);while(G!==null){if(Y.some((j)=>G.index>j.start&&G.index<j.end)){G=J.exec(X);continue}let w=G.index,q=w+G[0].length-1,W=N0(X,"(",")",q);if(W===-1){G=J.exec(X);continue}let U=X.slice(q+1,W),K=W+1,z=J5(X,$,Z,K);if(z===-1){G=J.exec(X);continue}let B=X.slice(K,z),_=z+`@${Z}`.length;Y.push({fullMatch:X.slice(w,_),name:$,params:U,content:B,start:w,end:_}),J.lastIndex=_,G=J.exec(X)}return Y}function H9(X,$){let Z=X.slice($).match(/^@switch\s*/);if(!Z)return null;let Y=$+Z[0].length,J=P1(X,Y);if(!J)return null;let G=J.endPos,Q=J5(X,"switch","endswitch",G);if(Q===-1)return null;let w=X.slice(G,Q),q=[],W=0,U=null,K=0;while(W<w.length){let z=w.slice(W),B=z.match(/^@switch\s*\(/),_=z.match(/^@endswitch(?![a-z])/);if(B){if(K++,U)U.content+=B[0];W+=B[0].length;continue}if(_){if(K--,U)U.content+=_[0];W+=_[0].length;continue}if(K>0){if(U)U.content+=w[W];W++;continue}let j=z.match(/^@case\s*/),H=z.match(/^@default(?![a-z])/),O=z.match(/^@break(?![a-z])/);if(j&&z.startsWith("@case")){if(U)q.push(U);let L=W+j[0].length,F=P1(w,L);if(!F){W++;continue}U={type:"case",value:F.expression,content:""},W=F.endPos}else if(H&&z.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=H[0].length}else if(O&&z.startsWith("@break"))W+=O[0].length;else{if(U)U.content+=w[W];W++}}if(U)q.push(U);return{fullMatch:X.slice($,Q+10),expression:J.expression,cases:q,start:$,end:Q+10}}var pZ=()=>{};var iZ=()=>{};var dX=D(()=>{pZ();iZ()});function Tz(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=H9(Y,Q);if(!w)break;try{let q;if(q0(w.expression))q=W0(w.expression,Object.keys($))(...Object.values($));else q=Y0(w.expression,$);let W="",U=!1;for(let K of w.cases)if(K.type==="default"){if(!U)W=K.content.trim()}else try{let z;if(K.value&&q0(K.value))z=W0(K.value,Object.keys($))(...Object.values($));else if(K.value)z=Y0(K.value,$);if(q===z){W=K.content.trim(),U=!0;break}}catch{continue}Y=Y.substring(0,Q)+W+Y.substring(w.end),J=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+U+Y.substring(w.end);break}}return Y}function Mz(X){let $=[];return{masked:X.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return $.push(Y),`\x00stx-script-${$.length-1}\x00`}),scripts:$}}function Nz(X,$){if($.length===0)return X;return X.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>$[Number(Y)]??Z)}function G5(X,$,Z){let{masked:Y,scripts:J}=Mz(X);return Nz(kz(Y,$,Z),J)}function kz(X,$,Z){let Y=X;Y=Tz(Y,$,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=P1(Y,w+7);if(!q)break;let W=q.endPos,U=J5(Y,"unless","endunless",W);if(U===-1){console.warn(`[stx] @unless directive at position ${w} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let K=Y.slice(W,U),z=q.expression,B=-1;{let j=0,H=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],V;while((V=H.exec(K))!==null)F.push({pos:V.index,type:"open"});while((V=O.exec(K))!==null)F.push({pos:V.index,type:"close"});while((V=L.exec(K))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")j++;else if(A.type==="close")j--;else if(A.type==="else"&&j===0){B=A.pos;break}}let _;if(B!==-1){let j=K.slice(0,B),H=K.slice(B+5);_=`@if (${z})${H}@else ${j}@endif`}else _=`@if (!(${z}))${K}@endif`;Y=Y.substring(0,w)+_+Y.substring(U+10),G=!0}}Y=O9(Y,$,Z),Y=F9(Y,$,Z),Y=L9(Y,$);let J=()=>{let G=f7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let w=G[Q];try{let q="",W=!1;for(let U of w.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let K;if(U.condition&&q0(U.condition))K=W0(U.condition,Object.keys($))(...Object.values($));else if(U.condition)K=Y0(U.condition,$);if(K)q=U.content,W=!0}catch(K){q=$0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${K instanceof Error?K.message:String(K)}`,o.EVALUATION_ERROR),W=!0}}Y=Y.substring(0,w.start)+q+Y.substring(w.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,w.start)+U+Y.substring(w.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function nZ(X){let $=0;while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!=="(")return null;$++;while($<X.length&&/\s/.test(X[$]))$++;let Z=X[$];if(Z!=="'"&&Z!=='"')return null;$++;let Y=[];while($<X.length){let J=X[$];if(J==="\\"&&$+1<X.length){Y.push(X[$+1]),$+=2;continue}if(J===Z){$++;break}Y.push(J),$++}while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!==")")return null;return $++,{value:Y.join(""),consumed:$}}function L9(X,$){let Z=X;function Y(w,q,W,U){let K=1,z=U,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g");while(z<w.length&&K>0){B.lastIndex=z,_.lastIndex=z;let j=B.exec(w),H=_.exec(w),O=j?j.index:1/0,L=H?H.index:1/0;if(O<L)K++,z=O+j[0].length;else if(L<1/0){if(K--,K===0)return L;z=L+H[0].length}else break}return-1}function J(w,q,W){let U=0,K=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,_=[],j;while((j=K.exec(w))!==null)_.push({pos:j.index,type:"open"});while((j=z.exec(w))!==null)_.push({pos:j.index,type:"close"});while((j=B.exec(w))!==null)_.push({pos:j.index,type:"else"});_.sort((H,O)=>H.pos-O.pos);for(let H of _)if(H.type==="open")U++;else if(H.type==="close")U--;else if(H.type==="else"&&U===0)return H.pos;return-1}{let w=!0;while(w){w=!1;let q=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,K,z=Z.slice(W+5),B=nZ(z);if(B)U=B.value,K=W+5+B.consumed;else K=W+5;let _=Y(Z,"auth","endauth",K);if(_===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let j=Z.slice(K,_),H=J(j,"auth","endauth"),O;if(!$.auth)O=!1;else O=U?C1(`auth?.check && auth?.user?.[${U}]`,$):C1("auth?.check",$);let L;if(H!==-1){let F=j.slice(0,H),V=j.slice(H+5);L=O?F:V}else L=O?j:"";Z=Z.substring(0,W)+L+Z.substring(_+8),w=!0}}{let w=!0;while(w){w=!1;let q=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,K,z=Z.slice(W+6),B=nZ(z);if(B)U=B.value,K=W+6+B.consumed;else K=W+6;let _=Y(Z,"guest","endguest",K);if(_===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let j=Z.slice(K,_),H=J(j,"guest","endguest"),O;if(!$.auth)O=!0;else O=U?C1(`!auth?.check || !auth?.user?.[${U}]`,$):C1("!auth?.check",$);let L;if(H!==-1){let F=j.slice(0,H),V=j.slice(H+5);L=O?F:V}else L=O?j:"";Z=Z.substring(0,W)+L+Z.substring(_+9),w=!0}}function G(w,q,W){if($.userCan&&typeof $.userCan[w]==="boolean")return $.userCan[w];if($.permissions?.check&&typeof $.permissions.check==="function")try{let U=[w];if(q)U.push(q);if(W){let K=C1(W,$);U.push(K)}return $.permissions.check(...U)}catch{return!1}return!1}function Q(w){let q=w.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let w of["can","cannot"]){let q=`end${w}`,W=w==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let K=Z.match(new RegExp(`@${w}\\s*\\(`));if(!K||K.index===void 0)break;let z=K.index,B=Z.slice(z+`@${w}`.length),_=Q(B);if(!_)break;let j=z+`@${w}`.length+_.paramsEnd,H=Y(Z,w,q,j);if(H===-1){console.warn(`[stx] @${w} directive at position ${z} has no matching @${q} \u2014 the block was skipped.`);break}let O=Z.slice(j,H),L=[],F=0,V=new RegExp(`@${w}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${W}\\s*\\(`,"g"),T=/@else(?![a-z])/g,M=[],k;while((k=V.exec(O))!==null)M.push({pos:k.index,type:"open"});while((k=A.exec(O))!==null)M.push({pos:k.index,type:"close"});while((k=R.exec(O))!==null)M.push({pos:k.index,type:"elseDirective"});while((k=T.exec(O))!==null)M.push({pos:k.index,type:"else"});M.sort((b,P)=>b.pos-P.pos);for(let b of M){if(b.type==="open"){F++;continue}if(b.type==="close"){F--;continue}if(F===0)L.push(b)}let N=[],y=0;for(let b=0;b<L.length;b++){let P=L[b];if(N.push({content:O.slice(y,P.pos),ability:void 0}),P.type==="elseDirective"){let x=O.slice(P.pos+`@${W}`.length),m=Q(x);if(m){N[N.length-1]={content:O.slice(y,P.pos)},y=P.pos+`@${W}`.length+m.paramsEnd,N.push({content:"",ability:m.ability,type:m.type,id:m.id}),N.pop();let l=L[b+1],Q0=l?l.pos:O.length;N.push({content:O.slice(y,Q0),ability:m.ability,type:m.type,id:m.id}),y=Q0}}else y=P.pos+5}if(y<O.length){let b=N[N.length-1];if(L.length>0&&L[L.length-1].type==="else")N.push({content:O.slice(y),isFinalElse:!0});else if(N.length===0)N.push({content:O.slice(y)})}let I=G(_.ability,_.type,_.id),C=w==="can"?I:!I,S="";if(C)S=N[0]?.content||"";else{let b=!1;for(let P=1;P<N.length;P++){let x=N[P];if(x.isFinalElse){S=x.content,b=!0;break}if(x.ability){let m=G(x.ability,x.type,x.id);if(w==="can"?m:!m){S=x.content,b=!0;break}}}if(!b&&N.length>0){let P=N[N.length-1];if(P.isFinalElse)S=P.content}}Z=Z.substring(0,z)+S+Z.substring(H+`@${q}`.length),U=!0}}return Z}function O9(X,$,Z){let Y=X;function J(G,Q,w,q,W){let U=!0;while(U){U=!1;let K=new RegExp(`@${Q}\\s*\\(`),z=G.match(K);if(!z||z.index===void 0)break;let B=z.index,_=P1(G,B+`@${Q}`.length);if(!_)break;let j=_.endPos,H=J5(G,Q,w,j);if(H===-1){console.warn(`[stx] @${Q} directive at position ${B} has no matching @${w} \u2014 the block was skipped.`);break}let O=G.slice(j,H),L=_.expression,F=-1,V=0,A=0;while(A<O.length){let R=O.indexOf("@",A);if(R===-1)break;let T=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(T)){F=R;break}A=R+1}try{let R=q(L.trim()),T;if(F!==-1){let M=O.slice(0,F),k=O.slice(F+5);T=R?M:k}else T=R?O:"";G=G.substring(0,B)+T+G.substring(H+`@${w}`.length),U=!0}catch(R){let T=R instanceof Error?R.message:String(R),M=$0(W,`Error processing @${Q} directive: ${T}`,o.EVALUATION_ERROR);G=G.substring(0,B)+M+G.substring(H+`@${w}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=C1(G,$);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=C1(G,$);return Q===void 0||Q===null||Q===""||Q===0||Q===!1||Array.isArray(Q)&&Q.length===0||typeof Q==="object"&&Q!==null&&Object.keys(Q).length===0},"Empty"),Y}function F9(X,$,Z){let Y=X,J="development";function G(Q,w,q,W){let U=new RegExp(`@${w}(?![a-z])`,"g"),K=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`^@${w}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),_=Q,j=!0;while(j){j=!1,U.lastIndex=0;let H=U.exec(_);if(!H)break;let O=H.index,L=O+H[0].length;if(w==="env"){let I=_.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;L+=I[0].length,W=J===I[2]}let F=1,V=L,A=-1;while(F>0&&V<_.length){U.lastIndex=V,K.lastIndex=V;let I=U.exec(_),C=K.exec(_),S=I?I.index:1/0,b=C?C.index:1/0;if(S<b)F++,V=S+I[0].length;else if(b<1/0){if(F--,F===0){A=b;break}V=b+C[0].length}else break}if(A===-1){console.warn(`[stx] @${w} directive at position ${O} has no matching @${q} \u2014 the block was skipped.`);break}let R=_.substring(L,A),T=-1,M=0,k=0;while(k<R.length){let I=R.indexOf("@",k);if(I===-1)break;let C=R.substring(I);if(z.test(C)){M++,k=I+1;continue}if(B.test(C)){M--,k=I+1;continue}if(M===0&&/^@else(?![a-z])/.test(C)){T=I;break}k=I+1}let N;if(T!==-1){let I=R.slice(0,T),C=R.slice(T+5);N=W?I:C}else N=W?R:"";let y=`@${q}`.length;_=_.substring(0,O)+N+_.substring(A+y),j=!0}return _}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var mX=D(()=>{fZ();F1();dX();F0()});function sZ(X=16){let $=new Uint8Array(X);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function lX(X,$){if(!X)return $?.nonceGenerator?.()??sZ();let Z=rZ.get(X);if(!Z)Z=$?.nonceGenerator?.()??sZ(),rZ.set(X,Z);return Z}function Iz(X,$){let Z=[];for(let[Y,J]of Object.entries(X)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if($&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${$}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function oZ(X,$){return`<meta http-equiv="Content-Security-Policy" content="${Iz(X,$).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function aZ(X,$,Z){if(!$.enabled||!$.addMetaTag)return X;if(X.includes('http-equiv="Content-Security-Policy"'))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let Y=$.useNonce?lX(Z,$):void 0,J=oZ($.directives,Y);return X.replace(/<head([^>]*)>/,`<head$1>
3355
3355
  ${J}`)}function tZ(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${$}"${J}>`}),Z=Z.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${$}"${J}>`}),Z}function eZ(X,$,Z,Y){let J=X,G=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?lX($,G):void 0;return oZ(G.directives,Q)}),J=J.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return lX($,G)}),G?.enabled&&G.useNonce)$.cspNonce=lX($,G);return J}var rZ;var XY=D(()=>{rZ=new WeakMap});import Ez from"crypto";function yz(X=Dz){let $=Ez.randomBytes(Math.ceil(X/2)).toString("hex").slice(0,X);return V9=$,$}function bz(){if(!V9)yz();return V9}function Sz(X=$Y){let $=bz();return`<input type="hidden" name="${X}" value="${$}">`}function ZY(X){return X.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Z,Y)=>{return Sz(Y||$Y)})}var Dz=40,$Y="_token",V9=null;var YY=()=>{};async function JY(X,$,Z,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return X;let J=X;for(let G of Y.customDirectives){if(!G.name||typeof G.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)J=await Cz(J,G,$,Z,Y);else J=await Pz(J,G,$,Z,Y)}return J}async function Cz(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=`@${G}`,q=`@end${G}`,W=X,U=C5(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),K=[],z=U.exec(W);while(z!==null){let[B,_="",j=""]=z,H=z.index||0;try{let O=_?GY(_):[],L=j.trim(),F=await Q(L,O,Z,Y);K.push({original:B,processed:F,startIndex:H})}catch(O){let L=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${G}:`,O);K.push({original:B,processed:$0("CustomDirective",`Error in @${G}${_?`(${_})`:""}: ${L}`,o.EVALUATION_ERROR),startIndex:H})}z=U.exec(W)}for(let B=K.length-1;B>=0;B--){let{original:_,processed:j}=K[B];W=W.replace(_,j)}return W}async function Pz(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=X,q=C5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(w);while(U!==null){let[B,_=""]=U,j=U.index||0;try{let H=GY(_),O=await Q("",H,Z,Y);W.push({original:B,processed:O,startIndex:j})}catch(H){let O=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${G}:`,H);W.push({original:B,processed:$0("CustomDirective",`Error in @${G}(${_}): ${O}`,o.EVALUATION_ERROR),startIndex:j})}U=q.exec(w)}let K=C5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),z=K.exec(w);while(z!==null){let[B]=z,_=z.index||0;try{let j=await Q("",[],Z,Y);W.push({original:B,processed:j,startIndex:_})}catch(j){let H=j instanceof Error?j.message:String(j);if(J.debug)console.error(`Error processing custom directive @${G}:`,j);W.push({original:B,processed:$0("CustomDirective",`Error in @${G}: ${H}`,o.EVALUATION_ERROR),startIndex:_})}z=K.exec(w)}for(let B=W.length-1;B>=0;B--){let{original:_,processed:j}=W[B];w=w.replace(_,j)}return w}function GY(X){if(!X.trim())return[];let $=[],Z="",Y=!1,J="";for(let G=0;G<X.length;G++){let Q=X[G];if((Q==='"'||Q==="'")&&(G===0||X[G-1]!=="\\"))if(!Y)Y=!0,J=Q;else if(Q===J)Y=!1;else Z+=Q;else if(Q===","&&!Y)$.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())$.push(Z.trim());return $.map((G)=>{let Q=G.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var QY=D(()=>{F1();P5()});function Q5(X,$){if(typeof X!=="string"||X.length===0)throw Error(`@appearanceBootstrap ${$} must be a non-empty string`)}function xz(X){if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap expects an options object");let $=X,Z=$.appearance,Y=$.colorMode;if(Q5($.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))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(Q5(Z.key,"appearance.key"),Q5(Z.attribute,"appearance.attribute"),Q5(Z.default,"appearance.default"),Q5(Y.key,"colorMode.key"),Q5(Y.attribute,"colorMode.attribute"),Q5(Y.default,"colorMode.default"),!qY.test(Z.key)||!qY.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!wY.test(Z.attribute)||!wY.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Z.allowed.includes(Z.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!vz.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:$.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function fz(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function gz(X){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${fz(X)};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 hz(X,$){let Z=1,Y=null,J=!1;for(let G=$+1;G<X.length;G++){let Q=X[G];if(J){J=!1;continue}if(Y){if(Q==="\\")J=!0;else if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function WY(X,$){let Z=X,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,Q=hz(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=Z.slice(G+1,Q).trim(),q=Y0(`(${w})`,$),W=gz(xz(q));Z=Z.slice(0,J.index)+W+Z.slice(Q+1),Y.lastIndex=J.index+W.length}return Z}var wY,qY,vz;var UY=D(()=>{F0();wY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,qY=/^[A-Za-z_$][\w$]*$/,vz=new Set(["light","dark","system"])});var T9={};t(T9,{useTitle:()=>cz,useSeoMeta:()=>KY,usePageTitle:()=>cz,useHead:()=>R9,seoMetaToHeadConfig:()=>pX,resetHead:()=>mz,renderHtmlAttrs:()=>iz,renderHead:()=>pz,renderBodyAttrs:()=>nz,processTitleDirective:()=>oz,processMetaDirective:()=>az,processHeadDirective:()=>sz,mergeHeadConfigs:()=>f5,getPageMeta:()=>dz,getHead:()=>A9,definePageMeta:()=>lz,applyHead:()=>rz});function A9(){return v1}function dz(){return cX}function mz(){v1={},uz.length=0,cX={}}function R9(X){v1=f5(v1,X)}function f5(X,$){return{title:$.title??X.title,titleTemplate:$.titleTemplate??X.titleTemplate,base:$.base??X.base,meta:[...X.meta||[],...$.meta||[]],link:[...X.link||[],...$.link||[]],script:[...X.script||[],...$.script||[]],style:[...X.style||[],...$.style||[]],htmlAttrs:{...X.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...X.bodyAttrs,...$.bodyAttrs}}}function KY(X){R9(pX(X))}function pX(X){let $=[];if(X.description)$.push({name:"description",content:X.description});if(X.keywords){let q=Array.isArray(X.keywords)?X.keywords.join(", "):X.keywords;$.push({name:"keywords",content:q})}if(X.author)$.push({name:"author",content:X.author});if(X.robots)$.push({name:"robots",content:X.robots});let Z=X.ogTitle??X.title,Y=X.ogDescription??X.description;if(Z)$.push({property:"og:title",content:Z});if(Y)$.push({property:"og:description",content:Y});if(X.ogImage)$.push({property:"og:image",content:X.ogImage});if(X.ogUrl)$.push({property:"og:url",content:X.ogUrl});if(X.ogType)$.push({property:"og:type",content:X.ogType});if(X.ogSiteName)$.push({property:"og:site_name",content:X.ogSiteName});if(X.ogLocale)$.push({property:"og:locale",content:X.ogLocale});let J=X.twitterTitle??X.title,G=X.twitterDescription??X.description,Q=X.twitterImage??X.ogImage;if(X.twitterCard)$.push({name:"twitter:card",content:X.twitterCard});if(J)$.push({name:"twitter:title",content:J});if(G)$.push({name:"twitter:description",content:G});if(Q)$.push({name:"twitter:image",content:Q});if(X.twitterSite)$.push({name:"twitter:site",content:X.twitterSite});if(X.twitterCreator)$.push({name:"twitter:creator",content:X.twitterCreator});if(X.articleAuthor)$.push({property:"article:author",content:X.articleAuthor});if(X.articlePublishedTime)$.push({property:"article:published_time",content:X.articlePublishedTime});if(X.articleModifiedTime)$.push({property:"article:modified_time",content:X.articleModifiedTime});if(X.articleSection)$.push({property:"article:section",content:X.articleSection});if(X.articleTags)for(let q of X.articleTags)$.push({property:"article:tag",content:q});let w=[];if(X.canonical)w.push({rel:"canonical",href:X.canonical});return{title:X.title,titleTemplate:X.titleTemplate,meta:$,link:w}}function lz(X){if(cX={...cX,...X},X.title||X.description)KY({title:X.title,description:X.description})}function cz(X){let $=typeof X==="function"?X():X;R9({title:$})}function pz(X=v1){let $=[];if(X.title){let Z=X.title;if(X.titleTemplate)Z=typeof X.titleTemplate==="function"?X.titleTemplate(Z):X.titleTemplate.replace("%s",Z);$.push(`<title>${w5(Z)}</title>`)}if(X.base){let Z=Object.entries(X.base).map(([Y,J])=>`${Y}="${w5(J)}"`).join(" ");$.push(`<base ${Z}>`)}for(let Z of X.meta||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>{return`${J==="httpEquiv"?"http-equiv":J}="${w5(String(G))}"`}).join(" ");$.push(`<meta ${Y}>`)}for(let Z of X.link||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>`${J}="${w5(String(G))}"`).join(" ");$.push(`<link ${Y}>`)}for(let Z of X.script||[]){let{content:Y,...J}=Z,G=Object.entries(J).filter(([Q,w])=>w!==void 0).map(([Q,w])=>{if(typeof w==="boolean")return w?Q:"";return`${Q}="${w5(String(w))}"`}).filter(Boolean).join(" ");if(Y)$.push(`<script ${G}>${Y}</script>`);else $.push(`<script ${G}></script>`)}for(let Z of X.style||[]){let Y=Z.type?` type="${Z.type}"`:"";$.push(`<style${Y}>${Z.content}</style>`)}return $.join(`
3356
3356
  `)}function iz(X=v1){if(!X.htmlAttrs)return"";return Object.entries(X.htmlAttrs).map(([$,Z])=>`${$}="${w5(Z)}"`).join(" ")}function nz(X=v1){if(!X.bodyAttrs)return"";return Object.entries(X.bodyAttrs).map(([$,Z])=>`${$}="${w5(Z)}"`).join(" ")}function w5(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function rz(X=v1){if(typeof document>"u")return;if(X.title){let $=X.title;if(X.titleTemplate)$=typeof X.titleTemplate==="function"?X.titleTemplate($):X.titleTemplate.replace("%s",$);document.title=$}for(let $ of X.meta||[]){let Z=$.name?`meta[name="${$.name}"]`:$.property?`meta[property="${$.property}"]`:null;if(Z){let Y=document.querySelector(Z);if(!Y){if(Y=document.createElement("meta"),$.name)Y.setAttribute("name",$.name);if($.property)Y.setAttribute("property",$.property);document.head.appendChild(Y)}Y.setAttribute("content",$.content)}}for(let $ of X.link||[]){let Z=`link[rel="${$.rel}"]${$.href?`[href="${$.href}"]`:""}`,Y=document.querySelector(Z);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[J,G]of Object.entries($))if(G!==void 0)Y.setAttribute(J,String(G))}if(X.htmlAttrs)for(let[$,Z]of Object.entries(X.htmlAttrs))if($==="class")for(let Y of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(Y);else document.documentElement.setAttribute($,Z);if(X.bodyAttrs)for(let[$,Z]of Object.entries(X.bodyAttrs))document.body.setAttribute($,Z)}function sz(X){let $="";return{content:X.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,J)=>{return $+=J.trim()+`
3357
- `,""}),headContent:$.trim()}}function oz(X,$){return X.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:$[(G||"").trim()]??G,w=$.__stx_runtime_head??{};return $.__stx_runtime_head=f5(w,{title:Q}),""})}function az(X,$){return X.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,Y,J,G,Q,w)=>{let q=G?Q:w,W=G?q:$[(q||"").trim()]??q,K=J.includes(":")?{property:J,content:W}:{name:J,content:W},z=$.__stx_runtime_head??{};return $.__stx_runtime_head=f5(z,{meta:[K]}),""})}var v1,uz,cX;var g7=D(()=>{v1={},uz=[],cX={}});import tz from"crypto";function H0(X){return String(X??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function iX(X,$,Z,Y){let J=X||$;return Z?`${J} ${Y}`:J}function p0(X){return String(X).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function g5(X,$){if(/\bid\s*=/i.test(X))return"";return` id="${H0($)}"`}function M9(X,$,Z){if(!$)return"";let Y="";if(!/\baria-invalid\s*=/i.test(Z))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))Y+=` aria-describedby="${H0(`${p0(X)}-error`)}"`;return Y}function ez(){return tz.randomUUID()}function nX(X,$){let Z=X;return Z=Z.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let Y=ez();$.csrf={token:Y}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${H0($.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let G=J.toUpperCase();if(J&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${H0(G)}">`;return Y}),Z}function BY(X,$,Z=_Y){let Y=X;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,G,Q,w,q,W="")=>{let U=G||Q||"POST",K=w||q||"",z=x1(W),B=U.toUpperCase(),_=["GET","POST"].includes(B)?B:"POST",j=`<form method="${H0(_)}" action="${H0(K)}"${z?` ${z}`:""}>`;if(j+=`
3357
+ `,""}),headContent:$.trim()}}function oz(X,$){return X.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:$[(G||"").trim()]??G,w=$.__stx_runtime_head??{};return $.__stx_runtime_head=f5(w,{title:Q}),""})}function az(X,$){return X.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,Y,J,G,Q,w)=>{let q=G?Q:w,W=G?q:$[(q||"").trim()]??q,K=J.includes(":")?{property:J,content:W}:{name:J,content:W},z=$.__stx_runtime_head??{};return $.__stx_runtime_head=f5(z,{meta:[K]}),""})}var v1,uz,cX;var g7=D(()=>{v1={},uz=[],cX={}});import tz from"crypto";function H0(X){return String(X??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function iX(X,$,Z,Y){let J=X||$;return Z?`${J} ${Y}`:J}function i0(X){return String(X).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function g5(X,$){if(/\bid\s*=/i.test(X))return"";return` id="${H0($)}"`}function M9(X,$,Z){if(!$)return"";let Y="";if(!/\baria-invalid\s*=/i.test(Z))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))Y+=` aria-describedby="${H0(`${i0(X)}-error`)}"`;return Y}function ez(){return tz.randomUUID()}function nX(X,$){let Z=X;return Z=Z.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let Y=ez();$.csrf={token:Y}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${H0($.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let G=J.toUpperCase();if(J&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${H0(G)}">`;return Y}),Z}function BY(X,$,Z=_Y){let Y=X;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,G,Q,w,q,W="")=>{let U=G||Q||"POST",K=w||q||"",z=x1(W),B=U.toUpperCase(),_=["GET","POST"].includes(B)?B:"POST",j=`<form method="${H0(_)}" action="${H0(K)}"${z?` ${z}`:""}>`;if(j+=`
3358
3358
  ${nX("@csrf",$)}`,!["GET","POST"].includes(B))j+=`
3359
- ${nX(`@method('${B}')`,$)}`;return j}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,w,q,W="")=>{let U=G||Q||"",K=w||q||"",z=x1(W),B=h7(U,$),_=B!==void 0&&B!==null?B:K||"",j=z.match(/type=['"]([^'"]+)['"]/i),H=j?j[1]:"text",O=u7(U,$),L=z.match(/class=['"]([^'"]+)['"]/i),F=iX(L?L[1]:"",Z.input,O,Z.inputError),V=z.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${H0(H)}" name="${H0(U)}"${g5(z,p0(U))} value="${H0(_)}" class="${F}"${M9(U,O,z)}${V?` ${V}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,G,Q="",w="")=>{let q=x1(Q),W=h7(G,$)||w.trim(),U=u7(G,$),K=q.match(/class=['"]([^'"]+)['"]/i),z=iX(K?K[1]:"",Z.input,U,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${H0(G)}"${g5(q,p0(G))} class="${z}"${M9(G,U,q)}${B?` ${B}`:""}>${H0(W)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,G,Q="",w)=>{let q=x1(Q),W=h7(G,$),U=u7(G,$),K=q.match(/class=['"]([^'"]+)['"]/i),z=iX(K?K[1]:"",Z.input,U,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),_=w;if(W!==void 0)_=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(j,H,O)=>{if((Array.isArray(W)?W.some((F)=>String(F)===O):String(W)===O)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return j});return`<select name="${H0(G)}"${g5(q,p0(G))} class="${z}"${M9(G,U,q)}${B?` ${B}`:""}>${_}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=Q===void 0?"1":Q,W=Q===void 0?p0(G):`${p0(G)}-${p0(q)}`,U=x1(w),K=h7(G,$),z=K!==void 0&&(Array.isArray(K)?K.some((H)=>String(H)===q):K===!0||String(K)===q),B=U.match(/class=['"]([^'"]+)['"]/i),_=B?B[1]:Z.checkInput,j=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${H0(G)}"${g5(U,W)} value="${H0(q)}" class="${_}"${z?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=x1(w),W=h7(G,$),U=W!==void 0&&W===Q,K=q.match(/class=['"]([^'"]+)['"]/i),z=K?K[1]:Z.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${H0(G)}"${g5(q,`${p0(G)}-${p0(Q)}`)} value="${H0(Q)}" class="${z}"${U?" checked":""}${B?` ${B}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q="")=>{let w=x1(Q),q=w.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=w.includes("multiple"),K=u7(G,$),z=w.match(/class=['"]([^'"]+)['"]/i),B=iX(z?z[1]:"",Z.input,K,Z.inputError),_=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),j=[`<input type="file" name="${H0(G)}"${g5(w,p0(G))}`,`class="${B}"`];if(W)j.push(`accept="${H0(W)}"`);if(U)j.push("multiple");if(_)j.push(_);return`${j.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,G,Q="",w)=>{let q=x1(Q),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Z.label,K=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${H0(p0(G))}" class="${U}"${K?` ${K}`:""}>${w}</label>`}),Y}function jY(X,$,Z=_Y){return X.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,G)=>{try{if(u7(J,$)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return zY(J,$);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(J);return zY(J,$)}let W=q.trim();if(q0(W)){let U=Y0(W,$);return U!==void 0?String(U):W}return W}catch{return q}});return`<div id="${H0(`${p0(J)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),Y}})}function u7(X,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(X);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,X);return!1}function zY(X,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(X);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,X)){let Z=$.errors[X];return Array.isArray(Z)?Z[0]:String(Z)}return""}function h7(X,$){let Z;if($.old&&typeof $.old==="function")return $.old(X);if($.old&&typeof $.old==="object")return $.old[X];if(X.endsWith("[]")){let Y=X.slice(0,-2);if(Z=$[Y],Z!==void 0)return Z}return $[X]}function x1(X){if(!X.trim())return"";let $=[],Z=X.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(Z))!==null){let[,G,,Q]=J;$.push(`${G}="${Q.trim()}"`)}return $.join(" ")}var _Y;var HY=D(()=>{F0();_Y={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import I9 from"path";async function X_(){if(d7!==void 0)return d7;try{d7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{d7=null}return d7}function $_(X,$=0){if($<=0)return!1;return Date.now()-X.loadedAt>$}async function Z_(X,$){if({...y9,...$.i18n}.cache&&E9[X]){let J=E9[X],G=$.i18n?.cacheMaxAge??0;if(!$_(J,G))return J.translations}if(m7[X]?.state==="loading")return m7[X].promise;N9[X]="loading";let Y=D9(X,$).then((J)=>{return N9[X]="loaded",delete m7[X],J}).catch((J)=>{throw N9[X]="error",m7[X]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return m7[X]={promise:Y,state:"loading"},Y}async function D9(X,$){let Z={...y9,...$.i18n},Y=I9.isAbsolute(Z.translationsDir)?Z.translationsDir:I9.resolve($.root||process.cwd(),Z.translationsDir);try{let J=await X_(),G=J?await J(X,{translationsDir:Y,defaultLocale:Z.defaultLocale,sources:w_(Z.format)}):await Y_(X,Z,Y);if(G===void 0){if(X!==Z.defaultLocale)return D9(Z.defaultLocale,$);return{}}let Q=G;if(Z.cache)E9[X]={translations:Q,loadedAt:Date.now(),locale:X};return Q}catch(J){if($.debug)console.error(`Error loading translation file for locale "${X}":`,J);if(X!==Z.defaultLocale)return D9(Z.defaultLocale,$);return{}}}async function Y_(X,$,Z){let Y=I9.join(Z,`${X}${J_($.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let G=await Bun.file(Y).text();if($.format==="yaml"||$.format==="yml")return G_(G);if($.format==="json")return JSON.parse(G);throw J}catch{return}}}function J_(X){switch(X){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function G_(X){let $={},Z=X.split(`
3359
+ ${nX(`@method('${B}')`,$)}`;return j}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,w,q,W="")=>{let U=G||Q||"",K=w||q||"",z=x1(W),B=h7(U,$),_=B!==void 0&&B!==null?B:K||"",j=z.match(/type=['"]([^'"]+)['"]/i),H=j?j[1]:"text",O=u7(U,$),L=z.match(/class=['"]([^'"]+)['"]/i),F=iX(L?L[1]:"",Z.input,O,Z.inputError),V=z.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${H0(H)}" name="${H0(U)}"${g5(z,i0(U))} value="${H0(_)}" class="${F}"${M9(U,O,z)}${V?` ${V}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,G,Q="",w="")=>{let q=x1(Q),W=h7(G,$)||w.trim(),U=u7(G,$),K=q.match(/class=['"]([^'"]+)['"]/i),z=iX(K?K[1]:"",Z.input,U,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${H0(G)}"${g5(q,i0(G))} class="${z}"${M9(G,U,q)}${B?` ${B}`:""}>${H0(W)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,G,Q="",w)=>{let q=x1(Q),W=h7(G,$),U=u7(G,$),K=q.match(/class=['"]([^'"]+)['"]/i),z=iX(K?K[1]:"",Z.input,U,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),_=w;if(W!==void 0)_=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(j,H,O)=>{if((Array.isArray(W)?W.some((F)=>String(F)===O):String(W)===O)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return j});return`<select name="${H0(G)}"${g5(q,i0(G))} class="${z}"${M9(G,U,q)}${B?` ${B}`:""}>${_}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=Q===void 0?"1":Q,W=Q===void 0?i0(G):`${i0(G)}-${i0(q)}`,U=x1(w),K=h7(G,$),z=K!==void 0&&(Array.isArray(K)?K.some((H)=>String(H)===q):K===!0||String(K)===q),B=U.match(/class=['"]([^'"]+)['"]/i),_=B?B[1]:Z.checkInput,j=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${H0(G)}"${g5(U,W)} value="${H0(q)}" class="${_}"${z?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=x1(w),W=h7(G,$),U=W!==void 0&&W===Q,K=q.match(/class=['"]([^'"]+)['"]/i),z=K?K[1]:Z.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${H0(G)}"${g5(q,`${i0(G)}-${i0(Q)}`)} value="${H0(Q)}" class="${z}"${U?" checked":""}${B?` ${B}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q="")=>{let w=x1(Q),q=w.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=w.includes("multiple"),K=u7(G,$),z=w.match(/class=['"]([^'"]+)['"]/i),B=iX(z?z[1]:"",Z.input,K,Z.inputError),_=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),j=[`<input type="file" name="${H0(G)}"${g5(w,i0(G))}`,`class="${B}"`];if(W)j.push(`accept="${H0(W)}"`);if(U)j.push("multiple");if(_)j.push(_);return`${j.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,G,Q="",w)=>{let q=x1(Q),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Z.label,K=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${H0(i0(G))}" class="${U}"${K?` ${K}`:""}>${w}</label>`}),Y}function jY(X,$,Z=_Y){return X.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,G)=>{try{if(u7(J,$)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return zY(J,$);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(J);return zY(J,$)}let W=q.trim();if(q0(W)){let U=Y0(W,$);return U!==void 0?String(U):W}return W}catch{return q}});return`<div id="${H0(`${i0(J)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),Y}})}function u7(X,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(X);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,X);return!1}function zY(X,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(X);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,X)){let Z=$.errors[X];return Array.isArray(Z)?Z[0]:String(Z)}return""}function h7(X,$){let Z;if($.old&&typeof $.old==="function")return $.old(X);if($.old&&typeof $.old==="object")return $.old[X];if(X.endsWith("[]")){let Y=X.slice(0,-2);if(Z=$[Y],Z!==void 0)return Z}return $[X]}function x1(X){if(!X.trim())return"";let $=[],Z=X.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(Z))!==null){let[,G,,Q]=J;$.push(`${G}="${Q.trim()}"`)}return $.join(" ")}var _Y;var HY=D(()=>{F0();_Y={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import I9 from"path";async function X_(){if(d7!==void 0)return d7;try{d7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{d7=null}return d7}function $_(X,$=0){if($<=0)return!1;return Date.now()-X.loadedAt>$}async function Z_(X,$){if({...y9,...$.i18n}.cache&&E9[X]){let J=E9[X],G=$.i18n?.cacheMaxAge??0;if(!$_(J,G))return J.translations}if(m7[X]?.state==="loading")return m7[X].promise;N9[X]="loading";let Y=D9(X,$).then((J)=>{return N9[X]="loaded",delete m7[X],J}).catch((J)=>{throw N9[X]="error",m7[X]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return m7[X]={promise:Y,state:"loading"},Y}async function D9(X,$){let Z={...y9,...$.i18n},Y=I9.isAbsolute(Z.translationsDir)?Z.translationsDir:I9.resolve($.root||process.cwd(),Z.translationsDir);try{let J=await X_(),G=J?await J(X,{translationsDir:Y,defaultLocale:Z.defaultLocale,sources:w_(Z.format)}):await Y_(X,Z,Y);if(G===void 0){if(X!==Z.defaultLocale)return D9(Z.defaultLocale,$);return{}}let Q=G;if(Z.cache)E9[X]={translations:Q,loadedAt:Date.now(),locale:X};return Q}catch(J){if($.debug)console.error(`Error loading translation file for locale "${X}":`,J);if(X!==Z.defaultLocale)return D9(Z.defaultLocale,$);return{}}}async function Y_(X,$,Z){let Y=I9.join(Z,`${X}${J_($.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let G=await Bun.file(Y).text();if($.format==="yaml"||$.format==="yml")return G_(G);if($.format==="json")return JSON.parse(G);throw J}catch{return}}}function J_(X){switch(X){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function G_(X){let $={},Z=X.split(`
3360
3360
  `),Y=[{obj:$,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let w=Y[Y.length-1].obj,q=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,K=W.trim(),z=U.trim();if(z==="")w[K]={},Y.push({obj:w[K],indent:Q});else w[K]=Q_(z)}}return $}function Q_(X){if(X.startsWith("'")&&X.endsWith("'")||X.startsWith('"')&&X.endsWith('"'))return X.slice(1,-1);let $=X.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Z=Number(X);if(!Number.isNaN(Z)&&X!=="")return Z;return X}function w_(X){switch(X){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function q_(X,$){return Z_(X,$)}function W_(X,$){for(let Z of X){let Y=Z.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let Q=Number.parseInt(J[1],10);if($===Q)return J[2];continue}let G=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10),w=G[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(G[2],10);if($>=Q&&$<=w)return G[3];continue}}if(X.length===2)return $===1?X[0].trim():X[1].trim();if($<X.length)return X[$].trim();return X[X.length-1].trim()}function U_(X,$={}){return FY(X,$)}function FY(X,$){let Z="",Y=0;while(Y<X.length)if(X[Y]==="{"){let J=K_(X,Y);if(J===-1){Z+=X[Y],Y++;continue}let G=X.slice(Y+1,J);Z+=z_(G,$),Y=J+1}else if(X[Y]==="'"&&Y+1<X.length)if(X[Y+1]==="'")Z+="'",Y+=2;else if(X[Y+1]==="{"||X[Y+1]==="}")Z+=X[Y+1],Y+=2;else Z+=X[Y],Y++;else Z+=X[Y],Y++;return Z}function K_(X,$){let Z=0;for(let Y=$;Y<X.length;Y++)if(X[Y]==="{")Z++;else if(X[Y]==="}"){if(Z--,Z===0)return Y}return-1}function z_(X,$){let Z=__(X);if(Z.length===0)return`{${X}}`;let Y=Z[0].trim(),J=$[Y];if(Z.length===1)return J!==void 0?String(J):`{${Y}}`;switch(Z[1].trim().toLowerCase()){case"plural":return B_(J,Z.slice(2).join(","),$);case"select":return H_(J,Z.slice(2).join(","));case"selectordinal":return L_(J,Z.slice(2).join(","));case"number":return F_(J,Z[2]?.trim());case"date":return V_(J,Z[2]?.trim());case"time":return A_(J,Z[2]?.trim());default:return J!==void 0?String(J):`{${X}}`}}function __(X){let $=[],Z="",Y=0;for(let J=0;J<X.length;J++){let G=X[J];if(G==="{")Y++,Z+=G;else if(G==="}")Y--,Z+=G;else if(G===","&&Y===0)$.push(Z),Z="";else Z+=G}if(Z)$.push(Z);return $}function B_(X,$,Z){let Y=Number(X)||0,J=b9($),G=`=${Y}`;if(J[G])return k9(J[G],Y,Z);let Q=j_(Y);if(J[Q])return k9(J[Q],Y,Z);if(J.other)return k9(J.other,Y,Z);return String(Y)}function k9(X,$,Z){let Y=X.replace(/#/g,String($));return FY(Y,Z)}function j_(X){let $=Math.abs(X),Z=Math.floor($),Y=String(X).includes(".")?String(X).split(".")[1].length:0;if(Z===1&&Y===0)return"one";return"other"}function H_(X,$){let Z=String(X||""),Y=b9($);if(Y[Z])return Y[Z];return Y.other||String(X)}function L_(X,$){let Z=Number(X)||0,Y=b9($),J=O_(Z);if(Y[J])return Y[J].replace(/#/g,String(Z));if(Y.other)return Y.other.replace(/#/g,String(Z));return String(Z)}function O_(X){let $=Math.abs(X),Z=$%10,Y=$%100;if(Z===1&&Y!==11)return"one";if(Z===2&&Y!==12)return"two";if(Z===3&&Y!==13)return"few";return"other"}function b9(X){let $={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=Z.exec(X);while(Y!==null)$[Y[1]]=Y[2],Y=Z.exec(X);return $}function F_(X,$){let Z=Number(X);if(Number.isNaN(Z))return String(X);switch($){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function V_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){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 Z.toLocaleDateString(void 0,Y)}function A_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){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 Z.toLocaleTimeString(void 0,Y)}function R_(X){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(X)}function LY(X,$,Z=!0,Y={}){let J=X.split("."),G=$;for(let w of J){if(G===void 0||G===null)break;G=G[w]}if(G===void 0||G===null)return Z?X:"";let Q=String(G);if(R_(Q))return U_(Q,Y);if(Q.includes("|")&&"count"in Y){let w=Number(Y.count),q=Q.split("|");Q=W_(q,w)}for(let[w,q]of Object.entries(Y)){let W=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${W}`,"g"),String(q))}return Q}async function VY(X,$,Z,Y){let J=X,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...y9,...Y.i18n},w=await q_(Q.locale,Y);$.__translations=w,$.__locale=Q.locale,$.__i18nConfig=Q,J=await OY(J,G,async(U,K,z,B,_)=>{try{let j={};if(z)try{let O=[()=>JSON.parse(z),()=>{let L=`{"data":${z}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return O0(z,$)}];for(let L of O)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(O){if(Y.debug)console.error("Error parsing parameters for @translate directive:",O)}return LY(K,w,Q.fallbackToKey,j)||B.trim()}catch(j){if(Y.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${K}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}});let q=/@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 U=[...J.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((K,z)=>console.warn(`Match ${z}: ${K[0]}, Key: ${K[1]}, Params: ${K[2]||"none"}`))}return J=await OY(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,K,z,B)=>{try{let _={};if(z)try{let j=[()=>JSON.parse(z),()=>{let H=`{"data":${z}}`,O=JSON.parse(H);return typeof O.data==="object"?O.data:{}},()=>{return O0(z,$)}];for(let H of j)try{if(_=H(),Object.keys(_).length>0)break}catch{}}catch(j){if(Y.debug)console.error("Error parsing parameters for @translate directive:",j)}return LY(K,w,Q.fallbackToKey,_)}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${K}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}}),J}async function OY(X,$,Z){let Y=[];return X.replace($,(G,...Q)=>{let w=Z(G,...Q).then((q)=>({match:G,replacement:q}));return Y.push(w),G}),(await Promise.all(Y)).reduce((G,{match:Q,replacement:w})=>G.replace(Q,w),X)}var d7,y9,E9,m7,N9;var AY=D(()=>{F1();F0();y9={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},E9={},m7={},N9={}});function M_(X){let $=X.replace(/^<template\b/i,"").replace(/>$/,"");return T_.test($)}function h5(X){l7.lastIndex=0;let $;while(($=l7.exec(X))!==null){if($[0].startsWith("</")||M_($[0]))continue;let Z=$.index,Y=l7.lastIndex,J=1,G;while((G=l7.exec(X))!==null)if(G[0].startsWith("</")){if(J--,J===0){let Q=G.index;return{start:Z,openEnd:Y,closeStart:Q,end:l7.lastIndex,content:X.slice(Y,Q)}}}else J++;return null}return null}var l7,T_;var rX=D(()=>{l7=/<\/?template\b[^>]*>/gi,T_=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var P9={};t(P9,{streamingSuspenseDirective:()=>MY,streamToResponse:()=>x_,streamTemplateSimple:()=>S_,streamTemplate:()=>k_,renderStreamingPage:()=>E_,registerStreamingDirectives:()=>P_,processStreamDirectives:()=>y_,processSectionDirectives:()=>v_,islandDirective:()=>NY,generateHydrationRuntime:()=>f_,extractStreamBoundaries:()=>b_,createStreamRenderer:()=>C_,buildSuspenseResolveScript:()=>C9,SUSPENSE_RESOLVER_RUNTIME:()=>TY});import sX from"path";function N_(X){let $=[],Z=0,Y;RY.lastIndex=0;while((Y=RY.exec(X))!==null){if(Y.index>Z){let Q=X.slice(Z,Y.index);if(Q.trim())$.push({type:$.length===0?"shell":"content",content:Q})}let J=Y[1],G=Y[2];$.push({type:"suspense",name:J,content:G}),Z=Y.index+Y[0].length}if(Z<X.length){let J=X.slice(Z);if(J.trim())$.push({type:$.length===0?"shell":"content",content:J})}if($.length===0)$.push({type:"shell",content:X});return $}async function k_(X,$={},Z={}){let Y={...A1,...Z,streaming:{...S9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:sX.dirname(X)};if(q.trim())await V1(q,U,X);let K=N_(W),z=new Set;if(!K.some((_)=>_.type==="suspense")){let _=Y.streaming?.strategy||"auto",j=new RegExp(q5.source,"g");if(!(_!=="manual"&&j.test(W))){let O=await V0(W,U,X,Y,z);for(let L=0;L<O.length;L+=J)G.enqueue(O.slice(L,L+J)),await new Promise((F)=>setTimeout(F,0))}else{let O=[],L=new RegExp(q5.source,"g"),F;while((F=L.exec(W))!==null)O.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of O){if(A.start>V){let T=W.slice(V,A.start);if(T.trim()){let M=await V0(T,U,X,Y,z);G.enqueue(M),await new Promise((k)=>setTimeout(k,0))}}let R=await V0(A.content,U,X,Y,z);G.enqueue(R),await new Promise((T)=>setTimeout(T,0)),V=A.end}if(V<W.length){let A=W.slice(V);if(A.trim()){let R=await V0(A,U,X,Y,z);G.enqueue(R)}}}}else{let _=new Map;for(let H of K)if(H.type==="shell"||H.type==="content"){let O=await V0(H.content,U,X,Y,z);G.enqueue(O)}else if(H.type==="suspense"&&H.name){let O=`stx-suspense-${H.name}`;G.enqueue(`<div id="${O}" data-suspense="${H.name}" style="display:contents;">
3361
3361
  <template data-suspense-fallback>Loading...</template>
3362
3362
  </div>`),_.set(H.name,V0(H.content,U,X,Y,z))}G.enqueue(`
@@ -3380,8 +3380,8 @@ ${J}`)}function tZ(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*
3380
3380
  window.__stxSuspense.resolve('${X}', \`${Y}\`);
3381
3381
  </script>`}catch(Z){let Y=Z instanceof Error?Z.message:String(Z);return`
3382
3382
  <script>
3383
- window.__stxSuspense.resolve('${X}', '<div class="stx-error">Error loading content: ${a0(Y)}</div>');
3384
- </script>`}}function I_(X,$,Z){if(!$||$<=0)return X;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${$}ms`)),$)});return Promise.race([X,J]).finally(()=>clearTimeout(Y))}function E_(X,$=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue(X),$.length>0)J.enqueue(TY),await Promise.all($.map(async(G)=>{let Q=I_(G.render(),Y,G.id);J.enqueue(await C9(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function y_(X,$){return X.replace(D_,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),w=Q[0].trim(),q=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!$.__streamTemplates)$.__streamTemplates={};return $.__streamTemplates[G]=w,`<div data-suspense="${G}">${q}</div>`})}function b_(X){let $=X?.streamBoundaries;if(!$||typeof $!=="object")return;let Z=Object.entries($).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function S_(X,$={},Z={}){let Y={...A1,...Z,streaming:{...S9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:sX.dirname(X)};if(q.trim())await V1(q,U,X);let K=new Set,z=Y.streaming?.strategy||"auto",B=new RegExp(q5.source,"g");if(!(z!=="manual"&&B.test(W))){let j=await V0(W,U,X,Y,K);for(let H=0;H<j.length;H+=J)G.enqueue(j.slice(H,H+J))}else{let j=[],H=new RegExp(q5.source,"g"),O;while((O=H.exec(W))!==null)j.push({name:O[1],content:O[2],start:O.index,end:O.index+O[0].length});let L=0;for(let F of j){if(F.start>L){let A=W.slice(L,F.start);if(A.trim()){let R=await V0(A,U,X,Y,K);G.enqueue(R)}}let V=await V0(F.content,U,X,Y,K);G.enqueue(V),L=F.end}if(L<W.length){let F=W.slice(L);if(F.trim()){let V=await V0(F,U,X,Y,K);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function C_(X,$={}){let Z={...A1,...$,streaming:{...S9,...$.streaming}},Y=await Bun.file(X).text(),J=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=J?J[1]:"",Q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=Q,q={},W;q5.lastIndex=0;while((W=q5.exec(Q))!==null){let z=W[1],B=W[2];q[z]=B}let U=Q.replace(q5,"");return{renderShell:async(z={})=>{let B={...z,__filename:X,__dirname:sX.dirname(X)};return await V1(G,B,X),V0(U,B,X,Z,new Set)},renderSection:async(z,B={})=>{try{if(!q[z])return`<div class="error-message">Section "${a0(z)}" not found in template "${a0(X)}"</div>`;let _={...B,__filename:X,__dirname:sX.dirname(X)};await V1(G,_,X);let j=new Set;return await V0(q[z],_,X,Z,j)}catch(_){let j=_ instanceof Error?_.message:String(_);return K0("Expression",j,X,q[z]||"",0,q[z]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return w}}}function P_(X={}){let $=[];if(X.streaming?.enabled)$.push(MY);if(X.hydration?.enabled)$.push(NY);return $}async function v_(X,$,Z,Y={}){return X}function x_(X,$={}){let Z=new TextEncoder,Y=X.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),J=new Headers($.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(Y,{...$,headers:J})}function f_(X={mode:"full"}){let{mode:$,components:Z={},dynamicImports:Y=!0}=X,J=Object.entries(Z).map(([G,Q])=>`'${G}': ${Y?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
3383
+ window.__stxSuspense.resolve('${X}', '<div class="stx-error">Error loading content: ${t0(Y)}</div>');
3384
+ </script>`}}function I_(X,$,Z){if(!$||$<=0)return X;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${$}ms`)),$)});return Promise.race([X,J]).finally(()=>clearTimeout(Y))}function E_(X,$=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue(X),$.length>0)J.enqueue(TY),await Promise.all($.map(async(G)=>{let Q=I_(G.render(),Y,G.id);J.enqueue(await C9(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function y_(X,$){return X.replace(D_,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),w=Q[0].trim(),q=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!$.__streamTemplates)$.__streamTemplates={};return $.__streamTemplates[G]=w,`<div data-suspense="${G}">${q}</div>`})}function b_(X){let $=X?.streamBoundaries;if(!$||typeof $!=="object")return;let Z=Object.entries($).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function S_(X,$={},Z={}){let Y={...A1,...Z,streaming:{...S9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:sX.dirname(X)};if(q.trim())await V1(q,U,X);let K=new Set,z=Y.streaming?.strategy||"auto",B=new RegExp(q5.source,"g");if(!(z!=="manual"&&B.test(W))){let j=await V0(W,U,X,Y,K);for(let H=0;H<j.length;H+=J)G.enqueue(j.slice(H,H+J))}else{let j=[],H=new RegExp(q5.source,"g"),O;while((O=H.exec(W))!==null)j.push({name:O[1],content:O[2],start:O.index,end:O.index+O[0].length});let L=0;for(let F of j){if(F.start>L){let A=W.slice(L,F.start);if(A.trim()){let R=await V0(A,U,X,Y,K);G.enqueue(R)}}let V=await V0(F.content,U,X,Y,K);G.enqueue(V),L=F.end}if(L<W.length){let F=W.slice(L);if(F.trim()){let V=await V0(F,U,X,Y,K);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function C_(X,$={}){let Z={...A1,...$,streaming:{...S9,...$.streaming}},Y=await Bun.file(X).text(),J=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=J?J[1]:"",Q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=Q,q={},W;q5.lastIndex=0;while((W=q5.exec(Q))!==null){let z=W[1],B=W[2];q[z]=B}let U=Q.replace(q5,"");return{renderShell:async(z={})=>{let B={...z,__filename:X,__dirname:sX.dirname(X)};return await V1(G,B,X),V0(U,B,X,Z,new Set)},renderSection:async(z,B={})=>{try{if(!q[z])return`<div class="error-message">Section "${t0(z)}" not found in template "${t0(X)}"</div>`;let _={...B,__filename:X,__dirname:sX.dirname(X)};await V1(G,_,X);let j=new Set;return await V0(q[z],_,X,Z,j)}catch(_){let j=_ instanceof Error?_.message:String(_);return K0("Expression",j,X,q[z]||"",0,q[z]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return w}}}function P_(X={}){let $=[];if(X.streaming?.enabled)$.push(MY);if(X.hydration?.enabled)$.push(NY);return $}async function v_(X,$,Z,Y={}){return X}function x_(X,$={}){let Z=new TextEncoder,Y=X.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),J=new Headers($.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(Y,{...$,headers:J})}function f_(X={mode:"full"}){let{mode:$,components:Z={},dynamicImports:Y=!0}=X,J=Object.entries(Z).map(([G,Q])=>`'${G}': ${Y?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
3385
3385
  `);if($==="loader")return`
3386
3386
  (function() {
3387
3387
  window.__stx = window.__stx || {};
@@ -3549,7 +3549,7 @@ else {
3549
3549
  ${q?`{${q}}`:"{}"}
3550
3550
  </script>
3551
3551
  </div>`}}});var EY={};t(EY,{warnUnbalancedTags:()=>x9,findUnbalancedTags:()=>IY});function u5(X){return X.replace(/[^\n]/g," ")}function IY(X){let $=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,u5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,u5).replace(/<!--[\s\S]*?-->/g,u5).replace(/\{\{\{[\s\S]*?\}\}\}/g,u5).replace(/\{\{[\s\S]*?\}\}/g,u5).replace(/\{!![\s\S]*?!!\}/g,u5),Z=new Map,Y=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=J.exec($))!==null){let w=G[1]==="/",q=G[2],W=G[3]==="/";if(g_.has(q.toLowerCase()))continue;if(W)continue;if(w)Y.set(q,(Y.get(q)??0)+1);else{let U=Z.get(q);if(U)U.count++;else{let K=$.slice(0,G.index).split(`
3552
- `).length;Z.set(q,{count:1,firstLine:K})}}}let Q=[];for(let w of new Set([...Z.keys(),...Y.keys()])){if(h_.has(w.toLowerCase()))continue;let q=Z.get(w)?.count??0,W=Y.get(w)??0;if(q!==W)Q.push({tag:w,opened:q,closed:W,firstOpenLine:Z.get(w)?.firstLine??0})}return Q}function x9(X,$){let Z;try{Z=IY(X)}catch{return}if(Z.length===0)return;let Y=`${$}:${X.length}`;if(kY.has(Y))return;kY.add(Y);let J=$?$.split(/[/\\]/).pop()||$:"template";for(let{tag:G,opened:Q,closed:w,firstOpenLine:q}of Z)if(Q>w){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 an unclosed <${G}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 ${w-Q} stray </${G}>.`)}var g_,h_,kY;var f9=D(()=>{g_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),h_=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);kY=new Set});import i0 from"path";import g9 from"fs";function DY(X){return X.split("-").map(($)=>$.charAt(0).toUpperCase()+$.slice(1)).join("")}function yY(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class bY{builtins=new Map;registerBuiltin(X){this.builtins.set(X.name.toLowerCase(),X);for(let $ of X.aliases)this.builtins.set($.toLowerCase(),X)}isBuiltin(X){return this.builtins.has(X.toLowerCase())}getBuiltin(X){return this.builtins.get(X.toLowerCase())??null}async resolveFile(X,$,Z,Y){let J=X.endsWith(".stx")?X.slice(0,-4):X,G=Y?.__importedComponents;if(G){let B=[J,J.toLowerCase(),DY(J),yY(J)];for(let _ of B)if(G.has(_))return G.get(_)}let Q=[...new Set([`${J}.stx`,`${DY(J)}.stx`,`${yY(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=i0.resolve(i0.dirname($),`${J}.stx`);if(await i(B))return B;return null}let w=[],q=Z.componentsDir||"",W=Y?.__originalFilePath;if(W)w.push(i0.join(i0.dirname(W),"components"));if(q)w.push(q);let U=i0.join(i0.dirname($),"components");if(!w.includes(U))w.push(U);let K=process.cwd(),z=[i0.resolve(K,"src/components"),i0.resolve(K,"components"),i0.resolve(import.meta.dir,"components")];for(let B of z)if(!w.includes(B))w.push(B);for(let B of w){if(!B)continue;for(let _ of Q){let j=i0.join(B,_);if(await i(j))return j}try{if(!g9.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let j=g9.readdirSync(B,{withFileTypes:!0});for(let H of j)if(H.isDirectory()){let O=i0.join(B,H.name);for(let L of Q){let F=i0.join(O,L);if(await i(F))return F}}}catch{}}return null}}var x0;var h9=D(()=>{T0();x0=new bY});function k0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function SY(X){return X.indexOf("\x00")===-1?X:X.replace(/\0/g,"")}var W5="\x00stx-boolean-attribute";function d5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.static)){if($.has(Y))continue;let G=X.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)Z.push(k0(G));continue}if(J===W5){Z.push(k0(G));continue}Z.push(`${k0(G)}="${k0(SY(String(J)))}"`)}return Z}var aX=()=>{};function c7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function u_(X){if(X.clientReactive.to)return{value:X.clientReactive.to,reactive:!0};if(X.serverDynamic.to!==void 0)return{value:String(X.serverDynamic.to),reactive:!1};if(typeof X.static.to==="string")return{value:X.static.to,reactive:!1};return{value:"#",reactive:!1}}var u9;var d9=D(()=>{aX();u9={name:"StxLink",aliases:["stx-link"],render(X,$,Z){let Y=u_(X),J=(typeof X.static.class==="string"?X.static.class:"")||(typeof X.static.className==="string"?X.static.className:""),G=typeof X.static.activeClass==="string"?X.static.activeClass:"active",Q=typeof X.static.exactActiveClass==="string"?X.static.exactActiveClass:"exact-active",w=X.static.prefetch===!0||X.static.prefetch==="true"||X.serverDynamic.prefetch===!0,q=[];if(Y.reactive)q.push(`:href="${c7(Y.value)}"`);else q.push(`href="${c7(Y.value)}"`);if(J)q.push(`class="${c7(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${c7(G)}"`),q.push(`data-stx-exact-active-class="${c7(Q)}"`),w)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...d5(X,W)),`<a ${q.join(" ")}>${$}</a>`}}});function I0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function y0(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function l9(X,$,Z=!1){let Y=X.serverDynamic[$];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=X.static[$];if(J!==void 0)return J!=="false"&&J!==!1;return Z}function CY(X){if(X.includes("(")||X.includes(","))return X;let $=X.trim().split(/\s+/),Z=[];for(let Y of $)if(Y.includes(":")){let[J,G]=Y.split(":"),Q=d_[J];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let w=Number.parseInt(J);if(!Number.isNaN(w))Z.push(`(max-width: ${w}px) ${G}`)}}else Z.push(Y);return Z.join(", ")}function c9(X,$,Z,Y){return $.map((J)=>`${p7(X,J,void 0,Z,Y)} ${J}w`).join(", ")}function m_(X,$,Z,Y,J){return $.map((G)=>{let Q=Z?Z*G:void 0;return`${p7(X,Q,void 0,Y,J)} ${G}x`}).join(", ")}function p7(X,$,Z,Y,J){if(!Y||Y==="local"||Y==="static")return X;if(Y==="cloudinary"){let G=[];if($)G.push(`w_${$}`);if(Z)G.push(`h_${Z}`);if(J)G.push(`f_${J}`);G.push("q_auto");let Q=G.join(",");return X.replace("/upload/",`/upload/${Q}/`)}if(Y==="imgix"){let G=new URLSearchParams;if($)G.set("w",String($));if(Z)G.set("h",String(Z));if(J)G.set("fm",J);G.set("auto","format");let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}if(Y==="bunny"){let G=new URLSearchParams;if($)G.set("width",String($));if(Z)G.set("height",String(Z));if(J)G.set("format",J);let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}return X}function l_(X,$,Z="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${$}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var d_,m9,p9;var i9=D(()=>{aX();d_={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},m9=[320,640,768,1024,1280,1536,1920];p9={name:"StxImage",aliases:["stx-image","stx-img"],render(X,$,Z){let Y=y0(X,"src")||"",J=y0(X,"alt")||"",G=y0(X,"width"),Q=y0(X,"height"),w=y0(X,"sizes"),q=y0(X,"srcset"),W=y0(X,"densities"),U=y0(X,"format"),K=y0(X,"placeholder"),z=y0(X,"placeholderColor")||"#e5e7eb",B=y0(X,"provider"),_=y0(X,"class")||y0(X,"className")||"",j=y0(X,"style")||"",H=y0(X,"quality"),O=l9(X,"lazy",!0),L=l9(X,"preload",!1),F=l9(X,"picture",!1)||!!U,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=q||"",T="";if(!R&&w)R=c9(Y,m9,B,U),T=CY(w);else if(!R&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));R=m_(Y,S,V,B,U)}else if(w)T=CY(w);let M=[];if(j)M.push(j);if(V&&A)M.push(`aspect-ratio:${V}/${A}`);if(K==="blur"||K==="color"||K==="thumbhash"){let S=l_(V||16,A||9,z);M.push(`background-image:url(${S})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(K&&K!=="empty"&&K!=="none")M.push(`background-image:url(${I0(K)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let k=p7(Y,V,A,B,U),N=[];if(N.push(`src="${I0(k)}"`),N.push(`alt="${I0(J)}"`),G)N.push(`width="${I0(G)}"`);if(Q)N.push(`height="${I0(Q)}"`);if(O)N.push('loading="lazy"');if(N.push('decoding="async"'),_)N.push(`class="${I0(_)}"`);if(M.length>0)N.push(`style="${I0(M.join(";"))}"`);if(R)N.push(`srcset="${I0(R)}"`);if(T)N.push(`sizes="${I0(T)}"`);let y=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);N.push(...d5(X,y));let I=`<img ${N.join(" ")} />`,C="";if(L){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${I0(k)}"${b?` type="${b}"`:""}${R?` imagesrcset="${I0(R)}"`:""}${T?` imagesizes="${I0(T)}"`:""} />
3552
+ `).length;Z.set(q,{count:1,firstLine:K})}}}let Q=[];for(let w of new Set([...Z.keys(),...Y.keys()])){if(h_.has(w.toLowerCase()))continue;let q=Z.get(w)?.count??0,W=Y.get(w)??0;if(q!==W)Q.push({tag:w,opened:q,closed:W,firstOpenLine:Z.get(w)?.firstLine??0})}return Q}function x9(X,$){let Z;try{Z=IY(X)}catch{return}if(Z.length===0)return;let Y=`${$}:${X.length}`;if(kY.has(Y))return;kY.add(Y);let J=$?$.split(/[/\\]/).pop()||$:"template";for(let{tag:G,opened:Q,closed:w,firstOpenLine:q}of Z)if(Q>w){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 an unclosed <${G}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 ${w-Q} stray </${G}>.`)}var g_,h_,kY;var f9=D(()=>{g_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),h_=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);kY=new Set});import n0 from"path";import g9 from"fs";function DY(X){return X.split("-").map(($)=>$.charAt(0).toUpperCase()+$.slice(1)).join("")}function yY(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class bY{builtins=new Map;registerBuiltin(X){this.builtins.set(X.name.toLowerCase(),X);for(let $ of X.aliases)this.builtins.set($.toLowerCase(),X)}isBuiltin(X){return this.builtins.has(X.toLowerCase())}getBuiltin(X){return this.builtins.get(X.toLowerCase())??null}async resolveFile(X,$,Z,Y){let J=X.endsWith(".stx")?X.slice(0,-4):X,G=Y?.__importedComponents;if(G){let B=[J,J.toLowerCase(),DY(J),yY(J)];for(let _ of B)if(G.has(_))return G.get(_)}let Q=[...new Set([`${J}.stx`,`${DY(J)}.stx`,`${yY(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=n0.resolve(n0.dirname($),`${J}.stx`);if(await i(B))return B;return null}let w=[],q=Z.componentsDir||"",W=Y?.__originalFilePath;if(W)w.push(n0.join(n0.dirname(W),"components"));if(q)w.push(q);let U=n0.join(n0.dirname($),"components");if(!w.includes(U))w.push(U);let K=process.cwd(),z=[n0.resolve(K,"src/components"),n0.resolve(K,"components"),n0.resolve(import.meta.dir,"components")];for(let B of z)if(!w.includes(B))w.push(B);for(let B of w){if(!B)continue;for(let _ of Q){let j=n0.join(B,_);if(await i(j))return j}try{if(!g9.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let j=g9.readdirSync(B,{withFileTypes:!0});for(let H of j)if(H.isDirectory()){let O=n0.join(B,H.name);for(let L of Q){let F=n0.join(O,L);if(await i(F))return F}}}catch{}}return null}}var x0;var h9=D(()=>{T0();x0=new bY});function k0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function SY(X){return X.indexOf("\x00")===-1?X:X.replace(/\0/g,"")}var W5="\x00stx-boolean-attribute";function d5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.static)){if($.has(Y))continue;let G=X.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)Z.push(k0(G));continue}if(J===W5){Z.push(k0(G));continue}Z.push(`${k0(G)}="${k0(SY(String(J)))}"`)}return Z}var aX=()=>{};function c7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function u_(X){if(X.clientReactive.to)return{value:X.clientReactive.to,reactive:!0};if(X.serverDynamic.to!==void 0)return{value:String(X.serverDynamic.to),reactive:!1};if(typeof X.static.to==="string")return{value:X.static.to,reactive:!1};return{value:"#",reactive:!1}}var u9;var d9=D(()=>{aX();u9={name:"StxLink",aliases:["stx-link"],render(X,$,Z){let Y=u_(X),J=(typeof X.static.class==="string"?X.static.class:"")||(typeof X.static.className==="string"?X.static.className:""),G=typeof X.static.activeClass==="string"?X.static.activeClass:"active",Q=typeof X.static.exactActiveClass==="string"?X.static.exactActiveClass:"exact-active",w=X.static.prefetch===!0||X.static.prefetch==="true"||X.serverDynamic.prefetch===!0,q=[];if(Y.reactive)q.push(`:href="${c7(Y.value)}"`);else q.push(`href="${c7(Y.value)}"`);if(J)q.push(`class="${c7(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${c7(G)}"`),q.push(`data-stx-exact-active-class="${c7(Q)}"`),w)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...d5(X,W)),`<a ${q.join(" ")}>${$}</a>`}}});function I0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function y0(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function l9(X,$,Z=!1){let Y=X.serverDynamic[$];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=X.static[$];if(J!==void 0)return J!=="false"&&J!==!1;return Z}function CY(X){if(X.includes("(")||X.includes(","))return X;let $=X.trim().split(/\s+/),Z=[];for(let Y of $)if(Y.includes(":")){let[J,G]=Y.split(":"),Q=d_[J];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let w=Number.parseInt(J);if(!Number.isNaN(w))Z.push(`(max-width: ${w}px) ${G}`)}}else Z.push(Y);return Z.join(", ")}function c9(X,$,Z,Y){return $.map((J)=>`${p7(X,J,void 0,Z,Y)} ${J}w`).join(", ")}function m_(X,$,Z,Y,J){return $.map((G)=>{let Q=Z?Z*G:void 0;return`${p7(X,Q,void 0,Y,J)} ${G}x`}).join(", ")}function p7(X,$,Z,Y,J){if(!Y||Y==="local"||Y==="static")return X;if(Y==="cloudinary"){let G=[];if($)G.push(`w_${$}`);if(Z)G.push(`h_${Z}`);if(J)G.push(`f_${J}`);G.push("q_auto");let Q=G.join(",");return X.replace("/upload/",`/upload/${Q}/`)}if(Y==="imgix"){let G=new URLSearchParams;if($)G.set("w",String($));if(Z)G.set("h",String(Z));if(J)G.set("fm",J);G.set("auto","format");let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}if(Y==="bunny"){let G=new URLSearchParams;if($)G.set("width",String($));if(Z)G.set("height",String(Z));if(J)G.set("format",J);let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}return X}function l_(X,$,Z="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${$}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var d_,m9,p9;var i9=D(()=>{aX();d_={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},m9=[320,640,768,1024,1280,1536,1920];p9={name:"StxImage",aliases:["stx-image","stx-img"],render(X,$,Z){let Y=y0(X,"src")||"",J=y0(X,"alt")||"",G=y0(X,"width"),Q=y0(X,"height"),w=y0(X,"sizes"),q=y0(X,"srcset"),W=y0(X,"densities"),U=y0(X,"format"),K=y0(X,"placeholder"),z=y0(X,"placeholderColor")||"#e5e7eb",B=y0(X,"provider"),_=y0(X,"class")||y0(X,"className")||"",j=y0(X,"style")||"",H=y0(X,"quality"),O=l9(X,"lazy",!0),L=l9(X,"preload",!1),F=l9(X,"picture",!1)||!!U,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=q||"",T="";if(!R&&w)R=c9(Y,m9,B,U),T=CY(w);else if(!R&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));R=m_(Y,S,V,B,U)}else if(w)T=CY(w);let M=[];if(j)M.push(j);if(V&&A)M.push(`aspect-ratio:${V}/${A}`);if(K==="blur"||K==="color"||K==="thumbhash"){let S=l_(V||16,A||9,z);M.push(`background-image:url(${S})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(K&&K!=="empty"&&K!=="none")M.push(`background-image:url(${I0(K)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let k=p7(Y,V,A,B,U),N=[];if(N.push(`src="${I0(k)}"`),N.push(`alt="${I0(J)}"`),G)N.push(`width="${I0(G)}"`);if(Q)N.push(`height="${I0(Q)}"`);if(O)N.push('loading="lazy"');if(N.push('decoding="async"'),_)N.push(`class="${I0(_)}"`);if(M.length>0)N.push(`style="${I0(M.join(";"))}"`);if(R)N.push(`srcset="${I0(R)}"`);if(T)N.push(`sizes="${I0(T)}"`);let y=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);N.push(...d5(X,y));let I=`<img ${N.join(" ")} />`,C="";if(L){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${I0(k)}"${b?` type="${b}"`:""}${R?` imagesrcset="${I0(R)}"`:""}${T?` imagesizes="${I0(T)}"`:""} />
3553
3553
  `}if(F){let S=[];if(U==="avif"||U==="auto"){let b=p7(Y,V,A,B,"avif"),P=R?c9(Y,m9,B,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${I0(P)}"${T?` sizes="${I0(T)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=p7(Y,V,A,B,"webp"),P=R?c9(Y,m9,B,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${I0(P)}"${T?` sizes="${I0(T)}"`:""} />`)}return`${C}<picture>
3554
3554
  ${S.join(`
3555
3555
  `)}
@@ -3588,15 +3588,15 @@ ${I}
3588
3588
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3589
3589
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3590
3590
  </style>`}}});import{existsSync as i_,readFileSync as n_}from"fs";function r_(X){if(hY.has(X))return;hY.add(X),console.warn(`[stx] icon collection "${X}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${X}\`.`)}function s_(X){let $=process.cwd();for(let Z of[`${$}/node_modules/@iconify-json/${X}/icons.json`,`${$}/pantry/@iconify-json/${X}/icons.json`,`${$}/node_modules/@iconify/json/json/${X}.json`,`${$}/pantry/@iconify/json/json/${X}.json`])if(i_(Z))return Z;for(let Z of[`@iconify-json/${X}/icons.json`,`@iconify/json/json/${X}.json`])try{return X0.resolve(Z)}catch{}return null}function o_(X){if(X8.has(X))return X8.get(X);let $=s_(X);if(!$)return r_(X),null;try{let Z=JSON.parse(n_($,"utf8"));return X8.set(X,Z.icons),Z.icons}catch{return null}}function c5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);if(X.static[$]!==void 0)return String(X.static[$]);if(X.clientReactive[$]!==void 0)return X.clientReactive[$];return}var X8,hY,J3;var G3=D(()=>{X8=new Map,hY=new Set;J3={name:"Icon",aliases:["icon","stx-icon"],render(X,$,Z){let Y=c5(X,"name")??c5(X,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",G=Y;if(Y.includes(":")){let L=Y.split(":");J=L[0],G=L[1]}let Q=k0(c5(X,"size")||"24"),w=k0(c5(X,"color")||"currentColor"),q=k0(c5(X,"class")||""),W=k0(c5(X,"style")||""),U=X8.get(J)??o_(J);if(!U)return`<!-- Icon: collection "${J}" not loaded -->`;let K=U[G];if(!K)return`<!-- Icon: "${G}" not found in ${J} -->`;let z=K.width||24,B=K.height||24,_=`0 0 ${z} ${B}`,j=K.body;if(w!=="currentColor")j=j.replace(/currentColor/g,w);let H=q?` class="${q}"`:"",O=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${_}" fill="none"${H}${O}>${j}</svg>`}}});function uY(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}function dY(X,$){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${$}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=X.match(Z);if(!Y)return{region:null,rest:X};return{region:Y[2],rest:X.replace(Y[0],"")}}var Q3;var w3=D(()=>{Q3={name:"Suspense",aliases:["suspense"],render(X,$,Z){let Y=dY($,"fallback"),J=Y.rest,G=dY(J,"error"),Q=G.rest,w=Y.region??uY(X,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=G.region??uY(X,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${w}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function $8(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}var q3;var W3=D(()=>{q3={name:"TransitionGroup",aliases:["transition-group"],render(X,$,Z){let Y=($8(X,"name")||"v").replace(/["'<>]/g,""),J=($8(X,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=$8(X,"class"),Q=$8(X,"id"),w=[`data-stx-transition-group="${Y}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${J} ${w}>${$}</${J}>`}}});function mY(){x0.registerBuiltin(u9),x0.registerBuiltin(p9),x0.registerBuiltin(n9),x0.registerBuiltin(o9),x0.registerBuiltin(t9),x0.registerBuiltin(X3),x0.registerBuiltin(Z3),x0.registerBuiltin(J3),x0.registerBuiltin(Q3),x0.registerBuiltin(q3)}var lY=D(()=>{d9();i9();r9();a9();e9();$3();Y3();G3();w3();W3();h9();d9();i9();r9();a9();e9();$3();Y3();G3();w3();W3()});function Z8(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function cY(X,$,Z){let Y=[],J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;let w=X.slice(G+1).match(new RegExp(`^(${$.source})(?![\\w.:-])`));if(!w){J=G+1;continue}let q=w[1];if(Z&&Z.has(q.toLowerCase())){let j=G+1+q.length;while(j<X.length&&X[j]!==">")j++;J=j+1;continue}let W=G+1+q.length,U=null,K=W,z=-1,B=!1;while(W<X.length){let j=X[W];if(U){if(j==="\\"&&W+1<X.length){W+=2;continue}if(j===U)U=null;W++;continue}if(j==='"'||j==="'"){U=j,W++;continue}if(j==="/"&&W+1<X.length&&X[W+1]===">"){z=W+2,B=!0;break}if(j===">"){z=W+1;break}W++}if(z===-1){J=G+1;continue}let _=X.slice(K,B?z-2:z-1).trim();if(B)Y.push({fullMatch:X.slice(G,z),tagName:q,attributes:_,content:"",startIndex:G,endIndex:z,isSelfClosing:!0}),J=z;else{let j=`<${q}`,H=`</${q}>`,O=1,L=z,F=-1;while(O>0&&L<X.length){let R=X.indexOf(j,L),T=X.indexOf(H,L);if(T===-1)break;if(R!==-1&&R<T){let M=X[R+j.length];if(M===" "||M===">"||M==="/"||M===`
3591
- `||M==="\t")O++;L=R+j.length}else{if(O--,O===0){F=T;break}L=T+H.length}}if(F===-1){J=z;continue}let V=X.slice(z,F),A=F+H.length;Y.push({fullMatch:X.slice(G,A),tagName:q,attributes:_,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function pY(X){return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function iY(X,$){try{let Z=Buffer.from(X,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=X.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if($?.debug)console.error("Error decoding __stx_ prop:",Z);return X}}var nY=D(()=>{F0();T0();$5()});var XJ={};t(XJ,{processESImports:()=>tY,processComponents:()=>G8});import J8 from"fs";import d0 from"path";function t_(X,$,Z){let Y={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(U6),G=(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,(q,W)=>W.toUpperCase())},Q=(w,q)=>{let W=G(w);if(Y.static[W]=q,W!==w)Y.staticNames[W]=w};for(let[w,q]of Object.entries(X)){let W=w.startsWith("x-")&&!J.has(w)&&!w.startsWith("x-bind:")&&!w.startsWith("x-on:")?`:${w.slice(2)}`:w;if(W.startsWith("@")){Y.events[W]=q;continue}if(W.startsWith("__stx_")){let U=G(W.slice(6));Y.serverDynamic[U]=iY(q,Z);continue}if(W.startsWith(":")){let U=G(W.slice(1)),K=q===W5?U:q;if(U==="if"||U==="for"||U==="show"){Y.clientReactive[U]=K;continue}try{if(!q0(K)){if(Z.debug)console.error(`Unsafe expression in :${U} binding: ${K}`);Y.clientReactive[U]=K;continue}let z=Object.keys($),_=W0(K,z)(...Object.values($));if(_===void 0){let j=K.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((L)=>!H.has(L)&&!z.includes(L))){Y.clientReactive[U]=K;continue}}Y.serverDynamic[U]=_}catch{Y.clientReactive[U]=K}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let U=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let K=U[1];if(q0(K)){let B=W0(K,Object.keys($))(...Object.values($));Q(W,B!=null?String(B):"")}else{if(Z.debug)console.error(`Unsafe expression in ${W}: ${K}`);Q(W,q)}}catch(K){if(Z.debug)console.error(`Error evaluating expression for ${W}:`,K);Q(W,q)}else{let K=q,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(q))!==null)try{let _=B[1];if(!q0(_)){if(Z.debug)console.error(`Unsafe expression in ${W}: ${_}`);continue}let H=W0(_,Object.keys($))(...Object.values($));K=K.replace(B[0],String(H??""))}catch(_){if(Z.debug)console.error(`Error evaluating expression in ${W}:`,_)}Q(W,K)}continue}Q(W,q===W5?"true":pY(q))}return Y}function e_(X){let $={},Z=0,Y=X.length;while(Z<Y){while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test(X[Z]))J+=X[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z<Y&&X[Z]==="="){Z++;while(Z<Y&&/\s/.test(X[Z]))Z++;let G="";if(Z<Y&&(X[Z]==='"'||X[Z]==="'")){let Q=X[Z];Z++;while(Z<Y){let w=X[Z];if(w==="\\"&&Z+1<Y){Z++,G+=X[Z],Z++;continue}if(w===Q){Z++;break}G+=w,Z++}}else while(Z<Y&&!/\s/.test(X[Z]))G+=X[Z],Z++;$[J]=G}else $[J]=W5}return $}function sY(X){return Object.entries(X).map(([$,Z])=>Z===W5?$:`${$}="${XB(Z)}"`).join(" ")}function XB(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $B(X){let $=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1];if(x0.isBuiltin(J))$.add(J)}return[...$].sort()}function ZB(X){let $=oY.get(X);if($)return $;let Z=new Map,Y=[d0.join(X,"src"),d0.join(X,"dist"),X];function J(G,Q){if(Q>6)return;let w;try{w=J8.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of w){let W=d0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(W,Q+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Z.has(U))Z.set(U,W);let K=U.toLowerCase();if(!Z.has(K))Z.set(K,W);let z=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(z))Z.set(z,W)}}}for(let G of Y)if(J(G,0),Z.size>0)break;return oY.set(X,Z),Z}function YB(X,$){if(X.startsWith(".")||X.startsWith("/"))return null;let Z=$;while(!0){let Y=d0.join(Z,"node_modules",X);try{if(J8.statSync(Y).isDirectory())return Y}catch{}let J=d0.dirname(Z);if(J===Z)return null;Z=J}}async function tY(X,$,Z,Y,J){if(!X.includes("import"))return X;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,Q=d0.dirname(Z),w=X,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return w=w.replace(q,(W,U,K)=>{let z=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=K,_,j=[];while((_=z.exec(K))!==null){let[H,O,L,F]=_,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let M=d0.resolve(Q,F);if(M.endsWith(".stx"))A=M;else{let k=`${M}.stx`;try{if(J8.statSync(k).isFile())A=k}catch{try{if(J8.statSync(M).isDirectory())V=M}catch{}}}}else V=YB(F,Q);if(!V&&!A)continue;let R=!1,T=(M,k)=>{G.set(M,k),G.set(M.toLowerCase(),k);let N=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(N,k),J.add(k)};if(L&&A)T(L,A),R=!0;else if(O){let M=O.slice(1,-1).split(",").map((N)=>N.trim()).filter(Boolean).map((N)=>{let y=N.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y)return{source:y[1],local:y[2]};return{source:N,local:N}}),k=V?ZB(V):null;for(let{source:N,local:y}of M){let I=null;if(A)I=A;else if(k)I=k.get(N)??k.get(N.toLowerCase())??k.get(N.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)T(y,I),R=!0}}if(R)j.push({start:_.index,end:_.index+H.length})}if(j.length===0)return W;for(let H=j.length-1;H>=0;H--)B=B.slice(0,j[H].start)+B.slice(j[H].end);return`<script${U}>${B}</script>`}),w}async function JB(X,$,Z,Y,J){let G=X;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,w=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=w.exec(G))!==null){let[W,U]=q,K=U.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of K){let B=z.split("/"),j=B[B.length-1].replace(/\.stx$/,""),H=j.includes("-")?j.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):j.charAt(0).toUpperCase()+j.slice(1),O=null,L=[d0.resolve(d0.dirname(Z),`${z}.stx`),d0.resolve(d0.dirname(Z),z),d0.resolve(Y.componentsDir||"components",`${z}.stx`),d0.resolve(Y.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){O=F;break}}catch{}if(O){Q.set(H,O),Q.set(j,O),Q.set(j.toLowerCase(),O);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,O),J.add(O),Y.debug)console.log(`Imported component: ${H} -> ${O}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${z}`)}G=G.replace(W,""),w.lastIndex=0}return G}async function GB(X,$,Z,Y,J){let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(G))!==null){let U=W.index,K=U+W[0].length-1,z=1,B=K+1;while(B<G.length&&z>0){if(G[B]==="(")z++;else if(G[B]===")"){if(z--,z===0)break}B++}if(z!==0)break;let _=G.substring(K+1,B),j=B+1,H=_.match(/^\s*['"]([^'"]+)['"]/);if(!H){q.lastIndex=0;continue}let O=H[1],L,F=_.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)L=F.slice(V[0].length).trim();let A={};if(L)try{A=O0(L,$)}catch(y){let I=y instanceof Error?y.message:String(y);G=G.replace(G.substring(U,j),`[Error parsing component props: ${I}]`);continue}let R="",T=j,k=G.substring(j).match(/^([\s\S]*?)@endcomponent/);if(k)R=k[1].trim(),T=j+k[0].length;let N=await U5(O,A,R,Q,$,Z,Y,w,J);G=G.substring(0,U)+N+G.substring(T),q.lastIndex=0}return G}async function QB(X,$,Z,Y,J){if(!X)return X;let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,q=y1(G);return G=q.output,G=await z(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await z(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await z(G,/[a-z][a-z0-9]*/,!1,a_),G=y7(G,q.scripts),G;async function z(B,_,j,H){if(!B)return B;let O=B,L=cY(O,_,H);for(let F=L.length-1;F>=0;F--){let V=L[F],A=j?Z8(V.tagName):V.tagName,R=e_(V.attributes),T=t_(R,$,Y),M=x0.getBuiltin(V.tagName),k=M?await Y8(A,Q,$,Z,Y):!1;if(M&&!k){let C={context:$,filePath:Z,options:Y,dependencies:J},S=M.render(T,V.content,C);if(Object.keys(T.clientReactive).length>0)S=aY(S,T.clientReactive);if(Object.keys(T.events).length>0){let b=sY(T.events);S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,V.startIndex)+S+O.substring(V.endIndex);continue}if(!j&&V.tagName.includes("-")&&!await Y8(A,Q,$,Z,Y))continue;let N={};for(let[C,S]of Object.entries(T.static))N[C]=S;for(let[C,S]of Object.entries(T.serverDynamic))N[C]=S;let I=await U5(A,N,V.content,Q,$,Z,Y,w,J);if(Object.keys(T.clientReactive).length>0)I=aY(I,T.clientReactive);if(Object.keys(T.events).length>0){let C=eY(I);if(C){let S=sY(T.events),b=Object.keys(T.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,C.insertPos)+` data-stx-parent-events="${b}" ${S}`+I.substring(C.insertPos)}}O=O.substring(0,V.startIndex)+I+O.substring(V.endIndex)}return O}}function aY(X,$){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries($).filter(([U])=>!Z.has(U)),G=J.filter(([U])=>!Y.has(U)).map(([U])=>Z8(U)).join(" "),Q=X,w=J.length>0?eY(Q):null;if(w){let U=J.map(([z,B])=>`:${Z8(z)}="${B.replace(/"/g,"&quot;")}"`).join(" "),K=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,w.insertPos)+`${K} ${U}`+Q.substring(w.insertPos)}let q=$.if;if(q)Q=`<template :if="${q.replace(/"/g,"&quot;")}">${Q}</template>`;let W=$.for;if(W)Q=`<template :for="${W.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function eY(X){let $=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(X);if($)return{insertPos:$.index+1+$[1].length};let Z=0;while(Z<X.length){let Y=X.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let w=X.indexOf("-->",Z+4);if(w===-1)return null;Z=w+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let w=`</${G[1].toLowerCase()}>`,q=X.toLowerCase().indexOf(w,Z+G[0].length);if(q===-1)return null;Z=q+w.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function G8(X,$,Z,Y,J){if(!rY)mY(),rY=!0;let G=await tY(X,$,Z,Y,J);G=await JB(G,$,Z,Y,J),G=await GB(G,$,Z,Y,J);let Q=[];for(let w=0;w<3;w++){let q=Q1(G,D7,(U,K)=>`\x00STX_COMPONENT_COMMENT_${Q.length+K}\x00`);Q.push(...q.tokens);let W=G;if(G=await QB(q.output,$,Z,Y,J),G===W)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,q)=>Q[Number(q)]??"");if(Y.debug){let w=$B(G);if(w.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${w.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var rY=!1,a_,oY;var U3=D(()=>{h9();lY();nY();$5();T0();F0();J1();a_=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"]);oY=new Map});var Q8={};t(Q8,{stripTypeScript:()=>wJ,splitDeclaration:()=>_J,isModuleResolutionFailure:()=>qJ,isMissingBindingFailure:()=>WJ,isCompleteImport:()=>UJ,hasVariables:()=>LJ,extractVariables:()=>V1,extractScriptFromTemplate:()=>HJ,convertToCommonJS:()=>_3,STX_ENGINE_BINDING_NAMES:()=>z3});import f1 from"path";import p5 from"process";function qB(X){let $=[],Z=0,Y=X.split(`
3591
+ `||M==="\t")O++;L=R+j.length}else{if(O--,O===0){F=T;break}L=T+H.length}}if(F===-1){J=z;continue}let V=X.slice(z,F),A=F+H.length;Y.push({fullMatch:X.slice(G,A),tagName:q,attributes:_,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function pY(X){return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function iY(X,$){try{let Z=Buffer.from(X,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=X.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if($?.debug)console.error("Error decoding __stx_ prop:",Z);return X}}var nY=D(()=>{F0();T0();$5()});var XJ={};t(XJ,{processESImports:()=>tY,processComponents:()=>G8});import J8 from"fs";import d0 from"path";function t_(X,$,Z){let Y={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(Array.isArray($.__stx_client_signal_names)?$.__stx_client_signal_names:[]),G=(W)=>{if(J.size===0)return!1;let U=p0(W),K=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(K&&J.has(K))return!0;for(let z of J){let B=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(U))return!0}return!1},Q=new Set(U6),w=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(U,K)=>K.toUpperCase())},q=(W,U)=>{let K=w(W);if(Y.static[K]=U,K!==W)Y.staticNames[K]=W};for(let[W,U]of Object.entries(X)){let K=W.startsWith("x-")&&!Q.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(K.startsWith("@")){Y.events[K]=U;continue}if(K.startsWith("__stx_")){let z=w(K.slice(6));Y.serverDynamic[z]=iY(U,Z);continue}if(K.startsWith(":")){let z=w(K.slice(1)),B=U===W5?z:U;if(z==="if"||z==="for"||z==="show"){Y.clientReactive[z]=B;continue}if(G(B)){Y.clientReactive[z]=B;continue}try{if(!q0(B)){if(Z.debug)console.error(`Unsafe expression in :${z} binding: ${B}`);Y.clientReactive[z]=B;continue}let _=Object.keys($),H=W0(B,_)(...Object.values($));if(H===void 0){let O=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(O.some((V)=>!L.has(V)&&!_.includes(V))){Y.clientReactive[z]=B;continue}}Y.serverDynamic[z]=H}catch{Y.clientReactive[z]=B}continue}if(typeof U==="string"&&U.includes("{{")&&U.includes("}}")){let z=U.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let B=z[1];if(q0(B)){let j=W0(B,Object.keys($))(...Object.values($));q(K,j!=null?String(j):"")}else{if(Z.debug)console.error(`Unsafe expression in ${K}: ${B}`);q(K,U)}}catch(B){if(Z.debug)console.error(`Error evaluating expression for ${K}:`,B);q(K,U)}else{let B=U,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,j;while((j=_.exec(U))!==null)try{let H=j[1];if(!q0(H)){if(Z.debug)console.error(`Unsafe expression in ${K}: ${H}`);continue}let L=W0(H,Object.keys($))(...Object.values($));B=B.replace(j[0],String(L??""))}catch(H){if(Z.debug)console.error(`Error evaluating expression in ${K}:`,H)}q(K,B)}continue}q(K,U===W5?"true":pY(U))}return Y}function e_(X){let $={},Z=0,Y=X.length;while(Z<Y){while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test(X[Z]))J+=X[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z<Y&&X[Z]==="="){Z++;while(Z<Y&&/\s/.test(X[Z]))Z++;let G="";if(Z<Y&&(X[Z]==='"'||X[Z]==="'")){let Q=X[Z];Z++;while(Z<Y){let w=X[Z];if(w==="\\"&&Z+1<Y){Z++,G+=X[Z],Z++;continue}if(w===Q){Z++;break}G+=w,Z++}}else while(Z<Y&&!/\s/.test(X[Z]))G+=X[Z],Z++;$[J]=G}else $[J]=W5}return $}function sY(X){return Object.entries(X).map(([$,Z])=>Z===W5?$:`${$}="${XB(Z)}"`).join(" ")}function XB(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $B(X){let $=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1];if(x0.isBuiltin(J))$.add(J)}return[...$].sort()}function ZB(X){let $=oY.get(X);if($)return $;let Z=new Map,Y=[d0.join(X,"src"),d0.join(X,"dist"),X];function J(G,Q){if(Q>6)return;let w;try{w=J8.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of w){let W=d0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(W,Q+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Z.has(U))Z.set(U,W);let K=U.toLowerCase();if(!Z.has(K))Z.set(K,W);let z=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(z))Z.set(z,W)}}}for(let G of Y)if(J(G,0),Z.size>0)break;return oY.set(X,Z),Z}function YB(X,$){if(X.startsWith(".")||X.startsWith("/"))return null;let Z=$;while(!0){let Y=d0.join(Z,"node_modules",X);try{if(J8.statSync(Y).isDirectory())return Y}catch{}let J=d0.dirname(Z);if(J===Z)return null;Z=J}}async function tY(X,$,Z,Y,J){if(!X.includes("import"))return X;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,Q=d0.dirname(Z),w=X,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return w=w.replace(q,(W,U,K)=>{let z=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=K,_,j=[];while((_=z.exec(K))!==null){let[H,O,L,F]=_,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let M=d0.resolve(Q,F);if(M.endsWith(".stx"))A=M;else{let k=`${M}.stx`;try{if(J8.statSync(k).isFile())A=k}catch{try{if(J8.statSync(M).isDirectory())V=M}catch{}}}}else V=YB(F,Q);if(!V&&!A)continue;let R=!1,T=(M,k)=>{G.set(M,k),G.set(M.toLowerCase(),k);let N=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(N,k),J.add(k)};if(L&&A)T(L,A),R=!0;else if(O){let M=O.slice(1,-1).split(",").map((N)=>N.trim()).filter(Boolean).map((N)=>{let y=N.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y)return{source:y[1],local:y[2]};return{source:N,local:N}}),k=V?ZB(V):null;for(let{source:N,local:y}of M){let I=null;if(A)I=A;else if(k)I=k.get(N)??k.get(N.toLowerCase())??k.get(N.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)T(y,I),R=!0}}if(R)j.push({start:_.index,end:_.index+H.length})}if(j.length===0)return W;for(let H=j.length-1;H>=0;H--)B=B.slice(0,j[H].start)+B.slice(j[H].end);return`<script${U}>${B}</script>`}),w}async function JB(X,$,Z,Y,J){let G=X;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,w=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=w.exec(G))!==null){let[W,U]=q,K=U.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of K){let B=z.split("/"),j=B[B.length-1].replace(/\.stx$/,""),H=j.includes("-")?j.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):j.charAt(0).toUpperCase()+j.slice(1),O=null,L=[d0.resolve(d0.dirname(Z),`${z}.stx`),d0.resolve(d0.dirname(Z),z),d0.resolve(Y.componentsDir||"components",`${z}.stx`),d0.resolve(Y.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){O=F;break}}catch{}if(O){Q.set(H,O),Q.set(j,O),Q.set(j.toLowerCase(),O);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,O),J.add(O),Y.debug)console.log(`Imported component: ${H} -> ${O}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${z}`)}G=G.replace(W,""),w.lastIndex=0}return G}async function GB(X,$,Z,Y,J){let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(G))!==null){let U=W.index,K=U+W[0].length-1,z=1,B=K+1;while(B<G.length&&z>0){if(G[B]==="(")z++;else if(G[B]===")"){if(z--,z===0)break}B++}if(z!==0)break;let _=G.substring(K+1,B),j=B+1,H=_.match(/^\s*['"]([^'"]+)['"]/);if(!H){q.lastIndex=0;continue}let O=H[1],L,F=_.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)L=F.slice(V[0].length).trim();let A={};if(L)try{A=O0(L,$)}catch(y){let I=y instanceof Error?y.message:String(y);G=G.replace(G.substring(U,j),`[Error parsing component props: ${I}]`);continue}let R="",T=j,k=G.substring(j).match(/^([\s\S]*?)@endcomponent/);if(k)R=k[1].trim(),T=j+k[0].length;let N=await U5(O,A,R,Q,$,Z,Y,w,J);G=G.substring(0,U)+N+G.substring(T),q.lastIndex=0}return G}async function QB(X,$,Z,Y,J){if(!X)return X;let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,q=y1(G);return G=q.output,G=await z(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await z(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await z(G,/[a-z][a-z0-9]*/,!1,a_),G=y7(G,q.scripts),G;async function z(B,_,j,H){if(!B)return B;let O=B,L=cY(O,_,H);for(let F=L.length-1;F>=0;F--){let V=L[F],A=j?Z8(V.tagName):V.tagName,R=e_(V.attributes),T=t_(R,$,Y),M=x0.getBuiltin(V.tagName),k=M?await Y8(A,Q,$,Z,Y):!1;if(M&&!k){let C={context:$,filePath:Z,options:Y,dependencies:J},S=M.render(T,V.content,C);if(Object.keys(T.clientReactive).length>0)S=aY(S,T.clientReactive);if(Object.keys(T.events).length>0){let b=sY(T.events);S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,V.startIndex)+S+O.substring(V.endIndex);continue}if(!j&&V.tagName.includes("-")&&!await Y8(A,Q,$,Z,Y))continue;let N={};for(let[C,S]of Object.entries(T.static))N[C]=S;for(let[C,S]of Object.entries(T.serverDynamic))N[C]=S;let I=await U5(A,N,V.content,Q,$,Z,Y,w,J);if(Object.keys(T.clientReactive).length>0)I=aY(I,T.clientReactive);if(Object.keys(T.events).length>0){let C=eY(I);if(C){let S=sY(T.events),b=Object.keys(T.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,C.insertPos)+` data-stx-parent-events="${b}" ${S}`+I.substring(C.insertPos)}}O=O.substring(0,V.startIndex)+I+O.substring(V.endIndex)}return O}}function aY(X,$){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries($).filter(([U])=>!Z.has(U)),G=J.filter(([U])=>!Y.has(U)).map(([U])=>Z8(U)).join(" "),Q=X,w=J.length>0?eY(Q):null;if(w){let U=J.map(([z,B])=>`:${Z8(z)}="${B.replace(/"/g,"&quot;")}"`).join(" "),K=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,w.insertPos)+`${K} ${U}`+Q.substring(w.insertPos)}let q=$.if;if(q)Q=`<template :if="${q.replace(/"/g,"&quot;")}">${Q}</template>`;let W=$.for;if(W)Q=`<template :for="${W.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function eY(X){let $=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(X);if($)return{insertPos:$.index+1+$[1].length};let Z=0;while(Z<X.length){let Y=X.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let w=X.indexOf("-->",Z+4);if(w===-1)return null;Z=w+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let w=`</${G[1].toLowerCase()}>`,q=X.toLowerCase().indexOf(w,Z+G[0].length);if(q===-1)return null;Z=q+w.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function G8(X,$,Z,Y,J){if(!rY)mY(),rY=!0;let G=await tY(X,$,Z,Y,J);G=await JB(G,$,Z,Y,J),G=await GB(G,$,Z,Y,J);let Q=[];for(let w=0;w<3;w++){let q=Q1(G,D7,(U,K)=>`\x00STX_COMPONENT_COMMENT_${Q.length+K}\x00`);Q.push(...q.tokens);let W=G;if(G=await QB(q.output,$,Z,Y,J),G===W)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,q)=>Q[Number(q)]??"");if(Y.debug){let w=$B(G);if(w.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${w.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var rY=!1,a_,oY;var U3=D(()=>{h9();lY();nY();$5();T0();F0();G1();a_=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"]);oY=new Map});var Q8={};t(Q8,{stripTypeScript:()=>wJ,splitDeclaration:()=>_J,isModuleResolutionFailure:()=>qJ,isMissingBindingFailure:()=>WJ,isCompleteImport:()=>UJ,hasVariables:()=>LJ,extractVariables:()=>V1,extractScriptFromTemplate:()=>HJ,convertToCommonJS:()=>_3,STX_ENGINE_BINDING_NAMES:()=>z3});import f1 from"path";import p5 from"process";function qB(X){let $=[],Z=0,Y=X.split(`
3592
3592
  `);for(let J of Y){let G=Z,Q=null,w=!1;for(let q=0;q<J.length;q++){let W=J[q];if(w){w=!1;continue}if(W==="\\"){w=!0;continue}if(Q){if(W===Q)Q=null;continue}if(W==="'"||W==='"'||W==="`"){Q=W;continue}if(W==="/"&&q+1<J.length&&J[q+1]==="/")break;if(W==="{")Z++;else if(W==="}")Z--}if(G===0){let q=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)$.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let W=J.match(/(?:const|let|var)\s+(\w+)/);if(W)$.push(W[1])}else{let W=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let K=W[1].slice(1,-1).split(",").map((z)=>{let B=z.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((z)=>/^\w+$/.test(z));$.push(...K)}}}}return[...new Set($)]}function wJ(X){let $=X;$=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(Y){if(!Y.includes(":"))return Y;let J=[],G="",Q=0,w=0,q=null;for(let W=0;W<Y.length;W++){let U=Y[W];if(q){if(G+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,G+=U;continue}if(U==="<")Q++;else if(U===">"&&Q>0)Q--;else if(U==="(")w++;else if(U===")")w--;if(U===","&&Q===0&&w===0){J.push(G),G="";continue}G+=U}if(G)J.push(G);return J.map((W)=>{let U=W.trim(),K=U.startsWith("..."),z=K?U.slice(3):U,B=-1,_=0;for(let A=0;A<z.length;A++)if(z[A]==="<")_++;else if(z[A]===">")_--;else if(z[A]===":"&&_===0){B=A;break}if(B===-1)return W;let H=z.substring(0,B).trim().replace(/\?$/,""),O=z.substring(B+1),L=-1,F=0;for(let A=0;A<O.length;A++)if(O[A]==="<")F++;else if(O[A]===">")F--;else if(O[A]==="="&&F===0){L=A;break}let V=K?"...":"";if(L!==-1)return`${V}${H} = ${O.substring(L+1).trim()}`;return`${V}${H}`}).join(", ")}$=$.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;return`${J}(${Z(G)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,G=[];while((J=Y.exec($))!==null){let Q=J.index+J[0].length-1,w=1,q=Q+1,W=0,U=null;while(q<$.length&&w>0){let B=$[q];if(U){if(B===U)U=null;q++;continue}if(B==='"'||B==="'"||B==="`"){U=B,q++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")w++;else if(B===")")w--}if(w>0)q++}if(w!==0)continue;let K=$.substring(Q+1,q);if(!K.includes(":"))continue;let z=Z(K);G.push({start:Q+1,end:q,replacement:z})}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];$=$.substring(0,w)+W+$.substring(q)}}return $=$.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((Q)=>{let[w,...q]=Q.split("="),W=w.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),$=$.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),$=$.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),$=$.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),$=$.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),$=$.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
3593
3593
 
3594
- `),$}function qJ(X){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(X)}function WJ(X){if(!/is not defined|can't find variable/i.test(X))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(X)}async function V1(X,$,Z,Y={}){if(!X.trim())return;let J;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}),v=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=E.transformSync(v)}catch{J=wJ(X)}let G={exports:{}},Q=G.exports,w=p5.cwd(),q={},W=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of W)try{let v=f1.resolve(w,"node_modules",E),d=f1.join(v,"package.json"),f=JSON.parse(X0("fs").readFileSync(d,"utf8")),s=f.main||"index.js";if(f.exports){let G0=typeof f.exports==="string"?f.exports:f.exports["."];if(typeof G0==="string")s=G0;else if(G0?.bun)s=G0.bun;else if(G0?.import)s=G0.import;else if(G0?.default)s=G0.default}q[E]=await import(f1.resolve(v,s))}catch{}let U=(E)=>{if(q[E])return q[E];return X0(E)},K=$.props||{},z=(E)=>{if(!E)return K;let v={};for(let[d,f]of Object.entries(E)){let s=K[d];if(s!==void 0)v[d]=s;else if(typeof f==="function")v[d]=f();else v[d]=f}return v};for(let[E,v]of Object.entries(K))Object.defineProperty(z,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(K,E))continue;try{Object.defineProperty(z,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(E)=>{if(!E)return K;let v={...K};for(let[d,f]of Object.entries(E)){let s=f&&typeof f==="object"&&!Array.isArray(f)?f:{type:f};if(v[d]===void 0&&s.default!==void 0)v[d]=typeof s.default==="function"?s.default():s.default}return v},_=()=>$.slots||{},j=(E,v)=>{let d={...E};for(let[f,s]of Object.entries(v))if(d[f]===void 0)if(typeof s==="function")d[f]=s();else d[f]=s;return d},H=(E)=>{let v=()=>E;return v.set=(d)=>{},v.update=(d)=>{},v},O=(E)=>{let v,d=!1;return()=>{if(!d)try{v=E(),d=!0}catch{v=void 0}return v}},L=(E)=>{},F=(E)=>E(),V=(E)=>{},A=(E)=>{};function R(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)y({title:v.title,description:v.description})}function T(E){if(!E||typeof E!=="object")return;let v=$.__stxClientPayload??{};Object.assign(v,E),$.__stxClientPayload=v}let M=()=>{let E=$.__stxServeContext,v=$.__stxServeSearch??E?.search??"",d=E?.path??"",f=Object.fromEntries(new URLSearchParams(v)),s=$.query,G0=Object.keys(f).length>0?f:s??{},s0=v||(Object.keys(G0).length>0?`?${new URLSearchParams(G0).toString()}`:"");return{params:$.params??{},query:G0,path:d,name:"",fullPath:d+s0,hash:"",matched:[]}},k=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),N=(E)=>{let v=$.__stx_runtime_head||{};$.__stx_runtime_head=f5(v,E||{})},y=(E)=>{N(pX(E||{}))},I=(E)=>({value:E}),C=(E)=>E,S=(E)=>({value:typeof E==="function"?E():E}),b=(E,v)=>{},P=(E)=>{},x=(E)=>{},m=(E)=>E?E():Promise.resolve(),l=(E)=>(v,...d)=>{},Q0=(E)=>{},l0=(E,v)=>{},R0=(E,v)=>v,r0=()=>({value:"light"}),c=()=>H(!1),j0=(E)=>H(!1),c0=()=>H(!1),M1=()=>j0("(prefers-color-scheme: dark)"),O5=()=>j0("(prefers-color-scheme: light)"),F5=()=>j0("(prefers-reduced-motion: reduce)"),r=()=>j0("(prefers-contrast: more)"),a={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:{}},U0=new Proxy(a,{get(E,v){if(v in E)return E[v];return},set(E,v,d){return E[v]=d,!0}}),M0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},w0=console;try{let E=_3(J,Z),v=new Set(Object.keys(K)),d=(n)=>/^[a-z_$][\w$]*$/i.test(n),f=Object.keys($).filter((n)=>!v.has(n)&&n!=="props"&&d(n)),s=f.map((n)=>$[n]);if(!f.includes("__stxServeContext"))f.push("__stxServeContext"),s.push(void 0);let G0=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"]),s0=[],S0=[];for(let[n,Y1]of Object.entries(K)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n))continue;if(G0.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(E))continue;s0.push(n),S0.push(Y1)}let o0=qB(E).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
3595
- `),V5=$.params??{},N1=[],k1=[];for(let n=0;n<f.length;n++){if(f[n]==="params")continue;N1.push(f[n]),k1.push(s[n])}let Z1=await Function(...z3,...s0,...N1,`return (async () => {
3594
+ `),$}function qJ(X){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(X)}function WJ(X){if(!/is not defined|can't find variable/i.test(X))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(X)}async function V1(X,$,Z,Y={}){if(!X.trim())return;let J;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}),v=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=E.transformSync(v)}catch{J=wJ(X)}let G={exports:{}},Q=G.exports,w=p5.cwd(),q={},W=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of W)try{let v=f1.resolve(w,"node_modules",E),d=f1.join(v,"package.json"),f=JSON.parse(X0("fs").readFileSync(d,"utf8")),s=f.main||"index.js";if(f.exports){let G0=typeof f.exports==="string"?f.exports:f.exports["."];if(typeof G0==="string")s=G0;else if(G0?.bun)s=G0.bun;else if(G0?.import)s=G0.import;else if(G0?.default)s=G0.default}q[E]=await import(f1.resolve(v,s))}catch{}let U=(E)=>{if(q[E])return q[E];return X0(E)},K=$.props||{},z=(E)=>{if(!E)return K;let v={};for(let[d,f]of Object.entries(E)){let s=K[d];if(s!==void 0)v[d]=s;else if(typeof f==="function")v[d]=f();else v[d]=f}return v};for(let[E,v]of Object.entries(K))Object.defineProperty(z,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(K,E))continue;try{Object.defineProperty(z,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(E)=>{if(!E)return K;let v={...K};for(let[d,f]of Object.entries(E)){let s=f&&typeof f==="object"&&!Array.isArray(f)?f:{type:f};if(v[d]===void 0&&s.default!==void 0)v[d]=typeof s.default==="function"?s.default():s.default}return v},_=()=>$.slots||{},j=(E,v)=>{let d={...E};for(let[f,s]of Object.entries(v))if(d[f]===void 0)if(typeof s==="function")d[f]=s();else d[f]=s;return d},H=(E)=>{let v=()=>E;return v.set=(d)=>{},v.update=(d)=>{},v},O=(E)=>{let v,d=!1;return()=>{if(!d)try{v=E(),d=!0}catch{v=void 0}return v}},L=(E)=>{},F=(E)=>E(),V=(E)=>{},A=(E)=>{};function R(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)y({title:v.title,description:v.description})}function T(E){if(!E||typeof E!=="object")return;let v=$.__stxClientPayload??{};Object.assign(v,E),$.__stxClientPayload=v}let M=()=>{let E=$.__stxServeContext,v=$.__stxServeSearch??E?.search??"",d=E?.path??"",f=Object.fromEntries(new URLSearchParams(v)),s=$.query,G0=Object.keys(f).length>0?f:s??{},o0=v||(Object.keys(G0).length>0?`?${new URLSearchParams(G0).toString()}`:"");return{params:$.params??{},query:G0,path:d,name:"",fullPath:d+o0,hash:"",matched:[]}},k=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),N=(E)=>{let v=$.__stx_runtime_head||{};$.__stx_runtime_head=f5(v,E||{})},y=(E)=>{N(pX(E||{}))},I=(E)=>({value:E}),C=(E)=>E,S=(E)=>({value:typeof E==="function"?E():E}),b=(E,v)=>{},P=(E)=>{},x=(E)=>{},m=(E)=>E?E():Promise.resolve(),l=(E)=>(v,...d)=>{},Q0=(E)=>{},l0=(E,v)=>{},R0=(E,v)=>v,s0=()=>({value:"light"}),c=()=>H(!1),j0=(E)=>H(!1),c0=()=>H(!1),M1=()=>j0("(prefers-color-scheme: dark)"),O5=()=>j0("(prefers-color-scheme: light)"),F5=()=>j0("(prefers-reduced-motion: reduce)"),r=()=>j0("(prefers-contrast: more)"),a={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:{}},U0=new Proxy(a,{get(E,v){if(v in E)return E[v];return},set(E,v,d){return E[v]=d,!0}}),M0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},w0=console;try{let E=_3(J,Z),v=new Set(Object.keys(K)),d=(n)=>/^[a-z_$][\w$]*$/i.test(n),f=Object.keys($).filter((n)=>!v.has(n)&&n!=="props"&&d(n)),s=f.map((n)=>$[n]);if(!f.includes("__stxServeContext"))f.push("__stxServeContext"),s.push(void 0);let G0=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"]),o0=[],S0=[];for(let[n,J1]of Object.entries(K)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n))continue;if(G0.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(E))continue;o0.push(n),S0.push(J1)}let a0=qB(E).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
3595
+ `),V5=$.params??{},N1=[],k1=[];for(let n=0;n<f.length;n++){if(f[n]==="params")continue;N1.push(f[n]),k1.push(s[n])}let Y1=await Function(...z3,...o0,...N1,`return (async () => {
3596
3596
  ${E}
3597
- ${o0}
3597
+ ${a0}
3598
3598
  return module.exports
3599
- })()`)(G,Q,U,K,z,B,j,T,H,O,L,F,V,A,R,M,k,N,y,I,C,S,b,P,x,m,l,Q0,_,l0,R0,r0,c,j0,c0,M1,O5,F5,r,U0,M0,w0,a.confirm,a.alert,a.fetch,V5,...S0,...k1);if(Y.preserveExisting){for(let[n,Y1]of Object.entries(Z1))if(!(n in $)||$[n]===void 0)$[n]=Y1}else Object.assign($,Z1);for(let[n,Y1]of Object.entries(K))if(!(n in $))$[n]=Y1}catch(E){let v=E instanceof Error?E.message:String(E);if(qJ(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(WJ(v))console.warn(`[stx] server <script> in ${Z??"<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(p5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await BB(J,$,Z)}catch(d){if(p5.env.STX_DEBUG){let f=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${f}`)}}}}function UJ(X){let $=0,Z=null,Y=!1,J=!1;for(let G=0;G<X.length;G++){let Q=X[G];if(Z){if(Q===Z){if(Z=null,Y||$===0)J=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")$++;else if(Q==="}")$--;else if(X.startsWith("from",G)&&$===0)Y=!0}return Z===null&&$===0&&J}function _3(X,$){let Z=$?f1.dirname($):p5.cwd(),Y=p5.cwd(),J=X.split(`
3599
+ })()`)(G,Q,U,K,z,B,j,T,H,O,L,F,V,A,R,M,k,N,y,I,C,S,b,P,x,m,l,Q0,_,l0,R0,s0,c,j0,c0,M1,O5,F5,r,U0,M0,w0,a.confirm,a.alert,a.fetch,V5,...S0,...k1);if(Y.preserveExisting){for(let[n,J1]of Object.entries(Y1))if(!(n in $)||$[n]===void 0)$[n]=J1}else Object.assign($,Y1);for(let[n,J1]of Object.entries(K))if(!(n in $))$[n]=J1}catch(E){let v=E instanceof Error?E.message:String(E);if(qJ(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(WJ(v))console.warn(`[stx] server <script> in ${Z??"<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(p5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await BB(J,$,Z)}catch(d){if(p5.env.STX_DEBUG){let f=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${f}`)}}}}function UJ(X){let $=0,Z=null,Y=!1,J=!1;for(let G=0;G<X.length;G++){let Q=X[G];if(Z){if(Q===Z){if(Z=null,Y||$===0)J=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")$++;else if(Q==="}")$--;else if(X.startsWith("from",G)&&$===0)Y=!0}return Z===null&&$===0&&J}function _3(X,$){let Z=$?f1.dirname($):p5.cwd(),Y=p5.cwd(),J=X.split(`
3600
3600
  `),G=[],Q=0;while(Q<J.length){let w=J[Q].trim();if(w.startsWith("interface ")||w.startsWith("export interface ")||w.startsWith("type ")||w.startsWith("export type ")){if(w.includes("{")&&!w.includes("}")){let q=0;for(;Q<J.length;Q++){for(let W of J[Q])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}Q++;continue}if(w.startsWith("definePageMeta(")){let q=0,W=!1,U=Q;for(let B=Q;B<J.length&&!W;B++){let _=null,j=!1,H=J[B];for(let O=0;O<H.length;O++){let L=H[O];if(j){j=!1;continue}if(L==="\\"){j=!0;continue}if(_){if(L===_)_=null;continue}if(L==='"'||L==="'"||L==="`"){_=L;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0){Q=B+1,W=!0;break}}}}if(!W)Q=J.length;let K=J.slice(U,Q).join(`
3601
3601
  `),z=[];for(let B of["title","description"]){let _=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(K);if(_)z.push(`${B}: ${JSON.stringify(_[2])}`)}if(z.length>0)G.push(`useSeoMeta({ ${z.join(", ")} });`);continue}if(w.startsWith("import ")||w==="import"||w.startsWith("import{")){let q=w,W=0;while(!UJ(q)&&Q+W+1<J.length)W++,q=`${q} ${J[Q+W].trim()}`;Q+=W;let U=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),K=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+['"](.+?)['"]/),B=q,_=(j)=>{if(j.startsWith("."))return f1.resolve(Z,j);if(j.startsWith("~/")||j.startsWith("@/"))return f1.resolve(Y,j.slice(2));return j};if(U){let[,j,H]=U,O=_(H);G.push(`const ${j} = (await import('${O}')).default`),G.push(`module.exports.${j} = ${j};`)}else if(K){let[,j,H]=K,O=_(H),L=[],F=[],V=wB.has(H);for(let A of j.split(",")){let R=A.trim();if(!R)continue;let T=R.split(/\s+as\s+/);if(T.length===2){let[M,k]=[T[0].trim(),T[1].trim()];if(V&&$J.has(M)){G.push(`const ${k} = ${M};`),F.push(k);continue}L.push(`${M}: ${k}`),F.push(k)}else{if(V&&$J.has(R)){F.push(R);continue}L.push(R),F.push(R)}}if(L.length>0)G.push(`const { ${L.join(", ")} } = await import('${O}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(z){let j=_(z[1]);G.push(`await import('${j}')`)}else G.push(B);Q++;continue}if(WB.test(w))G.push(J[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let q=YJ(J,Q),{type:W,name:U,value:K}=q;G.push(`${W} ${U} = ${K};`),G.push(`module.exports.${U} = ${U};`),Q=q.nextIndex}else if(w.startsWith("export function ")||w.startsWith("export async function ")){let q=K3(J,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("const ")||w.startsWith("let ")||w.startsWith("var ")){let q=YJ(J,Q),{type:W,name:U,value:K}=q;G.push(`${W} ${U} = ${K};`),G.push(`module.exports.${U} = ${U};`),Q=q.nextIndex}else if(w.startsWith("function ")||w.startsWith("async function ")){let q=K3(J,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("export default function ")||w.startsWith("export default async function ")){let q=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...J];W[Q]=q;let U=K3(W,Q);if(G.push(U.functionCode),U.name)G.push(`module.exports.default = ${U.name};`);Q=U.nextIndex}else if(w.startsWith("export default ")){let q=w.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${q};`),Q++}else if(w.startsWith("class ")||w.startsWith("export class ")){let q=w.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],U=J[Q].replace(/^export\s+/,""),K=0,z=Q;for(;z<J.length;z++){let B=J[z];for(let _ of B)if(_==="{")K++;else if(_==="}")K--;if(z>Q)U+=`
3602
3602
  `+B;if(K<=0&&z>=Q)break}G.push(U),G.push(`module.exports.${W} = ${W};`),Q=z+1}else G.push(w),Q++}else if(w.includes("module.exports"))G.push(w),Q++;else if(w.trim()&&!w.startsWith("//"))G.push(w),Q++;else Q++}return UB(G.join(`
@@ -3664,16 +3664,16 @@ ${kJ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
3664
3664
  } finally {
3665
3665
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3666
3666
  }
3667
- })();`}function DB(X,$){let Z=X.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:X,mergedIntoExisting:J[1]};let G=Z[1],Q=Z[2],w=Z[3];return{html:`${G}${Q} data-stx-scope="${$}"${w}${X.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:X,mergedIntoExisting:null}}function bB(X){if(X.__onceStore instanceof Set)return X.__onceStore;return yB}async function O3(X,$,Z,Y,J,G=new Set){let Q=Y.partialsDir||_0.join(_0.dirname(Z),"partials");if(Q&&!_0.isAbsolute(Q))Q=_0.resolve(process.cwd(),Q);let w=kB(X,"@partial","@include"),q=bB($);w=w.replace(/@once([\s\S]*?)@endonce/g,(_,j,H)=>{let O=j.trim(),L=`${Z}:${O}`;if(q.has(L))return"";return q.add(L),j});{let _=/@includeIf\s*\(/g,j;while((j=_.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,F=O+1;while(F<w.length&&L>0){if(w[F]==="(")L++;else if(w[F]===")")L--;F++}if(L!==0)break;let V=w.substring(O+1,F-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){_.lastIndex=F;continue}let R=A[1],T=W(R,Q,Z),M="";if(T&&await Bun.file(T).exists())J.add(T),M=`@include(${V})`;w=w.substring(0,H)+M+w.substring(F),_.lastIndex=0}}for(let[_,j]of[["@includeWhen",!1],["@includeUnless",!0]]){let H=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=H.exec(w))!==null){let L=O.index,F=L+O[0].length-1,V=1,A=F+1;while(A<w.length&&V>0){if(w[A]==="(")V++;else if(w[A]===")")V--;A++}if(V!==0)break;let R=w.substring(F+1,A-1),T=L3(R,0);if(T===-1){H.lastIndex=A;continue}let M=R.substring(0,T).trim(),k=R.substring(T+1).trim(),N=k.match(/^\s*['"]([^'"]+)['"]/);if(!N){H.lastIndex=A;continue}let y=N[1],I=k.substring(N[0].length),C,S=L3(I,0);if(S!==-1)C=I.substring(S+1).trim();try{let b=`Boolean(${M})`,P;if(q0(b)){let l=W0(b,Object.keys($));P=Boolean(l(...Object.values($)))}else P=Boolean(Y0(b,$));let x=j?!P:P,m="";if(x){let l=W(y,Q,Z);if(l&&await Bun.file(l).exists())J.add(l);m=`@include('${y}'${C?`, ${C}`:""})`}w=w.substring(0,L)+m+w.substring(A),H.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),x=K0("Include",`Error evaluating ${_} condition: ${P}`,Z,X,L);w=w.substring(0,L)+x+w.substring(A),H.lastIndex=0}}}{let _=/@each\s*\(/g,j;while((j=_.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,F=O+1;while(F<w.length&&L>0){if(w[F]==="(")L++;else if(w[F]===")"){if(L--,L===0)break}F++}if(L!==0)break;let V=w.substring(O+1,F),A=w.substring(H,F+1),R=V.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){_.lastIndex=0,w=w.replace(A,"");continue}let[,T,M,k,N]=R;try{let y,I=M.trim();if(q0(I))y=W0(I,Object.keys($))(...Object.values($));else y=Y0(I,$);let C="";if(Array.isArray(y)&&y.length>0)for(let S of y){let b={...$,[k]:S},P=await K(T,b,X,H);C+=P}else if(N)C=await K(N,{},X,H);w=w.substring(0,H)+C+w.substring(F+1),_.lastIndex=0}catch(y){let I=y instanceof Error?y.message:String(y);w=w.substring(0,H)+K0("Each",`Error in @each: ${I}`,Z,X,H)+w.substring(F+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,j;while((j=_.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,F=O+1;while(F<w.length&&L>0){if(w[F]==="(")L++;else if(w[F]===")"){if(L--,L===0)break}F++}if(L!==0)break;let V=w.substring(O+1,F),A=w.substring(H,F+1),R=V.match(/^\s*(\[[^\]]+\])/);if(!R){_.lastIndex=0,w=w.replace(A,"");continue}let T=R[1],M=V.slice(R[0].length),k,N=M.match(/^\s*,\s*\{/);if(N){M=M.slice(N[0].length-1);let C=1,S=1;while(S<M.length&&C>0){if(M[S]==="{")C++;else if(M[S]==="}"){if(C--,C===0)break}S++}k=M.substring(0,S+1),M=M.slice(S+1)}let y,I=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(I)y=I[1];try{let C=JSON.parse(T.replace(/'/g,'"')),S={};if(k)try{S=O0(k,$)}catch(P){let x=P instanceof Error?P.message:String(P);if(Y.debug){let m=K0("Include",`Error parsing includeFirst variables: ${x}`,Z,X,H,A);w=w.replace(A,()=>m)}else w=w.replace(A,()=>y||"");continue}let b=!1;for(let P of C){let x=W(P,Q,Z);if(!x)continue;if(await i(x)){let m=await K(P,S,X,H);w=w.replace(A,()=>m),b=!0;break}}if(!b)if(y!==void 0)w=w.replace(A,()=>y);else if(Y.debug){let P=K0("Include",`None of the includeFirst paths exist: ${T}`,Z,X,H,A);w=w.replace(A,()=>P)}else w=w.replace(A,"")}catch(C){let S=C instanceof Error?C.message:String(C),b=K0("Include",`Error processing @includeFirst: ${S}`,Z,X,H,A);w=w.replace(A,()=>b)}_.lastIndex=0}}function W(_,j,H){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let L=_0.resolve(j),F=_0.resolve(_0.dirname(H)),V;if(!O.startsWith("./")&&!O.startsWith("../"))V=_0.resolve(j,O);else V=_0.resolve(F,O);let A=_0.normalize(V),R=A.startsWith(L+_0.sep)||A===L,T=A.startsWith(F+_0.sep)||A===F,M=!1,k=_0.dirname(F);if(A.startsWith(k+_0.sep)){if(!_0.relative(k,A).split(_0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))M=!0}if(!R&&!T&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${L}, ${F}`),null;return A}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let U=_0.resolve(Z);G.add(U);async function K(_,j={},H,O){let L=W(_,Q,Z);if(!L)return K0("Include",`Could not resolve path for include: ${_}`,Z,H,O);let F=_0.resolve(L);if(G.has(F)){let V=[...G,F].map((A)=>_0.basename(A)).join(" -> ");return K0("Include",`Circular include detected: ${V}`,Z,H,O)}try{J.add(L);let V;if(!V)try{V=await Bun.file(L).text()}catch(x){let m=x instanceof Error?x.message:String(x);return K0("Include",`Error loading include file ${_}: ${m}`,Z,H,O)}if(V)V=V.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(V&&V.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (v9(),P9));V=x(V,$)}if(V&&(Y.debug||!v7()&&!PX()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (f9(),EY));x(V,L)}catch{}let A=V;try{let{processESImports:x}=await Promise.resolve().then(() => (U3(),XJ));await x(V,$,L,Y,J)}catch(x){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let R=h5(A);if(R)A=R.content.trim();let M=V.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(M)k=`<style${M[1]}>${M[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let N={...$};N.__stx_signals_gate=L1(V);for(let[x,m]of Object.entries(j))N[x]=m;let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...V.matchAll(y)],C="",S=null;for(let x of I){let m=x[1]||"",l=x[2]||"",Q0=m.includes("server"),l0=e1(m),R0="";try{let{extractAndStripCssImports:c,renderVendorStyleTags:j0}=await Promise.resolve().then(() => (y5(),f6)),c0=c(l,{filePath:L,projectRoot:process.cwd()});l=c0.code,R0=j0(c0.styles)}catch(c){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,c instanceof Error?c.message:c)}if(l0&&l.trim())l=X5(l);if(!Q0)try{let{hasUserImports:c,bundleClientScript:j0}=await Promise.resolve().then(() => (k7(),N7));if(c(l))l=await j0(l,L,{projectRoot:process.cwd()})}catch(c){if(Y.debug)console.warn(`[stx] bundler skipped for ${L}:`,c instanceof Error?c.message:c)}let r0=IB(l);if(r0&&!Q0){S=`stx_scope_${_0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++NJ}`;let c=h0(l),j0=EB(c,S);C+=`${R0}<script data-stx-scoped data-stx-run="always">${j0}</script>
3668
- `;continue}if(Q0)try{let{extractVariables:c}=await Promise.resolve().then(() => (i5(),Q8));await c(l,N,L)}catch(c){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,c)}if(!Q0&&!r0){let c=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${_0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++NJ}`;let j0=h0(l),c0=EJ(j0,S),M1=IJ(j0,c0);C+=`${R0}<script data-stx-scoped data-stx-run="always"${c?` ${c}`:""}>${M1}</script>
3667
+ })();`}function DB(X,$){let Z=X.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:X,mergedIntoExisting:J[1]};let G=Z[1],Q=Z[2],w=Z[3];return{html:`${G}${Q} data-stx-scope="${$}"${w}${X.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:X,mergedIntoExisting:null}}function bB(X){if(X.__onceStore instanceof Set)return X.__onceStore;return yB}async function O3(X,$,Z,Y,J,G=new Set){let Q=Y.partialsDir||_0.join(_0.dirname(Z),"partials");if(Q&&!_0.isAbsolute(Q))Q=_0.resolve(process.cwd(),Q);let w=kB(X,"@partial","@include"),q=bB($);w=w.replace(/@once([\s\S]*?)@endonce/g,(_,j,H)=>{let O=j.trim(),L=`${Z}:${O}`;if(q.has(L))return"";return q.add(L),j});{let _=/@includeIf\s*\(/g,j;while((j=_.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,F=O+1;while(F<w.length&&L>0){if(w[F]==="(")L++;else if(w[F]===")")L--;F++}if(L!==0)break;let V=w.substring(O+1,F-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){_.lastIndex=F;continue}let R=A[1],T=W(R,Q,Z),M="";if(T&&await Bun.file(T).exists())J.add(T),M=`@include(${V})`;w=w.substring(0,H)+M+w.substring(F),_.lastIndex=0}}for(let[_,j]of[["@includeWhen",!1],["@includeUnless",!0]]){let H=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=H.exec(w))!==null){let L=O.index,F=L+O[0].length-1,V=1,A=F+1;while(A<w.length&&V>0){if(w[A]==="(")V++;else if(w[A]===")")V--;A++}if(V!==0)break;let R=w.substring(F+1,A-1),T=L3(R,0);if(T===-1){H.lastIndex=A;continue}let M=R.substring(0,T).trim(),k=R.substring(T+1).trim(),N=k.match(/^\s*['"]([^'"]+)['"]/);if(!N){H.lastIndex=A;continue}let y=N[1],I=k.substring(N[0].length),C,S=L3(I,0);if(S!==-1)C=I.substring(S+1).trim();try{let b=`Boolean(${M})`,P;if(q0(b)){let l=W0(b,Object.keys($));P=Boolean(l(...Object.values($)))}else P=Boolean(Y0(b,$));let x=j?!P:P,m="";if(x){let l=W(y,Q,Z);if(l&&await Bun.file(l).exists())J.add(l);m=`@include('${y}'${C?`, ${C}`:""})`}w=w.substring(0,L)+m+w.substring(A),H.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),x=K0("Include",`Error evaluating ${_} condition: ${P}`,Z,X,L);w=w.substring(0,L)+x+w.substring(A),H.lastIndex=0}}}{let _=/@each\s*\(/g,j;while((j=_.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,F=O+1;while(F<w.length&&L>0){if(w[F]==="(")L++;else if(w[F]===")"){if(L--,L===0)break}F++}if(L!==0)break;let V=w.substring(O+1,F),A=w.substring(H,F+1),R=V.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){_.lastIndex=0,w=w.replace(A,"");continue}let[,T,M,k,N]=R;try{let y,I=M.trim();if(q0(I))y=W0(I,Object.keys($))(...Object.values($));else y=Y0(I,$);let C="";if(Array.isArray(y)&&y.length>0)for(let S of y){let b={...$,[k]:S},P=await K(T,b,X,H);C+=P}else if(N)C=await K(N,{},X,H);w=w.substring(0,H)+C+w.substring(F+1),_.lastIndex=0}catch(y){let I=y instanceof Error?y.message:String(y);w=w.substring(0,H)+K0("Each",`Error in @each: ${I}`,Z,X,H)+w.substring(F+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,j;while((j=_.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,F=O+1;while(F<w.length&&L>0){if(w[F]==="(")L++;else if(w[F]===")"){if(L--,L===0)break}F++}if(L!==0)break;let V=w.substring(O+1,F),A=w.substring(H,F+1),R=V.match(/^\s*(\[[^\]]+\])/);if(!R){_.lastIndex=0,w=w.replace(A,"");continue}let T=R[1],M=V.slice(R[0].length),k,N=M.match(/^\s*,\s*\{/);if(N){M=M.slice(N[0].length-1);let C=1,S=1;while(S<M.length&&C>0){if(M[S]==="{")C++;else if(M[S]==="}"){if(C--,C===0)break}S++}k=M.substring(0,S+1),M=M.slice(S+1)}let y,I=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(I)y=I[1];try{let C=JSON.parse(T.replace(/'/g,'"')),S={};if(k)try{S=O0(k,$)}catch(P){let x=P instanceof Error?P.message:String(P);if(Y.debug){let m=K0("Include",`Error parsing includeFirst variables: ${x}`,Z,X,H,A);w=w.replace(A,()=>m)}else w=w.replace(A,()=>y||"");continue}let b=!1;for(let P of C){let x=W(P,Q,Z);if(!x)continue;if(await i(x)){let m=await K(P,S,X,H);w=w.replace(A,()=>m),b=!0;break}}if(!b)if(y!==void 0)w=w.replace(A,()=>y);else if(Y.debug){let P=K0("Include",`None of the includeFirst paths exist: ${T}`,Z,X,H,A);w=w.replace(A,()=>P)}else w=w.replace(A,"")}catch(C){let S=C instanceof Error?C.message:String(C),b=K0("Include",`Error processing @includeFirst: ${S}`,Z,X,H,A);w=w.replace(A,()=>b)}_.lastIndex=0}}function W(_,j,H){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let L=_0.resolve(j),F=_0.resolve(_0.dirname(H)),V;if(!O.startsWith("./")&&!O.startsWith("../"))V=_0.resolve(j,O);else V=_0.resolve(F,O);let A=_0.normalize(V),R=A.startsWith(L+_0.sep)||A===L,T=A.startsWith(F+_0.sep)||A===F,M=!1,k=_0.dirname(F);if(A.startsWith(k+_0.sep)){if(!_0.relative(k,A).split(_0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))M=!0}if(!R&&!T&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${L}, ${F}`),null;return A}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let U=_0.resolve(Z);G.add(U);async function K(_,j={},H,O){let L=W(_,Q,Z);if(!L)return K0("Include",`Could not resolve path for include: ${_}`,Z,H,O);let F=_0.resolve(L);if(G.has(F)){let V=[...G,F].map((A)=>_0.basename(A)).join(" -> ");return K0("Include",`Circular include detected: ${V}`,Z,H,O)}try{J.add(L);let V;if(!V)try{V=await Bun.file(L).text()}catch(x){let m=x instanceof Error?x.message:String(x);return K0("Include",`Error loading include file ${_}: ${m}`,Z,H,O)}if(V)V=V.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(V&&V.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (v9(),P9));V=x(V,$)}if(V&&(Y.debug||!v7()&&!PX()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (f9(),EY));x(V,L)}catch{}let A=V;try{let{processESImports:x}=await Promise.resolve().then(() => (U3(),XJ));await x(V,$,L,Y,J)}catch(x){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let R=h5(A);if(R)A=R.content.trim();let M=V.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(M)k=`<style${M[1]}>${M[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let N={...$};N.__stx_signals_gate=L1(V);for(let[x,m]of Object.entries(j))N[x]=m;let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...V.matchAll(y)],C="",S=null;for(let x of I){let m=x[1]||"",l=x[2]||"",Q0=m.includes("server"),l0=e1(m),R0="";try{let{extractAndStripCssImports:c,renderVendorStyleTags:j0}=await Promise.resolve().then(() => (y5(),f6)),c0=c(l,{filePath:L,projectRoot:process.cwd()});l=c0.code,R0=j0(c0.styles)}catch(c){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,c instanceof Error?c.message:c)}if(l0&&l.trim())l=X5(l);if(!Q0)try{let{hasUserImports:c,bundleClientScript:j0}=await Promise.resolve().then(() => (k7(),N7));if(c(l))l=await j0(l,L,{projectRoot:process.cwd()})}catch(c){if(Y.debug)console.warn(`[stx] bundler skipped for ${L}:`,c instanceof Error?c.message:c)}let s0=IB(l);if(s0&&!Q0){S=`stx_scope_${_0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++NJ}`;let c=h0(l),j0=EB(c,S);C+=`${R0}<script data-stx-scoped data-stx-run="always">${j0}</script>
3668
+ `;continue}if(Q0)try{let{extractVariables:c}=await Promise.resolve().then(() => (i5(),Q8));await c(l,N,L)}catch(c){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,c)}if(!Q0&&!s0){let c=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${_0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++NJ}`;let j0=h0(l),c0=EJ(j0,S),M1=IJ(j0,c0);C+=`${R0}<script data-stx-scoped data-stx-run="always"${c?` ${c}`:""}>${M1}</script>
3669
3669
  `}}if(S){let x=DB(A,S);if(A=x.html,x.mergedIntoExisting)C=C.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),S=x.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await O3(A,N,L,Y,J,G);let{processLoops:b}=await Promise.resolve().then(() => (H3(),MJ)),P=b(A,N,L);if(P=G5(P,N,L),P=b1(P,N,L),k)P+=`
3670
3670
  `+k;if(C)P+=`
3671
3671
  `+C;return P}catch(V){let A=V instanceof Error?V.message:String(V);return K0("Include",`Error processing include ${_}: ${A}`,Z,H,O)}}let z=/@include\s*\(/g,B;while((B=z.exec(w))!==null){let _=B.index,j=_+B[0].length-1,H=1,O=j+1;while(O<w.length&&H>0){if(w[O]==="(")H++;else if(w[O]===")")H--;O++}if(H!==0)break;let L=w.substring(_,O),F=w.substring(j+1,O-1),V=F.match(/^\s*['"]([^'"]+)['"]/);if(!V){z.lastIndex=O;continue}let A=V[1],R,T=F.substring(V[0].length),M=L3(T,0);if(M!==-1)R=T.substring(M+1).trim();let k={};if(R)try{k=O0(R,$)}catch(y){let I=y instanceof Error?y.message:String(y);w=w.replace(L,K0("Include",`Error parsing include variables for ${A}: ${I}`,Z,X,_)),z.lastIndex=0;continue}let N=await K(A,k,X,_);w=w.substring(0,_)+N+w.substring(O),z.lastIndex=0}return w}function F3(X,$){let Z=X;function Y(J,G,Q,w){let q=J,W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),K=q.match(U);if(!K||K.index===void 0)break;let z=K.index,B=K[1],_=z+K[0].length,j=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),O=1,L=_,F=-1;while(O>0&&L<q.length){let A=q.slice(L),R=A.match(j),T=A.match(H),M=R?L+R.index:1/0,k=T?L+T.index:1/0;if(M<k)O++,L=M+(R[0].length||1);else if(k<1/0){if(O--,O===0){F=k;break}L=k+Q.length+1}else break}if(F===-1)break;let V=q.slice(_,F);if(!$[B])$[B]=[];if(w)$[B].unshift(V);else $[B].push(V);q=q.substring(0,z)+q.substring(F+`@${Q}`.length),W=!0}return q}return Z=Y(Z,"push","endpush",!1),Z=Y(Z,"prepend","endprepend",!0),Z}function V3(X,$){return X.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,Y)=>{if(!$[Y]||$[Y].length===0)return"";return $[Y].join(`
3672
- `)})}var NJ=0,vN,yB;var DJ=D(()=>{rX();mX();w1();J1();P5();F0();T0();vN=new Z5(500),yB=new Set});import*as A3 from"path";async function yJ(X,$,Z=""){if(A3.basename(Z)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,X.replace(/@js[\s\S]*?@endjs/g,"");return SJ(X,$,Z,"@js","@endjs")}async function bJ(X,$,Z=""){if(A3.basename(Z)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return X.replace(/@ts[\s\S]*?@endts/g,"")}return SJ(X,$,Z,"@ts","@endts")}async function SJ(X,$,Z,Y,J){let G=X,Q=C5(`${Y}([\\s\\S]*?)${J}`,"g"),w=[],q;while((q=Q.exec(X))!==null)w.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:K}of w)try{let z={...$,global:$},B=Object.keys(z),_=Object.values(z),j=U.trim();if(Y==="@ts")j=j.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=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=O.length>0?`return { ${O.join(", ")} };`:"return {};",F=`
3672
+ `)})}var NJ=0,xN,yB;var DJ=D(()=>{rX();mX();w1();G1();P5();F0();T0();xN=new Z5(500),yB=new Set});import*as A3 from"path";async function yJ(X,$,Z=""){if(A3.basename(Z)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,X.replace(/@js[\s\S]*?@endjs/g,"");return SJ(X,$,Z,"@js","@endjs")}async function bJ(X,$,Z=""){if(A3.basename(Z)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return X.replace(/@ts[\s\S]*?@endts/g,"")}return SJ(X,$,Z,"@ts","@endts")}async function SJ(X,$,Z,Y,J){let G=X,Q=C5(`${Y}([\\s\\S]*?)${J}`,"g"),w=[],q;while((q=Q.exec(X))!==null)w.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:K}of w)try{let z={...$,global:$},B=Object.keys(z),_=Object.values(z),j=U.trim();if(Y==="@ts")j=j.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=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=O.length>0?`return { ${O.join(", ")} };`:"return {};",F=`
3673
3673
  ${j}
3674
3674
  ${L}
3675
3675
  `,A=Function(...B,F)(..._);if(A&&typeof A==="object")Object.assign($,A);G=G.replace(W,"")}catch(z){console.error(`Error executing ${Y} code block in ${Z}:`,z);let B=z instanceof Error?z.message:String(z),_=K0(`${Y} Directive`,`Error executing code: ${B}`,Z,X,K,W);console.error(_),G=G.replace(W,"")}return G}var CJ=D(()=>{P5();T0()});function SB(X,$="_method"){let Z=X.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${$}" value="${Z}">`}function PJ(X){return X.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,Z,Y,J,G)=>{return SB(Y,G||"_method")})}async function vJ(X,$,Z,Y,J){if(!Y.middleware||Y.middleware.length===0)return X;let G=X,Q=Y.middleware.filter((w)=>w.timing===J);if(Q.length===0)return G;for(let w of Q){if(!w.name||typeof w.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",w);continue}try{let q=await w.handler(G,$,Z,Y);if(typeof q==="string")G=q;else if(Y.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(q){if(Y.debug)console.error(`Error in middleware ${w.name}:`,q);if(Y.debug){let W=K0("Middleware",`Error in middleware '${w.name}': ${q instanceof Error?q.message:String(q)}`,Z,X);G=G.replace(/<body[^>]*>/,`$&
3676
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${a0(W)}</div>
3676
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${t0(W)}</div>
3677
3677
  `)}}}return G}async function xJ(X,$,Z,Y){return vJ(X,$,Z,Y,"before")}async function fJ(X,$,Z,Y){return vJ(X,$,Z,Y,"after")}var gJ=D(()=>{w1();T0()});function hJ(X){return X.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,Z,Y,J,G)=>{try{let Q=J?O0(J,{}):{};return H7(Y,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var uJ=D(()=>{n1();n1();F0()});function dJ(X,$,Z,Y){let J=X;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),K=q,z=U.length>1?U[1]:"";if(z&&$[z])W=$[z];else if(K.startsWith("og:")&&$.openGraph&&$.openGraph[U[1]])W=$.openGraph[U[1]];else W="";return W?`<meta property="${p(K)}" content="${p(W)}">`:""}return W?`<meta name="${p(q)}" content="${p(W)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(J))!==null){let w=Q.index,q=w+Q[0].length-1,W=1,U=q+1;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let K=J.substring(q+1,U).trim(),z=U+1,B=(()=>{try{let _=O0(K,$);if(!_)return"";let j="<meta";if(_.name)j+=` name="${p(String(_.name))}"`;if(_.property)j+=` property="${p(String(_.property))}"`;if(_.httpEquiv)j+=` http-equiv="${p(String(_.httpEquiv))}"`;if(_.content)j+=` content="${p(String(_.content))}"`;return j+=">",j}catch(_){let j=_ instanceof Error?_.message:String(_);return $0("MetaTag",j,o.EVALUATION_ERROR)}})();J=J.substring(0,w)+B+J.substring(z),G.lastIndex=0}return J}function mJ(X,$,Z){let Y=X,J=/@structuredData\s*\(/g,G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=Y.substring(w+1,W).trim(),K=W+1,z=(()=>{try{let B=O0(U,$);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 _=B instanceof Error?B.message:String(B);return $0("StructuredData",_,o.EVALUATION_ERROR)}})();Y=Y.substring(0,Q)+z+Y.substring(K),J.lastIndex=0}return Y}function lJ(X,$,Z,Y){let J=X,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(J))!==null){let w=J.indexOf("{",Q.index+4),q=1,W=w+1,U=null,K=!1;while(W<J.length&&q>0){let O=J[W];if(K){K=!1,W++;continue}if(O==="\\"&&U){K=!0,W++;continue}if(U){if(O===U)U=null;W++;continue}if(O==='"'||O==="'"||O==="`"){U=O,W++;continue}if(O==="{")q++;else if(O==="}")q--;W++}if(q!==0)break;let z=J.substring(W).match(/^\s*\)/);if(!z)break;let B=W+z[0].length,_=J.substring(w,W),j=J.substring(Q.index,B),H=((O)=>{try{let L=O0(O,$);if(!L)return"";let F="";if(L.title)F+=`<title>${p(L.title)}</title>
3678
3678
  `,F+=`<meta name="title" content="${p(L.title)}">
3679
3679
  `;if(L.description)F+=`<meta name="description" content="${p(L.description)}">
@@ -4872,9 +4872,15 @@ else if (immediate) {
4872
4872
  // ==========================================================================
4873
4873
 
4874
4874
  function useRef(name) {
4875
+ // A ref belongs to the component scope that created it. Capturing that
4876
+ // owner now is essential: componentScope is a mutable compatibility
4877
+ // fallback and changes while the rest of the page hydrates. Reading it
4878
+ // from the getter made an early component resolve refs from whichever
4879
+ // component happened to hydrate last.
4880
+ var ownerScope = currentLifecycleScope() || componentScope;
4875
4881
  return {
4876
4882
  get current() {
4877
- return componentScope.$refs ? componentScope.$refs[name] : null;
4883
+ return (ownerScope.$refs && ownerScope.$refs[name]) || null;
4878
4884
  },
4879
4885
  get value() {
4880
4886
  return this.current;
@@ -8058,33 +8064,30 @@ catch (e2) {
8058
8064
  }
8059
8065
 
8060
8066
  // Helper to evaluate with captured scope (auto-unwraps signals).
8061
- // Mirrors bindStyle/bindShow/evalAttrExpr: first try the auto-unwrap
8062
- // proxy (so a bare-reference comparison like count > 5 reads the signal
8063
- // as a primitive), then retry with the raw scope so call-syntax
8064
- // expressions like count() === 0 or !recording() still work. The proxy
8065
- // unwraps signals to their values, which turns count() into 0() ->
8066
- // TypeError; pre-fix (stacksjs/stx#1733) the single catch swallowed
8067
- // that TypeError and returned '' (falsy), silently hiding the element
8068
- // for EVERY comparison/boolean expression. bindIf was the only
8069
- // directive missing this retry.
8067
+ // A with-scope resolves only identifiers the expression actually references,
8068
+ // so the conditional subscribes narrowly instead of reading every signal
8069
+ // in a component scope. That broad subscription made an unrelated ref
8070
+ // update re-enter structural removal while the real condition was already
8071
+ // removing the same subtree. First try the auto-unwrap proxy (so a bare
8072
+ // comparison like count > 5 reads the signal value), then retry with the
8073
+ // raw scope so call syntax like count() === 0 still works (#1733).
8070
8074
  const evalExpr = (expression) => {
8071
8075
  // Skip placeholder expressions like __TITLE__ (build-time placeholders)
8072
8076
  if (/^__[A-Z_]+__$/.test(expression.trim())) {
8073
8077
  return expression;
8074
8078
  }
8075
8079
  try {
8076
- // Use captured componentScope (with @for vars) merged with element scope
8077
8080
  const scope = { ...globalHelpers, ...capturedComponentScope, ...(capturedElementScope || {}) };
8078
8081
  const unwrapScope = createExpressionAutoUnwrapProxy(scope, expression);
8079
- const fn = new Function(...Object.keys(scope), 'return ' + expression);
8080
- return fn(...Object.values(unwrapScope));
8082
+ const fn = new Function('__scope__', 'with(__scope__) { return ' + expression + ' }');
8083
+ return fn(unwrapScope);
8081
8084
  }
8082
8085
  catch (e1) {
8083
8086
  try {
8084
8087
  // Retry without the unwrap proxy so call-syntax (signal()) works.
8085
8088
  const scope2 = { ...globalHelpers, ...capturedComponentScope, ...(capturedElementScope || {}) };
8086
- const fn2 = new Function(...Object.keys(scope2), 'return ' + expression);
8087
- return fn2(...Object.values(scope2));
8089
+ const fn2 = new Function('__scope__', 'with(__scope__) { return ' + expression + ' }');
8090
+ return fn2(scope2);
8088
8091
  }
8089
8092
  catch (e2) {
8090
8093
  if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Expression error:', expression, e2);
@@ -8141,11 +8144,6 @@ catch (e2) {
8141
8144
  value = directSignal();
8142
8145
  console.log('[stx] bindIf effect (direct):', expr, '\u2192', value, 'isInserted:', isInserted);
8143
8146
  } else {
8144
- // Complex expression: read all signals first for tracking, then evaluate
8145
- for (var sk in fullScope) {
8146
- var sv = fullScope[sk];
8147
- if (sv && typeof sv === 'function' && (sv._isSignal || sv._isDerived)) sv();
8148
- }
8149
8147
  value = evalExpr(expr);
8150
8148
  }
8151
8149
 
@@ -8583,12 +8581,19 @@ else if (timer === null) {
8583
8581
  };
8584
8582
  }
8585
8583
 
8586
- // Queue work after the current synchronous signal/effect flush. This mirrors
8587
- // the Composition API nextTick contract and gives template refs a chance to
8588
- // resolve after a structural directive inserts their elements.
8584
+ // Queue work after the current synchronous signal/effect flush and after
8585
+ // structural directives finish their deferred subtree hydration. The
8586
+ // microtask schedules this timer only after every subscriber has run, so a
8587
+ // :if/:for timer created later in the same signal flush runs first and its
8588
+ // template refs are available to the callback.
8589
8589
  function nextTick(fn) {
8590
8590
  return Promise.resolve().then(function() {
8591
- if (fn) fn();
8591
+ return new Promise(function(resolve) {
8592
+ setTimeout(function() {
8593
+ if (fn) fn();
8594
+ resolve();
8595
+ }, 0);
8596
+ });
8592
8597
  });
8593
8598
  }
8594
8599
 
@@ -11585,7 +11590,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
11585
11590
  }
11586
11591
  }
11587
11592
  })();
11588
- `}var Ej;var vG=D(()=>{A8();J1();A8();Ej={state:d1,derived:H8,effect:L8,batch:d3,onMount:m3,onDestroy:l3,isSignal:O8,isDerived:F8,untrack:c3,peek:V8,generateSignalsRuntime:CG,generateSignalsRuntimeDev:p3}});var i3={};t(i3,{templateCache:()=>xG,readFileCached:()=>Dj,invalidateFileCacheByDir:()=>bj,invalidateFileCache:()=>yj,hashFilePath:()=>s7,getCachedSignalsRuntime:()=>Pj,getCachedRouterScript:()=>vj,clearDevCaches:()=>xj,checkCache:()=>fj,cacheTemplate:()=>gj,__setSignalsGeneratorsForTest:()=>Cj});import m1 from"fs";import s5 from"path";async function Dj(X){let Z;for(let Y=0;Y<3;Y++)try{let G=(await m1.promises.stat(X)).mtime.getTime(),Q=_5.get(X);if(Q&&Q.mtime===G)return Q.content;let w=await Bun.file(X).text(),W=(await m1.promises.stat(X)).mtime.getTime();if(W!==G)continue;return _5.set(X,{content:w,mtime:W}),w}catch(J){Z=J;break}throw _5.delete(X),Error(`File not found: ${X}${Z?` (${Z.message})`:""}`)}function yj(X){_5.delete(X)}function bj(X){for(let $ of _5.keys())if($.startsWith(X))_5.delete($)}function Cj(X){fG=X}async function Pj(X=!1){let $=fG??await Promise.resolve().then(() => (vG(),PG));if(X)return $.generateSignalsRuntimeDev();if(R8===null)R8=$.generateSignalsRuntime();return R8}async function vj(){if(T8===null){let{getRouterScript:X}=await Promise.resolve().then(() => (n1(),X6));T8=X()}return T8}function xj(){_5.clear(),hG(),R8=null,Sj=null,T8=null}function gG(X){let $={debug:X.debug===!0,middleware:(X.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:(X.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify($)).digest("hex")}async function fj(X,$){try{if(!$.cachePath)return null;let Z=s5.resolve($.cachePath),Y=s5.join(Z,`${s7(X)}.html`),J=s5.join(Z,`${s7(X)}.meta.json`);if(!await i(Y)||!await i(J))return null;let G=await Bun.file(J).text(),Q=JSON.parse(G);if(Q.cacheVersion!==$.cacheVersion)return null;if(Q.optionsSignature!==gG($))return null;if((await m1.promises.stat(X)).mtime.getTime()>Q.mtime)return null;for(let q of Q.dependencies)if(await i(q)){if((await m1.promises.stat(q)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(Y).text()}catch(Z){return console.warn(`Cache error for ${X}:`,Z),null}}async function gj(X,$,Z,Y){try{if(!Y.cachePath)return;let J=s5.resolve(Y.cachePath);await m1.promises.mkdir(J,{recursive:!0});let G=s5.join(J,`${s7(X)}.html`),Q=s5.join(J,`${s7(X)}.meta.json`),w=await m1.promises.stat(X);await Bun.write(G,$);let q={sourcePath:X,mtime:w.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:Y.cacheVersion,optionsSignature:gG(Y),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(q,null,2)),xG.set(X,{output:$,mtime:w.mtime.getTime(),dependencies:Z})}catch(J){console.warn(`Failed to cache template ${X}:`,J)}}function s7(X){return new Bun.CryptoHasher("sha1").update(X).digest("hex").substring(0,hj)}var xG,_5,R8=null,Sj=null,fG=null,T8=null,hj=16;var n3=D(()=>{T0();xG=new Map,_5=new Map});function uG(X){return X.includes("data-stx-runtime")}function dG(X){let $=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=$.exec(X);Z!==null;Z=$.exec(X)){let Y=X.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}function r3(X,$){let Z=X.indexOf("<script"),Y=X.search(/<!doctype\b/i);if(Z!==-1&&(Y===-1||Z>Y))return X.slice(0,Z)+$+`
11593
+ `}var Ej;var vG=D(()=>{A8();G1();A8();Ej={state:d1,derived:H8,effect:L8,batch:d3,onMount:m3,onDestroy:l3,isSignal:O8,isDerived:F8,untrack:c3,peek:V8,generateSignalsRuntime:CG,generateSignalsRuntimeDev:p3}});var i3={};t(i3,{templateCache:()=>xG,readFileCached:()=>Dj,invalidateFileCacheByDir:()=>bj,invalidateFileCache:()=>yj,hashFilePath:()=>s7,getCachedSignalsRuntime:()=>Pj,getCachedRouterScript:()=>vj,clearDevCaches:()=>xj,checkCache:()=>fj,cacheTemplate:()=>gj,__setSignalsGeneratorsForTest:()=>Cj});import m1 from"fs";import s5 from"path";async function Dj(X){let Z;for(let Y=0;Y<3;Y++)try{let G=(await m1.promises.stat(X)).mtime.getTime(),Q=_5.get(X);if(Q&&Q.mtime===G)return Q.content;let w=await Bun.file(X).text(),W=(await m1.promises.stat(X)).mtime.getTime();if(W!==G)continue;return _5.set(X,{content:w,mtime:W}),w}catch(J){Z=J;break}throw _5.delete(X),Error(`File not found: ${X}${Z?` (${Z.message})`:""}`)}function yj(X){_5.delete(X)}function bj(X){for(let $ of _5.keys())if($.startsWith(X))_5.delete($)}function Cj(X){fG=X}async function Pj(X=!1){let $=fG??await Promise.resolve().then(() => (vG(),PG));if(X)return $.generateSignalsRuntimeDev();if(R8===null)R8=$.generateSignalsRuntime();return R8}async function vj(){if(T8===null){let{getRouterScript:X}=await Promise.resolve().then(() => (n1(),X6));T8=X()}return T8}function xj(){_5.clear(),hG(),R8=null,Sj=null,T8=null}function gG(X){let $={debug:X.debug===!0,middleware:(X.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:(X.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify($)).digest("hex")}async function fj(X,$){try{if(!$.cachePath)return null;let Z=s5.resolve($.cachePath),Y=s5.join(Z,`${s7(X)}.html`),J=s5.join(Z,`${s7(X)}.meta.json`);if(!await i(Y)||!await i(J))return null;let G=await Bun.file(J).text(),Q=JSON.parse(G);if(Q.cacheVersion!==$.cacheVersion)return null;if(Q.optionsSignature!==gG($))return null;if((await m1.promises.stat(X)).mtime.getTime()>Q.mtime)return null;for(let q of Q.dependencies)if(await i(q)){if((await m1.promises.stat(q)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(Y).text()}catch(Z){return console.warn(`Cache error for ${X}:`,Z),null}}async function gj(X,$,Z,Y){try{if(!Y.cachePath)return;let J=s5.resolve(Y.cachePath);await m1.promises.mkdir(J,{recursive:!0});let G=s5.join(J,`${s7(X)}.html`),Q=s5.join(J,`${s7(X)}.meta.json`),w=await m1.promises.stat(X);await Bun.write(G,$);let q={sourcePath:X,mtime:w.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:Y.cacheVersion,optionsSignature:gG(Y),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(q,null,2)),xG.set(X,{output:$,mtime:w.mtime.getTime(),dependencies:Z})}catch(J){console.warn(`Failed to cache template ${X}:`,J)}}function s7(X){return new Bun.CryptoHasher("sha1").update(X).digest("hex").substring(0,hj)}var xG,_5,R8=null,Sj=null,fG=null,T8=null,hj=16;var n3=D(()=>{T0();xG=new Map,_5=new Map});function uG(X){return X.includes("data-stx-runtime")}function dG(X){let $=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=$.exec(X);Z!==null;Z=$.exec(X)){let Y=X.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}function r3(X,$){let Z=X.indexOf("<script"),Y=X.search(/<!doctype\b/i);if(Z!==-1&&(Y===-1||Z>Y))return X.slice(0,Z)+$+`
11589
11594
  `+X.slice(Z);let J=/<head\b[^>]*>/i.exec(X);if(J){let Q=J.index+J[0].length;return`${X.slice(0,Q)}
11590
11595
  ${$}${X.slice(Q)}`}if(X.includes("</head>")){let Q=X.indexOf("</head>");return X.slice(0,Q)+$+`
11591
11596
  `+X.slice(Q)}if(P7(X))return bX(X,(Q)=>`${Q}
@@ -11612,13 +11617,13 @@ if(window.stx)window.stx._latestSetup=${Q};
11612
11617
  `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},B=()=>{if(J!==0)return;let _=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(_){let F=_[2];if(!Y.has(F))Z.push(F),Y.add(F);return}let j=$.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(j){j[1].split(",").forEach((F)=>{let V=F.trim();if(!V)return;let A=V.indexOf(":"),T=(A>=0?V.slice(A+1).trim():V).split(/[\s=]/)[0];if(T&&!Y.has(T))Z.push(T),Y.add(T)});return}let H=$.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!Y.has(A))Z.push(A),Y.add(A)});return}let O=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!Y.has(F))Z.push(F),Y.add(F);return}let L=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!Y.has(F))Z.push(F),Y.add(F)}};while(G<Q){if(z())continue;if($[G]==="'"||$[G]==='"'){U($[G]),w=$[G-1];continue}if($[G]==="`"){K(),w="`";continue}if($[G]==="/"&&$[G+1]!=="/"&&$[G+1]!=="*"&&W()){q(),w="/";continue}if($[G]==="{"){J++,w="{",G++;continue}if($[G]==="}"){J--,w="}",G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))B();if(!/\s/.test($[G]))w=$[G];G++}return Z.join(", ")}async function X4(X,$,Z,Y){if(!E8(X))return X;let J=X;if($.skipSignalsRuntime)return J;let{output:G,setupCode:Q}=await oG(J,Z,Y);if(J=G,J=await M8(J,$),Q){let U=I8(J,/<\/head>/i),K=U===-1?I8(J,/<body[^>]*>/i):-1;if(U!==-1)J=`${J.slice(0,U)}${Q}
11613
11618
  ${J.slice(U)}`;else if(K!==-1){let z=/<body[^>]*>/i.exec(J.slice(K))[0],B=K+z.length;J=`${J.slice(0,B)}
11614
11619
  ${Q}${J.slice(B)}`}else J=`${J}
11615
- ${Q}`}let q=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!Q&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,K=I8(J,U);if(K!==-1){let z=J.slice(0,K),B=J.slice(K).replace(U,(_)=>_.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=z+B}}return J}function I8(X,$){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec(X))!==null)Y.push([J.index,J.index+J[0].length]);let G=new RegExp($.source,$.flags.replace(/[gy]/g,"")),Q=0;while(Q<X.length){let w=G.exec(X.slice(Q));if(!w)return-1;let q=Q+w.index;if(!Y.some(([U,K])=>q>=U&&q<K))return q;Q=q+Math.max(w[0].length,1)}return-1}function tG(X){let $=[];for(let Z of X.split(",")){let Y=Z.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])$.push(`${J[2]} = ${J[1]}`)}if($.length===0)return iG;return`var ${$.join(", ")}; ${iG}`}var uj=0,mG=`(?:"[^"]*"|'[^']*'|[^>"'])*`,nG,cG,o3,nj,iG="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var o7=D(()=>{y5();dX();J1();l$();T0();N8();$5();V7();nG=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;cG=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"]);o3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);nj=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import o5 from"path";function eG(X){return X.startsWith("http://")||X.startsWith("https://")||X.startsWith("//")}async function XQ(X,$,Z){try{let Y;if(X.startsWith("/")){let J=$;for(let G=0;G<5;G++){let Q=o5.join(J,X);if(await Bun.file(Q).exists())return Q;J=o5.dirname(J)}Y=o5.join($,X)}else if(X.startsWith("./")||X.startsWith("../"))Y=o5.resolve($,X);else Y=o5.resolve($,X);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function $Q(X,$,Z){let Y=X,J=o5.dirname($),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(Y))!==null){let[W,U,K,z]=Q;if(eG(K))continue;let B=await XQ(K,J,$);if(B)try{let _=await Bun.file(B).text();if(Z.add(B),K.endsWith(".ts")||K.endsWith(".tsx")){let H=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:C0()});if(H.outputs.length>0)_=await H.outputs[0].text()}let j=`<script>
11620
+ ${Q}`}let q=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!Q&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,K=I8(J,U);if(K!==-1){let z=J.slice(0,K),B=J.slice(K).replace(U,(_)=>_.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=z+B}}return J}function I8(X,$){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec(X))!==null)Y.push([J.index,J.index+J[0].length]);let G=new RegExp($.source,$.flags.replace(/[gy]/g,"")),Q=0;while(Q<X.length){let w=G.exec(X.slice(Q));if(!w)return-1;let q=Q+w.index;if(!Y.some(([U,K])=>q>=U&&q<K))return q;Q=q+Math.max(w[0].length,1)}return-1}function tG(X){let $=[];for(let Z of X.split(",")){let Y=Z.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])$.push(`${J[2]} = ${J[1]}`)}if($.length===0)return iG;return`var ${$.join(", ")}; ${iG}`}var uj=0,mG=`(?:"[^"]*"|'[^']*'|[^>"'])*`,nG,cG,o3,nj,iG="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var o7=D(()=>{y5();dX();G1();l$();T0();N8();$5();V7();nG=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;cG=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"]);o3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);nj=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import o5 from"path";function eG(X){return X.startsWith("http://")||X.startsWith("https://")||X.startsWith("//")}async function XQ(X,$,Z){try{let Y;if(X.startsWith("/")){let J=$;for(let G=0;G<5;G++){let Q=o5.join(J,X);if(await Bun.file(Q).exists())return Q;J=o5.dirname(J)}Y=o5.join($,X)}else if(X.startsWith("./")||X.startsWith("../"))Y=o5.resolve($,X);else Y=o5.resolve($,X);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function $Q(X,$,Z){let Y=X,J=o5.dirname($),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(Y))!==null){let[W,U,K,z]=Q;if(eG(K))continue;let B=await XQ(K,J,$);if(B)try{let _=await Bun.file(B).text();if(Z.add(B),K.endsWith(".ts")||K.endsWith(".tsx")){let H=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:C0()});if(H.outputs.length>0)_=await H.outputs[0].text()}let j=`<script>
11616
11621
  // Source: ${K}
11617
11622
  ${_}
11618
11623
  </script>`;Y=Y.replace(W,j),G.lastIndex=0}catch(_){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=w.exec(Y))!==null){let[W,U,K,z]=q,B=U+z;if(eG(K))continue;if(/rel=["']stylesheet["']/.test(B)||K.endsWith(".css")){let j=await XQ(K,J,$);if(j)try{let H=await Bun.file(j).text();Z.add(j);let O=`<style>
11619
11624
  /* Source: ${K} */
11620
11625
  ${H}
11621
- </style>`;Y=Y.replace(W,O),w.lastIndex=0}catch(H){}}}return Y}var ZQ=D(()=>{E1()});function $4(X,$){let Z=X,Y=/@json\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index,Q=G+J[0].length-1,w=1,q=Q+1,W=null,U=!1;while(q<Z.length&&w>0){let F=Z[q];if(U){U=!1,q++;continue}if(F==="\\"&&W){U=!0,q++;continue}if(W){if(F===W)W=null;q++;continue}if(F==='"'||F==="'"||F==="`"){W=F,q++;continue}if(F==="(")w++;else if(F===")"){if(w--,w===0)break}q++}if(w!==0)break;let K=Z.substring(Q+1,q).trim(),z=Z.substring(G,q+1),B=-1,_=0,j=null,H=!1;for(let F=0;F<K.length;F++){let V=K[F];if(H){H=!1;continue}if(V==="\\"&&j){H=!0;continue}if(j){if(V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V;continue}if(V==="("||V==="["||V==="{")_++;else if(V===")"||V==="]"||V==="}")_--;if(V===","&&_===0){B=F;break}}let O=B>=0?K.substring(0,B).trim():K,L=B>=0?K.substring(B+1).trim():void 0;try{let F=O.trim(),V;if(q0(F))V=W0(F,Object.keys($))(...Object.values($));else V=void 0;let A;if(L==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(q+1),Y.lastIndex=G+R.length}catch(F){X1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),Y.lastIndex=G+z.length}}return Z}function Z4(X){return X.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function YQ(X){let $=X,Z=/@memo\s*\(/g,Y,J=[];while((Y=Z.exec($))!==null){let G=Y.index,Q=G+Y[0].length,w=1,q=Q;while(q<$.length&&w>0){if($[q]==="(")w++;else if($[q]===")")w--;q++}if(w!==0)continue;let W=$.slice(Q,q-1).trim(),U=q,K=$.slice(U),z=K.indexOf("@endmemo");if(z===-1)continue;let B=K.slice(0,z),_=U+z+8,j=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=j?j[0].length:0,O=B.slice(H),L=B.match(/(\s*)$/),F=L?L[0].length:0,V=O.slice(0,O.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[T,M,k="",N]=A,y=`<${M}${k} data-stx-memo="${W}"${N}>`;R=B.slice(0,H)+y+V.slice(T.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${W}">${V}</div>${B.slice(H+V.length)}`;J.push({start:G,end:_,replacement:R}),Z.lastIndex=_}for(let G=J.length-1;G>=0;G--){let Q=J[G];$=$.slice(0,Q.start)+Q.replacement+$.slice(Q.end)}return $.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Y4(X){let $=X.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),$}function JQ(X){let Z=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,G;while((G=Z.exec(X))!==null){let Q=G.index,w=Q+G[0].length,q=!1,W=!1,U=-1;while(w<X.length){let j=X[w];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){U=w;break}w++}if(U===-1)continue;if(X.slice(Q,U+1).includes("x-cloak"))continue;let z=X.slice(U+1),B=z.indexOf("</"),_=B>=0?z.slice(0,B):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(_))Y+=X.slice(J,U)+" x-cloak>",J=U+1}return Y+=X.slice(J),Y}function GQ(X){let $=/<[a-z][\w-]*/gi,Z="",Y=0,J;while((J=$.exec(X))!==null){let G=J.index,Q=J[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let _=`</${Q}>`,j=X.toLowerCase().indexOf(_,G);if(j!==-1)$.lastIndex=j+_.length;continue}let w=G+J[0].length,q=!1,W=!1,U=-1;while(w<X.length){let _=X[w];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){U=w;break}w++}if(U===-1)continue;let K=X.slice(G+J[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(K))continue;if(!oj.test(K))continue;let z=X[U-1]==="/",B=z?U-1:U;Z+=`${X.slice(Y,B)} x-cloak${z?" ":""}`,Y=B}return Z+=X.slice(Y),Z}var oj;var J4=D(()=>{F1();F0();oj=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function G4(X,$,Z,Y){let J=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=J.allowPatterns??[],Q=[],w=G1(X.replace(/\{\{--[\s\S]*?--\}\}/g,(q)=>q.replace(/[^\n]/g," ")));for(let{pattern:q,message:W,suggestion:U}of aj){if(G.some((z)=>/\w/.test(z)&&W.includes(z)))continue;q.lastIndex=0;let K=w.match(q);if(K&&K.length>0){let z=w.split(`
11626
+ </style>`;Y=Y.replace(W,O),w.lastIndex=0}catch(H){}}}return Y}var ZQ=D(()=>{E1()});function $4(X,$){let Z=X,Y=/@json\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index,Q=G+J[0].length-1,w=1,q=Q+1,W=null,U=!1;while(q<Z.length&&w>0){let F=Z[q];if(U){U=!1,q++;continue}if(F==="\\"&&W){U=!0,q++;continue}if(W){if(F===W)W=null;q++;continue}if(F==='"'||F==="'"||F==="`"){W=F,q++;continue}if(F==="(")w++;else if(F===")"){if(w--,w===0)break}q++}if(w!==0)break;let K=Z.substring(Q+1,q).trim(),z=Z.substring(G,q+1),B=-1,_=0,j=null,H=!1;for(let F=0;F<K.length;F++){let V=K[F];if(H){H=!1;continue}if(V==="\\"&&j){H=!0;continue}if(j){if(V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V;continue}if(V==="("||V==="["||V==="{")_++;else if(V===")"||V==="]"||V==="}")_--;if(V===","&&_===0){B=F;break}}let O=B>=0?K.substring(0,B).trim():K,L=B>=0?K.substring(B+1).trim():void 0;try{let F=O.trim(),V;if(q0(F))V=W0(F,Object.keys($))(...Object.values($));else V=void 0;let A;if(L==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(q+1),Y.lastIndex=G+R.length}catch(F){$1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),Y.lastIndex=G+z.length}}return Z}function Z4(X){return X.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function YQ(X){let $=X,Z=/@memo\s*\(/g,Y,J=[];while((Y=Z.exec($))!==null){let G=Y.index,Q=G+Y[0].length,w=1,q=Q;while(q<$.length&&w>0){if($[q]==="(")w++;else if($[q]===")")w--;q++}if(w!==0)continue;let W=$.slice(Q,q-1).trim(),U=q,K=$.slice(U),z=K.indexOf("@endmemo");if(z===-1)continue;let B=K.slice(0,z),_=U+z+8,j=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=j?j[0].length:0,O=B.slice(H),L=B.match(/(\s*)$/),F=L?L[0].length:0,V=O.slice(0,O.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[T,M,k="",N]=A,y=`<${M}${k} data-stx-memo="${W}"${N}>`;R=B.slice(0,H)+y+V.slice(T.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${W}">${V}</div>${B.slice(H+V.length)}`;J.push({start:G,end:_,replacement:R}),Z.lastIndex=_}for(let G=J.length-1;G>=0;G--){let Q=J[G];$=$.slice(0,Q.start)+Q.replacement+$.slice(Q.end)}return $.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Y4(X){let $=X.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),$}function JQ(X){let Z=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,G;while((G=Z.exec(X))!==null){let Q=G.index,w=Q+G[0].length,q=!1,W=!1,U=-1;while(w<X.length){let j=X[w];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){U=w;break}w++}if(U===-1)continue;if(X.slice(Q,U+1).includes("x-cloak"))continue;let z=X.slice(U+1),B=z.indexOf("</"),_=B>=0?z.slice(0,B):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(_))Y+=X.slice(J,U)+" x-cloak>",J=U+1}return Y+=X.slice(J),Y}function GQ(X){let $=/<[a-z][\w-]*/gi,Z="",Y=0,J;while((J=$.exec(X))!==null){let G=J.index,Q=J[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let _=`</${Q}>`,j=X.toLowerCase().indexOf(_,G);if(j!==-1)$.lastIndex=j+_.length;continue}let w=G+J[0].length,q=!1,W=!1,U=-1;while(w<X.length){let _=X[w];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){U=w;break}w++}if(U===-1)continue;let K=X.slice(G+J[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(K))continue;if(!oj.test(K))continue;let z=X[U-1]==="/",B=z?U-1:U;Z+=`${X.slice(Y,B)} x-cloak${z?" ":""}`,Y=B}return Z+=X.slice(Y),Z}var oj;var J4=D(()=>{F1();F0();oj=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function G4(X,$,Z,Y){let J=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=J.allowPatterns??[],Q=[],w=p0(X.replace(/\{\{--[\s\S]*?--\}\}/g,(q)=>q.replace(/[^\n]/g," ")));for(let{pattern:q,message:W,suggestion:U}of aj){if(G.some((z)=>/\w/.test(z)&&W.includes(z)))continue;q.lastIndex=0;let K=w.match(q);if(K&&K.length>0){let z=w.split(`
11622
11627
  `),B=X.split(`
11623
11628
  `),_=[];z.forEach((L,F)=>{if(q.lastIndex=0,q.test(L))_.push(F+1)});let j=_.length>0?` (script line${_.length>1?"s":""} ${_.join(", ")})`:"",H=_.slice(0,3).map((L)=>` ${L} | ${(B[L-1]??"").trim().slice(0,100)}`).join(`
11624
11629
  `),O=H?`
@@ -11635,7 +11640,7 @@ var __stx = window.stx || {};
11635
11640
  ${j1.filter((_)=>!W.has(_)&&new RegExp(`\\b${_}\\b`).test(K)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
11636
11641
  `)}
11637
11642
  ${K}
11638
- })();`;return U1(a5,$,J,B),B}function $H(){a5.clear()}var a5;var wQ=D(()=>{H1();E1();J1();w4();a5=new Map});var q4,JI;var qQ=D(()=>{q4=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],JI=new Set(q4)});var KQ={};t(KQ,{selectComposableFiles:()=>WQ,referencedFrameworkComposables:()=>UQ,getFrameworkComposableScript:()=>GH,clearFrameworkComposableCache:()=>YH,__setRuntimeOwnedForTest:()=>QH});import C8 from"path";function YH(){a7.clear()}function WQ(X){let $=new Map;for(let Z of X){let Y=C8.basename(Z);if(Y.endsWith(".d.ts"))continue;let J=Y.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===Y)continue;let G=$.get(J);if(G&&!G.endsWith(".js"))continue;$.set(J,Z)}return[...$.values()].sort()}function JH(X,$){let Z=$.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test(X)}function UQ(X){if(!X)return[];let $=X.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Z=[];for(let Y of ZH){if(W4.has(Y))continue;let J=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test($))Z.push(Y)}return Z.sort()}async function GH(X,$){let Z=UQ(X);if(Z.length===0)return null;let Y=$??C8.join(import.meta.dir,"composables"),J=`${Y}\x00${Z.join(",")}`,G=a7.get(J);if(G!==void 0)return G||null;let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}),w=new Set(Z),q=[],W=new Set,U=[];try{let _=new Bun.Glob("*.{ts,js}");for await(let j of _.scan({cwd:Y,absolute:!0}))U.push(j)}catch{return a7.set(J,""),null}U=WQ(U);for(let _ of U){let j;try{j=await Bun.file(_).text()}catch{continue}let H=[];try{H=Q.scan(j).exports.filter((O)=>O!=="default")}catch{continue}if(!H.some((O)=>w.has(O)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${C8.basename(_).replace(/\.[jt]s$/,"")}
11643
+ })();`;return U1(a5,$,J,B),B}function $H(){a5.clear()}var a5;var wQ=D(()=>{H1();E1();G1();w4();a5=new Map});var q4,GI;var qQ=D(()=>{q4=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],GI=new Set(q4)});var KQ={};t(KQ,{selectComposableFiles:()=>WQ,referencedFrameworkComposables:()=>UQ,getFrameworkComposableScript:()=>GH,clearFrameworkComposableCache:()=>YH,__setRuntimeOwnedForTest:()=>QH});import C8 from"path";function YH(){a7.clear()}function WQ(X){let $=new Map;for(let Z of X){let Y=C8.basename(Z);if(Y.endsWith(".d.ts"))continue;let J=Y.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===Y)continue;let G=$.get(J);if(G&&!G.endsWith(".js"))continue;$.set(J,Z)}return[...$.values()].sort()}function JH(X,$){let Z=$.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test(X)}function UQ(X){if(!X)return[];let $=X.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Z=[];for(let Y of ZH){if(W4.has(Y))continue;let J=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test($))Z.push(Y)}return Z.sort()}async function GH(X,$){let Z=UQ(X);if(Z.length===0)return null;let Y=$??C8.join(import.meta.dir,"composables"),J=`${Y}\x00${Z.join(",")}`,G=a7.get(J);if(G!==void 0)return G||null;let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}),w=new Set(Z),q=[],W=new Set,U=[];try{let _=new Bun.Glob("*.{ts,js}");for await(let j of _.scan({cwd:Y,absolute:!0}))U.push(j)}catch{return a7.set(J,""),null}U=WQ(U);for(let _ of U){let j;try{j=await Bun.file(_).text()}catch{continue}let H=[];try{H=Q.scan(j).exports.filter((O)=>O!=="default")}catch{continue}if(!H.some((O)=>w.has(O)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${C8.basename(_).replace(/\.[jt]s$/,"")}
11639
11644
  ${Q.transformSync(j).trim()}`);for(let O of H)W.add(O)}catch(O){console.warn(`[stx] framework composable ${C8.basename(_)} could not be bundled:`,O)}}let K=Z.filter((_)=>!W.has(_)&&!JH(X,_));if(K.length>0)console.warn(`[stx] could not bundle ${K.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(q.length===0)return a7.set(J,""),null;let z=[...W].map((_)=>` try { if (!(${JSON.stringify(_)} in __s)) { __s[${JSON.stringify(_)}] = ${_}; if (!(${JSON.stringify(_)} in window)) window[${JSON.stringify(_)}] = ${_}; } } catch (e) {}`).join(`
11640
11645
  `),B=`<script data-stx-framework-composables>
11641
11646
  ;(function(){
@@ -11670,7 +11675,7 @@ ${W}
11670
11675
  }
11671
11676
  window[__n] = __c[__n];
11672
11677
  }
11673
- })();`;return U1(t5,$,Y,B),B}function KH(){t5.clear(),U4.clear()}var t5,U4,wH;var jQ=D(()=>{H1();E1();w4();J1();t5=new Map,U4=new Map,wH=["composables","functions"]});var LQ={};t(LQ,{processDeferDirectives:()=>HH});function zH(){return`stx-defer-${++HQ}`}function _H(X){let $=X.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function BH(X,$,Z){let{trigger:Y,value:J}=_H($),G=Z,Q,w,q,W=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)Q=W[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)w=U[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let K=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(K)q=K[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:Y,triggerValue:J,content:G,placeholder:Q,loading:w,error:q}}function jH(X,$){let{trigger:Z,triggerValue:Y}=$,J;switch(Z){case"visible":J=`
11678
+ })();`;return U1(t5,$,Y,B),B}function KH(){t5.clear(),U4.clear()}var t5,U4,wH;var jQ=D(()=>{H1();E1();w4();G1();t5=new Map,U4=new Map,wH=["composables","functions"]});var LQ={};t(LQ,{processDeferDirectives:()=>HH});function zH(){return`stx-defer-${++HQ}`}function _H(X){let $=X.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function BH(X,$,Z){let{trigger:Y,value:J}=_H($),G=Z,Q,w,q,W=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)Q=W[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)w=U[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let K=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(K)q=K[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:Y,triggerValue:J,content:G,placeholder:Q,loading:w,error:q}}function jH(X,$){let{trigger:Z,triggerValue:Y}=$,J;switch(Z){case"visible":J=`
11674
11679
  const observer = new IntersectionObserver((entries) => {
11675
11680
  if (entries[0].isIntersecting) {
11676
11681
  observer.disconnect();
@@ -14377,14 +14382,14 @@ if ('serviceWorker' in navigator) {
14377
14382
  <meta name="stx-layout-group" content="${Ew(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?P7(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=bX(Q,(R,T)=>`<body${T} data-stx="${F[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${F[1]}"`,"i");Q=Q.replace(A,"$1")}}if(G){Q=OG(Q);let w=Y.app?.colorMode;if(w)Q=KG(Q,w);Q=_G(Q),Q=fL(Q)}if(G)try{let{getStoreScript:w}=await e("stx/store-loader",()=>Promise.resolve().then(() => (wQ(),QQ))),q=Y.storesDir,W=await w(q);if(W){let U=`<script data-stx-stores>${W}</script>`,K=Z7(Q,"data-stx-runtime");if(K)Q=Q.slice(0,K.end)+`
14378
14383
  `+U+Q.slice(K.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await e("stx/framework-composables",()=>Promise.resolve().then(() => (zQ(),KQ))),q=await w(Q);if(q){let W=Z7(Q,"data-stx-stores")||Z7(Q,"data-stx-runtime");if(W)Q=Q.slice(0,W.end)+`
14379
14384
  `+q+Q.slice(W.end)}}catch{}if(G)try{let{getComposableScript:w}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (jQ(),BQ))),q=Y.composablesDir,W=await w(q);if(W){let U=`<script data-stx-composables>${W}</script>`,K=Z7(Q,"data-stx-stores")||Z7(Q,"data-stx-runtime");if(K)Q=Q.slice(0,K.end)+`
14380
- `+U+Q.slice(K.end)}}catch{}if(G)Q=zG(Q);if(G&&$.__stx_inject_css!==!1)Q=await J9(Q,void 0,Y.buildMode==="serve");if(G)Q=UG(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof gX)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new Y5(`Template processing failed: ${w}`,Z,void 0,void 0,X.substring(0,200)+(X.length>200?"...":""));if(X1.log(q,{filePath:Z,context:$}),j9.logDetailedError(q,{filePath:Z,template:X.substring(0,500)}),Y.debug)throw q;return _9.createFallbackContent("Template Processing",q)}}async function gL(X,$,Z,Y,J){let G=process.cwd(),Q={...Y,partialsDir:Y.partialsDir&&!E0.isAbsolute(Y.partialsDir)?E0.resolve(G,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!E0.isAbsolute(Y.componentsDir)?E0.resolve(G,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!E0.isAbsolute(Y.layoutsDir)?E0.resolve(G,Y.layoutsDir):Y.layoutsDir},w=Q,q=X;await dL(Z,$),uL($,w),q=await x5(()=>xJ(q,$,Z,w),q,(F)=>{X1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=Q1(q,D7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,K=(F)=>U.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>U[Number(A)]??""),z="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,z),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),q=eJ(q),q=await $Q(q,Z,J);let B={};q=F3(q,B);let _={...$.__sections||{}},j="",H=DZ(EZ(X)),O=/@nolayout\b/.test(q)||H===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)j=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(j=H,!/@section\s*\(/.test(q))q=`@section('content')
14385
+ `+U+Q.slice(K.end)}}catch{}if(G)Q=zG(Q);if(G&&$.__stx_inject_css!==!1)Q=await J9(Q,void 0,Y.buildMode==="serve");if(G)Q=UG(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof gX)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new Y5(`Template processing failed: ${w}`,Z,void 0,void 0,X.substring(0,200)+(X.length>200?"...":""));if($1.log(q,{filePath:Z,context:$}),j9.logDetailedError(q,{filePath:Z,template:X.substring(0,500)}),Y.debug)throw q;return _9.createFallbackContent("Template Processing",q)}}async function gL(X,$,Z,Y,J){let G=process.cwd(),Q={...Y,partialsDir:Y.partialsDir&&!E0.isAbsolute(Y.partialsDir)?E0.resolve(G,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!E0.isAbsolute(Y.componentsDir)?E0.resolve(G,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!E0.isAbsolute(Y.layoutsDir)?E0.resolve(G,Y.layoutsDir):Y.layoutsDir},w=Q,q=X;await dL(Z,$),uL($,w),q=await x5(()=>xJ(q,$,Z,w),q,(F)=>{$1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=Q1(q,D7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,K=(F)=>U.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>U[Number(A)]??""),z="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,z),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),q=eJ(q),q=await $Q(q,Z,J);let B={};q=F3(q,B);let _={...$.__sections||{}},j="",H=DZ(EZ(X)),O=/@nolayout\b/.test(q)||H===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)j=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(j=H,!/@section\s*\(/.test(q))q=`@section('content')
14381
14386
  ${q.trim()}
14382
14387
  @endsection`}if(!j&&!O&&w.defaultLayout){let F=S3(q),V=/@section\s*\(/.test(q);if(!F||V){let A="",R=E0.dirname(Z),T=w.layoutsDir?E0.dirname(w.layoutsDir):process.cwd();for(let M=0;M<20;M++){let k=E0.join(R,"_layout.stx");if(await i(k)){A=k;break}let N=E0.dirname(R);if(N===R||N.length<T.length)break;R=N}if(A)j=A;else if(w.layoutsDir){let M=E0.isAbsolute(w.layoutsDir)?w.layoutsDir:E0.resolve(process.cwd(),w.layoutsDir),k=E0.join(M,`${w.defaultLayout}.stx`);if(await i(k))j=k}if(j&&!V)q=`@section('content')
14383
14388
  ${q.trim()}
14384
14389
  @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return _[V]=A,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=Y0(A.trim(),$);if(R===void 0)return F;return _[V]=String(R??""),""}catch{return F}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))_[V]=A.replace("@parent",j5);else _[V]=A.trim();return""}),$.__sections=_,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return _[V]||A||""}),!("slot"in $)||$.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""});if(q=V3(q,B),j){let F=[],V=y1(q),A=Q1(V.output,b5,(R,T)=>`\x00STX_ORPHAN_STYLE_${T}\x00`);if(q=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,T,M)=>{let k=T==="SCRIPT"?V.scripts[Number(M)]:A.tokens[Number(M)];if(k)F.push(k);return""}),F.length>0){let R=F.join(`
14385
14390
  `);_.content=_.content?`${_.content}
14386
- ${R}`:R,$.__sections=_}}if(j)try{let F;if(E0.isAbsolute(j))F=j,J.add(j);else F=await x5(()=>H4(j,Z,Q,J),null,()=>{throw new Y5(`Failed to resolve layout path: ${j}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let k=[];try{let y=Q.layoutsDir;if(y){let I=E0.isAbsolute(y)?y:E0.resolve(process.cwd(),y);k=vL.readdirSync(I).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,"")).sort()}}catch{}let N=`Layout not found: ${j} (referenced from ${Z})`+(k.length>0?`. Available layouts: ${k.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(X1.log(Error(N),{layoutPath:j,filePath:Z,available:k},"error"),console.error(`[stx] ${N}`),Q.debug)throw new Y5(N,Z);return q}let V=await x5(()=>Bun.file(F).text(),"",()=>{throw new Y5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let k={},N=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(C,S,b)=>{return k[S]=b.trim(),""});for(let[C,S]of Object.entries(k))if(_[C]&&_[C].includes(j5)){let b=_[C].indexOf(j5);_[C]=_[C].slice(0,b)+S+_[C].slice(b+j5.length)}else if(!_[C])_[C]=S;let y={...$,__sections:_},I=`@layout('${A[1]}')${N}`;return await V0(I,y,F,Q,J)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),T=F3(R,B),M={};return T=T.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,N,y)=>{return M[N]=y.trim(),`@slot('${N}')`}),T=T.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,N,y)=>{if(_[N]){let I=_[N];if(I.includes(j5)){let C=M[N]||"",S=I.indexOf(j5);I=I.slice(0,S)+C+I.slice(S+j5.length)}return I}return y||""}),T=hL(T,_),T=T.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""}),T=V3(T,B),$.__originalFilePath=Z,q=await yw(T,$,F,Q,J),q=`<!-- stx-layout: ${j} -->
14387
- ${q}`,K(q)}catch(F){return X1.log(F instanceof Error?F:Error(String(F)),{layoutPath:j,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return K(await yw(q,$,Z,Q,J))}function hL(X,$){return X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=$[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function uL(X,$){if(X.__stx_sfc_mode=!0,X.__stx_options=$,$.buildMode)X.__stx_buildMode=$.buildMode;let Z=$.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;X.$env=Y}async function dL(X,$){await x5(()=>nJ(X,$),void 0,(Z)=>{X1.log(Z,{filePath:X,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${X}: ${Z.message}`)})}async function mL(X,$,Z){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (i5(),Q8)));await q(Q,$,Z,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));X1.log(W,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${W.message}`)}}}async function lL(X,$,Z){try{let{interpolateScriptsInTemplate:Y}=await e("stx/expressions",()=>Promise.resolve().then(() => (w1(),GZ)));return Y(X,$,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return X1.log(J,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${J.message}`),X}}async function yw(X,$,Z,Y,J){let G=X,Q=Y;if(await mL(G,$,Z),G=await lL(G,$,Z),G=await yJ(G,$,Z),G=await bJ(G,$,Z),G=await JY(G,$,Z,Q),L1(G))G=a3(G,$),G=e3(G,$);G=t3(G);let{processStreamDirectives:w}=await e("stx/streaming",()=>Promise.resolve().then(() => (v9(),P9)));G=w(G,$),G=j3(G,$,Z,Q),G=await JG(G,$,Z,Q,J),G=await G8(G,$,Z,Q,J),G=C2(G,$,Z,Q);let{processDeferDirectives:q}=await e("stx/defer",()=>Promise.resolve().then(() => LQ));G=q(G,$,Z);let{processTeleportDirectives:W}=await e("stx/teleport",()=>Promise.resolve().then(() => FQ));G=W(G,$,Z);let{processTransitionDirectives:U,processTransitionAttributes:K}=await e("stx/transitions",()=>Promise.resolve().then(() => TQ));G=U(G,$,Z),G=K(G);let{processErrorBoundaryDirectives:z}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => NQ));G=z(G,$,Z);let{processSuspenseDirectives:B}=await e("stx/suspense",()=>Promise.resolve().then(() => kQ));G=B(G,$,Z);let{processAsyncDirectives:_}=await e("stx/async-components",()=>Promise.resolve().then(() => yQ));G=_(G,$,Z);let{processKeepAliveDirectives:j}=await e("stx/keep-alive",()=>Promise.resolve().then(() => SQ));G=j(G,$,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:O,processInfiniteListDirectives:L}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (gQ(),fQ)));G=H(G,$,Z),G=O(G,$,Z),G=L(G,$,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (eQ(),tQ)));G=F(G,$,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await e("stx/computed",()=>Promise.resolve().then(() => (Kw(),Uw)));G=A(G,$,Z),G=R(G,$,Z);let{processFormValidationDirectives:T}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (Ow(),Lw)));G=T(G,$,Z);let{processHeadDirective:M,processTitleDirective:k,processMetaDirective:N,resetHead:y}=await e("stx/head",()=>Promise.resolve().then(() => (g7(),T9)));if(!$.__stx_head_preset&&!$.__stx_runtime_head)y();let I=M(G);if(G=I.content,I.headContent)$.__stx_head_raw=`${$.__stx_head_raw||""}${I.headContent}
14391
+ ${R}`:R,$.__sections=_}}if(j)try{let F;if(E0.isAbsolute(j))F=j,J.add(j);else F=await x5(()=>H4(j,Z,Q,J),null,()=>{throw new Y5(`Failed to resolve layout path: ${j}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let k=[];try{let y=Q.layoutsDir;if(y){let I=E0.isAbsolute(y)?y:E0.resolve(process.cwd(),y);k=vL.readdirSync(I).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,"")).sort()}}catch{}let N=`Layout not found: ${j} (referenced from ${Z})`+(k.length>0?`. Available layouts: ${k.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if($1.log(Error(N),{layoutPath:j,filePath:Z,available:k},"error"),console.error(`[stx] ${N}`),Q.debug)throw new Y5(N,Z);return q}let V=await x5(()=>Bun.file(F).text(),"",()=>{throw new Y5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let k={},N=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(C,S,b)=>{return k[S]=b.trim(),""});for(let[C,S]of Object.entries(k))if(_[C]&&_[C].includes(j5)){let b=_[C].indexOf(j5);_[C]=_[C].slice(0,b)+S+_[C].slice(b+j5.length)}else if(!_[C])_[C]=S;let y={...$,__sections:_},I=`@layout('${A[1]}')${N}`;return await V0(I,y,F,Q,J)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),T=F3(R,B),M={};return T=T.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,N,y)=>{return M[N]=y.trim(),`@slot('${N}')`}),T=T.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,N,y)=>{if(_[N]){let I=_[N];if(I.includes(j5)){let C=M[N]||"",S=I.indexOf(j5);I=I.slice(0,S)+C+I.slice(S+j5.length)}return I}return y||""}),T=hL(T,_),T=T.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""}),T=V3(T,B),$.__originalFilePath=Z,q=await yw(T,$,F,Q,J),q=`<!-- stx-layout: ${j} -->
14392
+ ${q}`,K(q)}catch(F){return $1.log(F instanceof Error?F:Error(String(F)),{layoutPath:j,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return K(await yw(q,$,Z,Q,J))}function hL(X,$){return X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=$[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function uL(X,$){if(X.__stx_sfc_mode=!0,X.__stx_options=$,$.buildMode)X.__stx_buildMode=$.buildMode;let Z=$.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;X.$env=Y}async function dL(X,$){await x5(()=>nJ(X,$),void 0,(Z)=>{$1.log(Z,{filePath:X,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${X}: ${Z.message}`)})}async function mL(X,$,Z){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (i5(),Q8)));await q(Q,$,Z,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));$1.log(W,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${W.message}`)}}}async function lL(X,$,Z){try{let{interpolateScriptsInTemplate:Y}=await e("stx/expressions",()=>Promise.resolve().then(() => (w1(),GZ)));return Y(X,$,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return $1.log(J,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${J.message}`),X}}async function yw(X,$,Z,Y,J){let G=X,Q=Y;if(await mL(G,$,Z),G=await lL(G,$,Z),G=await yJ(G,$,Z),G=await bJ(G,$,Z),G=await JY(G,$,Z,Q),L1(G))G=a3(G,$),G=e3(G,$);G=t3(G);let{processStreamDirectives:w}=await e("stx/streaming",()=>Promise.resolve().then(() => (v9(),P9)));G=w(G,$),G=j3(G,$,Z,Q),G=await JG(G,$,Z,Q,J),G=await G8(G,$,Z,Q,J),G=C2(G,$,Z,Q);let{processDeferDirectives:q}=await e("stx/defer",()=>Promise.resolve().then(() => LQ));G=q(G,$,Z);let{processTeleportDirectives:W}=await e("stx/teleport",()=>Promise.resolve().then(() => FQ));G=W(G,$,Z);let{processTransitionDirectives:U,processTransitionAttributes:K}=await e("stx/transitions",()=>Promise.resolve().then(() => TQ));G=U(G,$,Z),G=K(G);let{processErrorBoundaryDirectives:z}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => NQ));G=z(G,$,Z);let{processSuspenseDirectives:B}=await e("stx/suspense",()=>Promise.resolve().then(() => kQ));G=B(G,$,Z);let{processAsyncDirectives:_}=await e("stx/async-components",()=>Promise.resolve().then(() => yQ));G=_(G,$,Z);let{processKeepAliveDirectives:j}=await e("stx/keep-alive",()=>Promise.resolve().then(() => SQ));G=j(G,$,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:O,processInfiniteListDirectives:L}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (gQ(),fQ)));G=H(G,$,Z),G=O(G,$,Z),G=L(G,$,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (eQ(),tQ)));G=F(G,$,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await e("stx/computed",()=>Promise.resolve().then(() => (Kw(),Uw)));G=A(G,$,Z),G=R(G,$,Z);let{processFormValidationDirectives:T}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (Ow(),Lw)));G=T(G,$,Z);let{processHeadDirective:M,processTitleDirective:k,processMetaDirective:N,resetHead:y}=await e("stx/head",()=>Promise.resolve().then(() => (g7(),T9)));if(!$.__stx_head_preset&&!$.__stx_runtime_head)y();let I=M(G);if(G=I.content,I.headContent)$.__stx_head_raw=`${$.__stx_head_raw||""}${I.headContent}
14388
14393
  `;if(G=k(G,$),G=N(G,$),G=hJ(G),G=L9(G,$),G=ZY(G),G=PJ(G),G=await O3(G,$,Z,Q,J),G=await G8(G,$,Z,Q,J),$.__stxProcessingDepth===1)G=d6(G,$);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=Y4(G),G=G5(G,$,Z),G=O9(G,$),G=F9(G,$),G=nX(G,$),G=BY(G,$),G=jY(G,$),G=await vZ(G,$,Z,Q),G=await bw(G,$,Z),G=await VY(G,$,Z,Q),G=k2(G,$,Z,Q),G=dJ(G,$,Z,Q),G=mJ(G,$,Z),G=lJ(G,$,Z,Q),G=eZ(G,$,Z,Q),G=$4(G,$),G=Z4(G),G=YQ(G),!Q.skipEventDirectives)G=O6(G,$,Z);if(G=CZ(G,$,Z),Q.debug){let r=/\bx-data\s*=/.test(G),a=E8(X);if(r&&a)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
14389
14394
  Both work on the same page, but they manage separate scopes.
14390
14395
  Prefer signals (state/derived/effect) for new components.`)}G=oJ(G,$),G=await b1(G,$,Z),G=JQ(G),G=GQ(G),G=MZ(G);let{processXElementDirectives:C}=await e("stx/x-element",()=>Promise.resolve().then(() => Aw));G=C(G);let S=$.__originalFilePath||Z,b=a1($);if(G=await X4(G,Q,S,b),G=WY(G,$),G=await fJ(G,$,Z,Q),Q.media?.image?.autoSiblings){let r=Q.publicDir||"public",{rewriteImagesWithSiblings:a}=await e("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (Tw(),Rw)));G=await a(G,{publicDir:r})}if(Q.seo?.enabled)G=cJ(G,$,Q);let P=(r,a,U0=!0)=>{if(!a)return r;let M0=a.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),w0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(M0&&w0){if(U0)r=r.replace(w0[0],M0[0]);if(a=a.replace(M0[0],"").trim(),!a)return r}if(/<\/head>/i.test(r))return r.replace(/<\/head>/i,`${a}
@@ -14392,22 +14397,23 @@ ${q}`,K(q)}catch(F){return X1.log(F instanceof Error?F:Error(String(F)),{layoutP
14392
14397
  ${a}`);if(/<html\b[^>]*>/i.test(r))return r.replace(/(<html\b[^>]*>)/i,`$1
14393
14398
  <head>
14394
14399
  ${a}
14395
- </head>`);return r},{renderHead:x,getHead:m}=await e("stx/head",()=>Promise.resolve().then(() => (g7(),T9))),Q0=$.__stx_runtime_head??m();if(Q0.title||Q0.meta?.length||Q0.link?.length){let r=x(Q0);if(r)G=P(G,r)}if(I.headContent)G=P(G,I.headContent,!Q0.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=aZ(G,Q.csp,$);if(Q.analytics?.enabled)G=kZ(G,Q);if(Q.heatmap?.enabled)G=J6(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:r}=await e("stx/pwa/inject",()=>Promise.resolve().then(() => (Iw(),kw)));G=r(G,Q)}let l0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),R0=/\bSTX\.\w+/.test(G),r0=/window\.STX\s*=/.test(G);if(l0&&R0&&!r0){let a=`<script data-stx-scoped data-stx-run="once">
14400
+ </head>`);return r},{renderHead:x,getHead:m}=await e("stx/head",()=>Promise.resolve().then(() => (g7(),T9))),Q0=$.__stx_runtime_head??m();if(Q0.title||Q0.meta?.length||Q0.link?.length){let r=x(Q0);if(r)G=P(G,r)}if(I.headContent)G=P(G,I.headContent,!Q0.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=aZ(G,Q.csp,$);if(Q.analytics?.enabled)G=kZ(G,Q);if(Q.heatmap?.enabled)G=J6(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:r}=await e("stx/pwa/inject",()=>Promise.resolve().then(() => (Iw(),kw)));G=r(G,Q)}let l0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),R0=/\bSTX\.\w+/.test(G),s0=/window\.STX\s*=/.test(G);if(l0&&R0&&!s0){let a=`<script data-stx-scoped data-stx-run="once">
14396
14401
  ${VZ()}
14397
14402
  </script>`;if(G.includes("</head>")){let U0=G.indexOf("</head>"),w0=G.slice(0,U0).indexOf("<script");if(w0!==-1){let E=G.slice(0,w0),v=G.slice(w0);G=E+a+`
14398
14403
  `+v}else G=G.replace("</head>",`${a}
14399
14404
  </head>`)}else if(G.includes("<body"))G=G.replace(/<body([^>]*)>/,`<body$1>
14400
14405
  ${a}`);else G=a+`
14401
14406
  `+G}{let{scanScriptTags:r}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (o7(),D8))),a=[];for(let U0 of r(G)){if(!/\bserver\b/i.test(U0.attrs))continue;let M0=U0.start+U0.fullMatch.indexOf(">")+1,w0=xL(G,M0);if(w0===-1)continue;let E=w0+9;while(E<G.length&&/\s/.test(G[E]))E++;a.push({start:U0.start,end:E})}for(let U0=a.length-1;U0>=0;U0--){let{start:M0,end:w0}=a[U0];G=G.substring(0,M0)+G.substring(w0)}}let c=K8(G,Z);if(c.hasScoped)G=c.html;let j0=$.__stx_event_bindings||[],c0=!1,M1=[],O5=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:F5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (o7(),D8)));for(let r of F5(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))M1.push({match:r.fullMatch,attrs:r.attrs,content:r.body});for(let{match:r,attrs:a,content:U0}of M1){c0=!0;let M0=U0;G4(U0,Z,Y.strict,$.__originalFilePath);let w0=await t1(U0,{eventBindings:j0,attrs:a,hasColonDirectives:O5,templateContent:X,filePath:Z,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:b});G=G.replace(r,()=>w0)}if(c0)$.__stx_event_bindings=[];if(!c0&&$.__stxProcessingDepth===1){let r=$.__stx_event_bindings||[];if(r.length>0){let a=d$(r);if(a){let U0=G.lastIndexOf("</body>");G=U0===-1?G+a:G.slice(0,U0)+a+`
14402
- `+G.slice(U0)}$.__stx_event_bindings=[]}}if(!uG(G)&&dG(G))G=await M8(G,Q);if(Q.csp?.enabled&&Q.csp.useNonce&&typeof $.cspNonce==="string")G=tZ(G,$.cspNonce);return G}var j5="<!--PARENT_CONTENT_PLACEHOLDER-->";var oX=D(()=>{G9();w9();$5();L$();AZ();NZ();IZ();f$();O$();m$();y5();PZ();xZ();mX();XY();YY();QY();UY();F1();g7();w1();HY();AY();DJ();CJ();H3();L4();gJ();P5();uJ();R3();T0();rJ();aJ();XG();GG();k3();D3();AG();o7();U3();ZQ();J4();Q4();F0();f9();s$();V7();N8();N8();J4();Q4()});var Sw=()=>{};var O4={};t(O4,{renderSlot:()=>Pw,processSlots:()=>xw,parseSlots:()=>Cw,parseSlotElement:()=>rL,extractSlotContent:()=>aL,applySlots:()=>tL});function cL(X,$){let Z=1,Y=$,J="<template",G="</template";while(Y<X.length&&Z>0){let Q=X.indexOf("<",Y);if(Q===-1)break;if(Y=Q,X.startsWith(J,Y)&&(Y+J.length>=X.length||/[\s>\/]/.test(X[Y+J.length]))){Z++,Y+=J.length;continue}if(X.startsWith(G,Y)){let w=X.indexOf(">",Y+G.length);if(w!==-1){if(Z--,Z===0)return w+1;Y=w+1;continue}}Y++}return Z===0?Y:-1}function iL(X,$){let Z=null;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function nL(X){let $=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;if(X.startsWith("<!--",G)){let z=X.indexOf("-->",G+4);J=z===-1?X.length:z+3;continue}let Q=iL(X,G+1);if(Q===-1)break;let w=X.slice(G,Q),q=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){J=Q;continue}let W=q[1]==="/",U=q[2].toLowerCase();if(W){let z=Z.lastIndexOf(U);if(z!==-1)Z.splice(z);J=Q;continue}if(U==="template"&&Z.length===0){let z=w.match(Y);if(z){let B=cL(X,Q);if(B!==-1){let _=z[1]||z[2]||z[3];$.push({start:G,end:B,slotName:_,content:X.slice(Q,B-11).trim(),propsBinding:z[4]||void 0}),J=B;continue}}}if(!/\/\s*>$/.test(w)&&!pL.has(U)){if(Z.push(U),U==="script"||U==="style"){let z=X.toLowerCase().indexOf(`</${U}>`,Q);if(z!==-1){J=z;continue}}}J=Q}return $}function Cw(X){let $={default:"",named:new Map},Z=X,Y=nL(X);for(let q of Y)$.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});Y.sort((q,W)=>W.start-q.start);for(let q of Y)Z=Z.slice(0,q.start)+Z.slice(q.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[q,W,U,K,z,B]=Q,_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+j).trim(),O=`<${W}${H?" "+H:""}>${B}</${W}>`;J.push({start:Q.index,end:Q.index+q.length,slotName:K,element:O})}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=w.exec(Z))!==null){let[q,W,U,K,z]=Q,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=(B+_).trim(),H=`<${W}${j?" "+j:""} />`;J.push({start:Q.index,end:Q.index+q.length,slotName:K,element:H})}J.sort((q,W)=>W.start-q.start);for(let q of J){let W=$.named.get(q.slotName);if(W)W.content+=q.element;else $.named.set(q.slotName,{name:q.slotName,content:q.element});Z=Z.slice(0,q.start)+Z.slice(q.end)}return $.default=Z.trim(),$}function rL(X){let $=X.match(/name\s*=\s*["']([^"']+)["']/),Z=$?$[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec(X))!==null)Y[G[1]]=G[2];let Q=X.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),w=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:w}}async function Pw(X,$,Z,Y){if(!X)return Z;let J=X.content;if(X.propsBinding&&Object.keys($).length>0){let G=X.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let w=G.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of w){let[W,U]=q.split(":").map((z)=>z.trim()),K=U||W;if($[W]!==void 0)Q[K]=$[W]}}else Q[G]=$;J=sL(J,Q)}return J}function sL(X,$){return X.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=vw(J,$);return a0(String(G??""))}catch{return`{{ ${Y} }}`}})}function vw(X,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(X)){let Y=X.split("."),J=$;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=X.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=$[Y],w=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+w;case"-":return Q-w;case"*":return Q*w;case"/":return Q/w}}try{if(!q0(X))return;return W0(X,Object.keys($))(...Object.values($))}catch{return}}async function xw(X,$,Z){let Y=X;Y=await oL(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,w,q,W)=>{let U=$.named.get(w),K=W?.trim()||"",z=q||"",B={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,j;while((j=_.exec(z))!==null){let H=j[1],O=j[2];B[H]=vw(O,Z)}return await Pw(U,B,K,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,w)=>{if(Q.includes("name="))return Q;let q=w?.trim()||"";return $.default||q}),Y}async function oL(X,$,Z){let Y=[],J=[];X.replace($,(w,...q)=>{let W=q[q.length-2];return J.push({match:w,index:W}),Y.push(Z(w,...q.slice(0,-2))),w});let G=await Promise.all(Y),Q=X;for(let w=J.length-1;w>=0;w--){let{match:q,index:W}=J[w];Q=Q.slice(0,W)+G[w]+Q.slice(W+q.length)}return Q}function aL(X){let $=Cw(X);return{defaultSlot:$.default,namedSlots:$.named}}async function tL(X,$,Z,Y){return await xw(X,{default:$,named:Z},Y)}var pL;var F4=D(()=>{w1();F0();pL=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import eL from"fs";import g from"path";function $O(X){let $=new WeakSet;try{let Z=(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($.has(Y))throw TypeError("Circular component input");if($.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(Z);let J={};for(let G of Object.keys(Y).sort())J[G]=Z(Y[G]);return J};return JSON.stringify(Z(X))}catch{return null}}function fw(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ZO(X){return/\bjs\b/.test(X)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(X)}function e1(X){return!ZO(X)}function X5(X){try{let $=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");$=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];$=$.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}).transformSync($);for(let G=0;G<Z.length;G++)J=J.replace(`"__STX_EXPR_${G}__"`,Z[G]),J=J.replace(`'__STX_EXPR_${G}__'`,Z[G]);return J}catch($){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",$);return X}}function YO(X){let $=[],Z=new Set,Y=0,J=0,G=X.length,Q=(U)=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]===U){J++;return}J++}},w=()=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]==="`"){J++;return}if(X[J]==="$"&&X[J+1]==="{"){J+=2;let U=1;while(J<G&&U>0)if(X[J]==="{")U++,J++;else if(X[J]==="}")U--,J++;else if(X[J]==="'"||X[J]==='"')Q(X[J]);else if(X[J]==="`")w();else J++;continue}J++}},q=()=>{if(X[J]==="/"&&X[J+1]==="/"){while(J<G&&X[J]!==`
14403
- `)J++;return!0}if(X[J]==="/"&&X[J+1]==="*"){J+=2;while(J<G-1&&!(X[J]==="*"&&X[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(Y!==0)return;let U=X.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let _=U[2].split(",").map((j)=>{let H=j.trim().split(":");return H[H.length-1].trim()});for(let j of _)if(j&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(j)&&!Z.has(j))$.push(j),Z.add(j);return}let K=X.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let _=K[2];if(!Z.has(_))$.push(_),Z.add(_);return}let z=X.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let _=z[1];if(!Z.has(_))$.push(_),Z.add(_);return}let B=X.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let _=B[1];if(!Z.has(_))$.push(_),Z.add(_)}};while(J<G){if(q())continue;if(X[J]==="'"||X[J]==='"'){Q(X[J]);continue}if(X[J]==="`"){w();continue}if(X[J]==="{"){Y++,J++;continue}if(X[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test(X[J])&&(J===0||/\s|[;{}()]/.test(X[J-1])))W();J++}return $}function JO(X){let $=[],Z=0,Y=0,J=null;for(let G=0;G<X.length;G++){let Q=X[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)$.push(X.slice(Y,G)),Y=G+1}if(Y<X.length)$.push(X.slice(Y));return $}function GO(X){let $=0,Z=null;for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")$++;else if(J===")"||J==="]"||J==="}")$--;else if(J==="="&&$===0){let G=X[Y-1],Q=X[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function QO(X,$){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(X);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test(X[Y]))Y--;if(X[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let q=X[Y];if(q==="}")G++;else if(q==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let w=X.slice(Q+1,J);for(let q of JO(w)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=GO(W);if(U===-1)continue;let K=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if($[K]!==void 0)continue;let z=W.slice(U+1).trim();if(!z)continue;try{let B=Object.keys($),_=Function(...B,`"use strict"; return (${z});`);$[K]=_(...B.map((j)=>$[j]))}catch{}}}catch{}}async function Y8(X,$,Z,Y,J){let G=X.endsWith(".stx")?X.slice(0,-4):X,Q=(H)=>H.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),w=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Z.__importedComponents;if(q){for(let H of[G,G.toLowerCase(),Q(G),w(G)])if(q.has(H))return!0}let W=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${w(G)}.stx`])],U=typeof J.root==="string"?g.resolve(J.root):void 0,K=U??g.dirname(Y),z=[],B=(H)=>{if(H&&!z.includes(H))z.push(H)},_=Z.__originalFilePath;if(_)B(g.join(g.dirname(_),"components"));B($),B(J._rootComponentsDir),B(g.join(g.dirname(Y),"components")),B(J.componentsDir);let j=J._pluginComponentDirs;if(Array.isArray(j))for(let H of j)B(typeof H==="string"?H:null);if(U)B(g.resolve(U,"resources/views/components")),B(g.resolve(U,"resources/components")),B(g.resolve(U,"src/components")),B(g.resolve(U,"components"));if(G.startsWith("./")||G.startsWith("../"))return i(g.resolve(g.dirname(Y),`${G}.stx`));for(let H of z){let O=g.isAbsolute(H)?H:g.resolve(K,H);for(let L of W)if(await i(g.join(O,L)))return!0}return!1}function wO(X){return X==="visible"||X==="idle"||X==="interaction"||X.startsWith("media:")}function qO(X){if(!X)return!1;let $=X.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test($)}function WO(X){let $=new Set,Z=/\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 X){let J;while((J=Z.exec(Y))!==null)$.add(J[1]);Z.lastIndex=0}return[...$]}async function U5(X,$,Z,Y,J,G,Q,w=new Set,q){let{extractVariables:W}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (i5(),Q8))),U=w??new Set;if(U.has(X))return`[Circular component reference: ${X}]`;let K=new Set(U);K.add(X);let z=typeof $.client==="string"?$.client.trim():"";if("client"in $)delete $.client;let B=z&&z!=="load"&&wO(z)?z:"";try{let _=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=X.endsWith(".stx")?X.slice(0,-4):X,O=null,L=J.__importedComponents;if(L){let E=[H,H.toLowerCase(),_(H),j(H)];for(let v of E)if(L.has(v)){O=L.get(v);break}}let F=[];if(!O){let E=[`${H}.stx`,`${_(H)}.stx`,`${j(H)}.stx`],v=[...new Set(E)],d=J.__originalFilePath,f=[];if(d){let z0=g.join(g.dirname(d),"components");f.push(z0)}if(Y)f.push(Y);let s=Q._rootComponentsDir;if(typeof s==="string"&&!f.includes(s))f.push(s);let G0=g.join(g.dirname(G),"components");if(!f.includes(G0))f.push(G0);if(Q.componentsDir&&Q.componentsDir!==Y&&!f.includes(Q.componentsDir))f.push(Q.componentsDir);let s0=Q._pluginComponentDirs;if(Array.isArray(s0)){for(let z0 of s0)if(typeof z0==="string"&&!f.includes(z0))f.push(z0)}let S0=typeof Q.root==="string"?g.resolve(Q.root):void 0,f0=S0??g.dirname(G),o0=[];if(S0)o0.push(g.resolve(S0,"resources/views/components")),o0.push(g.resolve(S0,"resources/components")),o0.push(g.resolve(S0,"src/components")),o0.push(g.resolve(S0,"components"));o0.push(g.resolve(import.meta.dir,"components"));for(let z0 of o0)if(!f.includes(z0))f.push(z0);let V5=[...new Set(f.map((z0)=>{if(!z0)return z0;return g.isAbsolute(z0)?z0:g.resolve(f0,z0)}))];f.length=0,f.push(...V5);let N1=`${H}\x00${G}\x00${V5.join("\x00")}`,k1=f8.get(N1);if(k1)if(await i(k1))O=k1;else f8.delete(N1);if(!O&&(H.startsWith("./")||H.startsWith("../")))O=g.resolve(g.dirname(G),`${H}.stx`),F.push(O);else if(!O)for(let z0 of f){if(!z0)continue;for(let Z1 of v){let n=g.join(z0,Z1);if(F.push(n),await i(n)){O=n;break}}if(O)break;if(!O)try{let Z1=await import("fs");if(!Z1.statSync(z0,{throwIfNoEntry:!1})?.isDirectory())continue;let Y1=8,i1=[{path:z0,depth:0}];while(i1.length>0&&!O){let z1=i1.pop();if(z1.depth>=Y1)continue;let GX;try{GX=Z1.readdirSync(z1.path,{withFileTypes:!0})}catch{continue}for(let QX of GX){if(!QX.isDirectory())continue;if(QX.name==="node_modules"||QX.name.startsWith("."))continue;let Y2=g.join(z1.path,QX.name);for(let XW of v){let z$=g.join(Y2,XW);if(F.push(z$),await i(z$)){O=z$;break}}if(O)break;i1.push({path:Y2,depth:z1.depth+1})}}}catch{}if(O)break}if(O)f8.set(N1,O)}if(!O||!await i(O)){let E=F.length>0?`
14407
+ `+G.slice(U0)}$.__stx_event_bindings=[]}}if(!uG(G)&&dG(G))G=await M8(G,Q);if(Q.csp?.enabled&&Q.csp.useNonce&&typeof $.cspNonce==="string")G=tZ(G,$.cspNonce);return G}var j5="<!--PARENT_CONTENT_PLACEHOLDER-->";var oX=D(()=>{G9();w9();$5();L$();AZ();NZ();IZ();f$();O$();m$();y5();PZ();xZ();mX();XY();YY();QY();UY();F1();g7();w1();HY();AY();DJ();CJ();H3();L4();gJ();P5();uJ();R3();T0();rJ();aJ();XG();GG();k3();D3();AG();o7();U3();ZQ();J4();Q4();F0();f9();s$();V7();N8();N8();J4();Q4()});var Sw=()=>{};var O4={};t(O4,{renderSlot:()=>Pw,processSlots:()=>xw,parseSlots:()=>Cw,parseSlotElement:()=>rL,extractSlotContent:()=>aL,applySlots:()=>tL});function cL(X,$){let Z=1,Y=$,J="<template",G="</template";while(Y<X.length&&Z>0){let Q=X.indexOf("<",Y);if(Q===-1)break;if(Y=Q,X.startsWith(J,Y)&&(Y+J.length>=X.length||/[\s>\/]/.test(X[Y+J.length]))){Z++,Y+=J.length;continue}if(X.startsWith(G,Y)){let w=X.indexOf(">",Y+G.length);if(w!==-1){if(Z--,Z===0)return w+1;Y=w+1;continue}}Y++}return Z===0?Y:-1}function iL(X,$){let Z=null;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function nL(X){let $=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;if(X.startsWith("<!--",G)){let z=X.indexOf("-->",G+4);J=z===-1?X.length:z+3;continue}let Q=iL(X,G+1);if(Q===-1)break;let w=X.slice(G,Q),q=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){J=Q;continue}let W=q[1]==="/",U=q[2].toLowerCase();if(W){let z=Z.lastIndexOf(U);if(z!==-1)Z.splice(z);J=Q;continue}if(U==="template"&&Z.length===0){let z=w.match(Y);if(z){let B=cL(X,Q);if(B!==-1){let _=z[1]||z[2]||z[3];$.push({start:G,end:B,slotName:_,content:X.slice(Q,B-11).trim(),propsBinding:z[4]||void 0}),J=B;continue}}}if(!/\/\s*>$/.test(w)&&!pL.has(U)){if(Z.push(U),U==="script"||U==="style"){let z=X.toLowerCase().indexOf(`</${U}>`,Q);if(z!==-1){J=z;continue}}}J=Q}return $}function Cw(X){let $={default:"",named:new Map},Z=X,Y=nL(X);for(let q of Y)$.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});Y.sort((q,W)=>W.start-q.start);for(let q of Y)Z=Z.slice(0,q.start)+Z.slice(q.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[q,W,U,K,z,B]=Q,_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+j).trim(),O=`<${W}${H?" "+H:""}>${B}</${W}>`;J.push({start:Q.index,end:Q.index+q.length,slotName:K,element:O})}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=w.exec(Z))!==null){let[q,W,U,K,z]=Q,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=(B+_).trim(),H=`<${W}${j?" "+j:""} />`;J.push({start:Q.index,end:Q.index+q.length,slotName:K,element:H})}J.sort((q,W)=>W.start-q.start);for(let q of J){let W=$.named.get(q.slotName);if(W)W.content+=q.element;else $.named.set(q.slotName,{name:q.slotName,content:q.element});Z=Z.slice(0,q.start)+Z.slice(q.end)}return $.default=Z.trim(),$}function rL(X){let $=X.match(/name\s*=\s*["']([^"']+)["']/),Z=$?$[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec(X))!==null)Y[G[1]]=G[2];let Q=X.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),w=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:w}}async function Pw(X,$,Z,Y){if(!X)return Z;let J=X.content;if(X.propsBinding&&Object.keys($).length>0){let G=X.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let w=G.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of w){let[W,U]=q.split(":").map((z)=>z.trim()),K=U||W;if($[W]!==void 0)Q[K]=$[W]}}else Q[G]=$;J=sL(J,Q)}return J}function sL(X,$){return X.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=vw(J,$);return t0(String(G??""))}catch{return`{{ ${Y} }}`}})}function vw(X,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(X)){let Y=X.split("."),J=$;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=X.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=$[Y],w=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+w;case"-":return Q-w;case"*":return Q*w;case"/":return Q/w}}try{if(!q0(X))return;return W0(X,Object.keys($))(...Object.values($))}catch{return}}async function xw(X,$,Z){let Y=X;Y=await oL(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,w,q,W)=>{let U=$.named.get(w),K=W?.trim()||"",z=q||"",B={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,j;while((j=_.exec(z))!==null){let H=j[1],O=j[2];B[H]=vw(O,Z)}return await Pw(U,B,K,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,w)=>{if(Q.includes("name="))return Q;let q=w?.trim()||"";return $.default||q}),Y}async function oL(X,$,Z){let Y=[],J=[];X.replace($,(w,...q)=>{let W=q[q.length-2];return J.push({match:w,index:W}),Y.push(Z(w,...q.slice(0,-2))),w});let G=await Promise.all(Y),Q=X;for(let w=J.length-1;w>=0;w--){let{match:q,index:W}=J[w];Q=Q.slice(0,W)+G[w]+Q.slice(W+q.length)}return Q}function aL(X){let $=Cw(X);return{defaultSlot:$.default,namedSlots:$.named}}async function tL(X,$,Z,Y){return await xw(X,{default:$,named:Z},Y)}var pL;var F4=D(()=>{w1();F0();pL=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import eL from"fs";import g from"path";function $O(X){let $=new WeakSet;try{let Z=(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($.has(Y))throw TypeError("Circular component input");if($.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(Z);let J={};for(let G of Object.keys(Y).sort())J[G]=Z(Y[G]);return J};return JSON.stringify(Z(X))}catch{return null}}function fw(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ZO(X){return/\bjs\b/.test(X)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(X)}function e1(X){return!ZO(X)}function X5(X){try{let $=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");$=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];$=$.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}).transformSync($);for(let G=0;G<Z.length;G++)J=J.replace(`"__STX_EXPR_${G}__"`,Z[G]),J=J.replace(`'__STX_EXPR_${G}__'`,Z[G]);return J}catch($){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",$);return X}}function YO(X){let $=[],Z=new Set,Y=0,J=0,G=X.length,Q=(U)=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]===U){J++;return}J++}},w=()=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]==="`"){J++;return}if(X[J]==="$"&&X[J+1]==="{"){J+=2;let U=1;while(J<G&&U>0)if(X[J]==="{")U++,J++;else if(X[J]==="}")U--,J++;else if(X[J]==="'"||X[J]==='"')Q(X[J]);else if(X[J]==="`")w();else J++;continue}J++}},q=()=>{if(X[J]==="/"&&X[J+1]==="/"){while(J<G&&X[J]!==`
14408
+ `)J++;return!0}if(X[J]==="/"&&X[J+1]==="*"){J+=2;while(J<G-1&&!(X[J]==="*"&&X[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(Y!==0)return;let U=X.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let _=U[2].split(",").map((j)=>{let H=j.trim().split(":");return H[H.length-1].trim()});for(let j of _)if(j&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(j)&&!Z.has(j))$.push(j),Z.add(j);return}let K=X.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let _=K[2];if(!Z.has(_))$.push(_),Z.add(_);return}let z=X.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let _=z[1];if(!Z.has(_))$.push(_),Z.add(_);return}let B=X.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let _=B[1];if(!Z.has(_))$.push(_),Z.add(_)}};while(J<G){if(q())continue;if(X[J]==="'"||X[J]==='"'){Q(X[J]);continue}if(X[J]==="`"){w();continue}if(X[J]==="{"){Y++,J++;continue}if(X[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test(X[J])&&(J===0||/\s|[;{}()]/.test(X[J-1])))W();J++}return $}function JO(X){let $=[],Z=0,Y=0,J=null;for(let G=0;G<X.length;G++){let Q=X[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)$.push(X.slice(Y,G)),Y=G+1}if(Y<X.length)$.push(X.slice(Y));return $}function GO(X){let $=0,Z=null;for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")$++;else if(J===")"||J==="]"||J==="}")$--;else if(J==="="&&$===0){let G=X[Y-1],Q=X[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function QO(X,$){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(X);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test(X[Y]))Y--;if(X[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let q=X[Y];if(q==="}")G++;else if(q==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let w=X.slice(Q+1,J);for(let q of JO(w)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=GO(W);if(U===-1)continue;let K=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if($[K]!==void 0)continue;let z=W.slice(U+1).trim();if(!z)continue;try{let B=Object.keys($),_=Function(...B,`"use strict"; return (${z});`);$[K]=_(...B.map((j)=>$[j]))}catch{}}}catch{}}async function Y8(X,$,Z,Y,J){let G=X.endsWith(".stx")?X.slice(0,-4):X,Q=(H)=>H.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),w=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Z.__importedComponents;if(q){for(let H of[G,G.toLowerCase(),Q(G),w(G)])if(q.has(H))return!0}let W=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${w(G)}.stx`])],U=typeof J.root==="string"?g.resolve(J.root):void 0,K=U??g.dirname(Y),z=[],B=(H)=>{if(H&&!z.includes(H))z.push(H)},_=Z.__originalFilePath;if(_)B(g.join(g.dirname(_),"components"));B($),B(J._rootComponentsDir),B(g.join(g.dirname(Y),"components")),B(J.componentsDir);let j=J._pluginComponentDirs;if(Array.isArray(j))for(let H of j)B(typeof H==="string"?H:null);if(U)B(g.resolve(U,"resources/views/components")),B(g.resolve(U,"resources/components")),B(g.resolve(U,"src/components")),B(g.resolve(U,"components"));if(G.startsWith("./")||G.startsWith("../"))return i(g.resolve(g.dirname(Y),`${G}.stx`));for(let H of z){let O=g.isAbsolute(H)?H:g.resolve(K,H);for(let L of W)if(await i(g.join(O,L)))return!0}return!1}function wO(X){return X==="visible"||X==="idle"||X==="interaction"||X.startsWith("media:")}function qO(X){if(!X)return!1;let $=X.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test($)}function WO(X){let $=new Set,Z=/\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 X){let J;while((J=Z.exec(Y))!==null)$.add(J[1]);Z.lastIndex=0}return[...$]}async function U5(X,$,Z,Y,J,G,Q,w=new Set,q){let{extractVariables:W}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (i5(),Q8))),U=w??new Set;if(U.has(X))return`[Circular component reference: ${X}]`;let K=new Set(U);K.add(X);let z=typeof $.client==="string"?$.client.trim():"";if("client"in $)delete $.client;let B=z&&z!=="load"&&wO(z)?z:"";try{let _=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=X.endsWith(".stx")?X.slice(0,-4):X,O=null,L=J.__importedComponents;if(L){let E=[H,H.toLowerCase(),_(H),j(H)];for(let v of E)if(L.has(v)){O=L.get(v);break}}let F=[];if(!O){let E=[`${H}.stx`,`${_(H)}.stx`,`${j(H)}.stx`],v=[...new Set(E)],d=J.__originalFilePath,f=[];if(d){let z0=g.join(g.dirname(d),"components");f.push(z0)}if(Y)f.push(Y);let s=Q._rootComponentsDir;if(typeof s==="string"&&!f.includes(s))f.push(s);let G0=g.join(g.dirname(G),"components");if(!f.includes(G0))f.push(G0);if(Q.componentsDir&&Q.componentsDir!==Y&&!f.includes(Q.componentsDir))f.push(Q.componentsDir);let o0=Q._pluginComponentDirs;if(Array.isArray(o0)){for(let z0 of o0)if(typeof z0==="string"&&!f.includes(z0))f.push(z0)}let S0=typeof Q.root==="string"?g.resolve(Q.root):void 0,f0=S0??g.dirname(G),a0=[];if(S0)a0.push(g.resolve(S0,"resources/views/components")),a0.push(g.resolve(S0,"resources/components")),a0.push(g.resolve(S0,"src/components")),a0.push(g.resolve(S0,"components"));a0.push(g.resolve(import.meta.dir,"components"));for(let z0 of a0)if(!f.includes(z0))f.push(z0);let V5=[...new Set(f.map((z0)=>{if(!z0)return z0;return g.isAbsolute(z0)?z0:g.resolve(f0,z0)}))];f.length=0,f.push(...V5);let N1=`${H}\x00${G}\x00${V5.join("\x00")}`,k1=f8.get(N1);if(k1)if(await i(k1))O=k1;else f8.delete(N1);if(!O&&(H.startsWith("./")||H.startsWith("../")))O=g.resolve(g.dirname(G),`${H}.stx`),F.push(O);else if(!O)for(let z0 of f){if(!z0)continue;for(let Y1 of v){let n=g.join(z0,Y1);if(F.push(n),await i(n)){O=n;break}}if(O)break;if(!O)try{let Y1=await import("fs");if(!Y1.statSync(z0,{throwIfNoEntry:!1})?.isDirectory())continue;let J1=8,i1=[{path:z0,depth:0}];while(i1.length>0&&!O){let z1=i1.pop();if(z1.depth>=J1)continue;let GX;try{GX=Y1.readdirSync(z1.path,{withFileTypes:!0})}catch{continue}for(let QX of GX){if(!QX.isDirectory())continue;if(QX.name==="node_modules"||QX.name.startsWith("."))continue;let Y2=g.join(z1.path,QX.name);for(let XW of v){let z$=g.join(Y2,XW);if(F.push(z$),await i(z$)){O=z$;break}}if(O)break;i1.push({path:Y2,depth:z1.depth+1})}}}catch{}if(O)break}if(O)f8.set(N1,O)}if(!O||!await i(O)){let E=F.length>0?`
14404
14409
  Searched paths:
14405
14410
  ${F.map((v)=>` - ${v}`).join(`
14406
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${X}']${E}`}q.add(O);let V;if(x8.has(O))V=x8.get(O);else try{V=await Bun.file(O).text(),x8.set(O,V)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let A=new Set(["__originalFilePath","__importedComponents",MX]),R={};for(let[E,v]of Object.entries(J))if(!E.startsWith("__")||A.has(E))R[E]=v;let{extractSlotContent:T}=await e("stx/slots",()=>Promise.resolve().then(() => (F4(),O4))),M=T(Z),k={};if(M.defaultSlot?.trim())k.default=M.defaultSlot;for(let[E,v]of M.namedSlots)k[E]=v.content;let N={...R,...$,props:$,slot:Z,$slots:k,__processedComponents:K,__sections:{},__stx_signals_gate:L1(V)||qO(Z)};QO(V,N);let y=V,I=h5(y);if(I)y=I.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...V.matchAll(C)],b=[],P=S.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&S.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,m=null;if(P){let E=$O({props:$,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(E!==null){x=`${O}\x00${E}`;let v=V4.get(x);if(v){for(let d of v.dependencies)q.add(d);return v.output}m=new Set(q)}}for(let E of S){let v=E[1]||"",d=E[2]||"",f=v.includes("server");if(e1(v)&&d.trim())d=X5(d);if(f&&d)try{await W(d,N,O)}catch(G0){}if(!f){let G0=d.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),s0=G0.includes("{{")&&G0.includes("}}"),S0=G0.includes("{!!")&&G0.includes("!!}");if(s0||S0)G0=EX(G0,N);let f0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${f0}>${G0}</script>`)}}let l=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Q0=l?l[1]:"",l0=l?l[2]:"",R0="",r0=Q0&&/\bscoped\b/i.test(Q0);if(l)R0=`<style${Q0}>${l0}</style>`;let c=y;if(c=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)c=c.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(c=c.replace(E,(d,f)=>{let s=f.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(s)v.push(`<style${s[1]}>${s[2]}</style>`);return""}),c=c.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)R0=`${R0}${v.join(`
14407
- `)}`}if(Z&&c.includes("{{ text || slot }}"))c=c.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:j0}=await e("stx/slots",()=>Promise.resolve().then(() => (F4(),O4))),{defaultSlot:c0,namedSlots:M1}=M;c=await j0(c,c0,M1,N);let O5=b.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),F5=WO(b);if(F5.length>0)N.__stx_client_signal_names=F5;let r={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:O5||b.length===0,defaultLayout:void 0};N.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let a=await V0(c,N,O,r,q),U0=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let E of a.matchAll(/\{\{([\s\S]*?)\}\}/g))U0.add(E[1].trim());if(U0.size>0)J.__stx_preserved_client_expressions=[...U0];let M0=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++XO}_${Math.random().toString(36).slice(2,8)}`,w0=a;if(O5){let E="";if(Object.keys($).length>0)try{E=` data-stx-props="${fw(JSON.stringify($))}"`}catch{}let v=B?` stx-hydrate="${fw(B)}"`:"";w0=`<div data-stx-scope="${M0}"${E}${v}>${a}</div>`;let d=await Promise.all(b.map(async(f)=>{let s=f.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!s)return f;let[,G0,s0]=s,S0=AX(s0,{filePath:O,projectRoot:process.cwd()}),f0=S0.code,o0=RX(S0.styles);f0=D5(f0).code;let{hasUserImports:V5,bundleClientScript:N1}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (k7(),N7)));if(V5(f0))f0=await N1(f0,O,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:k1}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (o7(),D8)));f0=f0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(z1,GX)=>k1(GX));let z0=h0(f0),Z1=YO(z0),n=`function(__scopeId) {
14408
- ${k5("const",[...w6,...Z1],z0)}
14411
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${X}']${E}`}q.add(O);let V;if(x8.has(O))V=x8.get(O);else try{V=await Bun.file(O).text(),x8.set(O,V)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let A=new Set(["__originalFilePath","__importedComponents",MX]),R={};for(let[E,v]of Object.entries(J))if(!E.startsWith("__")||A.has(E))R[E]=v;let{extractSlotContent:T}=await e("stx/slots",()=>Promise.resolve().then(() => (F4(),O4))),M=T(Z),k={};if(M.defaultSlot?.trim())k.default=M.defaultSlot;for(let[E,v]of M.namedSlots)k[E]=v.content;let N={...R,...$,props:$,slot:Z,$slots:k,__processedComponents:K,__sections:{},__stx_signals_gate:L1(V)||qO(Z)};QO(V,N);let y=V,I=h5(y);if(I)y=I.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...V.matchAll(C)],b=[],P=S.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&S.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,m=null;if(P){let E=$O({props:$,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(E!==null){x=`${O}\x00${E}`;let v=V4.get(x);if(v){for(let d of v.dependencies)q.add(d);return v.output}m=new Set(q)}}for(let E of S){let v=E[1]||"",d=E[2]||"",f=v.includes("server");if(e1(v)&&d.trim())d=X5(d);if(f&&d)try{await W(d,N,O)}catch(G0){}if(!f){let G0=d.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),o0=G0.includes("{{")&&G0.includes("}}"),S0=G0.includes("{!!")&&G0.includes("!!}");if(o0||S0)G0=EX(G0,N);let f0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${f0}>${G0}</script>`)}}let l=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Q0=l?l[1]:"",l0=l?l[2]:"",R0="",s0=Q0&&/\bscoped\b/i.test(Q0);if(l)R0=`<style${Q0}>${l0}</style>`;let c=y;if(c=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)c=c.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(c=c.replace(E,(d,f)=>{let s=f.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(s)v.push(`<style${s[1]}>${s[2]}</style>`);return""}),c=c.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)R0=`${R0}${v.join(`
14412
+ `)}`}if(Z&&c.includes("{{ text || slot }}"))c=c.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:j0}=await e("stx/slots",()=>Promise.resolve().then(() => (F4(),O4))),{defaultSlot:c0,namedSlots:M1}=M;c=await j0(c,c0,M1,N);let O5=b.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),F5=WO(b);if(F5.length>0)N.__stx_client_signal_names=F5;let r={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:O5||b.length===0,defaultLayout:void 0};N.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let a=await V0(c,N,O,r,q),U0=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let E of a.matchAll(/\{\{([\s\S]*?)\}\}/g))U0.add(E[1].trim());if(U0.size>0)J.__stx_preserved_client_expressions=[...U0];let M0=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++XO}_${Math.random().toString(36).slice(2,8)}`,w0=a;if(O5){let E="";if(Object.keys($).length>0)try{E=` data-stx-props="${fw(JSON.stringify($))}"`}catch{}let v=B?` stx-hydrate="${fw(B)}"`:"";w0=`<div data-stx-scope="${M0}"${E}${v}>${a}</div>`;let d=await Promise.all(b.map(async(f)=>{let s=f.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!s)return f;let[,G0,o0]=s,S0=AX(o0,{filePath:O,projectRoot:process.cwd()}),f0=S0.code,a0=RX(S0.styles);f0=D5(f0).code;let{hasUserImports:V5,bundleClientScript:N1}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (k7(),N7)));if(V5(f0))f0=await N1(f0,O,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:k1}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (o7(),D8)));f0=f0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(z1,GX)=>k1(GX));let z0=h0(f0),Y1=YO(z0),n=`function(__scopeId) {
14413
+ ${k5("const",[...w6,...Y1],z0)}
14409
14414
  const __scope = window.stx._scopes = window.stx._scopes || {};
14410
14415
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
14416
+ __scopeVars.$refs = __scopeVars.$refs || {};
14411
14417
  const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
14412
14418
  window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="' + __scopeId + '"]');
14413
14419
 
@@ -14423,7 +14429,7 @@ ${z0}
14423
14429
  // Register all defined signals and functions in this scope
14424
14430
  const __localVars = {};
14425
14431
  try {
14426
- ${Z1.map((z1)=>`if (typeof ${z1} !== 'undefined') __localVars['${z1}'] = ${z1};`).join(`
14432
+ ${Y1.map((z1)=>`if (typeof ${z1} !== 'undefined') __localVars['${z1}'] = ${z1};`).join(`
14427
14433
  `)}
14428
14434
  }
14429
14435
  catch (e) {}
@@ -14432,13 +14438,13 @@ catch (e) {}
14432
14438
  finally {
14433
14439
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
14434
14440
  }
14435
- }`,Y1=B?null:u6(J,n),i1=Y1?`window.__stxComponentFactories[${JSON.stringify(Y1)}](${JSON.stringify(M0)});`:`(${n})(${JSON.stringify(M0)});`;if(B)return`${o0}<script type="stx/island" data-stx-island="${M0}" data-stx-scoped${G0}>${i1}</script>`;return`${o0}<script data-stx-scoped data-stx-run="always"${G0}>${i1}</script>`}));if(w0=w0+`
14441
+ }`,J1=B?null:u6(J,n),i1=J1?`window.__stxComponentFactories[${JSON.stringify(J1)}](${JSON.stringify(M0)});`:`(${n})(${JSON.stringify(M0)});`;if(B)return`${a0}<script type="stx/island" data-stx-island="${M0}" data-stx-scoped${G0}>${i1}</script>`;return`${a0}<script data-stx-scoped data-stx-run="always"${G0}>${i1}</script>`}));if(w0=w0+`
14436
14442
  `+d.join(`
14437
14443
  `),R0)w0+=`
14438
14444
  `+R0}else{if(R0)w0+=`
14439
14445
  `+R0;if(b.length>0){let E=N.__stx_event_bindings||[],v=a1(N),d=await Promise.all(b.map(async(f)=>{let s=f.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!s)return f;return await t1(s[1],{eventBindings:E,templateContent:w0,filePath:O,projectRoot:process.cwd(),serverData:v})}));w0+=`
14440
14446
  `+d.join(`
14441
- `),N.__stx_event_bindings=[]}}if(r0){let E=K8(w0,O);if(E.hasScoped)w0=E.html}if(x&&m)V4.set(x,{output:w0,dependencies:[...q].filter((E)=>!m.has(E))});return w0}catch(_){return`[Error processing component: ${_ instanceof Error?_.message:String(_)}]`}finally{U.delete(X)}}async function i(X){return Bun.file(X).exists()}function A4(X,$){let Z=g.resolve($),Y=g.resolve(X),J=Z.endsWith(g.sep)?Z:Z+g.sep;if(Y===Z||Y.startsWith(J))return Y;return null}async function H4(X,$,Z,Y){let J=await UO(X,$,Z,Y);if(J===null)return null;let G=A4(J,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((w)=>typeof w==="string"&&w.length>0);for(let w of Q){let q=g.isAbsolute(w)?w:g.resolve(process.cwd(),w);if(A4(J,q))return g.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${X}, from: ${$})`),null}async function UO(X,$,Z,Y){if(Z.debug)console.log(`Resolving template path: ${X} from ${$}`);let J=g.dirname($),G=process.cwd();if(X.startsWith("/")){let z=g.join(G,X),B=A4(z,G);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${X} (from ${$})`),null;if(Z.debug)console.log(`Checking absolute path: ${B}`);if(await i(B)&&Y)Y.add(B);return B}let Q=g.join(J,X);if(await i(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(Y)Y.add(Q);return Q}if(!X.endsWith(".stx")&&!X.endsWith(".jsx")&&!X.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let B=`${Q}${z}`;if(await i(B)){if(Z.debug)console.log(`Found direct path with extension: ${B}`);if(Y)Y.add(B);return B}}let w="",q=g.resolve(J),W=process.cwd();for(let z=0;z<10;z++){let B=g.join(q,"layouts"),_=!1;try{_=eL.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(_){w=B;break}let j=g.dirname(q);if(j===q||j.length<W.length)break;q=j}if(w){let z=X.startsWith("layouts/")?X.slice(8):X,B=g.join(w,z);if(await i(B)){if(Z.debug)console.log(`Found in current layouts dir: ${B}`);if(Y)Y.add(B);return B}if(!z.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${_}`);if(Y)Y.add(_);return _}}}if(Z.layoutsDir){let z=g.isAbsolute(Z.layoutsDir)?Z.layoutsDir:g.resolve(process.cwd(),Z.layoutsDir),B=X.startsWith("layouts/")?X.slice(8):X,_=g.join(z,B);if(await i(_)){if(Z.debug)console.log(`Found in options.layoutsDir: ${_}`);if(Y)Y.add(_);return _}if(!X.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(X.startsWith("layouts/")||X.includes("/layouts/")){let z=X.split("layouts/"),B=g.join(Z.partialsDir||J,"layouts",z[1]);if(await i(B)){if(Z.debug)console.log(`Found in layouts path: ${B}`);if(Y)Y.add(B);return B}if(!B.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Z.debug)console.log(`Found in layouts path with extension: ${_}`);if(Y)Y.add(_);return _}}}if(Z.partialsDir){if(w=g.join(Z.partialsDir,"layouts"),await i(w)){let z=g.join(w,X);if(await i(z)){if(Z.debug)console.log(`Found in partials layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}}let U=Z.partialsDir||g.join(process.cwd(),"views"),K=g.join(U,X);if(await i(K)){if(Z.debug)console.log(`Found in views path: ${K}`);if(Y)Y.add(K);return K}if(!X.endsWith(".stx")){let z=`${K}.stx`;if(await i(z)){if(Z.debug)console.log(`Found in views path with extension: ${z}`);if(Y)Y.add(z);return z}}if(J.includes("temp")){let z=g.join(g.dirname(J),"layouts",X);if(await i(z)){if(Z.debug)console.log(`Found in temp layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${X} (referenced from ${$})`);else console.warn(`Template not found: ${X} (referenced from ${$})`);return null}function gw(X,$,Z){let Y=0,J="",G="";try{if(typeof $==="number"&&$>=0){let Q=X.split(`
14447
+ `),N.__stx_event_bindings=[]}}if(s0){let E=K8(w0,O);if(E.hasScoped)w0=E.html}if(x&&m)V4.set(x,{output:w0,dependencies:[...q].filter((E)=>!m.has(E))});return w0}catch(_){return`[Error processing component: ${_ instanceof Error?_.message:String(_)}]`}finally{U.delete(X)}}async function i(X){return Bun.file(X).exists()}function A4(X,$){let Z=g.resolve($),Y=g.resolve(X),J=Z.endsWith(g.sep)?Z:Z+g.sep;if(Y===Z||Y.startsWith(J))return Y;return null}async function H4(X,$,Z,Y){let J=await UO(X,$,Z,Y);if(J===null)return null;let G=A4(J,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((w)=>typeof w==="string"&&w.length>0);for(let w of Q){let q=g.isAbsolute(w)?w:g.resolve(process.cwd(),w);if(A4(J,q))return g.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${X}, from: ${$})`),null}async function UO(X,$,Z,Y){if(Z.debug)console.log(`Resolving template path: ${X} from ${$}`);let J=g.dirname($),G=process.cwd();if(X.startsWith("/")){let z=g.join(G,X),B=A4(z,G);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${X} (from ${$})`),null;if(Z.debug)console.log(`Checking absolute path: ${B}`);if(await i(B)&&Y)Y.add(B);return B}let Q=g.join(J,X);if(await i(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(Y)Y.add(Q);return Q}if(!X.endsWith(".stx")&&!X.endsWith(".jsx")&&!X.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let B=`${Q}${z}`;if(await i(B)){if(Z.debug)console.log(`Found direct path with extension: ${B}`);if(Y)Y.add(B);return B}}let w="",q=g.resolve(J),W=process.cwd();for(let z=0;z<10;z++){let B=g.join(q,"layouts"),_=!1;try{_=eL.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(_){w=B;break}let j=g.dirname(q);if(j===q||j.length<W.length)break;q=j}if(w){let z=X.startsWith("layouts/")?X.slice(8):X,B=g.join(w,z);if(await i(B)){if(Z.debug)console.log(`Found in current layouts dir: ${B}`);if(Y)Y.add(B);return B}if(!z.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${_}`);if(Y)Y.add(_);return _}}}if(Z.layoutsDir){let z=g.isAbsolute(Z.layoutsDir)?Z.layoutsDir:g.resolve(process.cwd(),Z.layoutsDir),B=X.startsWith("layouts/")?X.slice(8):X,_=g.join(z,B);if(await i(_)){if(Z.debug)console.log(`Found in options.layoutsDir: ${_}`);if(Y)Y.add(_);return _}if(!X.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(X.startsWith("layouts/")||X.includes("/layouts/")){let z=X.split("layouts/"),B=g.join(Z.partialsDir||J,"layouts",z[1]);if(await i(B)){if(Z.debug)console.log(`Found in layouts path: ${B}`);if(Y)Y.add(B);return B}if(!B.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Z.debug)console.log(`Found in layouts path with extension: ${_}`);if(Y)Y.add(_);return _}}}if(Z.partialsDir){if(w=g.join(Z.partialsDir,"layouts"),await i(w)){let z=g.join(w,X);if(await i(z)){if(Z.debug)console.log(`Found in partials layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}}let U=Z.partialsDir||g.join(process.cwd(),"views"),K=g.join(U,X);if(await i(K)){if(Z.debug)console.log(`Found in views path: ${K}`);if(Y)Y.add(K);return K}if(!X.endsWith(".stx")){let z=`${K}.stx`;if(await i(z)){if(Z.debug)console.log(`Found in views path with extension: ${z}`);if(Y)Y.add(z);return z}}if(J.includes("temp")){let z=g.join(g.dirname(J),"layouts",X);if(await i(z)){if(Z.debug)console.log(`Found in temp layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${X} (referenced from ${$})`);else console.warn(`Template not found: ${X} (referenced from ${$})`);return null}function gw(X,$,Z){let Y=0,J="",G="";try{if(typeof $==="number"&&$>=0){let Q=X.split(`
14442
14448
  `),w=0;for(let q=0;q<Q.length;q++)if(w+=Q[q].length+1,w>=$){Y=q+1,J=Q[q].trim();let W=Math.max(0,q-2),U=Math.min(Q.length,q+3);G=Q.slice(W,U).map((K,z)=>{let B=W+z+1;return`${B===Y?"> ":" "}${B}: ${K}`}).join(`
14443
14449
  `);break}}else if(Z){let Q=X.indexOf(Z);if(Q>=0)return gw(X,Q)}}catch{}return{lineNumber:Y,lineContent:J,context:G}}function K0(X,$,Z,Y,J,G){let{lineNumber:Q,context:w}=gw(Y,J,G),q=Z.split("/").pop(),W=0;if(typeof J==="number"&&J>=0&&Y){let K=Y.lastIndexOf(`
14444
14450
  `,Math.max(0,J-1));W=J-(K+1)+1}let U="";if(Q>0)U+=`
@@ -14453,7 +14459,7 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${$}
14453
14459
  `,w)U+=`
14454
14460
  ${Z0.blue}${Z0.bold}Context:${Z0.reset}
14455
14461
  ${Z0.dim}${w}${Z0.reset}
14456
- `;return U}function hG(){x8.clear(),f8.clear(),V4.clear()}var x8,f8,V4,XO=0,Z0;var T0=D(()=>{y5();s$();w1();J1();P5();oX();E1();k3();rX();V7();Sw();i5();x8=new Z5(500),f8=new Z5(1000),V4=new Z5(2000);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"}});async function bw(X,$,Z=""){let Y=X,J=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec(X))!==null){let w=Q.index,q=Q[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=w+Q[0].length,K=1,z=U,B=-1;while(K>0&&z<X.length){let H=X.indexOf("@markdown",z),O=X.indexOf("@endmarkdown",z);if(O===-1)break;if(H!==-1&&H<O&&H!==w){let L=X[H+9];if(L==="("||L===`
14462
+ `;return U}function hG(){x8.clear(),f8.clear(),V4.clear()}var x8,f8,V4,XO=0,Z0;var T0=D(()=>{y5();s$();w1();G1();P5();oX();E1();k3();rX();V7();Sw();i5();x8=new Z5(500),f8=new Z5(1000),V4=new Z5(2000);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"}});async function bw(X,$,Z=""){let Y=X,J=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec(X))!==null){let w=Q.index,q=Q[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=w+Q[0].length,K=1,z=U,B=-1;while(K>0&&z<X.length){let H=X.indexOf("@markdown",z),O=X.indexOf("@endmarkdown",z);if(O===-1)break;if(H!==-1&&H<O&&H!==w){let L=X[H+9];if(L==="("||L===`
14457
14463
  `||L==="\r"||L===" "||L===void 0)K++;z=H+9}else{if(K--,K===0){B=O;break}z=O+12}}if(B===-1)continue;let _=X.slice(U,B),j=X.slice(w,B+12);J.push({fullMatch:j,options:W,content:_,index:w}),G.lastIndex=B+12}for(let{fullMatch:w,options:q,content:W,index:U}of J)try{let K={};if(q)q.split(",").forEach((_)=>{let j=_.trim();if(j)K[j]=!0});let z={gfm:K.gfm??!0,breaks:K.breaks??!1},B=r1(W.trim(),z);Y=Y.split(w).join(B)}catch(K){let z=K instanceof Error?K.message:String(K),B=K0("Markdown Directive",`Error processing markdown: ${z}`,Z,X,U,w);Y=Y.split(w).join(B)}return Y}async function hw(X,$,Z,Y){let J={gfm:!0,breaks:!1};return $.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")J.breaks=!0;if(Q==="no-gfm")J.gfm=!1}),r1(X.trim(),J)}var L4=D(()=>{T0()});function _O(X){if(KO.set(X.name,X),X.client)zO.set(X.name,X.client)}function g8(X){return _O(X),{name:X.name,hasEndTag:X.hasEndTag??!0,description:X.description,handler:async(Z,Y,J,G)=>{let Q=BO(Y,X.defaults);if(X.validate){let q=X.validate(Q);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${X.name}`;throw Error(W)}}let w=Z;if(X.transform)w=await X.transform(Z,Q,J,G);if(X.clientScript){let q=X.clientScript(Q);w+=`<script>${q}</script>`}if(X.css){let q=X.css(Q);w+=`<style>${q}</style>`}return w}}}function BO(X,$){let Z={...$};for(let Y of X){let J=Y.indexOf(":"),G=Y.indexOf("="),Q=J>=0&&(G<0||J<G)?J:G;if(Q>=0){let w=Y.slice(0,Q).trim(),q=Y.slice(Q+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Z[w]=q}else{let w=Object.keys(Z).filter((q)=>!$||!(q in $)).length;Z[w===0?"value":`arg${w}`]=Y}}return Z}var KO,zO;var R4=D(()=>{KO=new Map,zO=new Map});function T4(X,$=Y7,Z={},Y){return $.sort((J,G)=>J-G).map((J)=>{return`${YX(X,{...Z,w:J,fm:Y})} ${J}w`}).join(", ")}function uw(X,$,Z=jO,Y={},J){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round($*G);return`${YX(X,{...Y,w:Q,dpr:G,fm:J})} ${G}x`}).join(", ")}function M4(X,$="100vw"){if(!X||Object.keys(X).length===0)return $;let Y=Object.entries(X).map(([J,G])=>{let Q=/^\d+$/.test(J)?`${J}px`:J;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((J,G)=>J.numericBp-G.numericBp).map(({bp:J,size:G})=>`(max-width: ${J}) ${G}`);return Y.push($),Y.join(", ")}function YX(X,$={}){let Z=Object.entries($).filter(([,G])=>G!==void 0&&G!==null).map(([G,Q])=>{if(Array.isArray(Q))return[G,Q.join(",")];return[G,String(Q)]});if(Z.length===0)return X;let Y=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),J=X.includes("?")?"&":"?";return`${X}${J}${Y}`}function N4(X){return HO[X]||"application/octet-stream"}var Y7,jO,ZX,HO;var k4=D(()=>{Y7=[320,480,640,768,1024,1280,1536,1920,2560],jO=[1,1.5,2,3],ZX=["avif","webp","jpeg"],HO={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function OO(){try{return await import("ts-images")}catch{return null}}async function FO(X,$={}){let Z={...LO,...$},Y=await OO();if(Y)try{return await VO(X,Z,Y)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return AO(X,Z)}async function VO(X,$,Z){let{generatePlaceholder:Y,generateThumbHash:J}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await J(X)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let w=await Y(X,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.blurLevel,strategy:Q,base64Encode:!0});return{dataURL:w.dataURL,width:w.width,height:w.height,aspectRatio:w.aspectRatio,originalWidth:w.originalWidth,originalHeight:w.originalHeight,strategy:$.strategy,dominantColor:w.dominantColor,css:w.css}}function AO(X,$){let Z=$.width||20,Y=$.height||Z,J="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}" viewBox="0 0 ${Z} ${Y}"><rect fill="#e5e7eb" width="${Z}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:Y,aspectRatio:Z/Y,originalWidth:0,originalHeight:0,strategy:$.strategy,dominantColor:"#e5e7eb"}}function dw(X,$,Z={}){let Y=Z.transitionDuration||300,J=Z.easing||"ease-out";return`
14458
14464
  #${X} {
14459
14465
  --stx-img-transition-duration: ${Y}ms;
@@ -14500,7 +14506,7 @@ ${Z0.dim}${w}${Z0.reset}
14500
14506
  filter: blur(0);
14501
14507
  transform: scale(1);
14502
14508
  }
14503
- `.trim();I4=new Map});import{createHash as pw}from"crypto";import{readFile as RO,stat as iw}from"fs/promises";async function b0(X){try{let $=await RO(X);return pw("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function cw(X){return pw("sha256").update(X).digest("hex").slice(0,16)}function h8(X,$){let Z=JSON.stringify($,Object.keys($).sort());return`${cw(X)}-${cw(Z)}`}async function D4(X){try{return(await iw(X)).mtimeMs}catch{return 0}}async function D0(X){try{return await iw(X),!0}catch{return!1}}var H5=()=>{};import{mkdir as TO,readFile as MO,writeFile as NO,readdir as HD,rm as kO,stat as LD}from"fs/promises";import{join as rw,dirname as IO}from"path";async function EO(X){try{await TO(X,{recursive:!0})}catch{}}function sw(X,$,Z){return rw(X,Z,`${$}.json`)}async function nw(X,$,Z){if((Date.now()-X.createdAt)/86400000>Z)return!1;if(await D4($)!==X.srcMtime)return!1;return!0}async function u8(X,$,Z,Y=y4){if(!Y.enabled)return null;let J=h8(X,$),G=J7.get(J);if(G){if(await nw(G,X,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;J7.delete(J)}let Q=sw(Y.directory,J,Z);if(await D0(Q))try{let w=await MO(Q,"utf-8"),q=JSON.parse(w);if(await nw(q,X,Y.maxAge))return q.lastAccessedAt=Date.now(),J7.set(J,q),q.data}catch{}return null}async function d8(X,$,Z,Y,J=y4){if(!J.enabled)return;let G=h8(X,$),Q=await b0(X),w=await D4(X),q={key:G,src:X,srcHash:Q,srcMtime:w,optionsHash:h8("",$),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};J7.set(G,q);let W=sw(J.directory,G,Y);try{await EO(IO(W)),await NO(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function m8(X,$=y4){if(X==="all")J7.clear();else J7.clear();let Z=X==="all"?["image","video"]:[X];for(let Y of Z){let J=rw($.directory,Y);try{await kO(J,{recursive:!0,force:!0})}catch{}}}var J7,y4;var b4=D(()=>{H5();J7=new Map,y4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class c8{config;constructor(X={}){this.config={...DO,...X}}async get(X,$){return u8(X,$,"image",this.config)}async set(X,$,Z){return d8(X,$,Z,"image",this.config)}async clear(){return m8("image",this.config)}updateConfig(X){this.config={...this.config,...X}}}function S4(X){if(!l8)l8=new c8(X);else if(X)l8.updateConfig(X);return l8}async function p8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return S4(Y).get(X,$)}async function i8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return S4(J).set(X,$,Z)}async function ow(){return S4().clear()}var DO,l8=null;var C4=D(()=>{b4();DO={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as yO,basename as bO,extname as SO,join as CO}from"path";import{mkdir as PO}from"fs/promises";async function P4(){try{return await import("ts-images")}catch{return null}}function aw(X){switch(X){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function vO(X,$){let Z=$?aw($):aw("web"),Y=X.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function tw(X,$,Z){let Y=await P4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:X,processed:!1};let J=await p8(X,$,Z);if(J)return J;try{let G=yO(X);if(!await D0(G))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let Q=vO(Z,$.preset),w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await PO(w,{recursive:!0});let W=await b0(G),U=bO(X,SO(X)),K=$.outputFormat?[$.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],z={src:X,processed:!0,variants:[],hash:W},B=null;if($.transformations&&$.transformations.length>0)B=await v4(G,$.transformations,Y);for(let _ of K){let j=Q[_]||{},H=`${U}-${W}.${_}`,O=CO(w,H);try{let L=await Y.optimizeImage({input:B||G,output:O,format:_,quality:j.quality,progressive:j.progressive});if(L){if(z.variants.push({path:O,url:`${q}/${H}`,width:L.width||0,height:L.height||0,format:_,size:L.outputSize||0}),!z.originalWidth&&L.width)z.originalWidth=L.width,z.originalHeight=L.height}}catch(L){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${_}: ${L}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let _=await Y.generateThumbHash(G);z.placeholder=_.dataUrl}catch(_){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${_}`)}if($.useDominantColor)try{let _=await Y.generatePlaceholder(G,{strategy:"dominant-color"});z.dominantColor=_.dominantColor}catch(_){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${_}`)}return await i8(X,$,z,Z),z}catch(G){return{src:X,processed:!1,errors:[`Processing failed: ${G}`]}}}async function ew(X,$,Z,Y){let J=await P4();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:X,output:Y,format:$,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function v4(X,$,Z){let Y=Z||await P4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode(X);for(let G of $){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var Xq=D(()=>{H5();C4()});import{resolve as xO,basename as fO,extname as gO,join as hO}from"path";import{mkdir as uO}from"fs/promises";async function dO(){try{return await import("ts-images")}catch{return null}}async function $q(X,$,Z){let Y=await dO();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=xO(X);if(!await D0(J))return console.warn(`[stx-media] Source file not found: ${X}`),null;try{let G=$.responsiveWidths||Z.breakpoints||mO,Q=$.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await uO(w,{recursive:!0});let W=await b0(J),U=fO(X,gO(X)),K=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:X,byFormat:{},srcsets:{}};for(let _ of Q){z.byFormat[_]=[];let j=[];for(let H of G){let O=`${U}-${H}w-${W}.${_}`,L=hO(w,O),F=`${q}/${O}`;try{let V=K[_]?.quality||80;if(await D0(L)){z.byFormat[_].push({path:L,url:F,width:H,height:0,format:_,size:0}),j.push(`${F} ${H}w`);continue}let A=await Y.processImage({input:J,output:L,format:_,quality:V,resize:{width:H}});if(A)z.byFormat[_].push({path:L,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:_,size:A.outputSize||0}),j.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${_} at ${H}w: ${V}`)}}z.srcsets[_]=j.join(", ")}let B=$.placeholder||Z.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let _=await Y.generateThumbHash(J);z.placeholder={dataURL:_.dataUrl,width:_.width||32,height:_.height||32,strategy:"thumbhash"}}else{let _=await Y.generatePlaceholder(J,{strategy:B,width:20});z.placeholder={dataURL:_.dataURL,width:_.width,height:_.height,strategy:B}}}catch(_){console.warn(`[stx-media] Failed to generate placeholder: ${_}`)}return z.sizes=$.sizes||lO(G),z}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function lO(X){let $=[...X].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<$.length-1;Y++){let J=$[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${$[$.length-1]}px`),Z.join(", ")}function Zq(X,$="width"){if(!X||X.length===0)return"";if($==="dpr")return X.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return X.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var mO;var Yq=D(()=>{H5();mO=[320,480,640,768,1024,1280,1536,1920]});var Jq={};t(Jq,{setCachedImageResult:()=>i8,processImage:()=>tw,optimizeImage:()=>ew,getCachedImageResult:()=>p8,generateSrcset:()=>Zq,generateResponsiveVariants:()=>$q,clearImageCache:()=>ow,applyTransformations:()=>v4,ImageProcessorCache:()=>c8});var Gq=D(()=>{Xq();Yq();C4()});async function cO(){try{return await Promise.resolve().then(() => (Gq(),Jq))}catch(X){if(!Qq)console.warn("[stx-media] Image processor not available, some features disabled:",X),Qq=!0;return null}}async function n8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return rO(Y,Z)}if(Z.processedResult?.processed)return h4(X,Z.processedResult,$);if(Z.responsiveVariants)return Uq(X,Z.responsiveVariants,$);let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=Y7,dpr:U,formats:K=ZX,quality:z=x4,params:B={},placeholder:_="none",placeholderOptions:j={},lazy:H=!0,priority:O=!1,loading:L=O?"eager":s8,decoding:F=r8,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:T,referrerpolicy:M}=X,k=X.class,N=X.style,y=X.id,I=X.data||{},{isDev:C=!1,baseUrl:S=""}=$;if(C&&!$.optimize)return nO(X);let b,P,x=y||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(_!=="none"&&!O)try{b=await mw(J,{strategy:_,...j}),P=dw(x,b,j)}catch{}let m=U!==void 0&&Q!==void 0,l;if(m)l=iO(X,x,b,$);else l=await pO(X,x,b,$);let Q0;if(O){let r0=K.includes("webp")?"webp":K[0],c=T4(J,W,{...B,q:z},r0),j0=typeof q==="object"?M4(q):q||"100vw";Q0=`<link rel="preload" as="image" imagesrcset="${c}" imagesizes="${j0}" />`}let l0=[];if(!wq&&_!=="none")l0.push(E4),wq=!0;if(P)l0.push(P);let R0=H?Wq(x):void 0;return{html:l,preloadLink:Q0,css:l0.length>0?l0.join(`
14509
+ `.trim();I4=new Map});import{createHash as pw}from"crypto";import{readFile as RO,stat as iw}from"fs/promises";async function b0(X){try{let $=await RO(X);return pw("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function cw(X){return pw("sha256").update(X).digest("hex").slice(0,16)}function h8(X,$){let Z=JSON.stringify($,Object.keys($).sort());return`${cw(X)}-${cw(Z)}`}async function D4(X){try{return(await iw(X)).mtimeMs}catch{return 0}}async function D0(X){try{return await iw(X),!0}catch{return!1}}var H5=()=>{};import{mkdir as TO,readFile as MO,writeFile as NO,readdir as LD,rm as kO,stat as OD}from"fs/promises";import{join as rw,dirname as IO}from"path";async function EO(X){try{await TO(X,{recursive:!0})}catch{}}function sw(X,$,Z){return rw(X,Z,`${$}.json`)}async function nw(X,$,Z){if((Date.now()-X.createdAt)/86400000>Z)return!1;if(await D4($)!==X.srcMtime)return!1;return!0}async function u8(X,$,Z,Y=y4){if(!Y.enabled)return null;let J=h8(X,$),G=J7.get(J);if(G){if(await nw(G,X,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;J7.delete(J)}let Q=sw(Y.directory,J,Z);if(await D0(Q))try{let w=await MO(Q,"utf-8"),q=JSON.parse(w);if(await nw(q,X,Y.maxAge))return q.lastAccessedAt=Date.now(),J7.set(J,q),q.data}catch{}return null}async function d8(X,$,Z,Y,J=y4){if(!J.enabled)return;let G=h8(X,$),Q=await b0(X),w=await D4(X),q={key:G,src:X,srcHash:Q,srcMtime:w,optionsHash:h8("",$),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};J7.set(G,q);let W=sw(J.directory,G,Y);try{await EO(IO(W)),await NO(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function m8(X,$=y4){if(X==="all")J7.clear();else J7.clear();let Z=X==="all"?["image","video"]:[X];for(let Y of Z){let J=rw($.directory,Y);try{await kO(J,{recursive:!0,force:!0})}catch{}}}var J7,y4;var b4=D(()=>{H5();J7=new Map,y4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class c8{config;constructor(X={}){this.config={...DO,...X}}async get(X,$){return u8(X,$,"image",this.config)}async set(X,$,Z){return d8(X,$,Z,"image",this.config)}async clear(){return m8("image",this.config)}updateConfig(X){this.config={...this.config,...X}}}function S4(X){if(!l8)l8=new c8(X);else if(X)l8.updateConfig(X);return l8}async function p8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return S4(Y).get(X,$)}async function i8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return S4(J).set(X,$,Z)}async function ow(){return S4().clear()}var DO,l8=null;var C4=D(()=>{b4();DO={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as yO,basename as bO,extname as SO,join as CO}from"path";import{mkdir as PO}from"fs/promises";async function P4(){try{return await import("ts-images")}catch{return null}}function aw(X){switch(X){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function vO(X,$){let Z=$?aw($):aw("web"),Y=X.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function tw(X,$,Z){let Y=await P4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:X,processed:!1};let J=await p8(X,$,Z);if(J)return J;try{let G=yO(X);if(!await D0(G))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let Q=vO(Z,$.preset),w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await PO(w,{recursive:!0});let W=await b0(G),U=bO(X,SO(X)),K=$.outputFormat?[$.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],z={src:X,processed:!0,variants:[],hash:W},B=null;if($.transformations&&$.transformations.length>0)B=await v4(G,$.transformations,Y);for(let _ of K){let j=Q[_]||{},H=`${U}-${W}.${_}`,O=CO(w,H);try{let L=await Y.optimizeImage({input:B||G,output:O,format:_,quality:j.quality,progressive:j.progressive});if(L){if(z.variants.push({path:O,url:`${q}/${H}`,width:L.width||0,height:L.height||0,format:_,size:L.outputSize||0}),!z.originalWidth&&L.width)z.originalWidth=L.width,z.originalHeight=L.height}}catch(L){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${_}: ${L}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let _=await Y.generateThumbHash(G);z.placeholder=_.dataUrl}catch(_){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${_}`)}if($.useDominantColor)try{let _=await Y.generatePlaceholder(G,{strategy:"dominant-color"});z.dominantColor=_.dominantColor}catch(_){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${_}`)}return await i8(X,$,z,Z),z}catch(G){return{src:X,processed:!1,errors:[`Processing failed: ${G}`]}}}async function ew(X,$,Z,Y){let J=await P4();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:X,output:Y,format:$,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function v4(X,$,Z){let Y=Z||await P4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode(X);for(let G of $){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var Xq=D(()=>{H5();C4()});import{resolve as xO,basename as fO,extname as gO,join as hO}from"path";import{mkdir as uO}from"fs/promises";async function dO(){try{return await import("ts-images")}catch{return null}}async function $q(X,$,Z){let Y=await dO();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=xO(X);if(!await D0(J))return console.warn(`[stx-media] Source file not found: ${X}`),null;try{let G=$.responsiveWidths||Z.breakpoints||mO,Q=$.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await uO(w,{recursive:!0});let W=await b0(J),U=fO(X,gO(X)),K=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:X,byFormat:{},srcsets:{}};for(let _ of Q){z.byFormat[_]=[];let j=[];for(let H of G){let O=`${U}-${H}w-${W}.${_}`,L=hO(w,O),F=`${q}/${O}`;try{let V=K[_]?.quality||80;if(await D0(L)){z.byFormat[_].push({path:L,url:F,width:H,height:0,format:_,size:0}),j.push(`${F} ${H}w`);continue}let A=await Y.processImage({input:J,output:L,format:_,quality:V,resize:{width:H}});if(A)z.byFormat[_].push({path:L,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:_,size:A.outputSize||0}),j.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${_} at ${H}w: ${V}`)}}z.srcsets[_]=j.join(", ")}let B=$.placeholder||Z.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let _=await Y.generateThumbHash(J);z.placeholder={dataURL:_.dataUrl,width:_.width||32,height:_.height||32,strategy:"thumbhash"}}else{let _=await Y.generatePlaceholder(J,{strategy:B,width:20});z.placeholder={dataURL:_.dataURL,width:_.width,height:_.height,strategy:B}}}catch(_){console.warn(`[stx-media] Failed to generate placeholder: ${_}`)}return z.sizes=$.sizes||lO(G),z}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function lO(X){let $=[...X].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<$.length-1;Y++){let J=$[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${$[$.length-1]}px`),Z.join(", ")}function Zq(X,$="width"){if(!X||X.length===0)return"";if($==="dpr")return X.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return X.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var mO;var Yq=D(()=>{H5();mO=[320,480,640,768,1024,1280,1536,1920]});var Jq={};t(Jq,{setCachedImageResult:()=>i8,processImage:()=>tw,optimizeImage:()=>ew,getCachedImageResult:()=>p8,generateSrcset:()=>Zq,generateResponsiveVariants:()=>$q,clearImageCache:()=>ow,applyTransformations:()=>v4,ImageProcessorCache:()=>c8});var Gq=D(()=>{Xq();Yq();C4()});async function cO(){try{return await Promise.resolve().then(() => (Gq(),Jq))}catch(X){if(!Qq)console.warn("[stx-media] Image processor not available, some features disabled:",X),Qq=!0;return null}}async function n8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return rO(Y,Z)}if(Z.processedResult?.processed)return h4(X,Z.processedResult,$);if(Z.responsiveVariants)return Uq(X,Z.responsiveVariants,$);let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=Y7,dpr:U,formats:K=ZX,quality:z=x4,params:B={},placeholder:_="none",placeholderOptions:j={},lazy:H=!0,priority:O=!1,loading:L=O?"eager":s8,decoding:F=r8,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:T,referrerpolicy:M}=X,k=X.class,N=X.style,y=X.id,I=X.data||{},{isDev:C=!1,baseUrl:S=""}=$;if(C&&!$.optimize)return nO(X);let b,P,x=y||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(_!=="none"&&!O)try{b=await mw(J,{strategy:_,...j}),P=dw(x,b,j)}catch{}let m=U!==void 0&&Q!==void 0,l;if(m)l=iO(X,x,b,$);else l=await pO(X,x,b,$);let Q0;if(O){let s0=K.includes("webp")?"webp":K[0],c=T4(J,W,{...B,q:z},s0),j0=typeof q==="object"?M4(q):q||"100vw";Q0=`<link rel="preload" as="image" imagesrcset="${c}" imagesizes="${j0}" />`}let l0=[];if(!wq&&_!=="none")l0.push(E4),wq=!0;if(P)l0.push(P);let R0=H?Wq(x):void 0;return{html:l,preloadLink:Q0,css:l0.length>0?l0.join(`
14504
14510
  `):void 0,script:R0}}async function pO(X,$,Z,Y){let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=Y7,formats:U=ZX,quality:K=x4,params:z={},lazy:B=!0,priority:_=!1,loading:j=_?"eager":s8,decoding:H=r8,fetchpriority:O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A}=X,R=X.class,T=X.style,M=X.data||{},k=typeof q==="object"?M4(q):q||"100vw",N=[];for(let C of U){let S=T4(J,W,{...z,q:K},C),b=N4(C);if(B&&!_)N.push(` <source type="${b}" data-srcset="${S}" data-sizes="${k}" />`);else N.push(` <source type="${b}" srcset="${S}" sizes="${k}" />`)}let y=f4({src:YX(J,{...z,q:K}),alt:G,width:Q,height:w,loading:_?void 0:j,decoding:H,fetchpriority:_?"high":O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A,className:qq(R,Z),style:g4(T,L,F,Z),lazy:B&&!_,data:M}),I;if(Z){let C=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${$}" class="stx-img-placeholder" style="${C}">
14505
14511
  <picture>
14506
14512
  ${N.join(`
@@ -14513,7 +14519,7 @@ ${N.join(`
14513
14519
  <img ${y} />
14514
14520
  </picture>`;return I}function iO(X,$,Z,Y){let{src:J,alt:G,width:Q,height:w,dpr:q=[1,2,3],quality:W=x4,params:U={},lazy:K=!0,priority:z=!1,loading:B=z?"eager":s8,decoding:_=r8,fetchpriority:j,objectFit:H,objectPosition:O,crossorigin:L,referrerpolicy:F}=X,V=X.class,A=X.style,R=X.data||{},T=typeof Q==="number"?Q:Number.parseInt(String(Q),10),M=uw(J,T,q,{...U,q:W}),k=f4({src:YX(J,{...U,w:T,q:W}),alt:G,width:Q,height:w,loading:z?void 0:B,decoding:_,fetchpriority:z?"high":j,objectFit:H,objectPosition:O,crossorigin:L,referrerpolicy:F,className:qq(V,Z),style:g4(A,H,O,Z),lazy:K&&!z,data:R}),N=K&&!z?`data-srcset="${M}"`:`srcset="${M}"`;if(Z){let y=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${$}" class="stx-img-placeholder" style="${y}">
14515
14521
  <img ${k} ${N} />
14516
- </div>`}return`<img ${$?`id="${$}" `:""}${k} ${N} />`}function nO(X){let{src:$,alt:Z,width:Y,height:J,loading:G=s8,decoding:Q=r8,fetchpriority:w,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K,priority:z=!1}=X,B=X.class,_=X.style,j=X.id,H=X.data||{};return{html:`<img ${f4({src:$,alt:Z,width:Y,height:J,loading:z?"eager":G,decoding:Q,fetchpriority:z?"high":w,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K,className:B,style:g4(_,q,W),id:j,data:H})} />`}}function f4(X){let $=[];if(X.lazy)$.push(`data-src="${$1(X.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${$1(X.src)}"`);if($.push(`alt="${$1(X.alt)}"`),X.width)$.push(`width="${X.width}"`);if(X.height)$.push(`height="${X.height}"`);if(X.loading)$.push(`loading="${X.loading}"`);if(X.decoding)$.push(`decoding="${X.decoding}"`);if(X.fetchpriority)$.push(`fetchpriority="${X.fetchpriority}"`);if(X.crossorigin)$.push(`crossorigin="${X.crossorigin}"`);if(X.referrerpolicy)$.push(`referrerpolicy="${X.referrerpolicy}"`);if(X.className)$.push(`class="${$1(X.className)}"`);if(X.style)$.push(`style="${$1(X.style)}"`);if(X.id)$.push(`id="${$1(X.id)}"`);if(X.data)for(let[Z,Y]of Object.entries(X.data))$.push(`data-${Z}="${$1(Y)}"`);if(X.lazy)$.push("data-stx-lazy");return $.join(" ")}function qq(X,$){let Z=[];if(X)Z.push(X);if($)Z.push("stx-img-blur");return Z.join(" ")||""}function g4(X,$,Z,Y){let J=[];if($)J.push(`object-fit: ${$}`);if(Z)J.push(`object-position: ${Z}`);if(Y)J.push("opacity: 0; transition: opacity 300ms ease-out");if(X)J.push(X);return J.join("; ")}function $1(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Wq(X){return`
14522
+ </div>`}return`<img ${$?`id="${$}" `:""}${k} ${N} />`}function nO(X){let{src:$,alt:Z,width:Y,height:J,loading:G=s8,decoding:Q=r8,fetchpriority:w,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K,priority:z=!1}=X,B=X.class,_=X.style,j=X.id,H=X.data||{};return{html:`<img ${f4({src:$,alt:Z,width:Y,height:J,loading:z?"eager":G,decoding:Q,fetchpriority:z?"high":w,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K,className:B,style:g4(_,q,W),id:j,data:H})} />`}}function f4(X){let $=[];if(X.lazy)$.push(`data-src="${Z1(X.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${Z1(X.src)}"`);if($.push(`alt="${Z1(X.alt)}"`),X.width)$.push(`width="${X.width}"`);if(X.height)$.push(`height="${X.height}"`);if(X.loading)$.push(`loading="${X.loading}"`);if(X.decoding)$.push(`decoding="${X.decoding}"`);if(X.fetchpriority)$.push(`fetchpriority="${X.fetchpriority}"`);if(X.crossorigin)$.push(`crossorigin="${X.crossorigin}"`);if(X.referrerpolicy)$.push(`referrerpolicy="${X.referrerpolicy}"`);if(X.className)$.push(`class="${Z1(X.className)}"`);if(X.style)$.push(`style="${Z1(X.style)}"`);if(X.id)$.push(`id="${Z1(X.id)}"`);if(X.data)for(let[Z,Y]of Object.entries(X.data))$.push(`data-${Z}="${Z1(Y)}"`);if(X.lazy)$.push("data-stx-lazy");return $.join(" ")}function qq(X,$){let Z=[];if(X)Z.push(X);if($)Z.push("stx-img-blur");return Z.join(" ")||""}function g4(X,$,Z,Y){let J=[];if($)J.push(`object-fit: ${$}`);if(Z)J.push(`object-position: ${Z}`);if(Y)J.push("opacity: 0; transition: opacity 300ms ease-out");if(X)J.push(X);return J.join("; ")}function Z1(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Wq(X){return`
14517
14523
  (function() {
14518
14524
  const container = document.getElementById('${X}');
14519
14525
  if (!container) return;
@@ -14550,7 +14556,7 @@ ${N.join(`
14550
14556
 
14551
14557
  observer.observe(container);
14552
14558
  })();
14553
- `.trim()}async function rO(X,$){let Z=await cO();if(!Z)return n8({...X,process:!1},$);let Y=$.tsImagesConfig;if(X.responsiveWidths&&X.responsiveWidths.length>0||X.widths&&X.widths.length>0||!X.width&&!X.dpr){let G=await Z.generateResponsiveVariants(X.src,X,Y);if(G)return Uq(X,G,$)}else{let G=await Z.processImage(X.src,X,Y);if(G.processed)return h4(X,G,$)}return n8({...X,process:!1},$)}async function h4(X,$,Z){let{alt:Y,width:J,height:G,lazy:Q=!0,priority:w=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K}=X,z=X.class,B=X.style,_=X.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,j=X.data||{},H=$.variants||[],O=H.find((P)=>P.format==="jpeg")||H.find((P)=>P.format==="webp")||H[0],L=O?.url||X.src,F=H.filter((P)=>P.format===(O?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of H){if(!V.has(P.format))V.set(P.format,[]);V.get(P.format).push(P)}let A=[],R=["avif","webp","jpeg","png"];for(let P of R){let x=V.get(P);if(x&&x.length>0){let m=x.map((Q0)=>`${Q0.url} ${Q0.width}w`).join(", "),l=N4(P);if(Q&&!w)A.push(` <source type="${l}" data-srcset="${m}" />`);else A.push(` <source type="${l}" srcset="${m}" />`)}}let T=[];if(Q&&!w){if(T.push(`data-src="${$1(L)}"`),T.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)T.push(`data-srcset="${F}"`)}else if(T.push(`src="${$1(L)}"`),F)T.push(`srcset="${F}"`);T.push(`alt="${$1(Y)}"`);let M=J||$.originalWidth,k=G||$.originalHeight;if(M)T.push(`width="${M}"`);if(k)T.push(`height="${k}"`);if(!w)T.push(`loading="${Q?"lazy":"eager"}"`);if(T.push('decoding="async"'),w)T.push('fetchpriority="high"');if(U)T.push(`crossorigin="${U}"`);if(K)T.push(`referrerpolicy="${K}"`);let N=[];if(q)N.push(`object-fit: ${q}`);if(W)N.push(`object-position: ${W}`);if($.placeholder&&Q)N.push("opacity: 0; transition: opacity 300ms ease-out");if(B)N.push(B);if(N.length>0)T.push(`style="${N.join("; ")}"`);let y=[];if(z)y.push(z);if($.placeholder)y.push("stx-img-blur");if(y.length>0)T.push(`class="${y.join(" ")}"`);if(Q&&!w)T.push("data-stx-lazy");for(let[P,x]of Object.entries(j))T.push(`data-${P}="${$1(x)}"`);let I;if($.placeholder||$.dominantColor&&X.useDominantColor){let P=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;I=`<div id="${_}" class="stx-img-placeholder" style="${P}">
14559
+ `.trim()}async function rO(X,$){let Z=await cO();if(!Z)return n8({...X,process:!1},$);let Y=$.tsImagesConfig;if(X.responsiveWidths&&X.responsiveWidths.length>0||X.widths&&X.widths.length>0||!X.width&&!X.dpr){let G=await Z.generateResponsiveVariants(X.src,X,Y);if(G)return Uq(X,G,$)}else{let G=await Z.processImage(X.src,X,Y);if(G.processed)return h4(X,G,$)}return n8({...X,process:!1},$)}async function h4(X,$,Z){let{alt:Y,width:J,height:G,lazy:Q=!0,priority:w=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K}=X,z=X.class,B=X.style,_=X.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,j=X.data||{},H=$.variants||[],O=H.find((P)=>P.format==="jpeg")||H.find((P)=>P.format==="webp")||H[0],L=O?.url||X.src,F=H.filter((P)=>P.format===(O?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of H){if(!V.has(P.format))V.set(P.format,[]);V.get(P.format).push(P)}let A=[],R=["avif","webp","jpeg","png"];for(let P of R){let x=V.get(P);if(x&&x.length>0){let m=x.map((Q0)=>`${Q0.url} ${Q0.width}w`).join(", "),l=N4(P);if(Q&&!w)A.push(` <source type="${l}" data-srcset="${m}" />`);else A.push(` <source type="${l}" srcset="${m}" />`)}}let T=[];if(Q&&!w){if(T.push(`data-src="${Z1(L)}"`),T.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)T.push(`data-srcset="${F}"`)}else if(T.push(`src="${Z1(L)}"`),F)T.push(`srcset="${F}"`);T.push(`alt="${Z1(Y)}"`);let M=J||$.originalWidth,k=G||$.originalHeight;if(M)T.push(`width="${M}"`);if(k)T.push(`height="${k}"`);if(!w)T.push(`loading="${Q?"lazy":"eager"}"`);if(T.push('decoding="async"'),w)T.push('fetchpriority="high"');if(U)T.push(`crossorigin="${U}"`);if(K)T.push(`referrerpolicy="${K}"`);let N=[];if(q)N.push(`object-fit: ${q}`);if(W)N.push(`object-position: ${W}`);if($.placeholder&&Q)N.push("opacity: 0; transition: opacity 300ms ease-out");if(B)N.push(B);if(N.length>0)T.push(`style="${N.join("; ")}"`);let y=[];if(z)y.push(z);if($.placeholder)y.push("stx-img-blur");if(y.length>0)T.push(`class="${y.join(" ")}"`);if(Q&&!w)T.push("data-stx-lazy");for(let[P,x]of Object.entries(j))T.push(`data-${P}="${Z1(x)}"`);let I;if($.placeholder||$.dominantColor&&X.useDominantColor){let P=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;I=`<div id="${_}" class="stx-img-placeholder" style="${P}">
14554
14560
  <picture>
14555
14561
  ${A.join(`
14556
14562
  `)}
@@ -18170,7 +18176,7 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function FW(X,$,
18170
18176
  `),hydrationData:G,metadata:{renderTime:Q,cacheHit:!1,totalSize:J.length,componentCount:X.metadata.componentCount}}}function FV(X,$){let Z=[],Y=[],J=[],G=new Map,Q=[];return W7(X.tree,(w,q)=>{if(w.type==="component"&&w.componentName){if(N2(w.componentName))Z.push(w.componentName)}if(w.type==="element"&&w.tag){let W=XU(w);if(W)Q.push(W);if(w.props){for(let[U,K]of Object.entries(w.props))if(U.startsWith("on")&&typeof K==="string"){let z=`handler_${G.size}`;G.set(z,K)}}}if(w.isStatic&&w.type==="element")Y.push(A2(w));else if(!w.isStatic&&w.type!=="text")J.push(w.tag||w.componentName||"unknown")}),{nativeComponents:Z,staticHTML:Y,dynamicParts:J,eventHandlers:G,nativeWidgets:Q}}function VV(X,$={}){let Z=gW(X),Y=mW(Z,$),J=new Map,G=[];return W7(Z.tree,(Q)=>{if(Q.type==="component"&&Q.componentName){if(N2(Q.componentName)){G.push(Q.componentName);let w=`<!--craft:${Q.componentName}:${Q.hydrationKey||"default"}-->`;J.set(Q.hydrationKey||Q.componentName,w)}}}),{staticHTML:Y,dynamicPlaceholders:J,craftComponents:G}}function hW(X){let $={type:"fragment",children:[]},Z=$,Y=[$],J=X,G=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(J.length>0){let Q=J.match(/^<(@?[\w-]+)([^>]*)>/);if(Q){let[W,U,K]=Q,z=uW(K),B=U.startsWith("@craft-"),_=B?U:U.toLowerCase(),j={type:B?"component":"element",tag:_,props:z,children:[],componentName:B?_.slice(1):void 0,isStatic:!F2(K),hydrationKey:eW()};if(Z.children=Z.children||[],Z.children.push(j),!G.has(_)&&!K.endsWith("/"))Y.push(j),Z=j;J=J.slice(W.length);continue}let w=J.match(/^<\/(@?[\w-]+)>/);if(w){let[W,U]=w,z=U.startsWith("@craft-")?U:U.toLowerCase();while(Y.length>1){let B=Y.pop();if(Z=Y[Y.length-1],B.tag===z)break}J=J.slice(W.length);continue}let q=J.match(/^[^<]+/);if(q){let W=q[0];if(W.trim()){let U={type:"text",text:W,isStatic:!F2(W)};Z.children=Z.children||[],Z.children.push(U)}J=J.slice(W.length);continue}J=J.slice(1)}return $}function uW(X){let $={},Z=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,Y;while((Y=Z.exec(X))!==null){let[,J,G,Q,w]=Y,q=G??Q??w??!0;$[J]=q}return $}function W7(X,$,Z=[]){if($(X,Z),X.children)X.children.forEach((Y,J)=>{W7(Y,$,[...Z,`${J}`])})}function q7(X,$){switch(X.type){case"text":return T2(X.text||"",$);case"element":case"component":{let Z=X.tag||"div",Y=R2(X.props||{},$),J=(X.children||[]).map((G)=>q7(G,$)).join("");if(!X.children||X.children.length===0){if(["input","br","hr","img","meta","link"].includes(Z))return`<${Z}${Y} />`}return`<${Z}${Y}>${J}</${Z}>`}case"fragment":return(X.children||[]).map((Z)=>q7(Z,$)).join("");case"slot":return`<!--slot:${X.slotName||"default"}-->`;default:return""}}function A2(X){if(X.type==="text")return X.text||"";let $=X.tag||"div",Z=R2(X.props||{},{});return`<${$}${Z}></${$}>`}function R2(X,$){let Z=[];for(let[Y,J]of Object.entries(X))if(J===!0)Z.push(` ${Y}`);else if(J!==!1&&J!==null&&J!==void 0){let G=T2(String(J),$);Z.push(` ${Y}="${M2(G)}"`)}return Z.join("")}async function dW(X,$){return q7(X,$)}function mW(X,$){let Z=[];return W7(X.tree,(Y)=>{if(Y.isStatic)Z.push(q7(Y,$))}),Z.join("")}function lW(X,$,Z){let Y={templateId:$.id,context:Z,dynamicParts:Array.from($.dynamicParts.entries())},J=`
18171
18177
  <script data-craft-hydration>
18172
18178
  window.__CRAFT_HYDRATION__ = ${JSON.stringify(Y)};
18173
- </script>`;return{html:X+J,data:Y}}function cW(X){let $=!1,Z=!1,Y=!1,J=!1,G=0,Q=0;function w(q,W){if(Q=Math.max(Q,W),q.type==="slot")$=!0;if(q.type==="component")G++;if(!q.isStatic)Z=!0;if(q.props)for(let U of Object.keys(q.props)){if(U.startsWith("on"))Y=!0;if(U==="@async"||U==="data-async")J=!0}if(q.children)q.children.forEach((U)=>w(U,W+1))}return w(X,0),{hasSlots:$,hasDynamicContent:Z,hasEventHandlers:Y,hasAsyncContent:J,componentCount:G,maxDepth:Q,estimatedSize:JSON.stringify(X).length}}function pW(X){let $=new Map,Z=new Map;return W7(X,(Y,J)=>{let G=J.join(".");if(Y.isStatic)$.set(G,A2(Y));else Z.set(G,Y.tag||Y.componentName||"dynamic")}),{staticParts:$,dynamicParts:Z}}function iW(X){let $=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function nW(X){let $=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function rW(X){let $=[],Z=/@include\s*\(\s*['"]([^'"]+)['"]/g,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);let J=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((Y=J.exec(X))!==null)$.push(Y[1]);let G=/<@craft-[\w-]+/g;while((Y=G.exec(X))!==null)$.push(Y[0].slice(2));return[...new Set($)]}function F2(X){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(X)}function T2(X,$){let Z=X.replace(/\{\{\s*(.+?)\s*\}\}/g,(Y,J)=>{try{let G=V2(J.trim(),$);return M2(String(G??""))}catch{return""}});return Z=Z.replace(/\{!!\s*(.+?)\s*!!\}/g,(Y,J)=>{try{let G=V2(J.trim(),$);return String(G??"")}catch{return""}}),Z}function V2(X,$){if(/^[\w.]+$/.test(X)){let Z=X.split("."),Y=$;for(let J of Z)if(Y&&typeof Y==="object"&&J in Y)Y=Y[J];else return;return Y}try{return Function(...Object.keys($),`return ${X}`)(...Object.values($))}catch{return}}function M2(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function sW(X){return X.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function oW(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return`tpl_${Math.abs($).toString(36)}`}function aW(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}var tW=0;function eW(){return`h_${++tW}`}function N2(X){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(X)}function XU(X){let $=X.tag?.toLowerCase(),Z=X.props?.type,Y={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},J=Z?`${$}:${Z}`:$,G=Y[J||""]||Y[$||""];if(G)return{htmlSelector:J||$||"",nativeComponent:G.component,confidence:G.confidence,reason:G.reason};return null}function $U(){Q7.clear()}function ZU(){w7.clear()}function AV(){$U(),ZU()}function RV(){return{templateCacheSize:Q7.size,renderCacheSize:w7.size,totalEntries:Q7.size+w7.size}}import{existsSync as tq,mkdirSync as n0,copyFileSync as c1,chmodSync as p1}from"fs";import{join as h,basename as cF}from"path";import{spawn as K$,execSync as pF}from"child_process";import{tmpdir as eq,homedir as Z2,platform as iF}from"os";H1();i5();oX();y5();rX();import{dirname as dF,resolve as sq}from"path";function nq(X){return X.endsWith(".md")||X.endsWith(".markdown")}function uF(X){let $=[];Y(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let Z=[...$];Y(/<code\b[^>]*>[\s\S]*?<\/code>/gi,Z);function Y(Q,w){let q;while((q=Q.exec(X))!==null){let W=q.index,U=W+q[0].length;if(w?.some((K)=>W>=K.start&&U<=K.end))continue;$.push({start:W,end:U})}}if($.length===0)return X;$.sort((Q,w)=>Q.start-w.start);let J="",G=0;for(let Q of $){if(Q.start<G)continue;J+=X.slice(G,Q.start),J+=`@raw${X.slice(Q.start,Q.end)}@endraw`,G=Q.end}return J+=X.slice(G),J}async function rq(X,$={}){let{data:Z,content:Y}=LX(X),G=await($.renderer??((Q)=>r1(Q)))(Y);return{html:uF(G),frontmatter:Z??{}}}function mF(X){let $=X,Z=h5(X);if(Z)$=Z.content.trim();let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J=[],G=[],Q=[],w=(U)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(U),q;while((q=Y.exec(X))!==null){let U=q[1],K=q[2],z=q[0],B=U.includes("server");if(w(K))Q.push(z);else if(B)G.push(K);else J.push(z)}let W=$;{let U=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,K,z=[];while((K=U.exec(W))!==null){let B=K.index+K[0].length,_=W.indexOf("</script>",B);if(_===-1)continue;z.push({start:K.index,end:_+9}),U.lastIndex=_+9}for(let B=z.length-1;B>=0;B--)W=W.substring(0,z[B].start)+W.substring(z[B].end)}for(let U of J)W=W.replace(U,"");return{templateContent:W,serverScripts:G,clientScripts:J,signalsScripts:Q}}function lF(X,$){return`<!DOCTYPE html>
18179
+ </script>`;return{html:X+J,data:Y}}function cW(X){let $=!1,Z=!1,Y=!1,J=!1,G=0,Q=0;function w(q,W){if(Q=Math.max(Q,W),q.type==="slot")$=!0;if(q.type==="component")G++;if(!q.isStatic)Z=!0;if(q.props)for(let U of Object.keys(q.props)){if(U.startsWith("on"))Y=!0;if(U==="@async"||U==="data-async")J=!0}if(q.children)q.children.forEach((U)=>w(U,W+1))}return w(X,0),{hasSlots:$,hasDynamicContent:Z,hasEventHandlers:Y,hasAsyncContent:J,componentCount:G,maxDepth:Q,estimatedSize:JSON.stringify(X).length}}function pW(X){let $=new Map,Z=new Map;return W7(X,(Y,J)=>{let G=J.join(".");if(Y.isStatic)$.set(G,A2(Y));else Z.set(G,Y.tag||Y.componentName||"dynamic")}),{staticParts:$,dynamicParts:Z}}function iW(X){let $=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function nW(X){let $=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function rW(X){let $=[],Z=/@include\s*\(\s*['"]([^'"]+)['"]/g,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);let J=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((Y=J.exec(X))!==null)$.push(Y[1]);let G=/<@craft-[\w-]+/g;while((Y=G.exec(X))!==null)$.push(Y[0].slice(2));return[...new Set($)]}function F2(X){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(X)}function T2(X,$){let Z=X.replace(/\{\{\s*(.+?)\s*\}\}/g,(Y,J)=>{try{let G=V2(J.trim(),$);return M2(String(G??""))}catch{return""}});return Z=Z.replace(/\{!!\s*(.+?)\s*!!\}/g,(Y,J)=>{try{let G=V2(J.trim(),$);return String(G??"")}catch{return""}}),Z}function V2(X,$){if(/^[\w.]+$/.test(X)){let Z=X.split("."),Y=$;for(let J of Z)if(Y&&typeof Y==="object"&&J in Y)Y=Y[J];else return;return Y}try{return Function(...Object.keys($),`return ${X}`)(...Object.values($))}catch{return}}function M2(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function sW(X){return X.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function oW(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return`tpl_${Math.abs($).toString(36)}`}function aW(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}var tW=0;function eW(){return`h_${++tW}`}function N2(X){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(X)}function XU(X){let $=X.tag?.toLowerCase(),Z=X.props?.type,Y={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},J=Z?`${$}:${Z}`:$,G=Y[J||""]||Y[$||""];if(G)return{htmlSelector:J||$||"",nativeComponent:G.component,confidence:G.confidence,reason:G.reason};return null}function $U(){Q7.clear()}function ZU(){w7.clear()}function AV(){$U(),ZU()}function RV(){return{templateCacheSize:Q7.size,renderCacheSize:w7.size,totalEntries:Q7.size+w7.size}}import{existsSync as tq,mkdirSync as r0,copyFileSync as c1,chmodSync as p1}from"fs";import{join as h,basename as cF}from"path";import{spawn as K$,execSync as pF}from"child_process";import{tmpdir as eq,homedir as Z2,platform as iF}from"os";H1();i5();oX();y5();rX();import{dirname as dF,resolve as sq}from"path";function nq(X){return X.endsWith(".md")||X.endsWith(".markdown")}function uF(X){let $=[];Y(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let Z=[...$];Y(/<code\b[^>]*>[\s\S]*?<\/code>/gi,Z);function Y(Q,w){let q;while((q=Q.exec(X))!==null){let W=q.index,U=W+q[0].length;if(w?.some((K)=>W>=K.start&&U<=K.end))continue;$.push({start:W,end:U})}}if($.length===0)return X;$.sort((Q,w)=>Q.start-w.start);let J="",G=0;for(let Q of $){if(Q.start<G)continue;J+=X.slice(G,Q.start),J+=`@raw${X.slice(Q.start,Q.end)}@endraw`,G=Q.end}return J+=X.slice(G),J}async function rq(X,$={}){let{data:Z,content:Y}=LX(X),G=await($.renderer??((Q)=>r1(Q)))(Y);return{html:uF(G),frontmatter:Z??{}}}function mF(X){let $=X,Z=h5(X);if(Z)$=Z.content.trim();let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J=[],G=[],Q=[],w=(U)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(U),q;while((q=Y.exec(X))!==null){let U=q[1],K=q[2],z=q[0],B=U.includes("server");if(w(K))Q.push(z);else if(B)G.push(K);else J.push(z)}let W=$;{let U=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,K,z=[];while((K=U.exec(W))!==null){let B=K.index+K[0].length,_=W.indexOf("</script>",B);if(_===-1)continue;z.push({start:K.index,end:_+9}),U.lastIndex=_+9}for(let B=z.length-1;B>=0;B--)W=W.substring(0,z[B].start)+W.substring(z[B].end)}for(let U of J)W=W.replace(U,"");return{templateContent:W,serverScripts:G,clientScripts:J,signalsScripts:Q}}function lF(X,$){return`<!DOCTYPE html>
18174
18180
  <html lang="en">
18175
18181
  <head>
18176
18182
  <meta charset="UTF-8">
@@ -18185,8 +18191,8 @@ ${G.join(`
18185
18191
  `)}`}else{if(Z.processClientScripts!==!1&&G.length>0){let U=w.__stx_event_bindings||[],K=a1(w),B=(await Promise.all(G.map(async(j)=>{let H=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!H)return j;return await t1(H[1],{eventBindings:U,templateContent:W,serverData:K,filePath:$})}))).join(`
18186
18192
  `);if(W.match(/(<\/body>)/i))W=W.replace(/(<\/body>)/i,`${B}
18187
18193
  $1`);else W+=`
18188
- ${B}`}W=await s3(W)}if(Z.wrapInDocument){if(!W.trim().toLowerCase().startsWith("<!doctype")&&!W.trim().toLowerCase().startsWith("<html"))W=lF(W,Z.title)}if(Z.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (G9(),LZ));W=await U(W)}catch{}return W}async function $b(X){let $=Date.now();try{if(!await Bun.file(X.input).exists())return{success:!1,target:X.target||U$(),format:X.format||"app",error:`Input file not found: ${X.input}`};let Z=X.target||U$(),Y=X.format||$V(Z),J=X.output||h(process.cwd(),"dist","native");if(!tq(J))n0(J,{recursive:!0});let G=await oq(X.input,{context:X.context,options:{isDev:!1}});if(G=G2(G,{debug:X.verbose}),G=j2(G),!G.includes("craft-component-styles")){if(G.includes("</head>"))G=G.replace("</head>",`${B2}
18189
- </head>`)}let Q=X.name||cF(X.input,".stx"),w=X.version||"1.0.0",q=X.craftPath||await XV();if(!q)return{success:!1,target:Z,format:Y,error:"Craft binary not found. Please install Craft or specify craftPath."};if(X.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Z}...`),console.log(` Input: ${X.input}`),console.log(` Output: ${J}`),console.log(` Craft: ${q}`);let W;switch(Z){case"macos":W=await nF(G,Q,w,J,Y,X,q);break;case"windows":W=await oF(G,Q,w,J,Y,X,q);break;case"linux":W=await aF(G,Q,w,J,Y,X,q);break;case"ios":W=await tF(G,Q,w,J,X,q);break;case"android":W=await eF(G,Q,w,J,X,q);break;default:W={success:!1,target:Z,format:Y,error:`Unsupported target: ${Z}`}}return W.duration=Date.now()-$,W}catch(Z){return{success:!1,target:X.target||U$(),format:X.format||"app",error:Z.message,duration:Date.now()-$}}}async function nF(X,$,Z,Y,J,G,Q){let w=G.bundleId||`com.stx.${$.toLowerCase().replace(/[^a-z0-9]/g,"")}`,q=h(Y,`${$}.app`),W=h(q,"Contents"),U=h(W,"MacOS"),K=h(W,"Resources");n0(U,{recursive:!0}),n0(K,{recursive:!0});let z=h(K,"index.html");await Bun.write(z,X);let B="";if(G.sidebar?.enabled&&G.sidebar?.config)B=h(K,"sidebar-config.json"),await Bun.write(B,JSON.stringify(G.sidebar.config));let _=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",j=G.menubarOnly??G.systemTray;if((G.bundleStyle||(await rF(Q)?"executable":"launcher"))==="executable"){let F=h(U,$);c1(Q,F),p1(F,493);let V={html:"index.html",title:G.window?.title||$,width:G.window?.width||1200,height:G.window?.height||800,devTools:Boolean(G.devTools)};if(j)V.menubarOnly=!0;else if(G.systemTray)V.systemTray=!0;if(G.window?.frameless)V.frameless=!0;if(G.window?.transparent)V.transparent=!0;if(G.window?.alwaysOnTop)V.alwaysOnTop=!0;if(G.window?.resizable===!1)V.resizable=!1;await Bun.write(h(K,"craft.json"),`${JSON.stringify(V,null,2)}
18194
+ ${B}`}W=await s3(W)}if(Z.wrapInDocument){if(!W.trim().toLowerCase().startsWith("<!doctype")&&!W.trim().toLowerCase().startsWith("<html"))W=lF(W,Z.title)}if(Z.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (G9(),LZ));W=await U(W)}catch{}return W}async function Zb(X){let $=Date.now();try{if(!await Bun.file(X.input).exists())return{success:!1,target:X.target||U$(),format:X.format||"app",error:`Input file not found: ${X.input}`};let Z=X.target||U$(),Y=X.format||$V(Z),J=X.output||h(process.cwd(),"dist","native");if(!tq(J))r0(J,{recursive:!0});let G=await oq(X.input,{context:X.context,options:{isDev:!1}});if(G=G2(G,{debug:X.verbose}),G=j2(G),!G.includes("craft-component-styles")){if(G.includes("</head>"))G=G.replace("</head>",`${B2}
18195
+ </head>`)}let Q=X.name||cF(X.input,".stx"),w=X.version||"1.0.0",q=X.craftPath||await XV();if(!q)return{success:!1,target:Z,format:Y,error:"Craft binary not found. Please install Craft or specify craftPath."};if(X.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Z}...`),console.log(` Input: ${X.input}`),console.log(` Output: ${J}`),console.log(` Craft: ${q}`);let W;switch(Z){case"macos":W=await nF(G,Q,w,J,Y,X,q);break;case"windows":W=await oF(G,Q,w,J,Y,X,q);break;case"linux":W=await aF(G,Q,w,J,Y,X,q);break;case"ios":W=await tF(G,Q,w,J,X,q);break;case"android":W=await eF(G,Q,w,J,X,q);break;default:W={success:!1,target:Z,format:Y,error:`Unsupported target: ${Z}`}}return W.duration=Date.now()-$,W}catch(Z){return{success:!1,target:X.target||U$(),format:X.format||"app",error:Z.message,duration:Date.now()-$}}}async function nF(X,$,Z,Y,J,G,Q){let w=G.bundleId||`com.stx.${$.toLowerCase().replace(/[^a-z0-9]/g,"")}`,q=h(Y,`${$}.app`),W=h(q,"Contents"),U=h(W,"MacOS"),K=h(W,"Resources");r0(U,{recursive:!0}),r0(K,{recursive:!0});let z=h(K,"index.html");await Bun.write(z,X);let B="";if(G.sidebar?.enabled&&G.sidebar?.config)B=h(K,"sidebar-config.json"),await Bun.write(B,JSON.stringify(G.sidebar.config));let _=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",j=G.menubarOnly??G.systemTray;if((G.bundleStyle||(await rF(Q)?"executable":"launcher"))==="executable"){let F=h(U,$);c1(Q,F),p1(F,493);let V={html:"index.html",title:G.window?.title||$,width:G.window?.width||1200,height:G.window?.height||800,devTools:Boolean(G.devTools)};if(j)V.menubarOnly=!0;else if(G.systemTray)V.systemTray=!0;if(G.window?.frameless)V.frameless=!0;if(G.window?.transparent)V.transparent=!0;if(G.window?.alwaysOnTop)V.alwaysOnTop=!0;if(G.window?.resizable===!1)V.resizable=!1;await Bun.write(h(K,"craft.json"),`${JSON.stringify(V,null,2)}
18190
18196
  `)}else{let F=h(U,"craft");c1(Q,F),p1(F,493);let V=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",R=`#!/bin/bash
18191
18197
  set -euo pipefail
18192
18198
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
@@ -18203,7 +18209,7 @@ ${Object.entries(X).map(([Z,Y])=>{let J=typeof Y==="boolean"?`<${Y}/>`:typeof Y=
18203
18209
  `)}
18204
18210
  </dict>
18205
18211
  </plist>
18206
- `}async function oF(X,$,Z,Y,J,G,Q){let w=h(Y,$);n0(w,{recursive:!0});let q=h(w,"index.html");await Bun.write(q,X),c1(Q,h(w,"craft.exe"));let W=`@echo off
18212
+ `}async function oF(X,$,Z,Y,J,G,Q){let w=h(Y,$);r0(w,{recursive:!0});let q=h(w,"index.html");await Bun.write(q,X),c1(Q,h(w,"craft.exe"));let W=`@echo off
18207
18213
  set DIR=%~dp0
18208
18214
  "%DIR%craft.exe" --html-file "%DIR%index.html" ^
18209
18215
  --title "${G.window?.title||$}" ^
@@ -18211,7 +18217,7 @@ set DIR=%~dp0
18211
18217
  --height ${G.window?.height||800} ^
18212
18218
  ${G.systemTray?"--system-tray":""} ^
18213
18219
  ${G.devTools?"":"--no-devtools"}
18214
- `;if(await Bun.write(h(w,`${$}.bat`),W),J==="zip"){let U=h(Y,`${$}-${Z}-windows.zip`),K=await YV(w,U);if(!K.success)return{success:!1,target:"windows",format:"zip",error:K.error};return{success:!0,target:"windows",format:"zip",outputPath:U}}return{success:!0,target:"windows",format:"app",outputPath:w}}async function aF(X,$,Z,Y,J,G,Q){let w=h(Y,$);n0(w,{recursive:!0});let q=h(w,"index.html");await Bun.write(q,X);let W=h(w,"craft");c1(Q,W),p1(W,493);let U=`#!/bin/bash
18220
+ `;if(await Bun.write(h(w,`${$}.bat`),W),J==="zip"){let U=h(Y,`${$}-${Z}-windows.zip`),K=await YV(w,U);if(!K.success)return{success:!1,target:"windows",format:"zip",error:K.error};return{success:!0,target:"windows",format:"zip",outputPath:U}}return{success:!0,target:"windows",format:"app",outputPath:w}}async function aF(X,$,Z,Y,J,G,Q){let w=h(Y,$);r0(w,{recursive:!0});let q=h(w,"index.html");await Bun.write(q,X);let W=h(w,"craft");c1(Q,W),p1(W,493);let U=`#!/bin/bash
18215
18221
  set -euo pipefail
18216
18222
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
18217
18223
  exec "$DIR/craft" --html-file "$DIR/index.html" \\
@@ -18227,7 +18233,7 @@ Exec=${K}
18227
18233
  Terminal=false
18228
18234
  Categories=Utility;
18229
18235
  `;if(await Bun.write(h(w,`${$.toLowerCase()}.desktop`),z),J==="deb"){let B=h(Y,`${$.toLowerCase()}_${Z}_amd64.deb`),_=await JV(w,B,$,Z,G);if(!_.success)return{success:!1,target:"linux",format:"deb",error:_.error};return{success:!0,target:"linux",format:"deb",outputPath:B}}if(J==="appimage"){let B=h(Y,`${$}-${Z}-x86_64.AppImage`),_=await GV(w,B,$,G);if(!_.success)return{success:!1,target:"linux",format:"appimage",error:_.error};return{success:!0,target:"linux",format:"appimage",outputPath:B}}return{success:!0,target:"linux",format:"app",outputPath:w}}async function tF(X,$,Z,Y,J,G){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${$}' to create an iOS project.`}}async function eF(X,$,Z,Y,J,G){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${$}' to create an Android project.`}}async function XV(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let X=[h(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),h(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),h(Z2(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),h(Z2(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",h(Z2(),".local/bin/craft"),h(process.env.LOCALAPPDATA||"","craft","craft.exe"),h(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let $ of X)if(await Bun.file($).exists())return $;try{let Z=pF("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
18230
- `)[0];if(Z&&await Bun.file(Z).exists())return Z}catch{}return null}function U$(){switch(iF()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function $V(X){switch(X){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function ZV(X,$,Z){return new Promise((Y)=>{let J=K$("hdiutil",["create","-volname",Z,"-srcfolder",X,"-ov","-format","UDZO",$]);J.on("close",(G)=>{if(G===0)Y({success:!0});else Y({success:!1,error:`hdiutil exited with code ${G}`})}),J.on("error",(G)=>{Y({success:!1,error:G.message})})})}async function YV(X,$){return new Promise((Z)=>{let Y=K$("zip",["-r",$,"."],{cwd:X});Y.on("close",(J)=>{if(J===0)Z({success:!0});else Z({success:!1,error:`zip exited with code ${J}`})}),Y.on("error",(J)=>{Z({success:!1,error:J.message})})})}async function JV(X,$,Z,Y,J){return new Promise((G)=>{try{let Q=h(eq(),`stx-deb-${Date.now()}`),w=h(Q,"DEBIAN"),q=h(Q,"usr","bin"),W=h(Q,"usr","share","applications"),U=h(Q,"usr","share",Z.toLowerCase());n0(w,{recursive:!0}),n0(q,{recursive:!0}),n0(W,{recursive:!0}),n0(U,{recursive:!0});let K=X0("fs").readdirSync(X);for(let j of K)c1(h(X,j),h(U,j));let z=`#!/bin/bash
18236
+ `)[0];if(Z&&await Bun.file(Z).exists())return Z}catch{}return null}function U$(){switch(iF()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function $V(X){switch(X){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function ZV(X,$,Z){return new Promise((Y)=>{let J=K$("hdiutil",["create","-volname",Z,"-srcfolder",X,"-ov","-format","UDZO",$]);J.on("close",(G)=>{if(G===0)Y({success:!0});else Y({success:!1,error:`hdiutil exited with code ${G}`})}),J.on("error",(G)=>{Y({success:!1,error:G.message})})})}async function YV(X,$){return new Promise((Z)=>{let Y=K$("zip",["-r",$,"."],{cwd:X});Y.on("close",(J)=>{if(J===0)Z({success:!0});else Z({success:!1,error:`zip exited with code ${J}`})}),Y.on("error",(J)=>{Z({success:!1,error:J.message})})})}async function JV(X,$,Z,Y,J){return new Promise((G)=>{try{let Q=h(eq(),`stx-deb-${Date.now()}`),w=h(Q,"DEBIAN"),q=h(Q,"usr","bin"),W=h(Q,"usr","share","applications"),U=h(Q,"usr","share",Z.toLowerCase());r0(w,{recursive:!0}),r0(q,{recursive:!0}),r0(W,{recursive:!0}),r0(U,{recursive:!0});let K=X0("fs").readdirSync(X);for(let j of K)c1(h(X,j),h(U,j));let z=`#!/bin/bash
18231
18237
  exec /usr/share/${Z.toLowerCase()}/${Z.toLowerCase()} "$@"`;X0("fs").writeFileSync(h(q,Z.toLowerCase()),z),p1(h(q,Z.toLowerCase()),493);let B=`Package: ${Z.toLowerCase()}
18232
18238
  Version: ${Y}
18233
18239
  Section: utils
@@ -18236,7 +18242,7 @@ Architecture: amd64
18236
18242
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
18237
18243
  Maintainer: ${J.author||"Unknown"}
18238
18244
  Description: ${J.description||Z}
18239
- `;X0("fs").writeFileSync(h(w,"control"),B);let _=K$("dpkg-deb",["--build",Q,$]);_.on("close",(j)=>{if(X0("fs").rmSync(Q,{recursive:!0,force:!0}),j===0)G({success:!0});else G({success:!1,error:`dpkg-deb exited with code ${j}`})}),_.on("error",(j)=>{X0("fs").rmSync(Q,{recursive:!0,force:!0}),G({success:!1,error:j.message})})}catch(Q){G({success:!1,error:Q.message})}})}async function GV(X,$,Z,Y){return new Promise((J)=>{try{let G=h(eq(),`stx-appimage-${Date.now()}`),Q=h(G,`${Z}.AppDir`),w=h(Q,"usr"),q=h(w,"bin"),W=h(w,"share");n0(q,{recursive:!0}),n0(W,{recursive:!0});let U=h(W,Z.toLowerCase());n0(U,{recursive:!0});let K=X0("fs").readdirSync(X);for(let H of K)c1(h(X,H),h(U,H));let z=`#!/bin/bash
18245
+ `;X0("fs").writeFileSync(h(w,"control"),B);let _=K$("dpkg-deb",["--build",Q,$]);_.on("close",(j)=>{if(X0("fs").rmSync(Q,{recursive:!0,force:!0}),j===0)G({success:!0});else G({success:!1,error:`dpkg-deb exited with code ${j}`})}),_.on("error",(j)=>{X0("fs").rmSync(Q,{recursive:!0,force:!0}),G({success:!1,error:j.message})})}catch(Q){G({success:!1,error:Q.message})}})}async function GV(X,$,Z,Y){return new Promise((J)=>{try{let G=h(eq(),`stx-appimage-${Date.now()}`),Q=h(G,`${Z}.AppDir`),w=h(Q,"usr"),q=h(w,"bin"),W=h(w,"share");r0(q,{recursive:!0}),r0(W,{recursive:!0});let U=h(W,Z.toLowerCase());r0(U,{recursive:!0});let K=X0("fs").readdirSync(X);for(let H of K)c1(h(X,H),h(U,H));let z=`#!/bin/bash
18240
18246
  SELF=$(readlink -f "$0")
18241
18247
  HERE=\${SELF%/*}
18242
18248
  export PATH="\${HERE}/usr/bin:\${PATH}"
@@ -18248,4 +18254,4 @@ Exec=${Z.toLowerCase()}
18248
18254
  Terminal=false
18249
18255
  Categories=Utility;
18250
18256
  Icon=${Z.toLowerCase()}
18251
- `;X0("fs").writeFileSync(h(Q,`${Z.toLowerCase()}.desktop`),B);let _=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(X0("fs").writeFileSync(h(Q,`${Z.toLowerCase()}.png`),_),Y.icon&&tq(Y.icon))c1(Y.icon,h(Q,`${Z.toLowerCase()}.png`));let j=K$("appimagetool",[Q,$],{env:{...process.env,ARCH:"x86_64"}});j.on("close",(H)=>{if(X0("fs").rmSync(G,{recursive:!0,force:!0}),H===0)p1($,493),J({success:!0});else J({success:!1,error:`appimagetool exited with code ${H}. Install from https://appimage.github.io/appimagetool/`})}),j.on("error",(H)=>{X0("fs").rmSync(G,{recursive:!0,force:!0}),J({success:!1,error:`appimagetool not found: ${H.message}`})})}catch(G){J({success:!1,error:G.message})}})}function Zb(){return[U$()]}function Yb(X){switch(X){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}export{OV as renderSSR,jV as registerCraftComponent,WV as processCraftDirective,j2 as processCraftComponents,VV as prerenderForCraft,qV as isCraftEnvironment,G2 as injectCraftBridge,RV as getSSRCacheStats,HV as getCraftComponents,Zb as getAvailableTargets,Yb as getAvailableFormats,FV as generateCraftOptimizations,J2 as generateCraftBridgeScript,zV as createHotReloadServer,KV as compileToNative,gW as compileTemplate,$U as clearTemplateCache,ZU as clearRenderCache,AV as clearAllCaches,$b as buildNative,JW as NATIVE_COMPONENTS,B2 as CRAFT_COMPONENT_STYLES,BV as CRAFT_COMPONENT_RUNTIME,H$ as CRAFT_COMPONENTS,wV as CRAFT_BRIDGE_SCRIPT};
18257
+ `;X0("fs").writeFileSync(h(Q,`${Z.toLowerCase()}.desktop`),B);let _=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(X0("fs").writeFileSync(h(Q,`${Z.toLowerCase()}.png`),_),Y.icon&&tq(Y.icon))c1(Y.icon,h(Q,`${Z.toLowerCase()}.png`));let j=K$("appimagetool",[Q,$],{env:{...process.env,ARCH:"x86_64"}});j.on("close",(H)=>{if(X0("fs").rmSync(G,{recursive:!0,force:!0}),H===0)p1($,493),J({success:!0});else J({success:!1,error:`appimagetool exited with code ${H}. Install from https://appimage.github.io/appimagetool/`})}),j.on("error",(H)=>{X0("fs").rmSync(G,{recursive:!0,force:!0}),J({success:!1,error:`appimagetool not found: ${H.message}`})})}catch(G){J({success:!1,error:G.message})}})}function Yb(){return[U$()]}function Jb(X){switch(X){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}export{OV as renderSSR,jV as registerCraftComponent,WV as processCraftDirective,j2 as processCraftComponents,VV as prerenderForCraft,qV as isCraftEnvironment,G2 as injectCraftBridge,RV as getSSRCacheStats,HV as getCraftComponents,Yb as getAvailableTargets,Jb as getAvailableFormats,FV as generateCraftOptimizations,J2 as generateCraftBridgeScript,zV as createHotReloadServer,KV as compileToNative,gW as compileTemplate,$U as clearTemplateCache,ZU as clearRenderCache,AV as clearAllCaches,Zb as buildNative,JW as NATIVE_COMPONENTS,B2 as CRAFT_COMPONENT_STYLES,BV as CRAFT_COMPONENT_RUNTIME,H$ as CRAFT_COMPONENTS,wV as CRAFT_BRIDGE_SCRIPT};