@stacksjs/stx 0.2.158 → 0.2.159

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
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var CK=Object.defineProperty;var vK=($)=>$;function xK($,Z){this[$]=vK.bind(null,Z)}var a=($,Z)=>{for(var Y in Z)CK($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:xK.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var t=import.meta.require;function S8($,Z,Y,J){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let U={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${W||U} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return X=X.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),X=X.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,W)=>{return`<span id="${`desc-${K}`}" class="sr-only">${W}</span>`}),X}var y8,P8;var s7=b(()=>{y8={name:"a11y",handler:($,Z,Y,J)=>{if(!Z.length)return $;let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[X]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},P8={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function xW($,Z={}){let{duration:Y,delay:J,ease:X,direction:Q,custom:G}={...H1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
2
+ var CK=Object.defineProperty;var vK=($)=>$;function xK($,Z){this[$]=vK.bind(null,Z)}var t=($,Z)=>{for(var Y in Z)CK($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:xK.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var e=import.meta.require;function S8($,Z,Y,J){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let U={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${W||U} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return X=X.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),X=X.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,W)=>{return`<span id="${`desc-${K}`}" class="sr-only">${W}</span>`}),X}var y8,P8;var s7=b(()=>{y8={name:"a11y",handler:($,Z,Y,J)=>{if(!Z.length)return $;let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[X]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},P8={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function xW($,Z={}){let{duration:Y,delay:J,ease:X,direction:Q,custom:G}={...H1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
3
3
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4
4
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
5
5
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -637,7 +637,7 @@ ${_}
637
637
  `:`
638
638
  `)}</p>`);if(X=K.join(`
639
639
  `),J)X=X.replace(/\n/g,`<br />
640
- `);for(let U=0;U<Q.length;U++)X=X.replace(`\x00CODEBLOCK${U}\x00`,Q[U]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function w5($="const",Z=[],Y){let J=Z.length?_1.filter((X)=>!Z.includes(X)):_1;if(Y!==void 0)J=J.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${J.join(", ")} } = window.stx;`}function t7($){if(!$)return!1;return iW.some((Z)=>new RegExp(`\\b${Z}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function e7($){if(!$)return!1;let Z=a8($);if(nW.some((Y)=>Y.test(Z)))return!0;return t7(Z)}function n8($){if(!$)return!1;return sW.test(a8($))||e7($)}function r8(){return`{${s8.map(($)=>`'${$}':1`).join(",")}}`}function a8($){if(!$)return $;let Z=(Y)=>Y.replace(/(<[^>]*>)|([^<]+)/g,(J,X,Q)=>X??" ".repeat(Q.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Y,J,X,Q)=>J+Z(X)+Q).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Y,J,X,Q)=>J+Z(X)+Q).replace(/<!--[\s\S]*?-->/g,(Y)=>" ".repeat(Y.length))}var _1,i8,cW,iW,nW,sW,s8,oW,o8;var X1=b(()=>{_1=["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"],i8=["onMount","onDestroy"];cW=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],iW=_1.filter(($)=>!cW.includes($));nW=[/@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/],sW=/\s@[a-z][\w.:-]*\s*=/i;s8=["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"],oW=["x-init","x-transition","x-effect","x-on"],o8=[...s8,...oW]});function $Z($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let J=Y.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(rW.has(J))Z.systemKeys.push(J);else if(J in ZZ)Z.mouse=J;else if(J in e8||/^[a-z]$/.test(J))Z.keys.push(e8[J]||J.toUpperCase());else if(J.startsWith("debounce")){let X=J.match(/debounce(?:\.(\d+))?/);Z.debounce=X?.[1]?Number.parseInt(X[1],10):300}else if(J.startsWith("throttle")){let X=J.match(/throttle(?:\.(\d+))?/);Z.throttle=X?.[1]?Number.parseInt(X[1],10):300}}return Z}function YZ($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,X;while((X=J.exec($))!==null){let[Q,G,K]=X,W=X.index,q=W+Q.length,U=`__stx_evt_${Y++}`,z=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,H;while((H=j.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!t8.has(L))continue;z.push({attribute:`@${_}`,event:L,handler:O,modifiers:$Z(F.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((H=B.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!t8.has(L))continue;z.push({attribute:`@${_}`,event:L,handler:O,modifiers:$Z(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:Q,elementId:U,events:z,startIndex:W,endIndex:q})}return Z}function aW($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=ZZ[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function tW($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function $3($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function eW($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=aW($),X=tW($3($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
640
+ `);for(let U=0;U<Q.length;U++)X=X.replace(`\x00CODEBLOCK${U}\x00`,Q[U]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function w5($="const",Z=[],Y){let J=Z.length?_1.filter((X)=>!Z.includes(X)):_1;if(Y!==void 0)J=J.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${J.join(", ")} } = window.stx;`}function t7($){if(!$)return!1;return iW.some((Z)=>new RegExp(`\\b${Z}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function e7($){if(!$)return!1;let Z=a8($);if(nW.some((Y)=>Y.test(Z)))return!0;return t7(Z)}function n8($){if(!$)return!1;return sW.test(a8($))||e7($)}function r8(){return`{${s8.map(($)=>`'${$}':1`).join(",")}}`}function a8($){if(!$)return $;let Z=(Y)=>Y.replace(/(<[^>]*>)|([^<]+)/g,(J,X,Q)=>X??" ".repeat(Q.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Y,J,X,Q)=>J+Z(X)+Q).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Y,J,X,Q)=>J+Z(X)+Q).replace(/<!--[\s\S]*?-->/g,(Y)=>" ".repeat(Y.length))}var _1,i8,cW,iW,nW,sW,s8,oW,o8;var Q1=b(()=>{_1=["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"],i8=["onMount","onDestroy"];cW=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],iW=_1.filter(($)=>!cW.includes($));nW=[/@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/],sW=/\s@[a-z][\w.:-]*\s*=/i;s8=["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"],oW=["x-init","x-transition","x-effect","x-on"],o8=[...s8,...oW]});function $Z($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let J=Y.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(rW.has(J))Z.systemKeys.push(J);else if(J in ZZ)Z.mouse=J;else if(J in e8||/^[a-z]$/.test(J))Z.keys.push(e8[J]||J.toUpperCase());else if(J.startsWith("debounce")){let X=J.match(/debounce(?:\.(\d+))?/);Z.debounce=X?.[1]?Number.parseInt(X[1],10):300}else if(J.startsWith("throttle")){let X=J.match(/throttle(?:\.(\d+))?/);Z.throttle=X?.[1]?Number.parseInt(X[1],10):300}}return Z}function YZ($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,X;while((X=J.exec($))!==null){let[Q,G,K]=X,W=X.index,q=W+Q.length,U=`__stx_evt_${Y++}`,z=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,H;while((H=j.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!t8.has(L))continue;z.push({attribute:`@${_}`,event:L,handler:O,modifiers:$Z(F.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((H=B.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!t8.has(L))continue;z.push({attribute:`@${_}`,event:L,handler:O,modifiers:$Z(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:Q,elementId:U,events:z,startIndex:W,endIndex:q})}return Z}function aW($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=ZZ[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function tW($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function $3($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function eW($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=aW($),X=tW($3($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
641
641
  (function() {
642
642
  var $el = document.getElementById('${Y}');
643
643
  if (!$el) return;
@@ -750,11 +750,11 @@ else {
750
750
  `)}
751
751
  })();
752
752
  </script>`}function $q($){let Z=YZ($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];for(let X=Z.length-1;X>=0;X--){let Q=Z[X],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let W of Q.events)W.elementId=K[1]}for(let K of Q.events){let W=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(q,""),G=G.replace(U,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),J.push(...Q.events)}return{template:Y,bindings:J}}function JZ($,Z,Y){if(e7($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:K,bindings:W}=$q($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...W],K}let J=YZ($);if(J.length===0)return $;let X=$;for(let K=J.length-1;K>=0;K--){let W=J[K],q=W.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let U=q.match(/id=["']([^"']+)["']/);if(U)for(let z of W.events)z.elementId=U[1]}for(let U of W.events){let z=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),H=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");q=q.replace(j,""),q=q.replace(H,"")}X=X.slice(0,W.startIndex)+q+X.slice(W.endIndex)}let Q=Z3(J.flatMap((K)=>K.events)),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
753
- `+X.slice(G);else X+=Q;return X}var t8,e8,rW,ZZ;var Y3=b(()=>{X1();t8=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"]),e8={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"},rW=new Set(["ctrl","alt","shift","meta"]),ZZ={left:0,middle:1,right:2}});function g0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
753
+ `+X.slice(G);else X+=Q;return X}var t8,e8,rW,ZZ;var Y3=b(()=>{Q1();t8=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"]),e8={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"},rW=new Set(["ctrl","alt","shift","meta"]),ZZ={left:0,middle:1,right:2}});function g0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
754
754
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
755
- `}),$}function s$($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function Zq(){let $=globalThis;return $[XZ]??=new Map,$[XZ]}function e($,Z){let Y=Zq(),J=`${import.meta.url}\x00${$}`,X=Y.get(J);if(X)return X;let Q=Z();return Y.set(J,Q),Q.catch(()=>{if(Y.get(J)===Q)Y.delete(J)}),Q}var XZ;var X$=b(()=>{XZ=Symbol.for("stx.lazy-module-promises")});function R5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(Yq,"<\\/$1")}var Yq;var J3=b(()=>{Yq=/<\/(script)/gi});import Jq from"process";function P0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(Jq.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var E1=()=>{};import Q$ from"path";function GZ($){QZ=$?.trim()||null}function G$(){return process.env[Xq]?.trim()||QZ||A5}function K$($=process.cwd(),...Z){let Y=G$();return Q$.isAbsolute(Y)?Q$.join(Y,...Z):Q$.join($,Y,...Z)}function W$($){if(!$||Q$.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==A5&&!Z.startsWith(`${A5}/`))return $;let Y=Z.slice(A5.length+1);return Y?Q$.join(G$(),Y):G$()}var A5=".stx",Xq="STX_DIR",QZ=null;var o$=()=>{};function Qq($){if(!$||typeof $!=="object")return!1;let Z=$;return typeof Z.message==="string"&&(Z.name==="BuildMessage"||Z.name==="ResolveMessage"||("position"in Z))}function Gq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function X3($,Z){let Y=[];for(let J of Gq($)){if(Qq(J)){let X=J.position||void 0;Y.push({file:Z||X?.file,line:X?.line,column:X?.column,message:J.message??"",lineText:X?.lineText});continue}Y.push({file:Z,message:J instanceof Error?J.message:String(J)})}return Y}function KZ($,Z){return X3($,Z).map((Y)=>{let J=Y.file?`${Y.file}${Y.line?`:${Y.line}${Y.column?`:${Y.column}`:""}`:""}`:"",X=Y.lineText?`
755
+ `}),$}function s$($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function Zq(){let $=globalThis;return $[XZ]??=new Map,$[XZ]}function $0($,Z){let Y=Zq(),J=`${import.meta.url}\x00${$}`,X=Y.get(J);if(X)return X;let Q=Z();return Y.set(J,Q),Q.catch(()=>{if(Y.get(J)===Q)Y.delete(J)}),Q}var XZ;var X$=b(()=>{XZ=Symbol.for("stx.lazy-module-promises")});function R5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(Yq,"<\\/$1")}var Yq;var J3=b(()=>{Yq=/<\/(script)/gi});import Jq from"process";function P0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(Jq.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var E1=()=>{};import Q$ from"path";function GZ($){QZ=$?.trim()||null}function G$(){return process.env[Xq]?.trim()||QZ||A5}function K$($=process.cwd(),...Z){let Y=G$();return Q$.isAbsolute(Y)?Q$.join(Y,...Z):Q$.join($,Y,...Z)}function W$($){if(!$||Q$.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==A5&&!Z.startsWith(`${A5}/`))return $;let Y=Z.slice(A5.length+1);return Y?Q$.join(G$(),Y):G$()}var A5=".stx",Xq="STX_DIR",QZ=null;var o$=()=>{};function Qq($){if(!$||typeof $!=="object")return!1;let Z=$;return typeof Z.message==="string"&&(Z.name==="BuildMessage"||Z.name==="ResolveMessage"||("position"in Z))}function Gq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function X3($,Z){let Y=[];for(let J of Gq($)){if(Qq(J)){let X=J.position||void 0;Y.push({file:Z||X?.file,line:X?.line,column:X?.column,message:J.message??"",lineText:X?.lineText});continue}Y.push({file:Z,message:J instanceof Error?J.message:String(J)})}return Y}function KZ($,Z){return X3($,Z).map((Y)=>{let J=Y.file?`${Y.file}${Y.line?`:${Y.line}${Y.column?`:${Y.column}`:""}`:""}`:"",X=Y.lineText?`
756
756
  ${Y.lineText.trim()}`:"";return J?`${J}: ${Y.message}${X}`:`${Y.message}${X}`}).join(`
757
- `)}var q$={};a(q$,{shouldLogBundlerDiagnostics:()=>zZ,setBundlerFallbackMode:()=>Uq,resolveBundlerFallback:()=>BZ,recordBundleFailure:()=>jZ,queueClientBundleBuild:()=>HZ,hasUserImports:()=>zq,getBundleFailures:()=>Wq,clearBundleFailures:()=>qq,bundleClientScript:()=>Bq});import F0 from"path";import C0 from"fs";function zZ($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function s1(...$){if(zZ())console.log("[stx:bundler]",...$)}function jZ($,Z,Y){K3.push({filePath:$||"<inline>",message:Z,details:Y})}function Wq(){return K3.slice()}function qq(){K3.length=0}function Uq($){G3=$}function BZ(){if(G3)return G3;try{return z$.strict?.bundlerFallback??"warn"}catch{return"warn"}}function zq($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(!WZ.some((G)=>G.test(X)))return s1("detected user import:",X),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=J.exec($))!==null){let X=Y[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!WZ.some((G)=>G.test(X)))return s1("detected side-effect import:",X),!0}return!1}function jq($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:F0.dirname(Q),W=F0.resolve(K,G),q=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,F0.join(W,"index.ts"),F0.join(W,"index.tsx"),F0.join(W,"index.js"),F0.join(W,"index.mjs")];for(let U of q)try{if(C0.existsSync(U)&&C0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(C0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=X(G.importer,G.path);return J.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=F0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,F0.join(K,"index.ts"),F0.join(K,"index.tsx"),F0.join(K,"index.js"),F0.join(K,"index.mjs")];for(let q of W)if(C0.existsSync(q)&&C0.statSync(q,{throwIfNoEntry:!1})?.isFile())return s1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",q),J.add(q),{path:q};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=F0.extname(G.path).toLowerCase(),W=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)J.add(G.path);return{contents:C0.readFileSync(G.path,"utf8"),loader:W}})}}}function HZ($){let Z=globalThis,J=(Z[qZ]??Promise.resolve()).then($,$);return Z[qZ]=J.then(()=>{return},()=>{return}),J}async function Bq($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||K$(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${Kq}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=F0.join(Q,`${K}.js`),q=F0.join(Q,`${K}.deps.json`),U=Bun.file(W);if(await U.exists()){let H=Bun.file(q),B=!0;if(await H.exists())try{let _=JSON.parse(await H.text());if(_.metadataVersion!==UZ||!Array.isArray(_.files))B=!1;for(let O of Array.isArray(_.files)?_.files:[])try{if(C0.statSync(O.path).mtimeMs!==O.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return s1("cache hit:",K),await U.text();s1("cache invalidated by dep change:",K)}let z=Q3.get(K);if(z)return await z;let j=HZ(()=>Hq($,Z,{projectRoot:J,minify:X,cacheDir:Q,hash:K,cachePath:W,depsPath:q}));Q3.set(K,j);try{return await j}finally{Q3.delete(K)}}async function Hq($,Z,Y){let{projectRoot:J,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=Y,q=K$(J,"bundle-tmp"),U=F0.join(q,`${G}.ts`),z=F0.join(q,"out",G);C0.mkdirSync(q,{recursive:!0}),C0.mkdirSync(z,{recursive:!0});let j=F0.dirname(Z),H=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=B.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)H.push(w)});else if(O[3])H.push(O[3])}while((O=_.exec($))!==null){if(O[1])continue;H.push(O[2])}let F=H.length>0?`
757
+ `)}var q$={};t(q$,{shouldLogBundlerDiagnostics:()=>zZ,setBundlerFallbackMode:()=>Uq,resolveBundlerFallback:()=>BZ,recordBundleFailure:()=>jZ,queueClientBundleBuild:()=>HZ,hasUserImports:()=>zq,getBundleFailures:()=>Wq,clearBundleFailures:()=>qq,bundleClientScript:()=>Bq});import F0 from"path";import C0 from"fs";function zZ($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function s1(...$){if(zZ())console.log("[stx:bundler]",...$)}function jZ($,Z,Y){K3.push({filePath:$||"<inline>",message:Z,details:Y})}function Wq(){return K3.slice()}function qq(){K3.length=0}function Uq($){G3=$}function BZ(){if(G3)return G3;try{return z$.strict?.bundlerFallback??"warn"}catch{return"warn"}}function zq($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(!WZ.some((G)=>G.test(X)))return s1("detected user import:",X),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=J.exec($))!==null){let X=Y[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!WZ.some((G)=>G.test(X)))return s1("detected side-effect import:",X),!0}return!1}function jq($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:F0.dirname(Q),W=F0.resolve(K,G),q=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,F0.join(W,"index.ts"),F0.join(W,"index.tsx"),F0.join(W,"index.js"),F0.join(W,"index.mjs")];for(let U of q)try{if(C0.existsSync(U)&&C0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(C0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=X(G.importer,G.path);return J.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=F0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,F0.join(K,"index.ts"),F0.join(K,"index.tsx"),F0.join(K,"index.js"),F0.join(K,"index.mjs")];for(let q of W)if(C0.existsSync(q)&&C0.statSync(q,{throwIfNoEntry:!1})?.isFile())return s1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",q),J.add(q),{path:q};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=F0.extname(G.path).toLowerCase(),W=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)J.add(G.path);return{contents:C0.readFileSync(G.path,"utf8"),loader:W}})}}}function HZ($){let Z=globalThis,J=(Z[qZ]??Promise.resolve()).then($,$);return Z[qZ]=J.then(()=>{return},()=>{return}),J}async function Bq($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||K$(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${Kq}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=F0.join(Q,`${K}.js`),q=F0.join(Q,`${K}.deps.json`),U=Bun.file(W);if(await U.exists()){let H=Bun.file(q),B=!0;if(await H.exists())try{let _=JSON.parse(await H.text());if(_.metadataVersion!==UZ||!Array.isArray(_.files))B=!1;for(let O of Array.isArray(_.files)?_.files:[])try{if(C0.statSync(O.path).mtimeMs!==O.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return s1("cache hit:",K),await U.text();s1("cache invalidated by dep change:",K)}let z=Q3.get(K);if(z)return await z;let j=HZ(()=>Hq($,Z,{projectRoot:J,minify:X,cacheDir:Q,hash:K,cachePath:W,depsPath:q}));Q3.set(K,j);try{return await j}finally{Q3.delete(K)}}async function Hq($,Z,Y){let{projectRoot:J,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=Y,q=K$(J,"bundle-tmp"),U=F0.join(q,`${G}.ts`),z=F0.join(q,"out",G);C0.mkdirSync(q,{recursive:!0}),C0.mkdirSync(z,{recursive:!0});let j=F0.dirname(Z),H=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=B.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)H.push(w)});else if(O[3])H.push(O[3])}while((O=_.exec($))!==null){if(O[1])continue;H.push(O[2])}let F=H.length>0?`
758
758
  export { ${H.join(", ")} }`:"";await Bun.write(U,$+F),s1("bundling:",G,"from:",F0.basename(Z));let L=new Set;try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:X,plugins:[jq(J,j,U,L)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...P0()},root:J});if(!V.success){let D=V.logs.filter((P)=>P.level==="error").map((P)=>P.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of V.outputs){w=await D.text();break}let R=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let P of D[1].split(",")){let y=P.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y){R.push([y[2],y[1]]);continue}let S=P.trim();if(/^[A-Za-z_$][\w$]*$/.test(S))R.push([S,S])}let A=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let M=`__stxBundle_${G}`,N=R.map(([D,P])=>`${JSON.stringify(D)}: ${P}`).join(", "),I=R.map(([D])=>`var ${D} = undefined;`).join(`
759
759
  `),T=R.map(([D])=>`${D} = ${M}[${JSON.stringify(D)}];`).join(`
760
760
  `);if(w=`${A.join(`
@@ -764,7 +764,7 @@ var ${M} = (function() {
764
764
  ${w}
765
765
  return { ${N} };
766
766
  })();
767
- ${T}`.trim(),s1("bundled:",G,"output:",w.length,"bytes"),H.length>0&&R.length===0)return console.warn(`[stx:bundler] dropped every binding for ${F0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;C0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let k=Array.from(L).map((D)=>{try{return{path:D,mtimeMs:C0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({metadataVersion:UZ,files:k})),w}catch(V){let w=X3(V,Z||void 0),R=KZ(V,Z||void 0);if(console.warn(`[stx:bundler] error: ${R}`),jZ(Z||"",R,w),BZ()==="error")throw V;return $}finally{try{C0.rmSync(U,{force:!0}),C0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var Kq=5,UZ=1,K3,G3,WZ,Q3,qZ;var U$=b(()=>{E1();o$();O1();K3=[];WZ=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];Q3=new Map,qZ=Symbol.for("stx.client-bundle-build-queue")});var MZ={};a(MZ,{stripCommentsAndLiterals:()=>t$,renderVendorStyleTags:()=>a$,processClientScript:()=>a1,injectBrowserCoreAutoImports:()=>M5,generateServerDataBridge:()=>e$,generateBrowserAutoImportDestructuring:()=>Tq,generateAutoImportDestructuring:()=>W3,extractBridgeData:()=>r1,extractAndStripCssImports:()=>r$,STX_AUTO_IMPORTS:()=>LZ});import o1 from"path";import j$ from"fs";function Oq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function Fq($,Z){let Y=Z;while(!0){let J=o1.join(Y,"node_modules",$,"package.json");if(j$.existsSync(J))return o1.dirname(J);let X=o1.dirname(Y);if(X===Y)return null;Y=X}}function Lq($,Z){if(!$||typeof $!=="object")return null;let Y=(X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"){if(typeof X.import==="string")return X.import;if(typeof X.default==="string")return X.default;if(typeof X.import==="object")return Y(X.import);if(typeof X.default==="object")return Y(X.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=null;for(let X of Object.keys($)){let Q=X.indexOf("*");if(Q===-1)continue;let G=X.slice(0,Q),K=X.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!J||G.length>J.prefix.length)J={pattern:X,prefix:G,suffix:K}}if(J){let X=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=Y($[J.pattern]);if(Q)return Q.replace("*",X)}return null}function Vq($,Z){let Y=Oq($);if(!Y||!Y.subpath)return null;let J=Fq(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(j$.readFileSync(o1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=Lq(X.exports,Q);if(!G)return null;let K=o1.resolve(J,G);return j$.existsSync(K)?K:null}function r$($,Z){let Y=Z.filePath?o1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(_q,(K,W)=>{let q;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(q=W.startsWith("/")?W:o1.resolve(Y,W),!j$.existsSync(q))throw Error(`file not found: ${q}`)}else{let U=null;try{U=Bun.resolveSync(W,J)}catch{U=Vq(W,J)}if(!U)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);q=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(X.has(q))return"";X.add(q);try{let U=j$.readFileSync(q,"utf8");Q.push({source:W,resolvedPath:q,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${q}: ${U?.message||U}`)}return""}),styles:Q}}function wq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function a$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${wq(Z.source)}" data-stx-layer="vendor">
767
+ ${T}`.trim(),s1("bundled:",G,"output:",w.length,"bytes"),H.length>0&&R.length===0)return console.warn(`[stx:bundler] dropped every binding for ${F0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;C0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let k=Array.from(L).map((D)=>{try{return{path:D,mtimeMs:C0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({metadataVersion:UZ,files:k})),w}catch(V){let w=X3(V,Z||void 0),R=KZ(V,Z||void 0);if(console.warn(`[stx:bundler] error: ${R}`),jZ(Z||"",R,w),BZ()==="error")throw V;return $}finally{try{C0.rmSync(U,{force:!0}),C0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var Kq=5,UZ=1,K3,G3,WZ,Q3,qZ;var U$=b(()=>{E1();o$();O1();K3=[];WZ=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];Q3=new Map,qZ=Symbol.for("stx.client-bundle-build-queue")});var MZ={};t(MZ,{stripCommentsAndLiterals:()=>t$,renderVendorStyleTags:()=>a$,processClientScript:()=>a1,injectBrowserCoreAutoImports:()=>M5,generateServerDataBridge:()=>e$,generateBrowserAutoImportDestructuring:()=>Tq,generateAutoImportDestructuring:()=>W3,extractBridgeData:()=>r1,extractAndStripCssImports:()=>r$,STX_AUTO_IMPORTS:()=>LZ});import o1 from"path";import j$ from"fs";function Oq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function Fq($,Z){let Y=Z;while(!0){let J=o1.join(Y,"node_modules",$,"package.json");if(j$.existsSync(J))return o1.dirname(J);let X=o1.dirname(Y);if(X===Y)return null;Y=X}}function Lq($,Z){if(!$||typeof $!=="object")return null;let Y=(X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"){if(typeof X.import==="string")return X.import;if(typeof X.default==="string")return X.default;if(typeof X.import==="object")return Y(X.import);if(typeof X.default==="object")return Y(X.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=null;for(let X of Object.keys($)){let Q=X.indexOf("*");if(Q===-1)continue;let G=X.slice(0,Q),K=X.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!J||G.length>J.prefix.length)J={pattern:X,prefix:G,suffix:K}}if(J){let X=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=Y($[J.pattern]);if(Q)return Q.replace("*",X)}return null}function Vq($,Z){let Y=Oq($);if(!Y||!Y.subpath)return null;let J=Fq(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(j$.readFileSync(o1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=Lq(X.exports,Q);if(!G)return null;let K=o1.resolve(J,G);return j$.existsSync(K)?K:null}function r$($,Z){let Y=Z.filePath?o1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(_q,(K,W)=>{let q;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(q=W.startsWith("/")?W:o1.resolve(Y,W),!j$.existsSync(q))throw Error(`file not found: ${q}`)}else{let U=null;try{U=Bun.resolveSync(W,J)}catch{U=Vq(W,J)}if(!U)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);q=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(X.has(q))return"";X.add(q);try{let U=j$.readFileSync(q,"utf8");Q.push({source:W,resolvedPath:q,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${q}: ${U?.message||U}`)}return""}),styles:Q}}function wq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function a$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${wq(Z.source)}" data-stx-layer="vendor">
768
768
  @layer vendor {
769
769
  ${Z.contents}
770
770
  }
@@ -842,7 +842,7 @@ else {
842
842
  // STX: auto-generated event bindings
843
843
  ${$.map((Y,J)=>Pq(Y,J)).join(`
844
844
  `)}`}function FZ($){let Z=[],Y=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),X=0,Q=J.length,G=0;while(G<Q){let K=J[G];if(K==="'"||K==='"'||K==="`"){let W=K;if(G++,W==="`"){let q=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&q===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){q++,G+=2;continue}if(J[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===W){G++;break}G++}continue}if(K==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
845
- `)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let W=J.slice(G),q=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let j=q[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=q[0].length;continue}let U=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((j)=>{let H=j.trim(),B=H.indexOf(":"),_=B>=0?H.slice(B+1).trim().split(/[\s=]/)[0]:H.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_)}),G+=U[0].length;continue}let z=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let j=z[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=z[0].length;continue}}G++}return Z}function xq($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(j){let H;while((H=Y.exec(j))!==null){let B=H[0];if(!vq.has(B))Z.add(B)}}let X=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=X.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);return Z}async function a1($,Z={}){let Y=$,J="",X=!1,Q=[],G=r$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=a$(G.styles),W=M5(Y);Y=W.code,Q=[...W.imports,...W.models];let{hasUserImports:q,bundleClientScript:U}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (U$(),q$)));if(q(Y))Y=await U(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let L=AZ(Y);Y=L.code,J=W3(L.stxImports,L.browserImports.filter((V)=>!Q.includes(V)))}if(J=`${e$(Y,Z.serverData)}${J}`,Y=g0(Y),!X&&t1(Z.attrs||""))Y=e1(Y);let z=Cq(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let L=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${K}<script ${V}>
845
+ `)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let W=J.slice(G),q=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let j=q[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=q[0].length;continue}let U=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((j)=>{let H=j.trim(),B=H.indexOf(":"),_=B>=0?H.slice(B+1).trim().split(/[\s=]/)[0]:H.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_)}),G+=U[0].length;continue}let z=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let j=z[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=z[0].length;continue}}G++}return Z}function xq($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(j){let H;while((H=Y.exec(j))!==null){let B=H[0];if(!vq.has(B))Z.add(B)}}let X=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=X.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);return Z}async function a1($,Z={}){let Y=$,J="",X=!1,Q=[],G=r$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=a$(G.styles),W=M5(Y);Y=W.code,Q=[...W.imports,...W.models];let{hasUserImports:q,bundleClientScript:U}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (U$(),q$)));if(q(Y))Y=await U(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let L=AZ(Y);Y=L.code,J=W3(L.stxImports,L.browserImports.filter((V)=>!Q.includes(V)))}if(J=`${e$(Y,Z.serverData)}${J}`,Y=g0(Y),!X&&t1(Z.attrs||""))Y=e1(Y);let z=Cq(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let L=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${K}<script ${V}>
846
846
  ${R5(`${J}${Y}
847
847
  ${z}`)}
848
848
  </script>`}let B=t7($),_=/function __stx_setup_/.test(Y),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(L){let V=L.length>0?`
@@ -856,7 +856,7 @@ ${z}${V}`)}
856
856
  'use strict';
857
857
  ${R5(`${J}${Y}
858
858
  ${z}`)}
859
- })()</script>`}var _q,LZ,VZ,Rq,kq,OZ,Sq,vq;var N5=b(()=>{Y3();M0();X$();X1();J3();_q=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;LZ=_1,VZ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];Rq=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"]);kq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,OZ=new Set;Sq={left:0,middle:1,right:2};vq=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 fq}from"crypto";function NZ($){let Z=$[$4];return Z instanceof Map?Z:null}function TZ($){$[$4]=new Map}function IZ($,Z){let Y=NZ($);if(!Y)return null;let J=fq("sha256").update(Z).digest("hex").slice(0,16),X=Y.get(J);if(X)X.instances++;else Y.set(J,{body:Z,instances:1});return J}function DZ($,Z){let Y=NZ(Z);if(!Y?.size)return $;let J=$;for(let[W,q]of Y){if(q.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(W)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(U,(z,j)=>`(${q.body})(${j});`)}let X=[...Y].filter(([,W])=>W.instances>1);if(X.length===0)return J;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
859
+ })()</script>`}var _q,LZ,VZ,Rq,kq,OZ,Sq,vq;var N5=b(()=>{Y3();M0();X$();Q1();J3();_q=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;LZ=_1,VZ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];Rq=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"]);kq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,OZ=new Set;Sq={left:0,middle:1,right:2};vq=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 fq}from"crypto";function NZ($){let Z=$[$4];return Z instanceof Map?Z:null}function TZ($){$[$4]=new Map}function IZ($,Z){let Y=NZ($);if(!Y)return null;let J=fq("sha256").update(Z).digest("hex").slice(0,16),X=Y.get(J);if(X)X.instances++;else Y.set(J,{body:Z,instances:1});return J}function DZ($,Z){let Y=NZ(Z);if(!Y?.size)return $;let J=$;for(let[W,q]of Y){if(q.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(W)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(U,(z,j)=>`(${q.body})(${j});`)}let X=[...Y].filter(([,W])=>W.instances>1);if(X.length===0)return J;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
860
860
  (function() {
861
861
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
862
862
  ${X.map(([W,q])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${q.body}; }
@@ -865,7 +865,7 @@ ${X.map(([W,q])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.str
865
865
  })();
866
866
  </script>`,K=J.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(K<0)return`${G}
867
867
  ${J}`;return`${J.slice(0,K)}${G}
868
- ${J.slice(K)}`}var $4="__stx_component_client_factories";var q3=()=>{};function mq($){let Z="",Y=null,J=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(J){J=!1;continue}if(Q==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&X+1<$.length&&$[X+1]==="{"){let G=1;X+=2;while(X<$.length&&G>0){if($[X]==="{")G++;else if($[X]==="}")G--;if(G>0)Z+=$[X],X++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function dq($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(hq.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&SZ.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function lq($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!SZ.has(J))continue;let X=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function Z4($){let Z=$.trim(),Y=mq(Z);dq(Y,Z),lq(Z);for(let J of bZ)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!kZ.allowBracketNotation&&uq.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function pq($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||bZ.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=U3(J);else Z[Y]=J}return Z}function U3($,Z=0){if(Z>=kZ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>U3(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,X]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(X&&typeof X==="object")Y[J]=U3(X,Z+1);else Y[J]=X}return Y}function J0($,Z){try{let Y=pq(Z),J=Object.keys(Y),X=Object.values(Y);return W0($,J)(...X)}catch{return}}function K0($){try{return Z4($),!0}catch{return!1}}function L0($,Z){try{let Y=J0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function W0($,Z){let Y=Z4($),J=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let q=0;q<Z.length;q++){let U=Z[q];if(!J.test(U))continue;if(yZ.has(U))continue;X.push(q),Q.push(U)}let G=(q)=>Function(...Q,...q,`
868
+ ${J.slice(K)}`}var $4="__stx_component_client_factories";var q3=()=>{};function mq($){let Z="",Y=null,J=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(J){J=!1;continue}if(Q==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&X+1<$.length&&$[X+1]==="{"){let G=1;X+=2;while(X<$.length&&G>0){if($[X]==="{")G++;else if($[X]==="}")G--;if(G>0)Z+=$[X],X++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function dq($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(hq.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&SZ.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function lq($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!SZ.has(J))continue;let X=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function Z4($){let Z=$.trim(),Y=mq(Z);dq(Y,Z),lq(Z);for(let J of bZ)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!kZ.allowBracketNotation&&uq.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function pq($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||bZ.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=U3(J);else Z[Y]=J}return Z}function U3($,Z=0){if(Z>=kZ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>U3(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,X]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(X&&typeof X==="object")Y[J]=U3(X,Z+1);else Y[J]=X}return Y}function J0($,Z){try{let Y=pq(Z),J=Object.keys(Y),X=Object.values(Y);return q0($,J)(...X)}catch{return}}function W0($){try{return Z4($),!0}catch{return!1}}function L0($,Z){try{let Y=J0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function q0($,Z){let Y=Z4($),J=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let q=0;q<Z.length;q++){let U=Z[q];if(!J.test(U))continue;if(yZ.has(U))continue;X.push(q),Q.push(U)}let G=(q)=>Function(...Q,...q,`
869
869
  'use strict';
870
870
  try {
871
871
  return ${Y};
@@ -876,7 +876,7 @@ catch (e) {
876
876
  }
877
877
  throw e;
878
878
  }
879
- `),K=G([]);if(Q.length===Z.length)return EZ(K,Q,G);return EZ((...q)=>{let U=Array(X.length);for(let z=0;z<X.length;z++)U[z]=q[X[z]];return K(...U)},Q,G,(q)=>{K=G(q)})}function EZ($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...q)=>{for(let U=0;U<=8;U++)try{return G(...q)}catch(z){let j=z instanceof Error?z.message:"",H=Q.exec(j);if(!(z instanceof ReferenceError)||!H)return;let B=H[1];if(W.has(B)||yZ.has(B))return;W.add(B),K.push(B),G=Y(K),J?.(K)}return}}function Y4($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var gq,kZ,bZ,hq,SZ,uq,yZ;var V0=b(()=>{gq={maxSanitizeDepth:10,allowBracketNotation:!1},kZ={...gq},bZ=[/\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/],hq=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"]),SZ=new Set(["__proto__","constructor","prototype"]),uq=/[\w)\]]\s*\[\s*['"]/;yZ=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 J4($,Z){let Y=cq++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return iq.set(J,{type:$,expression:Z}),J}var cq=0,iq;var PZ=b(()=>{iq=new Map});function gZ($,Z,Y,J){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)return-1;J.lastIndex=Y.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function k1($,Z){return gZ($,Z,CZ,vZ)}function T5($,Z){return gZ($,Z,xZ,fZ)}function B$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function nq($,Z){if($.startsWith("<!--",Z)){let Y=B$($,Z);return Y===-1?$.length:Y}for(let[Y,J]of[[CZ,vZ],[xZ,fZ]]){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)continue;J.lastIndex=Y.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function z3($,Z){let Y=[],J=0,X=$.length,Q=!1,G=null;while(J<X){let K=$[J];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;J++;continue}if(K!=="<"){J++;continue}let W=Z($,J);if(W>J){Y.push({start:J,end:W,token:$.slice(J,W)}),J=W;continue}let q=nq($,J);if(q>J){J=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return Y}function Q1($,Z,Y){let J=z3($,Z);if(J.length===0)return{output:$,tokens:[]};let X=J.map((K)=>K.token),Q="",G=0;for(let K=0;K<J.length;K++){let W=J[K];Q+=$.slice(G,W.start),Q+=Y(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function b1($){let{output:Z,tokens:Y}=Q1($,k1,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function H$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var CZ,vZ,xZ,fZ;var $5=b(()=>{CZ=/<script\b[^>]*>/iy,vZ=/<\/script\s*>/ig,xZ=/<style\b[^>]*>/iy,fZ=/<\/style\s*>/ig});var pZ={};a(pZ,{usesSignalsInScript:()=>F1,unescapeHtml:()=>ZU,registerFilters:()=>oq,registerFilter:()=>mZ,processExpressions:()=>S1,interpolateScriptsInTemplate:()=>aq,interpolateScriptExpressions:()=>X4,getAllFilters:()=>dZ,evaluateExpression:()=>c0,escapeHtml:()=>a0,defaultFilters:()=>O$,clearCustomFilters:()=>rq,applyFilters:()=>lZ});function sq($){let Z=hZ.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),hZ.set($,Z)}return Z.lastIndex=0,Z}function mZ($,Z){if($ in O$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);_$[$]=Z}function oq($){for(let[Z,Y]of Object.entries($))mZ(Z,Y)}function dZ(){return{...O$,..._$}}function rq(){for(let $ of Object.keys(_$))delete _$[$]}function a0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function F1($){let{scripts:Z}=b1($);for(let Y of Z){let J=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let X=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function uZ($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let q=0;q<J.length;q++){let U=J[q];if(!Q&&U==="`"){Q=!0,G=0;continue}if(Q){if(U==="`"&&G===0){Q=!1;continue}if(U==="$"&&J[q+1]==="{"){G++,q++,X+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){X+=U;continue}continue}X+=U}J=X;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=K.exec(J))!==null){let q=W[1];if(!J.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(q)&&!(q in Z))return!1}}return!0}function X4($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=c0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=c0(X,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),Y}function aq($,Z,Y={}){let{output:J,scripts:X}=b1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!K||!W||q===-1)return G;let U=K[1],z=K[2];if(/\bsrc\s*=/.test(U))return G;if(/\bdata-raw\b/.test(U))return G;if(/\btype\s*=\s*["']application\/json["']/.test(U))return G;if(Y.skipServer&&/\bserver\b/.test(U))return G;let j=X4(z,Z);return W[0]+j+G.slice(q)});return H$(J,Q)}function S1($,Z,Y){let J=$,X=(z,j)=>{let H=T5(z,j);if(H===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(j,H))?-1:H},Q=(z,j,H,B)=>{let _=H.length,{output:O,tokens:F}=Q1(z,j,(L,V)=>B(_+V));return H.push(...F),O},G=[];J=Q(J,X,G,(z)=>`<!--__STX_STYLE_${z}__-->`);let K=[];J=Q(J,k1,K,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let W=Z?.__stx_signals_gate===!0||F1($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,j,H)=>{try{let B=c0(j,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return U0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${_}`,Y,$,H,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,j,H)=>{try{let B=c0(j,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return J4("raw",j.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return J4("raw",j.trim());let _=B instanceof Error?B.message:String(B);return U0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${_}`,Y,$,H,z)}}),J=Q(J,k1,K,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),J=Q(J,X,G,(z)=>`<!--__STX_STYLE_${z}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(z,j,H)=>{let B=j.trim();if(U.has(B))return z;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(O)?.[1],V=L&&((L in Z)||_.includes(L)),w=Boolean(L&&q.has(L)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,A=B.match(R),M=A&&!_.includes(A[1])&&!(A[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let N=c0(j,Z);if(w)return z;if(W&&!uZ(B,Z))return z;if(N===void 0&&Z.__stx_buildMode==="compile"&&!W)return J4("expr",B);return N!==void 0&&N!==null?a0(String(N)):""}catch(N){if(w)return z;if(W&&!uZ(B,Z))return z;if(M)return z;let I=N instanceof Error?N.message:String(N);return U0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,Y,$,H,z)}});for(let z=0;z<K.length;z++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>K[z]);for(let z=0;z<G.length;z++)J=J.replace(`<!--__STX_STYLE_${z}__-->`,()=>G[z]);return J}function lZ($,Z,Y){if(!Z.trim())return $;let J=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=_$[G]||O$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(dZ()).join(", ")}`);let W=[];if(X.startsWith(":")){let q=X.match(/^:([^|\s]+)/);if(q){let U=q[1].trim();try{let z=Number(U);W=[Number.isNaN(z)?U:z]}catch{W=[U]}X=X.substring(q[0].length).trim()}}else if(X.startsWith("(")){let q=1,U=1;while(q>0&&U<X.length){if(X[U]==="(")q++;if(X[U]===")")q--;U++}if(q===0){let z=X.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))W=[c0(`(${z})`,Y,!0)];else{let j=[],H="",B=null,_=0,O=0,F=0,L=!1;for(let V=0;V<z.length;V++){let w=z[V];if(L){H+=w,L=!1;continue}if(w==="\\"){H+=w,L=!0;continue}if(B){if(H+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,H+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&_===0&&O===0&&F===0){j.push(H),H="";continue}H+=w}if(H)j.push(H);W=j.map((V)=>{let w=V.trim();return c0(w,Y,!0)})}}catch{W=[z]}X=X.substring(U).trim()}}try{J=K(J,Y,...W)}catch(q){let U=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${U}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function tq($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],q=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&q==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(W==="(")J++;else if(W===")")J--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&J===0&&X===0&&Q===0){if(q==="|"){K++;continue}if(q==="="){K++;continue}return K}}return-1}function c0($,Z,Y=!1){try{let J=$.trim(),X=tq(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=c0(Q,Z,!0);return lZ(K,G,Z)}if(!K0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return J0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return W0(J,Q)(...G)}catch{return J0(J,Z)}}catch(J){if(J instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(J.message);if(X){let Q=X[1],G=eq(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function eq($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=$U($,X);if(Y===null||Q<Y.dist)Y={key:X,dist:Q}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function $U($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],X=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)X[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function ZU($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var _$,hZ,O$;var G1=b(()=>{V0();M0();PZ();$5();_$={},hZ=new Map;O$={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return a0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(Y).forEach(([W,q])=>{K=K.replace(sq(W),String(q))}),K},t:($,Z,Y={})=>{return O$.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=Y)return X;if(Y<=J.length)return J.substring(0,Y);return X.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return X.toISOString();return new Intl.DateTimeFormat(J,Q[Y]||Q.short).format(X)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(X)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let X=Number($);if(Number.isNaN(X))return Y;let Q=J||`${Y}s`;return X===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let X=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let X=10**Y;return Math.round(J*X)/X}}});class Z5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function D5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!I5.has(Y)){if(I5.size>=YU){let J=I5.keys().next().value;if(J)I5.delete(J)}I5.set(Y,new RegExp($,Z))}return I5.get(Y)}class cZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let q=`${Y}:${W}`,U=X.get(q);if(!U){if(X.size>=Q){let z=X.keys().next().value;if(z)X.delete(z)}U=Function(...Z,`
879
+ `),K=G([]);if(Q.length===Z.length)return EZ(K,Q,G);return EZ((...q)=>{let U=Array(X.length);for(let z=0;z<X.length;z++)U[z]=q[X[z]];return K(...U)},Q,G,(q)=>{K=G(q)})}function EZ($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...q)=>{for(let U=0;U<=8;U++)try{return G(...q)}catch(z){let j=z instanceof Error?z.message:"",H=Q.exec(j);if(!(z instanceof ReferenceError)||!H)return;let B=H[1];if(W.has(B)||yZ.has(B))return;W.add(B),K.push(B),G=Y(K),J?.(K)}return}}function Y4($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var gq,kZ,bZ,hq,SZ,uq,yZ;var V0=b(()=>{gq={maxSanitizeDepth:10,allowBracketNotation:!1},kZ={...gq},bZ=[/\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/],hq=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"]),SZ=new Set(["__proto__","constructor","prototype"]),uq=/[\w)\]]\s*\[\s*['"]/;yZ=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 J4($,Z){let Y=cq++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return iq.set(J,{type:$,expression:Z}),J}var cq=0,iq;var PZ=b(()=>{iq=new Map});function gZ($,Z,Y,J){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)return-1;J.lastIndex=Y.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function k1($,Z){return gZ($,Z,CZ,vZ)}function T5($,Z){return gZ($,Z,xZ,fZ)}function B$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function nq($,Z){if($.startsWith("<!--",Z)){let Y=B$($,Z);return Y===-1?$.length:Y}for(let[Y,J]of[[CZ,vZ],[xZ,fZ]]){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)continue;J.lastIndex=Y.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function z3($,Z){let Y=[],J=0,X=$.length,Q=!1,G=null;while(J<X){let K=$[J];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;J++;continue}if(K!=="<"){J++;continue}let W=Z($,J);if(W>J){Y.push({start:J,end:W,token:$.slice(J,W)}),J=W;continue}let q=nq($,J);if(q>J){J=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return Y}function G1($,Z,Y){let J=z3($,Z);if(J.length===0)return{output:$,tokens:[]};let X=J.map((K)=>K.token),Q="",G=0;for(let K=0;K<J.length;K++){let W=J[K];Q+=$.slice(G,W.start),Q+=Y(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function b1($){let{output:Z,tokens:Y}=G1($,k1,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function H$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var CZ,vZ,xZ,fZ;var $5=b(()=>{CZ=/<script\b[^>]*>/iy,vZ=/<\/script\s*>/ig,xZ=/<style\b[^>]*>/iy,fZ=/<\/style\s*>/ig});var pZ={};t(pZ,{usesSignalsInScript:()=>F1,unescapeHtml:()=>ZU,registerFilters:()=>oq,registerFilter:()=>mZ,processExpressions:()=>S1,interpolateScriptsInTemplate:()=>aq,interpolateScriptExpressions:()=>X4,getAllFilters:()=>dZ,evaluateExpression:()=>c0,escapeHtml:()=>t0,defaultFilters:()=>O$,clearCustomFilters:()=>rq,applyFilters:()=>lZ});function sq($){let Z=hZ.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),hZ.set($,Z)}return Z.lastIndex=0,Z}function mZ($,Z){if($ in O$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);_$[$]=Z}function oq($){for(let[Z,Y]of Object.entries($))mZ(Z,Y)}function dZ(){return{...O$,..._$}}function rq(){for(let $ of Object.keys(_$))delete _$[$]}function t0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function F1($){let{scripts:Z}=b1($);for(let Y of Z){let J=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let X=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function uZ($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let q=0;q<J.length;q++){let U=J[q];if(!Q&&U==="`"){Q=!0,G=0;continue}if(Q){if(U==="`"&&G===0){Q=!1;continue}if(U==="$"&&J[q+1]==="{"){G++,q++,X+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){X+=U;continue}continue}X+=U}J=X;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=K.exec(J))!==null){let q=W[1];if(!J.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(q)&&!(q in Z))return!1}}return!0}function X4($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=c0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=c0(X,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),Y}function aq($,Z,Y={}){let{output:J,scripts:X}=b1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!K||!W||q===-1)return G;let U=K[1],z=K[2];if(/\bsrc\s*=/.test(U))return G;if(/\bdata-raw\b/.test(U))return G;if(/\btype\s*=\s*["']application\/json["']/.test(U))return G;if(Y.skipServer&&/\bserver\b/.test(U))return G;let j=X4(z,Z);return W[0]+j+G.slice(q)});return H$(J,Q)}function S1($,Z,Y){let J=$,X=(z,j)=>{let H=T5(z,j);if(H===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(j,H))?-1:H},Q=(z,j,H,B)=>{let _=H.length,{output:O,tokens:F}=G1(z,j,(L,V)=>B(_+V));return H.push(...F),O},G=[];J=Q(J,X,G,(z)=>`<!--__STX_STYLE_${z}__-->`);let K=[];J=Q(J,k1,K,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let W=Z?.__stx_signals_gate===!0||F1($),q=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,j,H)=>{try{let B=c0(j,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${_}`,Y,$,H,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,j,H)=>{try{let B=c0(j,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return J4("raw",j.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return J4("raw",j.trim());let _=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${_}`,Y,$,H,z)}}),J=Q(J,k1,K,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),J=Q(J,X,G,(z)=>`<!--__STX_STYLE_${z}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(z,j,H)=>{let B=j.trim();if(U.has(B))return z;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(O)?.[1],V=L&&((L in Z)||_.includes(L)),w=Boolean(L&&q.has(L)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,A=B.match(R),M=A&&!_.includes(A[1])&&!(A[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let N=c0(j,Z);if(w)return z;if(W&&!uZ(B,Z))return z;if(N===void 0&&Z.__stx_buildMode==="compile"&&!W)return J4("expr",B);return N!==void 0&&N!==null?t0(String(N)):""}catch(N){if(w)return z;if(W&&!uZ(B,Z))return z;if(M)return z;let I=N instanceof Error?N.message:String(N);return z0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,Y,$,H,z)}});for(let z=0;z<K.length;z++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>K[z]);for(let z=0;z<G.length;z++)J=J.replace(`<!--__STX_STYLE_${z}__-->`,()=>G[z]);return J}function lZ($,Z,Y){if(!Z.trim())return $;let J=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=_$[G]||O$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(dZ()).join(", ")}`);let W=[];if(X.startsWith(":")){let q=X.match(/^:([^|\s]+)/);if(q){let U=q[1].trim();try{let z=Number(U);W=[Number.isNaN(z)?U:z]}catch{W=[U]}X=X.substring(q[0].length).trim()}}else if(X.startsWith("(")){let q=1,U=1;while(q>0&&U<X.length){if(X[U]==="(")q++;if(X[U]===")")q--;U++}if(q===0){let z=X.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))W=[c0(`(${z})`,Y,!0)];else{let j=[],H="",B=null,_=0,O=0,F=0,L=!1;for(let V=0;V<z.length;V++){let w=z[V];if(L){H+=w,L=!1;continue}if(w==="\\"){H+=w,L=!0;continue}if(B){if(H+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,H+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&_===0&&O===0&&F===0){j.push(H),H="";continue}H+=w}if(H)j.push(H);W=j.map((V)=>{let w=V.trim();return c0(w,Y,!0)})}}catch{W=[z]}X=X.substring(U).trim()}}try{J=K(J,Y,...W)}catch(q){let U=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${U}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function tq($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],q=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&q==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(W==="(")J++;else if(W===")")J--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&J===0&&X===0&&Q===0){if(q==="|"){K++;continue}if(q==="="){K++;continue}return K}}return-1}function c0($,Z,Y=!1){try{let J=$.trim(),X=tq(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=c0(Q,Z,!0);return lZ(K,G,Z)}if(!W0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return J0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return q0(J,Q)(...G)}catch{return J0(J,Z)}}catch(J){if(J instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(J.message);if(X){let Q=X[1],G=eq(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function eq($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=$U($,X);if(Y===null||Q<Y.dist)Y={key:X,dist:Q}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function $U($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],X=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)X[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function ZU($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var _$,hZ,O$;var K1=b(()=>{V0();M0();PZ();$5();_$={},hZ=new Map;O$={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return t0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(Y).forEach(([W,q])=>{K=K.replace(sq(W),String(q))}),K},t:($,Z,Y={})=>{return O$.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=Y)return X;if(Y<=J.length)return J.substring(0,Y);return X.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return X.toISOString();return new Intl.DateTimeFormat(J,Q[Y]||Q.short).format(X)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(X)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let X=Number($);if(Number.isNaN(X))return Y;let Q=J||`${Y}s`;return X===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let X=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let X=10**Y;return Math.round(J*X)/X}}});class Z5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function D5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!I5.has(Y)){if(I5.size>=YU){let J=I5.keys().next().value;if(J)I5.delete(J)}I5.set(Y,new RegExp($,Z))}return I5.get(Y)}class cZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let q=`${Y}:${W}`,U=X.get(q);if(!U){if(X.size>=Q){let z=X.keys().next().value;if(z)X.delete(z)}U=Function(...Z,`
880
880
  'use strict';
881
881
  try {
882
882
  return ${W};
@@ -887,14 +887,14 @@ catch (e) {
887
887
  }
888
888
  throw e;
889
889
  }
890
- `),X.set(q,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class iZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,X=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:X};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(G)}catch{}let K=X?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);return{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}}let Z={};for(let[Y,J]of this.metrics.entries()){let X=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:X?.maxTime,budgetUtilization:X?J.totalTime/J.count/X.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}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 JU(){if(!j3)j3=new iZ;return j3}var I5,YU=500,dV,j3=null,nZ;var E5=b(()=>{I5=new Map;dV=new cZ;nZ=new Proxy({},{get($,Z){return JU()[Z]}})});function sZ($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function B3($,Z){let Y={...$};for(let[J,X]of Object.entries(Z))Y[J]=sZ(X)&&sZ(Y[J])?B3(Y[J],X):X;return Y}function oZ($={},Z={}){let Y=$.theme||{},J=Z.theme||{},{extend:X,...Q}=J,{extend:G,...K}=Y,W=B3(K,Q),q=B3(G||{},X||{});if(Object.keys(q).length>0)W.extend=q;let U=[...$.safelist||[],...Z.safelist||[]],z={...$.shortcuts||{},...Z.shortcuts||{}},j=[...$.preflights||[],...Z.preflights||[]];return{config:{...$,...Z,theme:W,safelist:U,shortcuts:z,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:U,shortcuts:z,includePreflight:Z.preflight!==!1,minify:Z.minify===!0}}var H0;var rZ=b(()=>{H0={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 Y2={};a(Y2,{resetCssCache:()=>zU,resetCrosswindCache:()=>jU,rebuildCrosswindCSS:()=>BU,loadCrosswindConfig:()=>F3,loadCrosswind:()=>O3,injectCrosswindCSS:()=>L3,getCrosswindServeAsset:()=>GU,getCachedCSS:()=>HU,generateCrosswindCSS:()=>Z2,extractClassNames:()=>$2,buildCrosswindCSS:()=>eZ});import X0 from"path";import{hasLocalConfig as XU}from"bunfig";function G4($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function H3($,Z){if(L1.has($))L1.delete($);else if(L1.size>=tZ)L1.delete(L1.keys().next().value);L1.set($,Z)}function QU($){let Z=G4($);if(t0.has(Z))t0.delete(Z);else if(t0.size>=tZ)t0.delete(t0.keys().next().value);return t0.set(Z,$),Z}function GU($){let Z=t0.get($);if(Z===void 0)return;return t0.delete($),t0.set($,Z),Z}async function KU($){if(!y1)return null;try{let Z=Bun.file(X0.join(y1,`cw-${G4($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function WU($,Z){if(!y1)return;try{if(!fs.existsSync(y1))fs.mkdirSync(y1,{recursive:!0});await Bun.write(X0.join(y1,`cw-${G4($)}.css`),Z)}catch{}}async function aZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function qU(){let $=[],Z=process.cwd();while(Z!==X0.dirname(Z))$.push(X0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=X0.dirname(Z);return $}function UU(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[X0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function O3(){if(_3)return K1;_3=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await aZ(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=X0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return K1=Q,K1}let Z=await $(qU());if(Z)return K1=Z,K1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of Y){let Q=await aZ(X);if(Q){if(K1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded`);return K1}}let J=await $(UU());if(J)return K1=J,K1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${H0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${H0.reset}`),console.warn(`${H0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${H0.reset}`),null}}function zU(){L1.clear(),t0.clear()}function jU(){K1=null,_3=!1,e0=null,F$="",L1.clear(),t0.clear(),Q4=null}async function F3($){try{if(!XU({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=X0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${H0.yellow}[Crosswind]${H0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function eZ($){if(k5)return F$;k5=!0;try{let Z=await O3();if(!Z||!Z.build)return k5=!1,"";if(!e0)e0=await F3($);if(!e0)return k5=!1,"";let Y=Z.defaultConfig?.theme||{},J=e0.theme||{},X={...Z.defaultConfig,...e0,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(F$=G.css,console.log(`${H0.cyan}[Crosswind]${H0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let W=X0.isAbsolute(X.output)?X.output:X0.join($,X.output),q=X0.dirname(W);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(W,G.css)}return k5=!1,G.css}catch(Z){return console.error(`${H0.red}[Crosswind]${H0.reset} Build error:`,Z),k5=!1,F$}}async function BU($){e0=null,await eZ($)}function HU(){return F$}function $2($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let X=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=X.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=X.exec($)}return Z}async function Z2($,Z){try{let Y=await O3();if(!Y)return"";let J=typeof Y.extractClasses==="function"?Y.extractClasses($):$2($);if(J.size===0)return"";let X=Z?X0.resolve(Z):process.cwd();if(!y1)y1=K$(X,"cache");let Q=[...J].sort().join(" "),G=`${Q4||"default"}::${Q}`,K=L1.get(G);if(K!==void 0)return H3(G,K),K;let W=await KU(G);if(W!==null)return H3(G,W),W;if(!e0){let w=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (O1(),J2)),A=await R(X);if(A.css)if(typeof A.css==="string"){let M=X0.isAbsolute(A.css)?A.css:X0.resolve(X,A.css);if(await Bun.file(M).exists()){let N=await import(M);w=N.default||N,console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from stx.config.ts \u2192 ${A.css}`)}}else{if(w={...A.css,content:A.css.content||[],preflight:A.css.preflight??!0,minify:A.css.minify??!1},A.css.config){let M=X0.isAbsolute(A.css.config)?A.css.config:X0.resolve(X,A.css.config);if(await Bun.file(M).exists()){let N=await import(M);w={...N.default||N,...w}}}console.log(`${H0.green}[Crosswind]${H0.reset} Using inline CSS config from stx.config.ts`)}}catch{}e0=w||await F3(X);try{Q4=G4(JSON.stringify(e0??{}))}catch{Q4="unhashable"}}let q=Y.defaultConfig||Y.config,U=e0||{},z=oZ(q,U),{safelist:j,includePreflight:H,minify:B}=z,_=z.config,O=new Y.CSSGenerator(_);for(let w of j)O.generate(w);for(let w of J)O.generate(w);let F=O.toCSS(H,B),L=_.shortcuts||U.shortcuts||{};for(let[w,R]of Object.entries(L)){if(!J.has(w)&&!j.includes(w))continue;let A=R.split(/\s+/).filter(Boolean);for(let M of A)O.generate(M)}F=O.toCSS(H,B);let V=F.split(`
890
+ `),X.set(q,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class iZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,X=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:X};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(G)}catch{}let K=X?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);return{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}}let Z={};for(let[Y,J]of this.metrics.entries()){let X=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:X?.maxTime,budgetUtilization:X?J.totalTime/J.count/X.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}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 JU(){if(!j3)j3=new iZ;return j3}var I5,YU=500,dV,j3=null,nZ;var E5=b(()=>{I5=new Map;dV=new cZ;nZ=new Proxy({},{get($,Z){return JU()[Z]}})});function sZ($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function B3($,Z){let Y={...$};for(let[J,X]of Object.entries(Z))Y[J]=sZ(X)&&sZ(Y[J])?B3(Y[J],X):X;return Y}function oZ($={},Z={}){let Y=$.theme||{},J=Z.theme||{},{extend:X,...Q}=J,{extend:G,...K}=Y,W=B3(K,Q),q=B3(G||{},X||{});if(Object.keys(q).length>0)W.extend=q;let U=[...$.safelist||[],...Z.safelist||[]],z={...$.shortcuts||{},...Z.shortcuts||{}},j=[...$.preflights||[],...Z.preflights||[]];return{config:{...$,...Z,theme:W,safelist:U,shortcuts:z,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:U,shortcuts:z,includePreflight:Z.preflight!==!1,minify:Z.minify===!0}}var H0;var rZ=b(()=>{H0={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 Y2={};t(Y2,{resetCssCache:()=>zU,resetCrosswindCache:()=>jU,rebuildCrosswindCSS:()=>BU,loadCrosswindConfig:()=>F3,loadCrosswind:()=>O3,injectCrosswindCSS:()=>L3,getCrosswindServeAsset:()=>GU,getCachedCSS:()=>HU,generateCrosswindCSS:()=>Z2,extractClassNames:()=>$2,buildCrosswindCSS:()=>eZ});import X0 from"path";import{hasLocalConfig as XU}from"bunfig";function G4($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function H3($,Z){if(L1.has($))L1.delete($);else if(L1.size>=tZ)L1.delete(L1.keys().next().value);L1.set($,Z)}function QU($){let Z=G4($);if(e0.has(Z))e0.delete(Z);else if(e0.size>=tZ)e0.delete(e0.keys().next().value);return e0.set(Z,$),Z}function GU($){let Z=e0.get($);if(Z===void 0)return;return e0.delete($),e0.set($,Z),Z}async function KU($){if(!y1)return null;try{let Z=Bun.file(X0.join(y1,`cw-${G4($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function WU($,Z){if(!y1)return;try{if(!fs.existsSync(y1))fs.mkdirSync(y1,{recursive:!0});await Bun.write(X0.join(y1,`cw-${G4($)}.css`),Z)}catch{}}async function aZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function qU(){let $=[],Z=process.cwd();while(Z!==X0.dirname(Z))$.push(X0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=X0.dirname(Z);return $}function UU(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[X0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function O3(){if(_3)return W1;_3=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await aZ(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=X0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return W1=Q,W1}let Z=await $(qU());if(Z)return W1=Z,W1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of Y){let Q=await aZ(X);if(Q){if(W1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded`);return W1}}let J=await $(UU());if(J)return W1=J,W1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${H0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${H0.reset}`),console.warn(`${H0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${H0.reset}`),null}}function zU(){L1.clear(),e0.clear()}function jU(){W1=null,_3=!1,$1=null,F$="",L1.clear(),e0.clear(),Q4=null}async function F3($){try{if(!XU({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=X0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${H0.yellow}[Crosswind]${H0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function eZ($){if(k5)return F$;k5=!0;try{let Z=await O3();if(!Z||!Z.build)return k5=!1,"";if(!$1)$1=await F3($);if(!$1)return k5=!1,"";let Y=Z.defaultConfig?.theme||{},J=$1.theme||{},X={...Z.defaultConfig,...$1,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(F$=G.css,console.log(`${H0.cyan}[Crosswind]${H0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let W=X0.isAbsolute(X.output)?X.output:X0.join($,X.output),q=X0.dirname(W);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(W,G.css)}return k5=!1,G.css}catch(Z){return console.error(`${H0.red}[Crosswind]${H0.reset} Build error:`,Z),k5=!1,F$}}async function BU($){$1=null,await eZ($)}function HU(){return F$}function $2($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let X=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=X.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=X.exec($)}return Z}async function Z2($,Z){try{let Y=await O3();if(!Y)return"";let J=typeof Y.extractClasses==="function"?Y.extractClasses($):$2($);if(J.size===0)return"";let X=Z?X0.resolve(Z):process.cwd();if(!y1)y1=K$(X,"cache");let Q=[...J].sort().join(" "),G=`${Q4||"default"}::${Q}`,K=L1.get(G);if(K!==void 0)return H3(G,K),K;let W=await KU(G);if(W!==null)return H3(G,W),W;if(!$1){let w=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (O1(),J2)),A=await R(X);if(A.css)if(typeof A.css==="string"){let M=X0.isAbsolute(A.css)?A.css:X0.resolve(X,A.css);if(await Bun.file(M).exists()){let N=await import(M);w=N.default||N,console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from stx.config.ts \u2192 ${A.css}`)}}else{if(w={...A.css,content:A.css.content||[],preflight:A.css.preflight??!0,minify:A.css.minify??!1},A.css.config){let M=X0.isAbsolute(A.css.config)?A.css.config:X0.resolve(X,A.css.config);if(await Bun.file(M).exists()){let N=await import(M);w={...N.default||N,...w}}}console.log(`${H0.green}[Crosswind]${H0.reset} Using inline CSS config from stx.config.ts`)}}catch{}$1=w||await F3(X);try{Q4=G4(JSON.stringify($1??{}))}catch{Q4="unhashable"}}let q=Y.defaultConfig||Y.config,U=$1||{},z=oZ(q,U),{safelist:j,includePreflight:H,minify:B}=z,_=z.config,O=new Y.CSSGenerator(_);for(let w of j)O.generate(w);for(let w of J)O.generate(w);let F=O.toCSS(H,B),L=_.shortcuts||U.shortcuts||{};for(let[w,R]of Object.entries(L)){if(!J.has(w)&&!j.includes(w))continue;let A=R.split(/\s+/).filter(Boolean);for(let M of A)O.generate(M)}F=O.toCSS(H,B);let V=F.split(`
891
891
  `);for(let[w,R]of Object.entries(L)){if(!J.has(w)&&!j.includes(w))continue;let A=R.split(/\s+/).filter(Boolean),M=[],N=[];for(let I of A){let T=I.startsWith("dark:"),P=`.${(T?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let S=V[y].trim();if(S===`${P} {`||S.startsWith(`${P} {`)){let C=y,x="";while(C<V.length){if(x+=V[C],V[C].includes("}"))break;C++}let m=x.match(/\{([^}]+)\}/);if(m)if(T)N.push(m[1].trim());else M.push(m[1].trim());break}}}if(M.length)F+=`
892
892
  .${w} { ${M.join(" ")} }`;if(N.length)F+=`
893
893
  @media (prefers-color-scheme: dark) { .dark .${w} { ${N.join(" ")} } }`}return H3(G,F),WU(G,F),F}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function L3($,Z,Y=!1){let J=await Z2($,Z);if(!J)return $;let X=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${QU(J)}.css">`:`<style data-crosswind="generated">
894
894
  ${J}
895
895
  </style>`,Q=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(Q.test($)){let G=!1;return $.replace(Q,()=>{if(G)return"";return G=!0,X})}if($.includes("</head>"))return $.replace("</head>",`${X}
896
896
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
897
- ${X}`);return X+$}var K1=null,_3=!1,e0=null,F$="",k5=!1,tZ=256,L1,t0,y1=null,Q4=null;var V3=b(()=>{o$();rZ();L1=new Map,t0=new Map});function K4($){let Z=0;while(Z<$.length){let Y=$.slice(Z),J=/<body\b([^>]*)>/i.exec(Y);if(!J)return null;let X=Z+J.index,Q=-1,G="";for(let W of _U){let q=W.open.exec(Y);if(!q)continue;let U=Z+q.index;if(U<X&&(Q===-1||U<Q))Q=U,G=W.close}if(Q===-1)return{index:X,tag:J[0],attrs:J[1]??""};let K=$.toLowerCase().indexOf(G,Q);if(K===-1)return null;Z=K+G.length}return null}function w3($,Z){let Y=K4($);if(!Y)return $;return $.slice(0,Y.index)+Z(Y.tag,Y.attrs)+$.slice(Y.index+Y.tag.length)}var _U;var R3=b(()=>{_U=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function X2(){return`
897
+ ${X}`);return X+$}var W1=null,_3=!1,$1=null,F$="",k5=!1,tZ=256,L1,e0,y1=null,Q4=null;var V3=b(()=>{o$();rZ();L1=new Map,e0=new Map});function K4($){let Z=0;while(Z<$.length){let Y=$.slice(Z),J=/<body\b([^>]*)>/i.exec(Y);if(!J)return null;let X=Z+J.index,Q=-1,G="";for(let W of _U){let q=W.open.exec(Y);if(!q)continue;let U=Z+q.index;if(U<X&&(Q===-1||U<Q))Q=U,G=W.close}if(Q===-1)return{index:X,tag:J[0],attrs:J[1]??""};let K=$.toLowerCase().indexOf(G,Q);if(K===-1)return null;Z=K+G.length}return null}function w3($,Z){let Y=K4($);if(!Y)return $;return $.slice(0,Y.index)+Z(Y.tag,Y.attrs)+$.slice(Y.index+Y.tag.length)}var _U;var R3=b(()=>{_U=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function X2(){return`
898
898
  // STX Lifecycle Runtime
899
899
  (function() {
900
900
  if (typeof window === 'undefined') return;
@@ -1673,7 +1673,7 @@ window.__stx_reactive = (function() {
1673
1673
  ${SU()}
1674
1674
  ${Y}
1675
1675
  </script>`}function F2($,Z,Y){if(O2=0,!CU($))return $;let J=DU($);if(J.length===0)return $;let X=PU($,J),Q=yU(J,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
1676
- `+X.slice(G);else X+=Q;return X}function PU($,Z){let Y=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(X,Q,G)=>{let K=Z[Y++];if(!K)return X;let W=/data-stx-scope="([^"]*)"/.exec(G);if(W)return K.id=W[1],K.selector=`[data-stx-scope="${K.id}"]`,X;return`<${Q} data-stx-scope="${K.id}"${G}>`});return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),J=J.replace(/\s*x-init\s*=\s*'[^']*'/g,""),J}function CU($){return/x-data\s*=\s*["']/.test($)}var O2=0,IU=0;var L2=b(()=>{G1()});import vU from"fs";import M3 from"path";import{createHighlighter as xU}from"ts-syntax-highlighter";async function fU($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let J=(await vU.promises.stat($)).mtime.getTime();if(Z.cache&&N3.has($)){let z=N3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let X=await Bun.file($).text(),{data:Q,content:G}=n$(X),K=Z.markdown||z$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=n1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)q=await gU(q,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:q,data:Q||{}};if(Z.cache)N3.set($,{...U,updatedAt:J});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:U0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function gU($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!W4)try{W4=await xU({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,q,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=q||(Y?"text":"");if(!j)return K;try{if(!W4.getSupportedLanguages().includes(j))return K;return(await W4.highlight(z,j,{theme:Z})).html}catch(H){console.error(`Error highlighting code block with language ${q}:`,H)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[W,q,U,z]=K,j=await X(W,q,U,z);Q=Q.replace(W,j)}return Q}async function V2($,Z,Y="",J={}){return await hU($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,q)=>{try{let U=K;if(!M3.isAbsolute(K))U=M3.resolve(M3.dirname(Y),K);let z={};if(W)try{try{z=JSON.parse(W)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let L=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of L){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),A=V.substring(w+1).trim(),M=A.startsWith('"')&&A.endsWith('"'),N=A.startsWith("'")&&A.endsWith("'");if(M||N)A=A.substring(1,A.length-1);z[R]=A}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:j,data:H}=await fU(U,J),B={...Z,...H,...z},_=j,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(F,L)=>{let V=L.trim();return B[V]!==void 0?String(B[V]):F}),_}catch(U){let z=U instanceof Error?U.message:String(U);return U0("Markdown File",`Error including markdown file: ${z}`,Y,$,q,G)}})}async function hU($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,q=X;J.push(Y(...q).then((U)=>({match:K,replacement:U,index:W})))}let Q=await Promise.all(J);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var N3,W4=null;var w2=b(()=>{O1();M0();N3=new Map});function P1($,Z){try{let Y=$.trim();if(K0(Y))return W0(Y,Object.keys(Z))(...Object.values(Z));else return J0(Y,Z)}catch{return!1}}var R2=b(()=>{V0()});function T3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var q4=b(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function L$(){return!1}function V$(){return!L$()||process.env.STX_DEBUG==="true"}function U4(){return!1}import uU from"path";function z4(){return{...I3}}function j4($){if(!I3.showRelativePaths||!$)return $;let Z=I3.baseDir||process.cwd();try{let Y=uU.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var mU,I3,B4,Y5,H4;var _4=b(()=>{q4();mU={showRelativePaths:!1,enableAutoRecovery:V$(),logRecoveryWarnings:!0},I3={...mU};B4=class B4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,X,Q,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=X;this.context=Q;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=j4(this.filePath)}};Y5=class Y5 extends B4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};H4=class H4 extends B4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function M2($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:W,snippet:q,suggestion:U,format:z="text"}=$,j=Q,H=G;if(!j&&K&&W!==void 0){let L=nU(K,W);j=L.line,H=L.column}let B=X?j4(X):void 0,_=J?T3(J):void 0,O={type:Z,code:J,codeName:_,message:Y,filePath:B,line:j,column:H,snippet:q,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=lU(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=pU(O,K,W);break;case"text":default:F=dU(O,K,W);break}return{formatted:F,data:O}}function dU($,Z,Y){let J=[],X=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${X}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
1676
+ `+X.slice(G);else X+=Q;return X}function PU($,Z){let Y=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(X,Q,G)=>{let K=Z[Y++];if(!K)return X;let W=/data-stx-scope="([^"]*)"/.exec(G);if(W)return K.id=W[1],K.selector=`[data-stx-scope="${K.id}"]`,X;return`<${Q} data-stx-scope="${K.id}"${G}>`});return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),J=J.replace(/\s*x-init\s*=\s*'[^']*'/g,""),J}function CU($){return/x-data\s*=\s*["']/.test($)}var O2=0,IU=0;var L2=b(()=>{K1()});import vU from"fs";import M3 from"path";import{createHighlighter as xU}from"ts-syntax-highlighter";async function fU($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let J=(await vU.promises.stat($)).mtime.getTime();if(Z.cache&&N3.has($)){let z=N3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let X=await Bun.file($).text(),{data:Q,content:G}=n$(X),K=Z.markdown||z$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=n1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)q=await gU(q,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:q,data:Q||{}};if(Z.cache)N3.set($,{...U,updatedAt:J});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:z0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function gU($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!W4)try{W4=await xU({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,q,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=q||(Y?"text":"");if(!j)return K;try{if(!W4.getSupportedLanguages().includes(j))return K;return(await W4.highlight(z,j,{theme:Z})).html}catch(H){console.error(`Error highlighting code block with language ${q}:`,H)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[W,q,U,z]=K,j=await X(W,q,U,z);Q=Q.replace(W,j)}return Q}async function V2($,Z,Y="",J={}){return await hU($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,q)=>{try{let U=K;if(!M3.isAbsolute(K))U=M3.resolve(M3.dirname(Y),K);let z={};if(W)try{try{z=JSON.parse(W)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let L=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of L){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),A=V.substring(w+1).trim(),M=A.startsWith('"')&&A.endsWith('"'),N=A.startsWith("'")&&A.endsWith("'");if(M||N)A=A.substring(1,A.length-1);z[R]=A}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:j,data:H}=await fU(U,J),B={...Z,...H,...z},_=j,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(F,L)=>{let V=L.trim();return B[V]!==void 0?String(B[V]):F}),_}catch(U){let z=U instanceof Error?U.message:String(U);return z0("Markdown File",`Error including markdown file: ${z}`,Y,$,q,G)}})}async function hU($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,q=X;J.push(Y(...q).then((U)=>({match:K,replacement:U,index:W})))}let Q=await Promise.all(J);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var N3,W4=null;var w2=b(()=>{O1();M0();N3=new Map});function P1($,Z){try{let Y=$.trim();if(W0(Y))return q0(Y,Object.keys(Z))(...Object.values(Z));else return J0(Y,Z)}catch{return!1}}var R2=b(()=>{V0()});function T3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var q4=b(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function L$(){return!1}function V$(){return!L$()||process.env.STX_DEBUG==="true"}function U4(){return!1}import uU from"path";function z4(){return{...I3}}function j4($){if(!I3.showRelativePaths||!$)return $;let Z=I3.baseDir||process.cwd();try{let Y=uU.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var mU,I3,B4,Y5,H4;var _4=b(()=>{q4();mU={showRelativePaths:!1,enableAutoRecovery:V$(),logRecoveryWarnings:!0},I3={...mU};B4=class B4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,X,Q,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=X;this.context=Q;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=j4(this.filePath)}};Y5=class Y5 extends B4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};H4=class H4 extends B4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function M2($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:W,snippet:q,suggestion:U,format:z="text"}=$,j=Q,H=G;if(!j&&K&&W!==void 0){let L=nU(K,W);j=L.line,H=L.column}let B=X?j4(X):void 0,_=J?T3(J):void 0,O={type:Z,code:J,codeName:_,message:Y,filePath:B,line:j,column:H,snippet:q,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=lU(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=pU(O,K,W);break;case"text":default:F=dU(O,K,W);break}return{formatted:F,data:O}}function dU($,Z,Y){let J=[],X=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${X}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
1677
1677
  ${$.message}`),Z&&$.line){let Q=cU(Z,$.line,2);if(Q)J.push(`
1678
1678
  ${Q}`)}if($.snippet)J.push(`
1679
1679
  Snippet: ${$.snippet}`);if($.suggestion)J.push(`
@@ -1697,15 +1697,15 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
1697
1697
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),J=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});await this.rotateIfNeeded(Z);let X=`${this.formatEntry($)}
1698
1698
  `;Z.appendFileSync(this.logFilePath,X,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let J=`${this.logFilePath}.${Y}`,X=`${this.logFilePath}.${Y+1}`;if($.existsSync(J))if(Y>=this.maxLogFiles-1)$.unlinkSync(J);else $.renameSync(J,X)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let J=Y.error.constructor.name;$[J]=($[J]||0)+1;let X=Y.level||"error";Z[X]=(Z[X]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),X=(await import("path")).dirname($);if(!Y.existsSync(X))Y.mkdirSync(X,{recursive:!0});if(Z==="json"){let Q=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Y.writeFileSync($,JSON.stringify(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,Q.join(`
1699
1699
 
1700
- `),"utf-8")}}async flush(){await this.writeQueue}}var D3,$1,k3;var T2=b(()=>{_4();D3={isEnabled(){return z4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=z4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],X=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(X>Q){let K=X-Q;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let W=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,q=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(W>q){let U=W-q;for(let z=0;z<U;z++)Y+=`
1701
- @end${K}`;J.push(`Added ${U} missing @end${K}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent($,Z){if(V$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};$1=new E3,k3={isDevelopment(){return V$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
1702
- `)}}});var I2=()=>{};var D2=b(()=>{q4();N2();T2();I2();_4()});var V1=b(()=>{D2()});function T0($,Z,Y,J=0){let X=0,Q=J,G=null,K=0,W=!1;while(Q<$.length){let q=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&q==="\\"){W=!0,Q++;continue}if(W=!1,(q==='"'||q==="'"||q==="`")&&!G){G=q,Q++;continue}if(q===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&q==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&q==="}"){K--,Q++;continue}if(q==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(q===Z)X++;else if(q===Y){if(X--,X===0)return Q}Q++}return-1}function C1($,Z){let Y=sU($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function sU($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=T0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function oU($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function J5($,Z,Y,J){let X=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),q=K.exec($),U=W?W.index:1/0,z=q?q.index:1/0;if(U<z)X++,Q=U+W[0].length;else if(z<1/0){if(X--,X===0)return z;Q=z+q[0].length}else break}return-1}function E2($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=C1($,J);if(!X)return null;let Q=X.endPos,G=J5($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,U="if",z=X.expression,j=0,H=0;while(q<K.length){let B=K.indexOf("@",q);if(B===-1)break;q=B;let _=K.substring(B);if(oU(K,B)){q++;continue}if(/^@if\s*\(/.test(_)){H++,q++;continue}if(/^@endif(?![a-z])/.test(_)){H--,q+=6;continue}if(H===0){let O=_.match(/^@elseif\s*/);if(O){W.push({type:U,condition:z,content:K.substring(j,q),start:Q+j,end:Q+q});let F=q+O[0].length,L=C1(K,F);if(!L){q++;continue}U="elseif",z=L.expression,q=L.endPos,j=q;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:U,condition:z,content:K.substring(j,q),start:Q+j,end:Q+q}),U="else",z=void 0,q+=5,j=q;continue}}q++}return W.push({type:U,condition:z,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function w$($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let Q=E2($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function O4($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,q=T0($,"(",")",W);if(q===-1){Q=X.exec($);continue}let U=$.slice(W+1,q),z=q+1,j=J5($,Z,Y,z);if(j===-1){Q=X.exec($);continue}let H=$.slice(z,j),B=j+`@${Y}`.length;J.push({fullMatch:$.slice(K,B),name:Z,params:U,content:H,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return J}function b3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=C1($,J);if(!X)return null;let Q=X.endPos,G=J5($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,U=null,z=0;while(q<K.length){let j=K.slice(q),H=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(H){if(z++,U)U.content+=H[0];q+=H[0].length;continue}if(B){if(z--,U)U.content+=B[0];q+=B[0].length;continue}if(z>0){if(U)U.content+=K[q];q++;continue}let _=j.match(/^@case\s*/),O=j.match(/^@default(?![a-z])/),F=j.match(/^@break(?![a-z])/);if(_&&j.startsWith("@case")){if(U)W.push(U);let L=q+_[0].length,V=C1(K,L);if(!V){q++;continue}U={type:"case",value:V.expression,content:""},q=V.endPos}else if(O&&j.startsWith("@default")){if(U)W.push(U);U={type:"default",content:""},q+=O[0].length}else if(F&&j.startsWith("@break"))q+=F[0].length;else{if(U)U.content+=K[q];q++}}if(U)W.push(U);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var k2=()=>{};var b2=()=>{};var F4=b(()=>{k2();b2()});function eU($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=b3(J,G);if(!K)break;try{let W;if(K0(K.expression))W=W0(K.expression,Object.keys(Z))(...Object.values(Z));else W=J0(K.expression,Z);let q="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)q=z.content.trim()}else try{let j;if(z.value&&K0(z.value))j=W0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)j=J0(z.value,Z);if(W===j){q=z.content.trim(),U=!0;break}}catch{continue}J=J.substring(0,G)+q+J.substring(K.end),X=!0}catch(W){let q=W instanceof Error?W.message:String(W),U=Z0("Switch",`Error evaluating @switch expression: ${q}`,o.EVALUATION_ERROR);J=J.substring(0,G)+U+J.substring(K.end);break}}return J}function $z($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return Z.push(J),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function Zz($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Y,J)=>Z[Number(J)]??Y)}function X5($,Z,Y){let{masked:J,scripts:X}=$z($);return Zz(Yz(J,Z,Y),X)}function Yz($,Z,Y){let J=$;J=eU(J,Z,Y);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=C1(J,K+7);if(!W)break;let q=W.endPos,U=J5(J,"unless","endunless",q);if(U===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=J.slice(q,U),j=W.expression,H=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,V=[],w;while((w=O.exec(z))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(z))!==null)V.push({pos:w.index,type:"close"});while((w=L.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){H=R.pos;break}}let B;if(H!==-1){let _=z.slice(0,H),O=z.slice(H+5);B=`@if (${j})${O}@else ${_}@endif`}else B=`@if (!(${j}))${z}@endif`;J=J.substring(0,K)+B+J.substring(U+10),Q=!0}}J=y3(J,Z,Y),J=P3(J,Z,Y),J=S3(J,Z);let X=()=>{let Q=w$(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",q=!1;for(let U of K.branches){if(q)break;if(U.type==="else")W=U.content,q=!0;else try{let z;if(U.condition&&K0(U.condition))z=W0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=J0(U.condition,Z);if(z)W=U.content,q=!0}catch(z){W=Z0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),q=!0}}J=J.substring(0,K.start)+W+J.substring(K.end)}catch(W){let q=W instanceof Error?W.message:String(W),U=Z0("If",`Error processing @if block: ${q}`,o.EVALUATION_ERROR);J=J.substring(0,K.start)+U+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function S2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(X===Y){Z++;break}J.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function S3($,Z){let Y=$;function J(K,W,q,U){let z=1,j=U,H=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(j<K.length&&z>0){H.lastIndex=j,B.lastIndex=j;let _=H.exec(K),O=B.exec(K),F=_?_.index:1/0,L=O?O.index:1/0;if(F<L)z++,j=F+_[0].length;else if(L<1/0){if(z--,z===0)return L;j=L+O[0].length}else break}return-1}function X(K,W,q){let U=0,z=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${q}(?![a-z])`,"g"),H=/@else(?![a-z])/g,B=[],_;while((_=z.exec(K))!==null)B.push({pos:_.index,type:"open"});while((_=j.exec(K))!==null)B.push({pos:_.index,type:"close"});while((_=H.exec(K))!==null)B.push({pos:_.index,type:"else"});B.sort((O,F)=>O.pos-F.pos);for(let O of B)if(O.type==="open")U++;else if(O.type==="close")U--;else if(O.type==="else"&&U===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,U,z,j=Y.slice(q+5),H=S2(j);if(H)U=H.value,z=q+5+H.consumed;else z=q+5;let B=J(Y,"auth","endauth",z);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let _=Y.slice(z,B),O=X(_,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?P1(`auth?.check && auth?.user?.[${U}]`,Z):P1("auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,q)+L+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,U,z,j=Y.slice(q+6),H=S2(j);if(H)U=H.value,z=q+6+H.consumed;else z=q+6;let B=J(Y,"guest","endguest",z);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let _=Y.slice(z,B),O=X(_,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?P1(`!auth?.check || !auth?.user?.[${U}]`,Z):P1("!auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,q)+L+Y.substring(B+9),K=!0}}function Q(K,W,q){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(W)U.push(W);if(q){let z=P1(q,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,q=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let j=z.index,H=Y.slice(j+`@${K}`.length),B=G(H);if(!B)break;let _=j+`@${K}`.length+B.paramsEnd,O=J(Y,K,W,_);if(O===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let F=Y.slice(_,O),L=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${W}(?![a-z])`,"g"),A=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,N=[],I;while((I=w.exec(F))!==null)N.push({pos:I.index,type:"open"});while((I=R.exec(F))!==null)N.push({pos:I.index,type:"close"});while((I=A.exec(F))!==null)N.push({pos:I.index,type:"elseDirective"});while((I=M.exec(F))!==null)N.push({pos:I.index,type:"else"});N.sort((S,C)=>S.pos-C.pos);for(let S of N){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)L.push(S)}let T=[],k=0;for(let S=0;S<L.length;S++){let C=L[S];if(T.push({content:F.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=F.slice(C.pos+`@${q}`.length),m=G(x);if(m){T[T.length-1]={content:F.slice(k,C.pos)},k=C.pos+`@${q}`.length+m.paramsEnd,T.push({content:"",ability:m.ability,type:m.type,id:m.id}),T.pop();let l=L[S+1],Q0=l?l.pos:F.length;T.push({content:F.slice(k,Q0),ability:m.ability,type:m.type,id:m.id}),k=Q0}}else k=C.pos+5}if(k<F.length){let S=T[T.length-1];if(L.length>0&&L[L.length-1].type==="else")T.push({content:F.slice(k),isFinalElse:!0});else if(T.length===0)T.push({content:F.slice(k)})}let D=Q(B.ability,B.type,B.id),P=K==="can"?D:!D,y="";if(P)y=T[0]?.content||"";else{let S=!1;for(let C=1;C<T.length;C++){let x=T[C];if(x.isFinalElse){y=x.content,S=!0;break}if(x.ability){let m=Q(x.ability,x.type,x.id);if(K==="can"?m:!m){y=x.content,S=!0;break}}}if(!S&&T.length>0){let C=T[T.length-1];if(C.isFinalElse)y=C.content}}Y=Y.substring(0,j)+y+Y.substring(O+`@${W}`.length),U=!0}}return Y}function y3($,Z,Y){let J=$;function X(Q,G,K,W,q){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),j=Q.match(z);if(!j||j.index===void 0)break;let H=j.index,B=C1(Q,H+`@${G}`.length);if(!B)break;let _=B.endPos,O=J5(Q,G,K,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${H} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(_,O),L=B.expression,V=-1,w=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let M=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,R=A+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){V=A;break}R=A+1}try{let A=W(L.trim()),M;if(V!==-1){let N=F.slice(0,V),I=F.slice(V+5);M=A?N:I}else M=A?F:"";Q=Q.substring(0,H)+M+Q.substring(O+`@${K}`.length),U=!0}catch(A){let M=A instanceof Error?A.message:String(A),N=Z0(q,`Error processing @${G} directive: ${M}`,o.EVALUATION_ERROR);Q=Q.substring(0,H)+N+Q.substring(O+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=P1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=P1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function P3($,Z,Y){let J=$,X="development";function Q(G,K,W,q){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),H=new RegExp(`^@${W}(?![a-z])`),B=G,_=!0;while(_){_=!1,U.lastIndex=0;let O=U.exec(B);if(!O)break;let F=O.index,L=F+O[0].length;if(K==="env"){let D=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;L+=D[0].length,q=X===D[2]}let V=1,w=L,R=-1;while(V>0&&w<B.length){U.lastIndex=w,z.lastIndex=w;let D=U.exec(B),P=z.exec(B),y=D?D.index:1/0,S=P?P.index:1/0;if(y<S)V++,w=y+D[0].length;else if(S<1/0){if(V--,V===0){R=S;break}w=S+P[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${W} \u2014 the block was skipped.`);break}let A=B.substring(L,R),M=-1,N=0,I=0;while(I<A.length){let D=A.indexOf("@",I);if(D===-1)break;let P=A.substring(D);if(j.test(P)){N++,I=D+1;continue}if(H.test(P)){N--,I=D+1;continue}if(N===0&&/^@else(?![a-z])/.test(P)){M=D;break}I=D+1}let T;if(M!==-1){let D=A.slice(0,M),P=A.slice(M+5);T=q?D:P}else T=q?A:"";let k=`@${W}`.length;B=B.substring(0,F)+T+B.substring(R+k),_=!0}return B}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",X==="production"),J=Q(J,"development","enddevelopment",X==="development"),J=Q(J,"staging","endstaging",X==="staging"),J=Q(J,"testing","endtesting",X==="testing"),J}var L4=b(()=>{R2();V1();F4();V0()});function P2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function V4($,Z){if(!$)return Z?.nonceGenerator?.()??P2();let Y=y2.get($);if(!Y)Y=Z?.nonceGenerator?.()??P2(),y2.set($,Y);return Y}function Jz($,Z){let Y=[];for(let[J,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)Y.push(J);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${J} ${Q.join(" ")}`)}}return Y.join("; ")}function C2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Jz($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function v2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?V4(Y,Z):void 0,X=C2(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
1703
- ${X}`)}function x2($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<script nonce="${Z}"${X}>`}),Y=Y.replace(/<style([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<style nonce="${Z}"${X}>`}),Y}function f2($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?V4(Z,Q):void 0;return C2(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return V4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=V4(Z,Q);return X}var y2;var g2=b(()=>{y2=new WeakMap});import Xz from"crypto";function Gz($=Qz){let Z=Xz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return C3=Z,Z}function Kz(){if(!C3)Gz();return C3}function Wz($=h2){let Z=Kz();return`<input type="hidden" name="${$}" value="${Z}">`}function u2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return Wz(J||h2)})}var Qz=40,h2="_token",C3=null;var m2=()=>{};async function d2($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let X=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)X=await qz(X,Q,Z,Y,J);else X=await Uz(X,Q,Z,Y,J)}return X}async function qz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,q=$,U=D5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),z=[],j=U.exec(q);while(j!==null){let[H,B="",_=""]=j,O=j.index||0;try{let F=B?l2(B):[],L=_.trim(),V=await G(L,F,Y,J);z.push({original:H,processed:V,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(X.debug)console.error(`Error processing custom directive @${Q}:`,F);z.push({original:H,processed:Z0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${L}`,o.EVALUATION_ERROR),startIndex:O})}j=U.exec(q)}for(let H=z.length-1;H>=0;H--){let{original:B,processed:_}=z[H];q=q.replace(B,_)}return q}async function Uz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,W=D5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],U=W.exec(K);while(U!==null){let[H,B=""]=U,_=U.index||0;try{let O=l2(B),F=await G("",O,Y,J);q.push({original:H,processed:F,startIndex:_})}catch(O){let F=O instanceof Error?O.message:String(O);if(X.debug)console.error(`Error processing custom directive @${Q}:`,O);q.push({original:H,processed:Z0("CustomDirective",`Error in @${Q}(${B}): ${F}`,o.EVALUATION_ERROR),startIndex:_})}U=W.exec(K)}let z=D5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=z.exec(K);while(j!==null){let[H]=j,B=j.index||0;try{let _=await G("",[],Y,J);q.push({original:H,processed:_,startIndex:B})}catch(_){let O=_ instanceof Error?_.message:String(_);if(X.debug)console.error(`Error processing custom directive @${Q}:`,_);q.push({original:H,processed:Z0("CustomDirective",`Error in @${Q}: ${O}`,o.EVALUATION_ERROR),startIndex:B})}j=z.exec(K)}for(let H=q.length-1;H>=0;H--){let{original:B,processed:_}=q[H];K=K.replace(B,_)}return K}function l2($){if(!$.trim())return[];let Z=[],Y="",J=!1,X="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,X=G;else if(G===X)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var p2=b(()=>{V1();E5()});function Q5($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function jz($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,J=Z.colorMode;if(Q5(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(Q5(Y.key,"appearance.key"),Q5(Y.attribute,"appearance.attribute"),Q5(Y.default,"appearance.default"),Q5(J.key,"colorMode.key"),Q5(J.attribute,"colorMode.attribute"),Q5(J.default,"colorMode.default"),!i2.test(Y.key)||!i2.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!c2.test(Y.attribute)||!c2.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((X)=>typeof X!=="string"||X.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!zz.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function Bz($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Hz($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Bz($)};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 _z($,Z){let Y=1,J=null,X=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(X){X=!1;continue}if(J){if(G==="\\")X=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function n2($,Z){let Y=$,J=/@appearanceBootstrap\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index+X[0].length-1,G=_z(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),W=J0(`(${K})`,Z),q=Hz(jz(W));Y=Y.slice(0,X.index)+q+Y.slice(G+1),J.lastIndex=X.index+q.length}return Y}var c2,i2,zz;var s2=b(()=>{V0();c2=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,i2=/^[A-Za-z_$][\w$]*$/,zz=new Set(["light","dark","system"])});var f3={};a(f3,{useTitle:()=>wz,useSeoMeta:()=>o2,usePageTitle:()=>wz,useHead:()=>x3,seoMetaToHeadConfig:()=>R4,resetHead:()=>Lz,renderHtmlAttrs:()=>Az,renderHead:()=>Rz,renderBodyAttrs:()=>Mz,processTitleDirective:()=>Iz,processMetaDirective:()=>Dz,processHeadDirective:()=>Tz,mergeHeadConfigs:()=>S5,getPageMeta:()=>Fz,getHead:()=>v3,definePageMeta:()=>Vz,applyHead:()=>Nz});function v3(){return v1}function Fz(){return w4}function Lz(){v1={},Oz.length=0,w4={}}function x3($){v1=S5(v1,$)}function S5($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function o2($){x3(R4($))}function R4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let W=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:W})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(J)Z.push({property:"og:description",content:J});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let X=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(X)Z.push({name:"twitter:title",content:X});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let W of $.articleTags)Z.push({property:"article:tag",content:W});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function Vz($){if(w4={...w4,...$},$.title||$.description)o2({title:$.title,description:$.description})}function wz($){let Z=typeof $==="function"?$():$;x3({title:Z})}function Rz($=v1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${G5(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,X])=>`${J}="${G5(X)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>{return`${X==="httpEquiv"?"http-equiv":X}="${G5(String(Q))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>`${X}="${G5(String(Q))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...X}=Y,Q=Object.entries(X).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${G5(String(K))}"`}).filter(Boolean).join(" ");if(J)Z.push(`<script ${Q}>${J}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let J=Y.type?` type="${Y.type}"`:"";Z.push(`<style${J}>${Y.content}</style>`)}return Z.join(`
1700
+ `),"utf-8")}}async flush(){await this.writeQueue}}var D3,Z1,k3;var T2=b(()=>{_4();D3={isEnabled(){return z4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=z4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],X=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(X>Q){let K=X-Q;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let W=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,q=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(W>q){let U=W-q;for(let z=0;z<U;z++)Y+=`
1701
+ @end${K}`;J.push(`Added ${U} missing @end${K}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent($,Z){if(V$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};Z1=new E3,k3={isDevelopment(){return V$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
1702
+ `)}}});var I2=()=>{};var D2=b(()=>{q4();N2();T2();I2();_4()});var V1=b(()=>{D2()});function T0($,Z,Y,J=0){let X=0,Q=J,G=null,K=0,W=!1;while(Q<$.length){let q=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&q==="\\"){W=!0,Q++;continue}if(W=!1,(q==='"'||q==="'"||q==="`")&&!G){G=q,Q++;continue}if(q===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&q==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&q==="}"){K--,Q++;continue}if(q==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(q===Z)X++;else if(q===Y){if(X--,X===0)return Q}Q++}return-1}function C1($,Z){let Y=sU($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function sU($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=T0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function oU($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function J5($,Z,Y,J){let X=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),q=K.exec($),U=W?W.index:1/0,z=q?q.index:1/0;if(U<z)X++,Q=U+W[0].length;else if(z<1/0){if(X--,X===0)return z;Q=z+q[0].length}else break}return-1}function E2($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=C1($,J);if(!X)return null;let Q=X.endPos,G=J5($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,U="if",z=X.expression,j=0,H=0;while(q<K.length){let B=K.indexOf("@",q);if(B===-1)break;q=B;let _=K.substring(B);if(oU(K,B)){q++;continue}if(/^@if\s*\(/.test(_)){H++,q++;continue}if(/^@endif(?![a-z])/.test(_)){H--,q+=6;continue}if(H===0){let O=_.match(/^@elseif\s*/);if(O){W.push({type:U,condition:z,content:K.substring(j,q),start:Q+j,end:Q+q});let F=q+O[0].length,L=C1(K,F);if(!L){q++;continue}U="elseif",z=L.expression,q=L.endPos,j=q;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:U,condition:z,content:K.substring(j,q),start:Q+j,end:Q+q}),U="else",z=void 0,q+=5,j=q;continue}}q++}return W.push({type:U,condition:z,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function w$($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let Q=E2($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function O4($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,q=T0($,"(",")",W);if(q===-1){Q=X.exec($);continue}let U=$.slice(W+1,q),z=q+1,j=J5($,Z,Y,z);if(j===-1){Q=X.exec($);continue}let H=$.slice(z,j),B=j+`@${Y}`.length;J.push({fullMatch:$.slice(K,B),name:Z,params:U,content:H,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return J}function b3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=C1($,J);if(!X)return null;let Q=X.endPos,G=J5($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,U=null,z=0;while(q<K.length){let j=K.slice(q),H=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(H){if(z++,U)U.content+=H[0];q+=H[0].length;continue}if(B){if(z--,U)U.content+=B[0];q+=B[0].length;continue}if(z>0){if(U)U.content+=K[q];q++;continue}let _=j.match(/^@case\s*/),O=j.match(/^@default(?![a-z])/),F=j.match(/^@break(?![a-z])/);if(_&&j.startsWith("@case")){if(U)W.push(U);let L=q+_[0].length,V=C1(K,L);if(!V){q++;continue}U={type:"case",value:V.expression,content:""},q=V.endPos}else if(O&&j.startsWith("@default")){if(U)W.push(U);U={type:"default",content:""},q+=O[0].length}else if(F&&j.startsWith("@break"))q+=F[0].length;else{if(U)U.content+=K[q];q++}}if(U)W.push(U);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var k2=()=>{};var b2=()=>{};var F4=b(()=>{k2();b2()});function eU($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=b3(J,G);if(!K)break;try{let W;if(W0(K.expression))W=q0(K.expression,Object.keys(Z))(...Object.values(Z));else W=J0(K.expression,Z);let q="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)q=z.content.trim()}else try{let j;if(z.value&&W0(z.value))j=q0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)j=J0(z.value,Z);if(W===j){q=z.content.trim(),U=!0;break}}catch{continue}J=J.substring(0,G)+q+J.substring(K.end),X=!0}catch(W){let q=W instanceof Error?W.message:String(W),U=Z0("Switch",`Error evaluating @switch expression: ${q}`,o.EVALUATION_ERROR);J=J.substring(0,G)+U+J.substring(K.end);break}}return J}function $z($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return Z.push(J),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function Zz($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Y,J)=>Z[Number(J)]??Y)}function X5($,Z,Y){let{masked:J,scripts:X}=$z($);return Zz(Yz(J,Z,Y),X)}function Yz($,Z,Y){let J=$;J=eU(J,Z,Y);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=C1(J,K+7);if(!W)break;let q=W.endPos,U=J5(J,"unless","endunless",q);if(U===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=J.slice(q,U),j=W.expression,H=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,V=[],w;while((w=O.exec(z))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(z))!==null)V.push({pos:w.index,type:"close"});while((w=L.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){H=R.pos;break}}let B;if(H!==-1){let _=z.slice(0,H),O=z.slice(H+5);B=`@if (${j})${O}@else ${_}@endif`}else B=`@if (!(${j}))${z}@endif`;J=J.substring(0,K)+B+J.substring(U+10),Q=!0}}J=y3(J,Z,Y),J=P3(J,Z,Y),J=S3(J,Z);let X=()=>{let Q=w$(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",q=!1;for(let U of K.branches){if(q)break;if(U.type==="else")W=U.content,q=!0;else try{let z;if(U.condition&&W0(U.condition))z=q0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=J0(U.condition,Z);if(z)W=U.content,q=!0}catch(z){W=Z0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),q=!0}}J=J.substring(0,K.start)+W+J.substring(K.end)}catch(W){let q=W instanceof Error?W.message:String(W),U=Z0("If",`Error processing @if block: ${q}`,o.EVALUATION_ERROR);J=J.substring(0,K.start)+U+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function S2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(X===Y){Z++;break}J.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function S3($,Z){let Y=$;function J(K,W,q,U){let z=1,j=U,H=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(j<K.length&&z>0){H.lastIndex=j,B.lastIndex=j;let _=H.exec(K),O=B.exec(K),F=_?_.index:1/0,L=O?O.index:1/0;if(F<L)z++,j=F+_[0].length;else if(L<1/0){if(z--,z===0)return L;j=L+O[0].length}else break}return-1}function X(K,W,q){let U=0,z=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${q}(?![a-z])`,"g"),H=/@else(?![a-z])/g,B=[],_;while((_=z.exec(K))!==null)B.push({pos:_.index,type:"open"});while((_=j.exec(K))!==null)B.push({pos:_.index,type:"close"});while((_=H.exec(K))!==null)B.push({pos:_.index,type:"else"});B.sort((O,F)=>O.pos-F.pos);for(let O of B)if(O.type==="open")U++;else if(O.type==="close")U--;else if(O.type==="else"&&U===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,U,z,j=Y.slice(q+5),H=S2(j);if(H)U=H.value,z=q+5+H.consumed;else z=q+5;let B=J(Y,"auth","endauth",z);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let _=Y.slice(z,B),O=X(_,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?P1(`auth?.check && auth?.user?.[${U}]`,Z):P1("auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,q)+L+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,U,z,j=Y.slice(q+6),H=S2(j);if(H)U=H.value,z=q+6+H.consumed;else z=q+6;let B=J(Y,"guest","endguest",z);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let _=Y.slice(z,B),O=X(_,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?P1(`!auth?.check || !auth?.user?.[${U}]`,Z):P1("!auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,q)+L+Y.substring(B+9),K=!0}}function Q(K,W,q){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(W)U.push(W);if(q){let z=P1(q,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,q=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let j=z.index,H=Y.slice(j+`@${K}`.length),B=G(H);if(!B)break;let _=j+`@${K}`.length+B.paramsEnd,O=J(Y,K,W,_);if(O===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let F=Y.slice(_,O),L=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${W}(?![a-z])`,"g"),A=new RegExp(`@${q}\\s*\\(`,"g"),M=/@else(?![a-z])/g,N=[],I;while((I=w.exec(F))!==null)N.push({pos:I.index,type:"open"});while((I=R.exec(F))!==null)N.push({pos:I.index,type:"close"});while((I=A.exec(F))!==null)N.push({pos:I.index,type:"elseDirective"});while((I=M.exec(F))!==null)N.push({pos:I.index,type:"else"});N.sort((S,C)=>S.pos-C.pos);for(let S of N){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)L.push(S)}let T=[],k=0;for(let S=0;S<L.length;S++){let C=L[S];if(T.push({content:F.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=F.slice(C.pos+`@${q}`.length),m=G(x);if(m){T[T.length-1]={content:F.slice(k,C.pos)},k=C.pos+`@${q}`.length+m.paramsEnd,T.push({content:"",ability:m.ability,type:m.type,id:m.id}),T.pop();let l=L[S+1],G0=l?l.pos:F.length;T.push({content:F.slice(k,G0),ability:m.ability,type:m.type,id:m.id}),k=G0}}else k=C.pos+5}if(k<F.length){let S=T[T.length-1];if(L.length>0&&L[L.length-1].type==="else")T.push({content:F.slice(k),isFinalElse:!0});else if(T.length===0)T.push({content:F.slice(k)})}let D=Q(B.ability,B.type,B.id),P=K==="can"?D:!D,y="";if(P)y=T[0]?.content||"";else{let S=!1;for(let C=1;C<T.length;C++){let x=T[C];if(x.isFinalElse){y=x.content,S=!0;break}if(x.ability){let m=Q(x.ability,x.type,x.id);if(K==="can"?m:!m){y=x.content,S=!0;break}}}if(!S&&T.length>0){let C=T[T.length-1];if(C.isFinalElse)y=C.content}}Y=Y.substring(0,j)+y+Y.substring(O+`@${W}`.length),U=!0}}return Y}function y3($,Z,Y){let J=$;function X(Q,G,K,W,q){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),j=Q.match(z);if(!j||j.index===void 0)break;let H=j.index,B=C1(Q,H+`@${G}`.length);if(!B)break;let _=B.endPos,O=J5(Q,G,K,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${H} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(_,O),L=B.expression,V=-1,w=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let M=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(M)){w++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(M)){w--,R=A+1;continue}if(w===0&&/^@else(?![a-z])/.test(M)){V=A;break}R=A+1}try{let A=W(L.trim()),M;if(V!==-1){let N=F.slice(0,V),I=F.slice(V+5);M=A?N:I}else M=A?F:"";Q=Q.substring(0,H)+M+Q.substring(O+`@${K}`.length),U=!0}catch(A){let M=A instanceof Error?A.message:String(A),N=Z0(q,`Error processing @${G} directive: ${M}`,o.EVALUATION_ERROR);Q=Q.substring(0,H)+N+Q.substring(O+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=P1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=P1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function P3($,Z,Y){let J=$,X="development";function Q(G,K,W,q){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),H=new RegExp(`^@${W}(?![a-z])`),B=G,_=!0;while(_){_=!1,U.lastIndex=0;let O=U.exec(B);if(!O)break;let F=O.index,L=F+O[0].length;if(K==="env"){let D=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;L+=D[0].length,q=X===D[2]}let V=1,w=L,R=-1;while(V>0&&w<B.length){U.lastIndex=w,z.lastIndex=w;let D=U.exec(B),P=z.exec(B),y=D?D.index:1/0,S=P?P.index:1/0;if(y<S)V++,w=y+D[0].length;else if(S<1/0){if(V--,V===0){R=S;break}w=S+P[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${W} \u2014 the block was skipped.`);break}let A=B.substring(L,R),M=-1,N=0,I=0;while(I<A.length){let D=A.indexOf("@",I);if(D===-1)break;let P=A.substring(D);if(j.test(P)){N++,I=D+1;continue}if(H.test(P)){N--,I=D+1;continue}if(N===0&&/^@else(?![a-z])/.test(P)){M=D;break}I=D+1}let T;if(M!==-1){let D=A.slice(0,M),P=A.slice(M+5);T=q?D:P}else T=q?A:"";let k=`@${W}`.length;B=B.substring(0,F)+T+B.substring(R+k),_=!0}return B}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",X==="production"),J=Q(J,"development","enddevelopment",X==="development"),J=Q(J,"staging","endstaging",X==="staging"),J=Q(J,"testing","endtesting",X==="testing"),J}var L4=b(()=>{R2();V1();F4();V0()});function P2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function V4($,Z){if(!$)return Z?.nonceGenerator?.()??P2();let Y=y2.get($);if(!Y)Y=Z?.nonceGenerator?.()??P2(),y2.set($,Y);return Y}function Jz($,Z){let Y=[];for(let[J,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)Y.push(J);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${J} ${Q.join(" ")}`)}}return Y.join("; ")}function C2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Jz($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function v2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?V4(Y,Z):void 0,X=C2(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
1703
+ ${X}`)}function x2($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<script nonce="${Z}"${X}>`}),Y=Y.replace(/<style([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<style nonce="${Z}"${X}>`}),Y}function f2($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?V4(Z,Q):void 0;return C2(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return V4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=V4(Z,Q);return X}var y2;var g2=b(()=>{y2=new WeakMap});import Xz from"crypto";function Gz($=Qz){let Z=Xz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return C3=Z,Z}function Kz(){if(!C3)Gz();return C3}function Wz($=h2){let Z=Kz();return`<input type="hidden" name="${$}" value="${Z}">`}function u2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return Wz(J||h2)})}var Qz=40,h2="_token",C3=null;var m2=()=>{};async function d2($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let X=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)X=await qz(X,Q,Z,Y,J);else X=await Uz(X,Q,Z,Y,J)}return X}async function qz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,q=$,U=D5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),z=[],j=U.exec(q);while(j!==null){let[H,B="",_=""]=j,O=j.index||0;try{let F=B?l2(B):[],L=_.trim(),V=await G(L,F,Y,J);z.push({original:H,processed:V,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(X.debug)console.error(`Error processing custom directive @${Q}:`,F);z.push({original:H,processed:Z0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${L}`,o.EVALUATION_ERROR),startIndex:O})}j=U.exec(q)}for(let H=z.length-1;H>=0;H--){let{original:B,processed:_}=z[H];q=q.replace(B,_)}return q}async function Uz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,W=D5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],U=W.exec(K);while(U!==null){let[H,B=""]=U,_=U.index||0;try{let O=l2(B),F=await G("",O,Y,J);q.push({original:H,processed:F,startIndex:_})}catch(O){let F=O instanceof Error?O.message:String(O);if(X.debug)console.error(`Error processing custom directive @${Q}:`,O);q.push({original:H,processed:Z0("CustomDirective",`Error in @${Q}(${B}): ${F}`,o.EVALUATION_ERROR),startIndex:_})}U=W.exec(K)}let z=D5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=z.exec(K);while(j!==null){let[H]=j,B=j.index||0;try{let _=await G("",[],Y,J);q.push({original:H,processed:_,startIndex:B})}catch(_){let O=_ instanceof Error?_.message:String(_);if(X.debug)console.error(`Error processing custom directive @${Q}:`,_);q.push({original:H,processed:Z0("CustomDirective",`Error in @${Q}: ${O}`,o.EVALUATION_ERROR),startIndex:B})}j=z.exec(K)}for(let H=q.length-1;H>=0;H--){let{original:B,processed:_}=q[H];K=K.replace(B,_)}return K}function l2($){if(!$.trim())return[];let Z=[],Y="",J=!1,X="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,X=G;else if(G===X)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var p2=b(()=>{V1();E5()});function Q5($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function jz($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,J=Z.colorMode;if(Q5(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(Q5(Y.key,"appearance.key"),Q5(Y.attribute,"appearance.attribute"),Q5(Y.default,"appearance.default"),Q5(J.key,"colorMode.key"),Q5(J.attribute,"colorMode.attribute"),Q5(J.default,"colorMode.default"),!i2.test(Y.key)||!i2.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!c2.test(Y.attribute)||!c2.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((X)=>typeof X!=="string"||X.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!zz.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function Bz($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Hz($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Bz($)};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 _z($,Z){let Y=1,J=null,X=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(X){X=!1;continue}if(J){if(G==="\\")X=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function n2($,Z){let Y=$,J=/@appearanceBootstrap\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index+X[0].length-1,G=_z(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),W=J0(`(${K})`,Z),q=Hz(jz(W));Y=Y.slice(0,X.index)+q+Y.slice(G+1),J.lastIndex=X.index+q.length}return Y}var c2,i2,zz;var s2=b(()=>{V0();c2=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,i2=/^[A-Za-z_$][\w$]*$/,zz=new Set(["light","dark","system"])});var f3={};t(f3,{useTitle:()=>wz,useSeoMeta:()=>o2,usePageTitle:()=>wz,useHead:()=>x3,seoMetaToHeadConfig:()=>R4,resetHead:()=>Lz,renderHtmlAttrs:()=>Az,renderHead:()=>Rz,renderBodyAttrs:()=>Mz,processTitleDirective:()=>Iz,processMetaDirective:()=>Dz,processHeadDirective:()=>Tz,mergeHeadConfigs:()=>S5,getPageMeta:()=>Fz,getHead:()=>v3,definePageMeta:()=>Vz,applyHead:()=>Nz});function v3(){return v1}function Fz(){return w4}function Lz(){v1={},Oz.length=0,w4={}}function x3($){v1=S5(v1,$)}function S5($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function o2($){x3(R4($))}function R4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let W=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:W})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(J)Z.push({property:"og:description",content:J});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let X=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(X)Z.push({name:"twitter:title",content:X});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let W of $.articleTags)Z.push({property:"article:tag",content:W});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function Vz($){if(w4={...w4,...$},$.title||$.description)o2({title:$.title,description:$.description})}function wz($){let Z=typeof $==="function"?$():$;x3({title:Z})}function Rz($=v1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${G5(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,X])=>`${J}="${G5(X)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>{return`${X==="httpEquiv"?"http-equiv":X}="${G5(String(Q))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>`${X}="${G5(String(Q))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...X}=Y,Q=Object.entries(X).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${G5(String(K))}"`}).filter(Boolean).join(" ");if(J)Z.push(`<script ${Q}>${J}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let J=Y.type?` type="${Y.type}"`:"";Z.push(`<style${J}>${Y.content}</style>`)}return Z.join(`
1704
1704
  `)}function Az($=v1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${G5(Y)}"`).join(" ")}function Mz($=v1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${G5(Y)}"`).join(" ")}function G5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Nz($=v1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),Z.name)J.setAttribute("name",Z.name);if(Z.property)J.setAttribute("property",Z.property);document.head.appendChild(J)}J.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[X,Q]of Object.entries(Z))if(Q!==void 0)J.setAttribute(X,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))if(Z==="class")for(let J of String(Y).split(/\s+/).filter(Boolean))document.documentElement.classList.add(J);else document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function Tz($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,X)=>{return Z+=X.trim()+`
1705
1705
  `,""}),headContent:Z.trim()}}function Iz($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,X,Q)=>{let G=J?X:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=S5(K,{title:G}),""})}function Dz($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,X,Q,G,K)=>{let W=Q?G:K,q=Q?W:Z[(W||"").trim()]??W,z=X.includes(":")?{property:X,content:q}:{name:X,content:q},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=S5(j,{meta:[z]}),""})}var v1,Oz,w4;var R$=b(()=>{v1={},Oz=[],w4={}});import Ez from"crypto";function O0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function A4($,Z,Y,J){let X=$||Z;return Y?`${X} ${J}`:X}function i0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function y5($,Z){if(/\bid\s*=/i.test($))return"";return` id="${O0(Z)}"`}function g3($,Z,Y){if(!Z)return"";let J="";if(!/\baria-invalid\s*=/i.test(Y))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Y))J+=` aria-describedby="${O0(`${i0($)}-error`)}"`;return J}function kz(){return Ez.randomUUID()}function M4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=kz();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${O0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,X)=>{let Q=X.toUpperCase();if(X&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${O0(Q)}">`;return J}),Y}function t2($,Z,Y=a2){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,W,q="")=>{let U=Q||G||"POST",z=K||W||"",j=x1(q),H=U.toUpperCase(),B=["GET","POST"].includes(H)?H:"POST",_=`<form method="${O0(B)}" action="${O0(z)}"${j?` ${j}`:""}>`;if(_+=`
1706
1706
  ${M4("@csrf",Z)}`,!["GET","POST"].includes(H))_+=`
1707
- ${M4(`@method('${H}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,q="")=>{let U=Q||G||"",z=K||W||"",j=x1(q),H=A$(U,Z),B=H!==void 0&&H!==null?H:z||"",_=j.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",F=M$(U,Z),L=j.match(/class=['"]([^'"]+)['"]/i),V=A4(L?L[1]:"",Y.input,F,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${O0(O)}" name="${O0(U)}"${y5(j,i0(U))} value="${O0(B)}" class="${V}"${g3(U,F,j)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=x1(G),q=A$(Q,Z)||K.trim(),U=M$(Q,Z),z=W.match(/class=['"]([^'"]+)['"]/i),j=A4(z?z[1]:"",Y.input,U,Y.inputError),H=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${O0(Q)}"${y5(W,i0(Q))} class="${j}"${g3(Q,U,W)}${H?` ${H}`:""}>${O0(q)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=x1(G),q=A$(Q,Z),U=M$(Q,Z),z=W.match(/class=['"]([^'"]+)['"]/i),j=A4(z?z[1]:"",Y.input,U,Y.inputError),H=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(q!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,F)=>{if((Array.isArray(q)?q.some((V)=>String(V)===F):String(q)===F)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${O0(Q)}"${y5(W,i0(Q))} class="${j}"${g3(Q,U,W)}${H?` ${H}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=G===void 0?"1":G,q=G===void 0?i0(Q):`${i0(Q)}-${i0(W)}`,U=x1(K),z=A$(Q,Z),j=z!==void 0&&(Array.isArray(z)?z.some((O)=>String(O)===W):z===!0||String(z)===W),H=U.match(/class=['"]([^'"]+)['"]/i),B=H?H[1]:Y.checkInput,_=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${O0(Q)}"${y5(U,q)} value="${O0(W)}" class="${B}"${j?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=x1(K),q=A$(Q,Z),U=q!==void 0&&q===G,z=W.match(/class=['"]([^'"]+)['"]/i),j=z?z[1]:Y.checkInput,H=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${O0(Q)}"${y5(W,`${i0(Q)}-${i0(G)}`)} value="${O0(G)}" class="${j}"${U?" checked":""}${H?` ${H}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=x1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),q=W?W[1]:"",U=K.includes("multiple"),z=M$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),H=A4(j?j[1]:"",Y.input,z,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${O0(Q)}"${y5(K,i0(Q))}`,`class="${H}"`];if(q)_.push(`accept="${O0(q)}"`);if(U)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=x1(G),q=W.match(/class=['"]([^'"]+)['"]/i),U=q?q[1]:Y.label,z=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${O0(i0(Q))}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),J}function e2($,Z,Y=a2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(M$(X,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(K,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return r2(X,Z);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return r2(X,Z)}let q=W.trim();if(K0(q)){let U=J0(q,Z);return U!==void 0?String(U):q}return q}catch{return W}});return`<div id="${O0(`${i0(X)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function M$($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function r2($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function A$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function x1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=J.exec(Y))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var a2;var $Y=b(()=>{V0();a2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import m3 from"path";async function bz(){if(N$!==void 0)return N$;try{N$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{N$=null}return N$}function Sz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function yz($,Z){if({...p3,...Z.i18n}.cache&&d3[$]){let X=d3[$],Q=Z.i18n?.cacheMaxAge??0;if(!Sz(X,Q))return X.translations}if(T$[$]?.state==="loading")return T$[$].promise;h3[$]="loading";let J=l3($,Z).then((X)=>{return h3[$]="loaded",delete T$[$],X}).catch((X)=>{throw h3[$]="error",T$[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return T$[$]={promise:J,state:"loading"},J}async function l3($,Z){let Y={...p3,...Z.i18n},J=m3.isAbsolute(Y.translationsDir)?Y.translationsDir:m3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await bz(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:fz(Y.format)}):await Pz($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return l3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)d3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(X){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,X);if($!==Y.defaultLocale)return l3(Y.defaultLocale,Z);return{}}}async function Pz($,Z,Y){let J=m3.join(Y,`${$}${Cz(Z.format)}`);try{let X=await import(J);return X.default||X}catch(X){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return vz(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function Cz($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function vz($){let Z={},Y=$.split(`
1708
- `),J=[{obj:Z,indent:-1}];for(let X of Y){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,q,U]=W,z=q.trim(),j=U.trim();if(j==="")K[z]={},J.push({obj:K[z],indent:G});else K[z]=xz(j)}}return Z}function xz($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function fz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function gz($,Z){return yz($,Z)}function hz($,Z){for(let Y of $){let J=Y.trim(),X=J.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function uz($,Z={}){return JY($,Z)}function JY($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=mz($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=dz(Q,Z),J=X+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function mz($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function dz($,Z){let Y=lz($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),X=Z[J];if(Y.length===1)return X!==void 0?String(X):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return pz(X,Y.slice(2).join(","),Z);case"select":return iz(X,Y.slice(2).join(","));case"selectordinal":return nz(X,Y.slice(2).join(","));case"number":return oz(X,Y[2]?.trim());case"date":return rz(X,Y[2]?.trim());case"time":return az(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function lz($){let Z=[],Y="",J=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")J++,Y+=Q;else if(Q==="}")J--,Y+=Q;else if(Q===","&&J===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function pz($,Z,Y){let J=Number($)||0,X=c3(Z),Q=`=${J}`;if(X[Q])return u3(X[Q],J,Y);let G=cz(J);if(X[G])return u3(X[G],J,Y);if(X.other)return u3(X.other,J,Y);return String(J)}function u3($,Z,Y){let J=$.replace(/#/g,String(Z));return JY(J,Y)}function cz($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function iz($,Z){let Y=String($||""),J=c3(Z);if(J[Y])return J[Y];return J.other||String($)}function nz($,Z){let Y=Number($)||0,J=c3(Z),X=sz(Y);if(J[X])return J[X].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function sz($){let Z=Math.abs($),Y=Z%10,J=Z%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function c3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function oz($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function rz($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function az($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function tz($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function ZY($,Z,Y=!0,J={}){let X=$.split("."),Q=Z;for(let K of X){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(tz(G))return uz(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),W=G.split("|");G=hz(W,K)}for(let[K,W]of Object.entries(J)){let q=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${q}`,"g"),String(W))}return G}async function XY($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...p3,...J.i18n},K=await gz(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await YY(X,Q,async(U,z,j,H,B)=>{try{let _={};if(j)try{let F=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return L0(j,Z)}];for(let L of F)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(F){if(J.debug)console.error("Error parsing parameters for @translate directive:",F)}return ZY(z,K,G.fallbackToKey,_)||H.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return Z0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...X.matchAll(W)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,j)=>console.warn(`Match ${j}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return X=await YY(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,j,H)=>{try{let B={};if(j)try{let _=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return L0(j,Z)}];for(let O of _)try{if(B=O(),Object.keys(B).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return ZY(z,K,G.fallbackToKey,B)}catch(B){if(J.debug)console.error("Error processing @translate directive:",B);return Z0("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),X}async function YY($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var N$,p3,d3,T$,h3;var QY=b(()=>{V1();V0();p3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},d3={},T$={},h3={}});function $j($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return ez.test(Z)}function P5($){I$.lastIndex=0;let Z;while((Z=I$.exec($))!==null){if(Z[0].startsWith("</")||$j(Z[0]))continue;let Y=Z.index,J=I$.lastIndex,X=1,Q;while((Q=I$.exec($))!==null)if(Q[0].startsWith("</")){if(X--,X===0){let G=Q.index;return{start:Y,openEnd:J,closeStart:G,end:I$.lastIndex,content:$.slice(J,G)}}}else X++;return null}return null}var I$,ez;var N4=b(()=>{I$=/<\/?template\b[^>]*>/gi,ez=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var s3={};a(s3,{streamingSuspenseDirective:()=>WY,streamToResponse:()=>jj,streamTemplateSimple:()=>Wj,streamTemplate:()=>Yj,renderStreamingPage:()=>Xj,registerStreamingDirectives:()=>Uj,processStreamDirectives:()=>Gj,processSectionDirectives:()=>zj,islandDirective:()=>qY,generateHydrationRuntime:()=>Bj,extractStreamBoundaries:()=>Kj,createStreamRenderer:()=>qj,buildSuspenseResolveScript:()=>n3,SUSPENSE_RESOLVER_RUNTIME:()=>KY});import T4 from"path";function Zj($){let Z=[],Y=0,J;GY.lastIndex=0;while((J=GY.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let X=J[1],Q=J[2];Z.push({type:"suspense",name:X,content:Q}),Y=J.index+J[0].length}if(Y<$.length){let X=$.slice(Y);if(X.trim())Z.push({type:Z.length===0?"shell":"content",content:X})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function Yj($,Z={},Y={}){let J={...R1,...Y,streaming:{...i3,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:T4.dirname($)};if(W.trim())await w1(W,U,$);let z=Zj(q),j=new Set;if(!z.some((B)=>B.type==="suspense")){let B=J.streaming?.strategy||"auto",_=new RegExp(K5.source,"g");if(!(B!=="manual"&&_.test(q))){let F=await w0(q,U,$,J,j);for(let L=0;L<F.length;L+=X)Q.enqueue(F.slice(L,L+X)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],L=new RegExp(K5.source,"g"),V;while((V=L.exec(q))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let R of F){if(R.start>w){let M=q.slice(w,R.start);if(M.trim()){let N=await w0(M,U,$,J,j);Q.enqueue(N),await new Promise((I)=>setTimeout(I,0))}}let A=await w0(R.content,U,$,J,j);Q.enqueue(A),await new Promise((M)=>setTimeout(M,0)),w=R.end}if(w<q.length){let R=q.slice(w);if(R.trim()){let A=await w0(R,U,$,J,j);Q.enqueue(A)}}}}else{let B=new Map;for(let O of z)if(O.type==="shell"||O.type==="content"){let F=await w0(O.content,U,$,J,j);Q.enqueue(F)}else if(O.type==="suspense"&&O.name){let F=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${F}" data-suspense="${O.name}" style="display:contents;">
1707
+ ${M4(`@method('${H}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,q="")=>{let U=Q||G||"",z=K||W||"",j=x1(q),H=A$(U,Z),B=H!==void 0&&H!==null?H:z||"",_=j.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",F=M$(U,Z),L=j.match(/class=['"]([^'"]+)['"]/i),V=A4(L?L[1]:"",Y.input,F,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${O0(O)}" name="${O0(U)}"${y5(j,i0(U))} value="${O0(B)}" class="${V}"${g3(U,F,j)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=x1(G),q=A$(Q,Z)||K.trim(),U=M$(Q,Z),z=W.match(/class=['"]([^'"]+)['"]/i),j=A4(z?z[1]:"",Y.input,U,Y.inputError),H=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${O0(Q)}"${y5(W,i0(Q))} class="${j}"${g3(Q,U,W)}${H?` ${H}`:""}>${O0(q)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=x1(G),q=A$(Q,Z),U=M$(Q,Z),z=W.match(/class=['"]([^'"]+)['"]/i),j=A4(z?z[1]:"",Y.input,U,Y.inputError),H=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(q!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,F)=>{if((Array.isArray(q)?q.some((V)=>String(V)===F):String(q)===F)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${O0(Q)}"${y5(W,i0(Q))} class="${j}"${g3(Q,U,W)}${H?` ${H}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=G===void 0?"1":G,q=G===void 0?i0(Q):`${i0(Q)}-${i0(W)}`,U=x1(K),z=A$(Q,Z),j=z!==void 0&&(Array.isArray(z)?z.some((O)=>String(O)===W):z===!0||String(z)===W),H=U.match(/class=['"]([^'"]+)['"]/i),B=H?H[1]:Y.checkInput,_=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${O0(Q)}"${y5(U,q)} value="${O0(W)}" class="${B}"${j?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=x1(K),q=A$(Q,Z),U=q!==void 0&&q===G,z=W.match(/class=['"]([^'"]+)['"]/i),j=z?z[1]:Y.checkInput,H=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${O0(Q)}"${y5(W,`${i0(Q)}-${i0(G)}`)} value="${O0(G)}" class="${j}"${U?" checked":""}${H?` ${H}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=x1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),q=W?W[1]:"",U=K.includes("multiple"),z=M$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),H=A4(j?j[1]:"",Y.input,z,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${O0(Q)}"${y5(K,i0(Q))}`,`class="${H}"`];if(q)_.push(`accept="${O0(q)}"`);if(U)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=x1(G),q=W.match(/class=['"]([^'"]+)['"]/i),U=q?q[1]:Y.label,z=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${O0(i0(Q))}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),J}function e2($,Z,Y=a2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(M$(X,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(K,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return r2(X,Z);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return r2(X,Z)}let q=W.trim();if(W0(q)){let U=J0(q,Z);return U!==void 0?String(U):q}return q}catch{return W}});return`<div id="${O0(`${i0(X)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function M$($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function r2($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function A$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function x1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=J.exec(Y))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var a2;var $Y=b(()=>{V0();a2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import m3 from"path";async function bz(){if(N$!==void 0)return N$;try{N$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{N$=null}return N$}function Sz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function yz($,Z){if({...p3,...Z.i18n}.cache&&d3[$]){let X=d3[$],Q=Z.i18n?.cacheMaxAge??0;if(!Sz(X,Q))return X.translations}if(T$[$]?.state==="loading")return T$[$].promise;h3[$]="loading";let J=l3($,Z).then((X)=>{return h3[$]="loaded",delete T$[$],X}).catch((X)=>{throw h3[$]="error",T$[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return T$[$]={promise:J,state:"loading"},J}async function l3($,Z){let Y={...p3,...Z.i18n},J=m3.isAbsolute(Y.translationsDir)?Y.translationsDir:m3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await bz(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:fz(Y.format)}):await Pz($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return l3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)d3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(X){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,X);if($!==Y.defaultLocale)return l3(Y.defaultLocale,Z);return{}}}async function Pz($,Z,Y){let J=m3.join(Y,`${$}${Cz(Z.format)}`);try{let X=await import(J);return X.default||X}catch(X){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return vz(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function Cz($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function vz($){let Z={},Y=$.split(`
1708
+ `),J=[{obj:Z,indent:-1}];for(let X of Y){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,q,U]=W,z=q.trim(),j=U.trim();if(j==="")K[z]={},J.push({obj:K[z],indent:G});else K[z]=xz(j)}}return Z}function xz($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function fz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function gz($,Z){return yz($,Z)}function hz($,Z){for(let Y of $){let J=Y.trim(),X=J.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function uz($,Z={}){return JY($,Z)}function JY($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=mz($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=dz(Q,Z),J=X+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function mz($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function dz($,Z){let Y=lz($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),X=Z[J];if(Y.length===1)return X!==void 0?String(X):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return pz(X,Y.slice(2).join(","),Z);case"select":return iz(X,Y.slice(2).join(","));case"selectordinal":return nz(X,Y.slice(2).join(","));case"number":return oz(X,Y[2]?.trim());case"date":return rz(X,Y[2]?.trim());case"time":return az(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function lz($){let Z=[],Y="",J=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")J++,Y+=Q;else if(Q==="}")J--,Y+=Q;else if(Q===","&&J===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function pz($,Z,Y){let J=Number($)||0,X=c3(Z),Q=`=${J}`;if(X[Q])return u3(X[Q],J,Y);let G=cz(J);if(X[G])return u3(X[G],J,Y);if(X.other)return u3(X.other,J,Y);return String(J)}function u3($,Z,Y){let J=$.replace(/#/g,String(Z));return JY(J,Y)}function cz($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function iz($,Z){let Y=String($||""),J=c3(Z);if(J[Y])return J[Y];return J.other||String($)}function nz($,Z){let Y=Number($)||0,J=c3(Z),X=sz(Y);if(J[X])return J[X].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function sz($){let Z=Math.abs($),Y=Z%10,J=Z%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function c3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function oz($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function rz($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function az($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function tz($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function ZY($,Z,Y=!0,J={}){let X=$.split("."),Q=Z;for(let K of X){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(tz(G))return uz(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),W=G.split("|");G=hz(W,K)}for(let[K,W]of Object.entries(J)){let q=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${q}`,"g"),String(W))}return G}async function XY($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...p3,...J.i18n},K=await gz(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await YY(X,Q,async(U,z,j,H,B)=>{try{let _={};if(j)try{let F=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return L0(j,Z)}];for(let L of F)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(F){if(J.debug)console.error("Error parsing parameters for @translate directive:",F)}return ZY(z,K,G.fallbackToKey,_)||H.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return Z0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...X.matchAll(W)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,j)=>console.warn(`Match ${j}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return X=await YY(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,j,H)=>{try{let B={};if(j)try{let _=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return L0(j,Z)}];for(let O of _)try{if(B=O(),Object.keys(B).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return ZY(z,K,G.fallbackToKey,B)}catch(B){if(J.debug)console.error("Error processing @translate directive:",B);return Z0("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),X}async function YY($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var N$,p3,d3,T$,h3;var QY=b(()=>{V1();V0();p3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},d3={},T$={},h3={}});function $j($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return ez.test(Z)}function P5($){I$.lastIndex=0;let Z;while((Z=I$.exec($))!==null){if(Z[0].startsWith("</")||$j(Z[0]))continue;let Y=Z.index,J=I$.lastIndex,X=1,Q;while((Q=I$.exec($))!==null)if(Q[0].startsWith("</")){if(X--,X===0){let G=Q.index;return{start:Y,openEnd:J,closeStart:G,end:I$.lastIndex,content:$.slice(J,G)}}}else X++;return null}return null}var I$,ez;var N4=b(()=>{I$=/<\/?template\b[^>]*>/gi,ez=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var s3={};t(s3,{streamingSuspenseDirective:()=>WY,streamToResponse:()=>jj,streamTemplateSimple:()=>Wj,streamTemplate:()=>Yj,renderStreamingPage:()=>Xj,registerStreamingDirectives:()=>Uj,processStreamDirectives:()=>Gj,processSectionDirectives:()=>zj,islandDirective:()=>qY,generateHydrationRuntime:()=>Bj,extractStreamBoundaries:()=>Kj,createStreamRenderer:()=>qj,buildSuspenseResolveScript:()=>n3,SUSPENSE_RESOLVER_RUNTIME:()=>KY});import T4 from"path";function Zj($){let Z=[],Y=0,J;GY.lastIndex=0;while((J=GY.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let X=J[1],Q=J[2];Z.push({type:"suspense",name:X,content:Q}),Y=J.index+J[0].length}if(Y<$.length){let X=$.slice(Y);if(X.trim())Z.push({type:Z.length===0?"shell":"content",content:X})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function Yj($,Z={},Y={}){let J={...R1,...Y,streaming:{...i3,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:T4.dirname($)};if(W.trim())await w1(W,U,$);let z=Zj(q),j=new Set;if(!z.some((B)=>B.type==="suspense")){let B=J.streaming?.strategy||"auto",_=new RegExp(K5.source,"g");if(!(B!=="manual"&&_.test(q))){let F=await w0(q,U,$,J,j);for(let L=0;L<F.length;L+=X)Q.enqueue(F.slice(L,L+X)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],L=new RegExp(K5.source,"g"),V;while((V=L.exec(q))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let R of F){if(R.start>w){let M=q.slice(w,R.start);if(M.trim()){let N=await w0(M,U,$,J,j);Q.enqueue(N),await new Promise((I)=>setTimeout(I,0))}}let A=await w0(R.content,U,$,J,j);Q.enqueue(A),await new Promise((M)=>setTimeout(M,0)),w=R.end}if(w<q.length){let R=q.slice(w);if(R.trim()){let A=await w0(R,U,$,J,j);Q.enqueue(A)}}}}else{let B=new Map;for(let O of z)if(O.type==="shell"||O.type==="content"){let F=await w0(O.content,U,$,J,j);Q.enqueue(F)}else if(O.type==="suspense"&&O.name){let F=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${F}" data-suspense="${O.name}" style="display:contents;">
1709
1709
  <template data-suspense-fallback>Loading...</template>
1710
1710
  </div>`),B.set(O.name,w0(O.content,U,$,J,j))}Q.enqueue(`
1711
1711
  <script>
@@ -1728,8 +1728,8 @@ ${X}`)}function x2($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*
1728
1728
  window.__stxSuspense.resolve('${$}', \`${J}\`);
1729
1729
  </script>`}catch(Y){let J=Y instanceof Error?Y.message:String(Y);return`
1730
1730
  <script>
1731
- window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${a0(J)}</div>');
1732
- </script>`}}function Jj($,Z,Y){if(!Z||Z<=0)return $;let J,X=new Promise((Q,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(J))}function Xj($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(KY),await Promise.all(Z.map(async(Q)=>{let G=Jj(Q.render(),J,Q.id);X.enqueue(await n3(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function Gj($,Z){return $.replace(Qj,(Y,J,X)=>{let Q=J.trim(),G=X.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function Kj($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,X])=>({id:J,render:X})):void 0}async function Wj($,Z={},Y={}){let J={...R1,...Y,streaming:{...i3,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:T4.dirname($)};if(W.trim())await w1(W,U,$);let z=new Set,j=J.streaming?.strategy||"auto",H=new RegExp(K5.source,"g");if(!(j!=="manual"&&H.test(q))){let _=await w0(q,U,$,J,z);for(let O=0;O<_.length;O+=X)Q.enqueue(_.slice(O,O+X))}else{let _=[],O=new RegExp(K5.source,"g"),F;while((F=O.exec(q))!==null)_.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let L=0;for(let V of _){if(V.start>L){let R=q.slice(L,V.start);if(R.trim()){let A=await w0(R,U,$,J,z);Q.enqueue(A)}}let w=await w0(V.content,U,$,J,z);Q.enqueue(w),L=V.end}if(L<q.length){let V=q.slice(L);if(V.trim()){let w=await w0(V,U,$,J,z);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function qj($,Z={}){let Y={...R1,...Z,streaming:{...i3,...Z.streaming}},J=await Bun.file($).text(),X=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},q;K5.lastIndex=0;while((q=K5.exec(G))!==null){let j=q[1],H=q[2];W[j]=H}let U=G.replace(K5,"");return{renderShell:async(j={})=>{let H={...j,__filename:$,__dirname:T4.dirname($)};return await w1(Q,H,$),w0(U,H,$,Y,new Set)},renderSection:async(j,H={})=>{try{if(!W[j])return`<div class="error-message">Section "${a0(j)}" not found in template "${a0($)}"</div>`;let B={...H,__filename:$,__dirname:T4.dirname($)};await w1(Q,B,$);let _=new Set;return await w0(W[j],B,$,Y,_)}catch(B){let _=B instanceof Error?B.message:String(B);return U0("Expression",_,$,W[j]||"",0,W[j]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function Uj($={}){let Z=[];if($.streaming?.enabled)Z.push(WY);if($.hydration?.enabled)Z.push(qY);return Z}async function zj($,Z,Y,J={}){return $}function jj($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),X=new Headers(Z.headers);if(!X.has("Content-Type"))X.set("Content-Type","text/html; charset=utf-8");if(!X.has("Transfer-Encoding"))X.set("Transfer-Encoding","chunked");if(!X.has("X-Content-Type-Options"))X.set("X-Content-Type-Options","nosniff");if(!X.has("X-Accel-Buffering"))X.set("X-Accel-Buffering","no");return new Response(J,{...Z,headers:X})}function Bj($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
1731
+ window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${t0(J)}</div>');
1732
+ </script>`}}function Jj($,Z,Y){if(!Z||Z<=0)return $;let J,X=new Promise((Q,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(J))}function Xj($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(KY),await Promise.all(Z.map(async(Q)=>{let G=Jj(Q.render(),J,Q.id);X.enqueue(await n3(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function Gj($,Z){return $.replace(Qj,(Y,J,X)=>{let Q=J.trim(),G=X.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function Kj($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,X])=>({id:J,render:X})):void 0}async function Wj($,Z={},Y={}){let J={...R1,...Y,streaming:{...i3,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:T4.dirname($)};if(W.trim())await w1(W,U,$);let z=new Set,j=J.streaming?.strategy||"auto",H=new RegExp(K5.source,"g");if(!(j!=="manual"&&H.test(q))){let _=await w0(q,U,$,J,z);for(let O=0;O<_.length;O+=X)Q.enqueue(_.slice(O,O+X))}else{let _=[],O=new RegExp(K5.source,"g"),F;while((F=O.exec(q))!==null)_.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let L=0;for(let V of _){if(V.start>L){let R=q.slice(L,V.start);if(R.trim()){let A=await w0(R,U,$,J,z);Q.enqueue(A)}}let w=await w0(V.content,U,$,J,z);Q.enqueue(w),L=V.end}if(L<q.length){let V=q.slice(L);if(V.trim()){let w=await w0(V,U,$,J,z);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function qj($,Z={}){let Y={...R1,...Z,streaming:{...i3,...Z.streaming}},J=await Bun.file($).text(),X=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},q;K5.lastIndex=0;while((q=K5.exec(G))!==null){let j=q[1],H=q[2];W[j]=H}let U=G.replace(K5,"");return{renderShell:async(j={})=>{let H={...j,__filename:$,__dirname:T4.dirname($)};return await w1(Q,H,$),w0(U,H,$,Y,new Set)},renderSection:async(j,H={})=>{try{if(!W[j])return`<div class="error-message">Section "${t0(j)}" not found in template "${t0($)}"</div>`;let B={...H,__filename:$,__dirname:T4.dirname($)};await w1(Q,B,$);let _=new Set;return await w0(W[j],B,$,Y,_)}catch(B){let _=B instanceof Error?B.message:String(B);return z0("Expression",_,$,W[j]||"",0,W[j]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function Uj($={}){let Z=[];if($.streaming?.enabled)Z.push(WY);if($.hydration?.enabled)Z.push(qY);return Z}async function zj($,Z,Y,J={}){return $}function jj($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),X=new Headers(Z.headers);if(!X.has("Content-Type"))X.set("Content-Type","text/html; charset=utf-8");if(!X.has("Transfer-Encoding"))X.set("Transfer-Encoding","chunked");if(!X.has("X-Content-Type-Options"))X.set("X-Content-Type-Options","nosniff");if(!X.has("X-Accel-Buffering"))X.set("X-Accel-Buffering","no");return new Response(J,{...Z,headers:X})}function Bj($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
1733
1733
  `);if(Z==="loader")return`
1734
1734
  (function() {
1735
1735
  window.__stx = window.__stx || {};
@@ -1891,12 +1891,12 @@ else {
1891
1891
  }
1892
1892
  };
1893
1893
  })();
1894
- </script>`,Qj,WY,qY;var o3=b(()=>{O1();G1();I4();M0();i3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},K5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,GY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;Qj=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;WY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let X=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${X} -->${$}<!-- @endsuspense:${X} -->`}},qY={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let X=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${X}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",q=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
1894
+ </script>`,Qj,WY,qY;var o3=b(()=>{O1();K1();I4();M0();i3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},K5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,GY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;Qj=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;WY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let X=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${X} -->${$}<!-- @endsuspense:${X} -->`}},qY={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let X=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${X}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",q=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
1895
1895
  ${q}
1896
1896
  <script type="application/json" data-island-props="${G}">
1897
1897
  ${W?`{${W}}`:"{}"}
1898
1898
  </script>
1899
- </div>`}}});var jY={};a(jY,{warnUnbalancedTags:()=>r3,findUnbalancedTags:()=>zY});function C5($){return $.replace(/[^\n]/g," ")}function zY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,C5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,C5).replace(/<!--[\s\S]*?-->/g,C5).replace(/\{\{\{[\s\S]*?\}\}\}/g,C5).replace(/\{\{[\s\S]*?\}\}/g,C5).replace(/\{!![\s\S]*?!!\}/g,C5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",W=Q[2],q=Q[3]==="/";if(Hj.has(W.toLowerCase()))continue;if(q)continue;if(K)J.set(W,(J.get(W)??0)+1);else{let U=Y.get(W);if(U)U.count++;else{let z=Z.slice(0,Q.index).split(`
1899
+ </div>`}}});var jY={};t(jY,{warnUnbalancedTags:()=>r3,findUnbalancedTags:()=>zY});function C5($){return $.replace(/[^\n]/g," ")}function zY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,C5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,C5).replace(/<!--[\s\S]*?-->/g,C5).replace(/\{\{\{[\s\S]*?\}\}\}/g,C5).replace(/\{\{[\s\S]*?\}\}/g,C5).replace(/\{!![\s\S]*?!!\}/g,C5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",W=Q[2],q=Q[3]==="/";if(Hj.has(W.toLowerCase()))continue;if(q)continue;if(K)J.set(W,(J.get(W)??0)+1);else{let U=Y.get(W);if(U)U.count++;else{let z=Z.slice(0,Q.index).split(`
1900
1900
  `).length;Y.set(W,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(_j.has(K.toLowerCase()))continue;let W=Y.get(K)?.count??0,q=J.get(K)??0;if(W!==q)G.push({tag:K,opened:W,closed:q,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function r3($,Z){let Y;try{Y=zY($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(UY.has(J))return;UY.add(J);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:W}of Y)if(G>K){let q=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${q} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var Hj,_j,UY;var a3=b(()=>{Hj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_j=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);UY=new Set});import n0 from"path";import t3 from"fs";function BY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function HY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class _Y{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,J){let X=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let H=[X,X.toLowerCase(),BY(X),HY(X)];for(let B of H)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${X}.stx`,`${BY(X)}.stx`,`${HY(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let H=n0.resolve(n0.dirname(Z),`${X}.stx`);if(await i(H))return H;return null}let K=[],W=Y.componentsDir||"",q=J?.__originalFilePath;if(q)K.push(n0.join(n0.dirname(q),"components"));if(W)K.push(W);let U=n0.join(n0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),j=[n0.resolve(z,"src/components"),n0.resolve(z,"components"),n0.resolve(import.meta.dir,"components")];for(let H of j)if(!K.includes(H))K.push(H);for(let H of K){if(!H)continue;for(let B of G){let _=n0.join(H,B);if(await i(_))return _}try{if(!t3.statSync(H,{throwIfNoEntry:!1})?.isDirectory())continue;let _=t3.readdirSync(H,{withFileTypes:!0});for(let O of _)if(O.isDirectory()){let F=n0.join(H,O.name);for(let L of G){let V=n0.join(F,L);if(await i(V))return V}}}catch{}}return null}}var v0;var e3=b(()=>{M0();v0=new _Y});function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function OY($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var W5="\x00stx-boolean-attribute";function v5($,Z){let Y=[];for(let[J,X]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof X==="boolean"){if(X)Y.push(I0(Q));continue}if(X===W5){Y.push(I0(Q));continue}Y.push(`${I0(Q)}="${I0(OY(String(X)))}"`)}return Y}var D4=()=>{};function D$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Oj($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var $6;var Z6=b(()=>{D4();$6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=Oj($),X=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,W=[];if(J.reactive)W.push(`:href="${D$(J.value)}"`);else W.push(`href="${D$(J.value)}"`);if(X)W.push(`class="${D$(X)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${D$(Q)}"`),W.push(`data-stx-exact-active-class="${D$(G)}"`),K)W.push("data-stx-prefetch");let q=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...v5($,q)),`<a ${W.join(" ")}>${Z}</a>`}}});function D0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function b0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function J6($,Z,Y=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let X=$.static[Z];if(X!==void 0)return X!=="false"&&X!==!1;return Y}function FY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[X,Q]=J.split(":"),G=Fj[X];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(X);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(J);return Y.join(", ")}function X6($,Z,Y,J){return Z.map((X)=>`${E$($,X,void 0,Y,J)} ${X}w`).join(", ")}function Lj($,Z,Y,J,X){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${E$($,G,void 0,J,X)} ${Q}x`}).join(", ")}function E$($,Z,Y,J,X){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(X)Q.push(`f_${X}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(X)Q.set("fm",X);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(X)Q.set("format",X);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function Vj($,Z,Y="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var Fj,Y6,Q6;var G6=b(()=>{D4();Fj={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Y6=[320,640,768,1024,1280,1536,1920];Q6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=b0($,"src")||"",X=b0($,"alt")||"",Q=b0($,"width"),G=b0($,"height"),K=b0($,"sizes"),W=b0($,"srcset"),q=b0($,"densities"),U=b0($,"format"),z=b0($,"placeholder"),j=b0($,"placeholderColor")||"#e5e7eb",H=b0($,"provider"),B=b0($,"class")||b0($,"className")||"",_=b0($,"style")||"",O=b0($,"quality"),F=J6($,"lazy",!0),L=J6($,"preload",!1),V=J6($,"picture",!1)||!!U,w=Q?Number.parseInt(Q):void 0,R=G?Number.parseInt(G):void 0,A=W||"",M="";if(!A&&K)A=X6(J,Y6,H,U),M=FY(K);else if(!A&&q){let y=q.split(/\s+/).map((S)=>Number.parseFloat(S.replace("x","")));A=Lj(J,y,w,H,U)}else if(K)M=FY(K);let N=[];if(_)N.push(_);if(w&&R)N.push(`aspect-ratio:${w}/${R}`);if(z==="blur"||z==="color"||z==="thumbhash"){let y=Vj(w||16,R||9,j);N.push(`background-image:url(${y})`),N.push("background-size:cover"),N.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")N.push(`background-image:url(${D0(z)})`),N.push("background-size:cover"),N.push("background-repeat:no-repeat");let I=E$(J,w,R,H,U),T=[];if(T.push(`src="${D0(I)}"`),T.push(`alt="${D0(X)}"`),Q)T.push(`width="${D0(Q)}"`);if(G)T.push(`height="${D0(G)}"`);if(F)T.push('loading="lazy"');if(T.push('decoding="async"'),B)T.push(`class="${D0(B)}"`);if(N.length>0)T.push(`style="${D0(N.join(";"))}"`);if(A)T.push(`srcset="${D0(A)}"`);if(M)T.push(`sizes="${D0(M)}"`);let k=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);T.push(...v5($,k));let D=`<img ${T.join(" ")} />`,P="";if(L){let S=U==="webp"?"image/webp":U==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${D0(I)}"${S?` type="${S}"`:""}${A?` imagesrcset="${D0(A)}"`:""}${M?` imagesizes="${D0(M)}"`:""} />
1901
1901
  `}if(V){let y=[];if(U==="avif"||U==="auto"){let S=E$(J,w,R,H,"avif"),C=A?X6(J,Y6,H,"avif"):`${S}`;y.push(`<source type="image/avif" srcset="${D0(C)}"${M?` sizes="${D0(M)}"`:""} />`)}if(U==="webp"||U==="auto"){let S=E$(J,w,R,H,"webp"),C=A?X6(J,Y6,H,"webp"):`${S}`;y.push(`<source type="image/webp" srcset="${D0(C)}"${M?` sizes="${D0(M)}"`:""} />`)}return`${P}<picture>
1902
1902
  ${y.join(`
@@ -1935,16 +1935,16 @@ ${D}
1935
1935
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
1936
1936
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
1937
1937
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
1938
- </style>`}}});import{existsSync as Aj,readFileSync as Mj}from"fs";function Nj($){if(MY.has($))return;MY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Tj($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(Aj(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return t.resolve(Y)}catch{}return null}function Ij($){if(b4.has($))return b4.get($);let Z=Tj($);if(!Z)return Nj($),null;try{let Y=JSON.parse(Mj(Z,"utf8"));return b4.set($,Y.icons),Y.icons}catch{return null}}function g5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var b4,MY,L6;var V6=b(()=>{b4=new Map,MY=new Set;L6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=g5($,"name")??g5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=J;if(J.includes(":")){let L=J.split(":");X=L[0],Q=L[1]}let G=I0(g5($,"size")||"24"),K=I0(g5($,"color")||"currentColor"),W=I0(g5($,"class")||""),q=I0(g5($,"style")||""),U=b4.get(X)??Ij(X);if(!U)return`<!-- Icon: collection "${X}" not loaded -->`;let z=U[Q];if(!z)return`<!-- Icon: "${Q}" not found in ${X} -->`;let j=z.width||24,H=z.height||24,B=`0 0 ${j} ${H}`,_=z.body;if(K!=="currentColor")_=_.replace(/currentColor/g,K);let O=W?` class="${W}"`:"",F=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${O}${F}>${_}</svg>`}}});function NY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function TY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var w6;var R6=b(()=>{w6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=TY(Z,"fallback"),X=J.rest,Q=TY(X,"error"),G=Q.rest,K=J.region??NY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??NY($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function S4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var A6;var M6=b(()=>{A6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(S4($,"name")||"v").replace(/["'<>]/g,""),X=(S4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=S4($,"class"),G=S4($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function IY(){v0.registerBuiltin($6),v0.registerBuiltin(Q6),v0.registerBuiltin(K6),v0.registerBuiltin(U6),v0.registerBuiltin(j6),v0.registerBuiltin(H6),v0.registerBuiltin(O6),v0.registerBuiltin(L6),v0.registerBuiltin(w6),v0.registerBuiltin(A6)}var DY=b(()=>{Z6();G6();W6();z6();B6();_6();F6();V6();R6();M6();e3();Z6();G6();W6();z6();B6();_6();F6();V6();R6();M6()});function y4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function EY($,Z,Y){let J=[],X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!K){X=Q+1;continue}let W=K[1];if(Y&&Y.has(W.toLowerCase())){let _=Q+1+W.length;while(_<$.length&&$[_]!==">")_++;X=_+1;continue}let q=Q+1+W.length,U=null,z=q,j=-1,H=!1;while(q<$.length){let _=$[q];if(U){if(_==="\\"&&q+1<$.length){q+=2;continue}if(_===U)U=null;q++;continue}if(_==='"'||_==="'"){U=_,q++;continue}if(_==="/"&&q+1<$.length&&$[q+1]===">"){j=q+2,H=!0;break}if(_===">"){j=q+1;break}q++}if(j===-1){X=Q+1;continue}let B=$.slice(z,H?j-2:j-1).trim();if(H)J.push({fullMatch:$.slice(Q,j),tagName:W,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),X=j;else{let _=`<${W}`,O=`</${W}>`,F=1,L=j,V=-1;while(F>0&&L<$.length){let A=$.indexOf(_,L),M=$.indexOf(O,L);if(M===-1)break;if(A!==-1&&A<M){let N=$[A+_.length];if(N===" "||N===">"||N==="/"||N===`
1939
- `||N==="\t")F++;L=A+_.length}else{if(F--,F===0){V=M;break}L=M+O.length}}if(V===-1){X=j;continue}let w=$.slice(j,V),R=V+O.length;J.push({fullMatch:$.slice(Q,R),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),X=R}}return J}function kY($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function bY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var SY=b(()=>{V0();M0();$5()});var gY={};a(gY,{processESImports:()=>xY,processComponents:()=>v4});import C4 from"fs";import u0 from"path";function Ej($,Z,Y){let J={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(o8),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(W,q)=>q.toUpperCase())},G=(K,W)=>{let q=Q(K);if(J.static[q]=W,q!==K)J.staticNames[q]=K};for(let[K,W]of Object.entries($)){let q=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(q.startsWith("@")){J.events[q]=W;continue}if(q.startsWith("__stx_")){let U=Q(q.slice(6));J.serverDynamic[U]=bY(W,Y);continue}if(q.startsWith(":")){let U=Q(q.slice(1)),z=W===W5?U:W;if(U==="if"||U==="for"||U==="show"){J.clientReactive[U]=z;continue}try{if(!K0(z)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${z}`);J.clientReactive[U]=z;continue}let j=Object.keys(Z),B=W0(z,j)(...Object.values(Z));if(B===void 0){let _=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((L)=>!O.has(L)&&!j.includes(L))){J.clientReactive[U]=z;continue}}J.serverDynamic[U]=B}catch{J.clientReactive[U]=z}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let U=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let z=U[1];if(K0(z)){let H=W0(z,Object.keys(Z))(...Object.values(Z));G(q,H!=null?String(H):"")}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${z}`);G(q,W)}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,z);G(q,W)}else{let z=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(W))!==null)try{let B=H[1];if(!K0(B)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let O=W0(B,Object.keys(Z))(...Object.values(Z));z=z.replace(H[0],String(O??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,B)}G(q,z)}continue}G(q,W===W5?"true":kY(W))}return J}function kj($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let X="";while(Y<J&&!/[\s=]/.test($[Y]))X+=$[Y],Y++;if(!X)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let Q="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[X]=Q}else Z[X]=W5}return Z}function PY($){return Object.entries($).map(([Z,Y])=>Y===W5?Z:`${Z}="${bj(Y)}"`).join(" ")}function bj($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Sj($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let X=J[1];if(v0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function yj($){let Z=CY.get($);if(Z)return Z;let Y=new Map,J=[u0.join($,"src"),u0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=C4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let q=u0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(q,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let U=W.name.slice(0,-4);if(!Y.has(U))Y.set(U,q);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,q);let j=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,q)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return CY.set($,Y),Y}function Pj($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=u0.join(Y,"node_modules",$);try{if(C4.statSync(J).isDirectory())return J}catch{}let X=u0.dirname(Y);if(X===Y)return null;Y=X}}async function xY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=u0.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(q,U,z)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,H=z,B,_=[];while((B=j.exec(z))!==null){let[O,F,L,V]=B,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let N=u0.resolve(G,V);if(N.endsWith(".stx"))R=N;else{let I=`${N}.stx`;try{if(C4.statSync(I).isFile())R=I}catch{try{if(C4.statSync(N).isDirectory())w=N}catch{}}}}else w=Pj(V,G);if(!w&&!R)continue;let A=!1,M=(N,I)=>{Q.set(N,I),Q.set(N.toLowerCase(),I);let T=N.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(T,I),X.add(I)};if(L&&R)M(L,R),A=!0;else if(F){let N=F.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let k=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:T,local:T}}),I=w?yj(w):null;for(let{source:T,local:k}of N){let D=null;if(R)D=R;else if(I)D=I.get(T)??I.get(T.toLowerCase())??I.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)M(k,D),A=!0}}if(A)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return q;for(let O=_.length-1;O>=0;O--)H=H.slice(0,_[O].start)+H.slice(_[O].end);return`<script${U}>${H}</script>`}),K}async function Cj($,Z,Y,J,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[q,U]=W,z=U.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of z){let H=j.split("/"),_=H[H.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),F=null,L=[u0.resolve(u0.dirname(Y),`${j}.stx`),u0.resolve(u0.dirname(Y),j),u0.resolve(J.componentsDir||"components",`${j}.stx`),u0.resolve(J.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of L)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(O,F),G.set(_,F),G.set(_.toLowerCase(),F);let V=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),X.add(F),J.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(q,""),K.lastIndex=0}return Q}async function vj($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,q;while((q=W.exec(Q))!==null){let U=q.index,z=U+q[0].length-1,j=1,H=z+1;while(H<Q.length&&j>0){if(Q[H]==="(")j++;else if(Q[H]===")"){if(j--,j===0)break}H++}if(j!==0)break;let B=Q.substring(z+1,H),_=H+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let F=O[1],L,V=B.slice(O[0].length),w=V.match(/^\s*,\s*/);if(w)L=V.slice(w[0].length).trim();let R={};if(L)try{R=L0(L,Z)}catch(k){let D=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(U,_),`[Error parsing component props: ${D}]`);continue}let A="",M=_,I=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(I)A=I[1].trim(),M=_+I[0].length;let T=await q5(F,R,A,G,Z,Y,J,K,X);Q=Q.substring(0,U)+T+Q.substring(M),W.lastIndex=0}return Q}async function xj($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=b1(Q);return Q=W.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,Dj),Q=H$(Q,W.scripts),Q;async function j(H,B,_,O){if(!H)return H;let F=H,L=EY(F,B,O);for(let V=L.length-1;V>=0;V--){let w=L[V],R=_?y4(w.tagName):w.tagName,A=kj(w.attributes),M=Ej(A,Z,J),N=v0.getBuiltin(w.tagName),I=N?await P4(R,G,Z,Y,J):!1;if(N&&!I){let P={context:Z,filePath:Y,options:J,dependencies:X},y=N.render(M,w.content,P);if(Object.keys(M.clientReactive).length>0)y=vY(y,M.clientReactive);if(Object.keys(M.events).length>0){let S=PY(M.events);y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${S}`)}F=F.substring(0,w.startIndex)+y+F.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await P4(R,G,Z,Y,J))continue;let T={};for(let[P,y]of Object.entries(M.static))T[P]=y;for(let[P,y]of Object.entries(M.serverDynamic))T[P]=y;let D=await q5(R,T,w.content,G,Z,Y,J,K,X);if(Object.keys(M.clientReactive).length>0)D=vY(D,M.clientReactive);if(Object.keys(M.events).length>0){let P=fY(D);if(P){let y=PY(M.events),S=Object.keys(M.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,P.insertPos)+` data-stx-parent-events="${S}" ${y}`+D.substring(P.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function vY($,Z){let Y=new Set(["if","for"]),J=new Set(["show"]),X=Object.entries(Z).filter(([U])=>!Y.has(U)),Q=X.filter(([U])=>!J.has(U)).map(([U])=>y4(U)).join(" "),G=$,K=X.length>0?fY(G):null;if(K){let U=X.map(([j,H])=>`:${y4(j)}="${H.replace(/"/g,"&quot;")}"`).join(" "),z=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${z} ${U}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,"&quot;")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,"&quot;")}">${G}</template>`;return G}function fY($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let J=$.slice(Y),X=J.match(/^\s+/);if(X){Y+=X[0].length;continue}if(J.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,Y+Q[0].length);if(W===-1)return null;Y=W+K.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function v4($,Z,Y,J,X){if(!yY)IY(),yY=!0;let Q=await xY($,Z,Y,J,X);Q=await Cj(Q,Z,Y,J,X),Q=await vj(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let W=Q1(Q,B$,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...W.tokens);let q=Q;if(Q=await xj(W.output,Z,Y,J,X),Q===q)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(J.debug){let K=Sj(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var yY=!1,Dj,CY;var N6=b(()=>{e3();DY();SY();$5();M0();V0();X1();Dj=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"]);CY=new Map});var x4={};a(x4,{stripTypeScript:()=>lY,splitDeclaration:()=>oY,isModuleResolutionFailure:()=>pY,isMissingBindingFailure:()=>cY,isCompleteImport:()=>iY,hasVariables:()=>eY,extractVariables:()=>w1,extractScriptFromTemplate:()=>tY,convertToCommonJS:()=>I6});import f1 from"path";import h5 from"process";function fj($){let Z=[],Y=0,J=$.split(`
1938
+ </style>`}}});import{existsSync as Aj,readFileSync as Mj}from"fs";function Nj($){if(MY.has($))return;MY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Tj($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(Aj(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return e.resolve(Y)}catch{}return null}function Ij($){if(b4.has($))return b4.get($);let Z=Tj($);if(!Z)return Nj($),null;try{let Y=JSON.parse(Mj(Z,"utf8"));return b4.set($,Y.icons),Y.icons}catch{return null}}function g5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var b4,MY,L6;var V6=b(()=>{b4=new Map,MY=new Set;L6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=g5($,"name")??g5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=J;if(J.includes(":")){let L=J.split(":");X=L[0],Q=L[1]}let G=I0(g5($,"size")||"24"),K=I0(g5($,"color")||"currentColor"),W=I0(g5($,"class")||""),q=I0(g5($,"style")||""),U=b4.get(X)??Ij(X);if(!U)return`<!-- Icon: collection "${X}" not loaded -->`;let z=U[Q];if(!z)return`<!-- Icon: "${Q}" not found in ${X} -->`;let j=z.width||24,H=z.height||24,B=`0 0 ${j} ${H}`,_=z.body;if(K!=="currentColor")_=_.replace(/currentColor/g,K);let O=W?` class="${W}"`:"",F=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${O}${F}>${_}</svg>`}}});function NY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function TY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var w6;var R6=b(()=>{w6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=TY(Z,"fallback"),X=J.rest,Q=TY(X,"error"),G=Q.rest,K=J.region??NY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??NY($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function S4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var A6;var M6=b(()=>{A6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(S4($,"name")||"v").replace(/["'<>]/g,""),X=(S4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=S4($,"class"),G=S4($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function IY(){v0.registerBuiltin($6),v0.registerBuiltin(Q6),v0.registerBuiltin(K6),v0.registerBuiltin(U6),v0.registerBuiltin(j6),v0.registerBuiltin(H6),v0.registerBuiltin(O6),v0.registerBuiltin(L6),v0.registerBuiltin(w6),v0.registerBuiltin(A6)}var DY=b(()=>{Z6();G6();W6();z6();B6();_6();F6();V6();R6();M6();e3();Z6();G6();W6();z6();B6();_6();F6();V6();R6();M6()});function y4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function EY($,Z,Y){let J=[],X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!K){X=Q+1;continue}let W=K[1];if(Y&&Y.has(W.toLowerCase())){let _=Q+1+W.length;while(_<$.length&&$[_]!==">")_++;X=_+1;continue}let q=Q+1+W.length,U=null,z=q,j=-1,H=!1;while(q<$.length){let _=$[q];if(U){if(_==="\\"&&q+1<$.length){q+=2;continue}if(_===U)U=null;q++;continue}if(_==='"'||_==="'"){U=_,q++;continue}if(_==="/"&&q+1<$.length&&$[q+1]===">"){j=q+2,H=!0;break}if(_===">"){j=q+1;break}q++}if(j===-1){X=Q+1;continue}let B=$.slice(z,H?j-2:j-1).trim();if(H)J.push({fullMatch:$.slice(Q,j),tagName:W,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),X=j;else{let _=`<${W}`,O=`</${W}>`,F=1,L=j,V=-1;while(F>0&&L<$.length){let A=$.indexOf(_,L),M=$.indexOf(O,L);if(M===-1)break;if(A!==-1&&A<M){let N=$[A+_.length];if(N===" "||N===">"||N==="/"||N===`
1939
+ `||N==="\t")F++;L=A+_.length}else{if(F--,F===0){V=M;break}L=M+O.length}}if(V===-1){X=j;continue}let w=$.slice(j,V),R=V+O.length;J.push({fullMatch:$.slice(Q,R),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),X=R}}return J}function kY($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function bY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var SY=b(()=>{V0();M0();$5()});var gY={};t(gY,{processESImports:()=>xY,processComponents:()=>v4});import C4 from"fs";import u0 from"path";function Ej($,Z,Y){let J={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(o8),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(W,q)=>q.toUpperCase())},G=(K,W)=>{let q=Q(K);if(J.static[q]=W,q!==K)J.staticNames[q]=K};for(let[K,W]of Object.entries($)){let q=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(q.startsWith("@")){J.events[q]=W;continue}if(q.startsWith("__stx_")){let U=Q(q.slice(6));J.serverDynamic[U]=bY(W,Y);continue}if(q.startsWith(":")){let U=Q(q.slice(1)),z=W===W5?U:W;if(U==="if"||U==="for"||U==="show"){J.clientReactive[U]=z;continue}try{if(!W0(z)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${z}`);J.clientReactive[U]=z;continue}let j=Object.keys(Z),B=q0(z,j)(...Object.values(Z));if(B===void 0){let _=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((L)=>!O.has(L)&&!j.includes(L))){J.clientReactive[U]=z;continue}}J.serverDynamic[U]=B}catch{J.clientReactive[U]=z}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let U=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let z=U[1];if(W0(z)){let H=q0(z,Object.keys(Z))(...Object.values(Z));G(q,H!=null?String(H):"")}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${z}`);G(q,W)}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,z);G(q,W)}else{let z=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(W))!==null)try{let B=H[1];if(!W0(B)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let O=q0(B,Object.keys(Z))(...Object.values(Z));z=z.replace(H[0],String(O??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,B)}G(q,z)}continue}G(q,W===W5?"true":kY(W))}return J}function kj($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let X="";while(Y<J&&!/[\s=]/.test($[Y]))X+=$[Y],Y++;if(!X)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let Q="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[X]=Q}else Z[X]=W5}return Z}function PY($){return Object.entries($).map(([Z,Y])=>Y===W5?Z:`${Z}="${bj(Y)}"`).join(" ")}function bj($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Sj($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let X=J[1];if(v0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function yj($){let Z=CY.get($);if(Z)return Z;let Y=new Map,J=[u0.join($,"src"),u0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=C4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let q=u0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(q,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let U=W.name.slice(0,-4);if(!Y.has(U))Y.set(U,q);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,q);let j=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,q)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return CY.set($,Y),Y}function Pj($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=u0.join(Y,"node_modules",$);try{if(C4.statSync(J).isDirectory())return J}catch{}let X=u0.dirname(Y);if(X===Y)return null;Y=X}}async function xY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=u0.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(q,U,z)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,H=z,B,_=[];while((B=j.exec(z))!==null){let[O,F,L,V]=B,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let N=u0.resolve(G,V);if(N.endsWith(".stx"))R=N;else{let I=`${N}.stx`;try{if(C4.statSync(I).isFile())R=I}catch{try{if(C4.statSync(N).isDirectory())w=N}catch{}}}}else w=Pj(V,G);if(!w&&!R)continue;let A=!1,M=(N,I)=>{Q.set(N,I),Q.set(N.toLowerCase(),I);let T=N.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(T,I),X.add(I)};if(L&&R)M(L,R),A=!0;else if(F){let N=F.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let k=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:T,local:T}}),I=w?yj(w):null;for(let{source:T,local:k}of N){let D=null;if(R)D=R;else if(I)D=I.get(T)??I.get(T.toLowerCase())??I.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)M(k,D),A=!0}}if(A)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return q;for(let O=_.length-1;O>=0;O--)H=H.slice(0,_[O].start)+H.slice(_[O].end);return`<script${U}>${H}</script>`}),K}async function Cj($,Z,Y,J,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[q,U]=W,z=U.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of z){let H=j.split("/"),_=H[H.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),F=null,L=[u0.resolve(u0.dirname(Y),`${j}.stx`),u0.resolve(u0.dirname(Y),j),u0.resolve(J.componentsDir||"components",`${j}.stx`),u0.resolve(J.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of L)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(O,F),G.set(_,F),G.set(_.toLowerCase(),F);let V=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),X.add(F),J.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(q,""),K.lastIndex=0}return Q}async function vj($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,q;while((q=W.exec(Q))!==null){let U=q.index,z=U+q[0].length-1,j=1,H=z+1;while(H<Q.length&&j>0){if(Q[H]==="(")j++;else if(Q[H]===")"){if(j--,j===0)break}H++}if(j!==0)break;let B=Q.substring(z+1,H),_=H+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let F=O[1],L,V=B.slice(O[0].length),w=V.match(/^\s*,\s*/);if(w)L=V.slice(w[0].length).trim();let R={};if(L)try{R=L0(L,Z)}catch(k){let D=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(U,_),`[Error parsing component props: ${D}]`);continue}let A="",M=_,I=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(I)A=I[1].trim(),M=_+I[0].length;let T=await q5(F,R,A,G,Z,Y,J,K,X);Q=Q.substring(0,U)+T+Q.substring(M),W.lastIndex=0}return Q}async function xj($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=b1(Q);return Q=W.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,Dj),Q=H$(Q,W.scripts),Q;async function j(H,B,_,O){if(!H)return H;let F=H,L=EY(F,B,O);for(let V=L.length-1;V>=0;V--){let w=L[V],R=_?y4(w.tagName):w.tagName,A=kj(w.attributes),M=Ej(A,Z,J),N=v0.getBuiltin(w.tagName),I=N?await P4(R,G,Z,Y,J):!1;if(N&&!I){let P={context:Z,filePath:Y,options:J,dependencies:X},y=N.render(M,w.content,P);if(Object.keys(M.clientReactive).length>0)y=vY(y,M.clientReactive);if(Object.keys(M.events).length>0){let S=PY(M.events);y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${S}`)}F=F.substring(0,w.startIndex)+y+F.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await P4(R,G,Z,Y,J))continue;let T={};for(let[P,y]of Object.entries(M.static))T[P]=y;for(let[P,y]of Object.entries(M.serverDynamic))T[P]=y;let D=await q5(R,T,w.content,G,Z,Y,J,K,X);if(Object.keys(M.clientReactive).length>0)D=vY(D,M.clientReactive);if(Object.keys(M.events).length>0){let P=fY(D);if(P){let y=PY(M.events),S=Object.keys(M.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,P.insertPos)+` data-stx-parent-events="${S}" ${y}`+D.substring(P.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function vY($,Z){let Y=new Set(["if","for"]),J=new Set(["show"]),X=Object.entries(Z).filter(([U])=>!Y.has(U)),Q=X.filter(([U])=>!J.has(U)).map(([U])=>y4(U)).join(" "),G=$,K=X.length>0?fY(G):null;if(K){let U=X.map(([j,H])=>`:${y4(j)}="${H.replace(/"/g,"&quot;")}"`).join(" "),z=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${z} ${U}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,"&quot;")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,"&quot;")}">${G}</template>`;return G}function fY($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let J=$.slice(Y),X=J.match(/^\s+/);if(X){Y+=X[0].length;continue}if(J.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,Y+Q[0].length);if(W===-1)return null;Y=W+K.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function v4($,Z,Y,J,X){if(!yY)IY(),yY=!0;let Q=await xY($,Z,Y,J,X);Q=await Cj(Q,Z,Y,J,X),Q=await vj(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let W=G1(Q,B$,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...W.tokens);let q=Q;if(Q=await xj(W.output,Z,Y,J,X),Q===q)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(J.debug){let K=Sj(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var yY=!1,Dj,CY;var N6=b(()=>{e3();DY();SY();$5();M0();V0();Q1();Dj=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"]);CY=new Map});var x4={};t(x4,{stripTypeScript:()=>lY,splitDeclaration:()=>oY,isModuleResolutionFailure:()=>pY,isMissingBindingFailure:()=>cY,isCompleteImport:()=>iY,hasVariables:()=>eY,extractVariables:()=>w1,extractScriptFromTemplate:()=>tY,convertToCommonJS:()=>I6});import f1 from"path";import h5 from"process";function fj($){let Z=[],Y=0,J=$.split(`
1940
1940
  `);for(let X of J){let Q=Y,G=null,K=!1;for(let W=0;W<X.length;W++){let q=X[W];if(K){K=!1;continue}if(q==="\\"){K=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&W+1<X.length&&X[W+1]==="/")break;if(q==="{")Y++;else if(q==="}")Y--}if(Q===0){let W=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let q=X.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let z=q[1].slice(1,-1).split(",").map((j)=>{let H=j.split(":");return(H.length>1?H[1]:H[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...z)}}}}return[...new Set(Z)]}function lY($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(J){if(!J.includes(":"))return J;let X=[],Q="",G=0,K=0,W=null;for(let q=0;q<J.length;q++){let U=J[q];if(W){if(Q+=U,U===W)W=null;continue}if(U==='"'||U==="'"||U==="`"){W=U,Q+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")K++;else if(U===")")K--;if(U===","&&G===0&&K===0){X.push(Q),Q="";continue}Q+=U}if(Q)X.push(Q);return X.map((q)=>{let U=q.trim(),z=U.startsWith("..."),j=z?U.slice(3):U,H=-1,B=0;for(let R=0;R<j.length;R++)if(j[R]==="<")B++;else if(j[R]===">")B--;else if(j[R]===":"&&B===0){H=R;break}if(H===-1)return q;let O=j.substring(0,H).trim().replace(/\?$/,""),F=j.substring(H+1),L=-1,V=0;for(let R=0;R<F.length;R++)if(F[R]==="<")V++;else if(F[R]===">")V--;else if(F[R]==="="&&V===0){L=R;break}let w=z?"...":"";if(L!==-1)return`${w}${O} = ${F.substring(L+1).trim()}`;return`${w}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,X,Q)=>{if(!Q.includes(":"))return J;return`${X}(${Y(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,X,Q=[];while((X=J.exec(Z))!==null){let G=X.index+X[0].length-1,K=1,W=G+1,q=0,U=null;while(W<Z.length&&K>0){let H=Z[W];if(U){if(H===U)U=null;W++;continue}if(H==='"'||H==="'"||H==="`"){U=H,W++;continue}if(H==="<")q++;else if(H===">"&&q>0)q--;else if(q===0){if(H==="(")K++;else if(H===")")K--}if(K>0)W++}if(K!==0)continue;let z=Z.substring(G+1,W);if(!z.includes(":"))continue;let j=Y(z);Q.push({start:G+1,end:W,replacement:j})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Z=Z.substring(0,K)+q+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,X)=>{if(!X.includes(":"))return J;if(X.includes("{")||X.includes("}"))return J;return`(${X.split(",").map((G)=>{let[K,...W]=G.split("="),q=K.split(":")[0].trim();if(W.length>0)return`${q} = ${W.join("=").trim()}`;return q}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
1941
1941
 
1942
- `),Z}function pY($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function cY($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function w1($,Z,Y,J={}){if(!$.trim())return;let X;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=E.transformSync(v)}catch{X=lY($)}let Q={exports:{}},G=Q.exports,K=h5.cwd(),W={},q=[...X.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 q)try{let v=f1.resolve(K,"node_modules",E),u=f1.join(v,"package.json"),h=JSON.parse(t("fs").readFileSync(u,"utf8")),$0=h.main||"index.js";if(h.exports){let z0=typeof h.exports==="string"?h.exports:h.exports["."];if(typeof z0==="string")$0=z0;else if(z0?.bun)$0=z0.bun;else if(z0?.import)$0=z0.import;else if(z0?.default)$0=z0.default}W[E]=await import(f1.resolve(v,$0))}catch{}let U=(E)=>{if(W[E])return W[E];return t(E)},z=Z.props||{},j=(E)=>{if(!E)return z;let v={};for(let[u,h]of Object.entries(E)){let $0=z[u];if($0!==void 0)v[u]=$0;else if(typeof h==="function")v[u]=h();else v[u]=h}return v};for(let[E,v]of Object.entries(z))Object.defineProperty(j,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,E))continue;try{Object.defineProperty(j,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(E)=>{if(!E)return z;let v={...z};for(let[u,h]of Object.entries(E)){let $0=h&&typeof h==="object"&&!Array.isArray(h)?h:{type:h};if(v[u]===void 0&&$0.default!==void 0)v[u]=typeof $0.default==="function"?$0.default():$0.default}return v},B=()=>Z.slots||{},_=(E,v)=>{let u={...E};for(let[h,$0]of Object.entries(v))if(u[h]===void 0)if(typeof $0==="function")u[h]=$0();else u[h]=$0;return u},O=(E)=>{let v=()=>E;return v.set=(u)=>{},v.update=(u)=>{},v},F=(E)=>{let v,u=!1;return()=>{if(!u)try{v=E(),u=!0}catch{v=void 0}return v}},L=(E)=>{},V=(E)=>E(),w=(E)=>{},R=(E)=>{};function A(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)k({title:v.title,description:v.description})}function M(E){if(!E||typeof E!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,E),Z.__stxClientPayload=v}let N=()=>{let E=Z.__stxServeContext,v=Z.__stxServeSearch??E?.search??"",u=E?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(v)),path:u,name:"",fullPath:u+v,hash:"",matched:[]}},I=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),T=(E)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=S5(v,E||{})},k=(E)=>{T(R4(E||{}))},D=(E)=>({value:E}),P=(E)=>E,y=(E)=>({value:typeof E==="function"?E():E}),S=(E,v)=>{},C=(E)=>{},x=(E)=>{},m=(E)=>E?E():Promise.resolve(),l=(E)=>(v,...u)=>{},Q0=(E)=>{},l0=(E,v)=>{},A0=(E,v)=>v,o0=()=>({value:"light"}),p=()=>O(!1),_0=(E)=>O(!1),p0=()=>O(!1),N1=()=>_0("(prefers-color-scheme: dark)"),O5=()=>_0("(prefers-color-scheme: light)"),F5=()=>_0("(prefers-reduced-motion: reduce)"),s=()=>_0("(prefers-contrast: more)"),r={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:{}},q0=new Proxy(r,{get(E,v){if(v in E)return E[v];return},set(E,v,u){return E[v]=u,!0}}),N0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},G0=console;try{let E=I6(X,Y),v=new Set(Object.keys(z)),u=(n)=>/^[a-z_$][\w$]*$/i.test(n),h=Object.keys(Z).filter((n)=>!v.has(n)&&n!=="props"&&u(n)),$0=h.map((n)=>Z[n]),z0=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"]),z1=[],y0=[];for(let[n,J1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n))continue;if(z0.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(E))continue;z1.push(n),y0.push(J1)}let r0=fj(E).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
1943
- `),L5=Z.params??{},T1=[],I1=[];for(let n=0;n<h.length;n++){if(h[n]==="params")continue;T1.push(h[n]),I1.push($0[n])}let Y1=await Function("module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...z1,...T1,`return (async () => {
1942
+ `),Z}function pY($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function cY($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function w1($,Z,Y,J={}){if(!$.trim())return;let X;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=E.transformSync(v)}catch{X=lY($)}let Q={exports:{}},G=Q.exports,K=h5.cwd(),W={},q=[...X.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 q)try{let v=f1.resolve(K,"node_modules",E),u=f1.join(v,"package.json"),g=JSON.parse(e("fs").readFileSync(u,"utf8")),a=g.main||"index.js";if(g.exports){let Q0=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof Q0==="string")a=Q0;else if(Q0?.bun)a=Q0.bun;else if(Q0?.import)a=Q0.import;else if(Q0?.default)a=Q0.default}W[E]=await import(f1.resolve(v,a))}catch{}let U=(E)=>{if(W[E])return W[E];return e(E)},z=Z.props||{},j=(E)=>{if(!E)return z;let v={};for(let[u,g]of Object.entries(E)){let a=z[u];if(a!==void 0)v[u]=a;else if(typeof g==="function")v[u]=g();else v[u]=g}return v};for(let[E,v]of Object.entries(z))Object.defineProperty(j,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,E))continue;try{Object.defineProperty(j,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(E)=>{if(!E)return z;let v={...z};for(let[u,g]of Object.entries(E)){let a=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(v[u]===void 0&&a.default!==void 0)v[u]=typeof a.default==="function"?a.default():a.default}return v},B=()=>Z.slots||{},_=(E,v)=>{let u={...E};for(let[g,a]of Object.entries(v))if(u[g]===void 0)if(typeof a==="function")u[g]=a();else u[g]=a;return u},O=(E)=>{let v=()=>E;return v.set=(u)=>{},v.update=(u)=>{},v},F=(E)=>{let v,u=!1;return()=>{if(!u)try{v=E(),u=!0}catch{v=void 0}return v}},L=(E)=>{},V=(E)=>E(),w=(E)=>{},R=(E)=>{};function A(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)k({title:v.title,description:v.description})}function M(E){if(!E||typeof E!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,E),Z.__stxClientPayload=v}let N=()=>{let E=Z.__stxServeContext,v=Z.__stxServeSearch??E?.search??"",u=E?.path??"",g=Object.fromEntries(new URLSearchParams(v)),a=Z.query,Q0=Object.keys(g).length>0?g:a??{},r0=v||(Object.keys(Q0).length>0?`?${new URLSearchParams(Q0).toString()}`:"");return{params:Z.params??{},query:Q0,path:u,name:"",fullPath:u+r0,hash:"",matched:[]}},I=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),T=(E)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=S5(v,E||{})},k=(E)=>{T(R4(E||{}))},D=(E)=>({value:E}),P=(E)=>E,y=(E)=>({value:typeof E==="function"?E():E}),S=(E,v)=>{},C=(E)=>{},x=(E)=>{},m=(E)=>E?E():Promise.resolve(),l=(E)=>(v,...u)=>{},G0=(E)=>{},l0=(E,v)=>{},A0=(E,v)=>v,o0=()=>({value:"light"}),p=()=>O(!1),_0=(E)=>O(!1),p0=()=>O(!1),N1=()=>_0("(prefers-color-scheme: dark)"),O5=()=>_0("(prefers-color-scheme: light)"),F5=()=>_0("(prefers-reduced-motion: reduce)"),s=()=>_0("(prefers-contrast: more)"),r={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(r,{get(E,v){if(v in E)return E[v];return},set(E,v,u){return E[v]=u,!0}}),N0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},K0=console;try{let E=I6(X,Y),v=new Set(Object.keys(z)),u=(n)=>/^[a-z_$][\w$]*$/i.test(n),g=Object.keys(Z).filter((n)=>!v.has(n)&&n!=="props"&&u(n)),a=g.map((n)=>Z[n]),Q0=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"]),r0=[],y0=[];for(let[n,X1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n))continue;if(Q0.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(E))continue;r0.push(n),y0.push(X1)}let a0=fj(E).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
1943
+ `),L5=Z.params??{},T1=[],I1=[];for(let n=0;n<g.length;n++){if(g[n]==="params")continue;T1.push(g[n]),I1.push(a[n])}let J1=await Function("module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...r0,...T1,`return (async () => {
1944
1944
  ${E}
1945
- ${r0}
1945
+ ${a0}
1946
1946
  return module.exports
1947
- })()`)(Q,G,U,z,j,H,_,M,O,F,L,V,w,R,A,N,I,T,k,D,P,y,S,C,x,m,l,Q0,B,l0,A0,o0,p,_0,p0,N1,O5,F5,s,q0,N0,G0,r.confirm,r.alert,r.fetch,L5,...y0,...I1);if(J.preserveExisting){for(let[n,J1]of Object.entries(Y1))if(!(n in Z)||Z[n]===void 0)Z[n]=J1}else Object.assign(Z,Y1);for(let[n,J1]of Object.entries(z))if(!(n in Z))Z[n]=J1}catch(E){let v=E instanceof Error?E.message:String(E);if(pY(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(cY(v))console.warn(`[stx] server <script> in ${Y??"<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(h5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await dj(X,Z,Y)}catch(u){if(h5.env.STX_DEBUG){let h=u instanceof Error?u.message:String(u);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${h}`)}}}}function iY($){let Z=0,Y=null,J=!1,X=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G===Y){if(Y=null,J||Z===0)X=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return Y===null&&Z===0&&X}function I6($,Z){let Y=Z?f1.dirname(Z):h5.cwd(),J=h5.cwd(),X=$.split(`
1947
+ })()`)(Q,G,U,z,j,H,_,M,O,F,L,V,w,R,A,N,I,T,k,D,P,y,S,C,x,m,l,G0,B,l0,A0,o0,p,_0,p0,N1,O5,F5,s,U0,N0,K0,r.confirm,r.alert,r.fetch,L5,...y0,...I1);if(J.preserveExisting){for(let[n,X1]of Object.entries(J1))if(!(n in Z)||Z[n]===void 0)Z[n]=X1}else Object.assign(Z,J1);for(let[n,X1]of Object.entries(z))if(!(n in Z))Z[n]=X1}catch(E){let v=E instanceof Error?E.message:String(E);if(pY(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(cY(v))console.warn(`[stx] server <script> in ${Y??"<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(h5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await dj(X,Z,Y)}catch(u){if(h5.env.STX_DEBUG){let g=u instanceof Error?u.message:String(u);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${g}`)}}}}function iY($){let Z=0,Y=null,J=!1,X=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G===Y){if(Y=null,J||Z===0)X=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return Y===null&&Z===0&&X}function I6($,Z){let Y=Z?f1.dirname(Z):h5.cwd(),J=h5.cwd(),X=$.split(`
1948
1948
  `),Q=[],G=0;while(G<X.length){let K=X[G].trim();if(K.startsWith("interface ")||K.startsWith("export interface ")||K.startsWith("type ")||K.startsWith("export type ")){if(K.includes("{")&&!K.includes("}")){let W=0;for(;G<X.length;G++){for(let q of X[G])if(q==="{")W++;else if(q==="}")W--;if(W<=0)break}}G++;continue}if(K.startsWith("definePageMeta(")){let W=0,q=!1,U=G;for(let H=G;H<X.length&&!q;H++){let B=null,_=!1,O=X[H];for(let F=0;F<O.length;F++){let L=O[F];if(_){_=!1;continue}if(L==="\\"){_=!0;continue}if(B){if(L===B)B=null;continue}if(L==='"'||L==="'"||L==="`"){B=L;continue}if(L==="(")W++;else if(L===")"){if(W--,W===0){G=H+1,q=!0;break}}}}if(!q)G=X.length;let z=X.slice(U,G).join(`
1949
1949
  `),j=[];for(let H of["title","description"]){let B=new RegExp(`\\b${H}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(B)j.push(`${H}: ${JSON.stringify(B[2])}`)}if(j.length>0)Q.push(`useSeoMeta({ ${j.join(", ")} });`);continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let W=K,q=0;while(!iY(W)&&G+q+1<X.length)q++,W=`${W} ${X[G+q].trim()}`;G+=q;let U=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),j=W.match(/^import\s+['"](.+?)['"]/),H=W,B=(_)=>{if(_.startsWith("."))return f1.resolve(Y,_);if(_.startsWith("~/")||_.startsWith("@/"))return f1.resolve(J,_.slice(2));return _};if(U){let[,_,O]=U,F=B(O);Q.push(`const ${_} = await import('${F}')`),Q.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,O]=z,F=B(O),L=[],V=[];for(let w of _.split(",")){let R=w.trim();if(!R)continue;let A=R.split(/\s+as\s+/);if(A.length===2){let[M,N]=[A[0].trim(),A[1].trim()];L.push(`${M}: ${N}`),V.push(N)}else L.push(R),V.push(R)}Q.push(`const { ${L.join(", ")} } = await import('${F}')`);for(let w of V)Q.push(`module.exports.${w} = ${w};`)}else if(j){let _=B(j[1]);Q.push(`await import('${_}')`)}else Q.push(H);G++;continue}if((K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")||K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var "))&&!K.includes("="))Q.push(X[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let W=hY(X,G),{type:q,name:U,value:z}=W;Q.push(`${q} ${U} = ${z};`),Q.push(`module.exports.${U} = ${U};`),G=W.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let W=T6(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let W=hY(X,G),{type:q,name:U,value:z}=W;Q.push(`${q} ${U} = ${z};`),Q.push(`module.exports.${U} = ${U};`),G=W.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let W=T6(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let W=X[G].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[G]=W;let U=T6(q,G);if(Q.push(U.functionCode),U.name)Q.push(`module.exports.default = ${U.name};`);G=U.nextIndex}else if(K.startsWith("export default ")){let W=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${W};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let W=K.match(/(?:export\s+)?class\s+(\w+)/);if(W){let q=W[1],U=X[G].replace(/^export\s+/,""),z=0,j=G;for(;j<X.length;j++){let H=X[j];for(let B of H)if(B==="{")z++;else if(B==="}")z--;if(j>G)U+=`
1950
1950
  `+H;if(z<=0&&j>=G)break}Q.push(U),Q.push(`module.exports.${q} = ${q};`),G=j+1}else Q.push(K),G++}else if(K.includes("module.exports"))Q.push(K),G++;else if(K.trim()&&!K.startsWith("//"))Q.push(K),G++;else G++}return gj(Q.join(`
@@ -1955,7 +1955,7 @@ ${A}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}l
1955
1955
  ${$[q]}`,q++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:q}}function T6($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,X]=J,Q=Y.replace(/^export\s+/,""),G=Z;if(uj(Y)){let K=mj($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function uY($){let Z=$.trim();if(Z.startsWith("{"))return T0(Z,"{","}",0)===-1;if(Z.startsWith("["))return T0(Z,"[","]",0)===-1;return!rY(Z)}function rY($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let X=0;X<$.length;X++){let Q=$[X];if((X>0?$[X-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[X+1]==="{"){J++,X++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(Y)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function aY($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let Y=T0($,"(",")",Z);if(Y===-1)return-1;return $.indexOf("{",Y)}function uj($){let Z=aY($);if(Z===-1)return!0;return T0($,"{","}",Z)===-1}function mY($,Z,Y){let J=Y,X=Z+1;while(X<$.length&&!rY(J)){let Q=$[X];J+=`
1956
1956
  ${Q}`,X++}while(X<$.length){let Q=$[X].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
1957
1957
  ${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function mj($,Z,Y){let J=Y,X=Z+1;while(X<$.length){let Q=aY(J);if(Q!==-1){if(T0(J,"{","}",Q)!==-1)break}let G=$[X];J+=`
1958
- ${G}`,X++}return{functionCode:J,nextIndex:X}}function dY($,Z){let Y=J0($,Z)??J0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...h5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function dj($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),q=dY(W,Z);if(q!==void 0)Z[G]=q}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),q=dY(W,Z);if(q!==void 0)Z[G]=q}catch{}}}function tY($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function eY($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var u5=b(()=>{R$();E1();V0()});var GJ={};a(GJ,{processLoops:()=>E6,parseLoopBinding:()=>D6});function cj($,Z){let Y=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index+Q[0].length,K=Q.index+Q[0].indexOf("("),W=T0($,"(",")",K);if(W===-1)continue;let q=$.slice(G,W).trim();if(!q)continue;if(!Object.keys(Z).some((j)=>new RegExp(`(?:^|[^\\w$.])${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let z;try{let j=L0(q,Z);if(!j||typeof j!=="object")continue;z=JSON.stringify(j)}catch{continue}J+=$.slice(X,G)+z,X=W,Y.lastIndex=W}return X===0?$:J+$.slice(X)}function ij($,Z){let Y=/@component\s*\(/g,J=$,X,Q=[];while((X=Y.exec(J))!==null){let G=X.index,K=G+X[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")"){if(W--,W===0)break}q++}if(W!==0)continue;let U=J.substring(K+1,q),z=q+1,j=U.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let H=j[1],B=U.slice(j[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let O=B.slice(_[0].length).trim();if(!O)continue;try{let F=L0(O,Z),L=JSON.stringify(F),V=`@component('${H}', ${L})`;Q.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];J=J.substring(0,K)+q+J.substring(W)}return J}function f4($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1,U=null,z=!1;while(q<J.length&&W>0){let B=J[q];if(z){z=!1,q++;continue}if(B==="\\"&&U){z=!0,q++;continue}if(U){if(B===U)U=null;q++;continue}if(B==='"'||B==="'"||B==="`"){U=B,q++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}q++}if(W!==0)break;let j=J.substring(K+1,q),H=Y(j);J=J.substring(0,G)+H+J.substring(q+1)}return J}function nj($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,X)=>{if(X in Z)return`:${X}="${X}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);Z4(Q);let q=W0(Q,G)(...K),U=JSON.stringify(q),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${X}="${z}"`}catch(G){return J}}),Y}function sj($,Z){let Y=$;return Y=f4(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(K0(Q)){let K=W0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(Q,Z));return G?g4:""}catch{return""}}),Y=f4(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(K0(Q)){let K=W0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(Q,Z));return G?h4:""}catch{return""}}),Y}function oj($){let Z=$;return Z=Z.replace(/@break(?!\()/g,g4),Z=Z.replace(/@continue(?!\()/g,h4),Z}function $J($){let Z=$.includes(g4),Y=Z?$.substring(0,$.indexOf(g4)):$;return{hasBreak:Z,content:Y}}function ZJ($){let Z=$.includes(h4),Y=Z?$.substring(0,$.indexOf(h4)):$;return{hasContinue:Z,content:Y}}function JJ($){let Z=$;return Z=f4(Z,"@break",(Y)=>{let J=Y.trim();if(!Y4(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=f4(Z,"@continue",(Y)=>{let J=Y.trim();if(!Y4(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function rj($){let Z=/@forelse\s*\(/g,Y,J=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((U,z)=>U.pos-z.pos);let K=[],W=0;for(let U of J)W+=U.delta,K.push({pos:U.pos,depth:W});function q(U){let z=0,j=K.length-1,H=0;while(z<=j){let B=z+j>>1;if(K[B].pos<=U)H=K[B].depth,z=B+1;else j=B-1}return H}while((Y=Z.exec($))!==null){if(q(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,j=1,H=z+1,B=-1;while(H<$.length&&j>0){if($[H]==="(")j++;else if($[H]===")"){if(j--,j===0){B=H;break}}H++}if(B===-1)continue;let _=$.substring(z+1,B),O=D6(_);if(!O)continue;let{arrayExpr:F,itemVar:L}=O,V=B+1,w=1,R=V,A=/@forelse\s*\(/g,M=/@endforelse/g,N=-1;while(w>0&&R<$.length){A.lastIndex=R,M.lastIndex=R;let y=A.exec($),S=M.exec($);if(!S)break;if(y&&y.index<S.index)w++,R=y.index+y[0].length;else{if(w--,w===0){N=S.index;break}R=S.index+11}}if(N===-1)continue;let I=$.substring(V,N),T=N+11,k=-1,D=0,P=0;while(P<I.length){let y=I.indexOf("@",P);if(y===-1)break;let S=I.substring(y);if(/^@forelse\s*\(/.test(S))D++,P=y+1;else if(S.startsWith("@endforelse"))D--,P=y+11;else if(D===0&&S.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){k=y;break}P=y+1}else P=y+1}if(k===-1)continue;return{start:U,end:T,arrayExpr:F,itemVar:L,foreachContent:I.substring(0,k),emptyContent:I.substring(k+6)}}return null}function YJ($,Z){let Y=$;while(!0){let J=rj(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:q}=J;try{let U;if(K0(G))U=W0(G,Object.keys(Z))(...Object.values(Z));else U=J0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=q;else z=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,X)+z+Y.substring(Q)}catch(U){let z=U instanceof Error?U.message:String(U),j=Z0("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,o.EVALUATION_ERROR);Y=Y.substring(0,X)+j+Y.substring(Q)}}return Y}function D6($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let Y=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!Y)return null;let J=Y[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),X=Y[2].trim();return J&&X?{arrayExpr:X,itemVar:J}:null}function E6($,Z,Y,J){let X=$;X=YJ(X,Z);function Q(W){let q=/@foreach\s*\(/g,U;while((U=q.exec(W))!==null){let z=U.index,j=U.index+U[0].length-1,H=1,B=j+1,_=-1;while(B<W.length&&H>0){if(W[B]==="(")H++;else if(W[B]===")"){if(H--,H===0){_=B;break}}B++}if(_===-1)continue;let O=W.substring(j+1,_),F=D6(O);if(!F)continue;let L=z,{arrayExpr:V,itemVar:w}=F,R=_+1,A=1,M=R,N=/@foreach\s*\(/g,I=/@endforeach/g;while(A>0&&M<W.length){N.lastIndex=M,I.lastIndex=M;let T=N.exec(W),k=I.exec(W);if(!k)break;if(T&&T.index<k.index)A++,M=T.index+T[0].length;else{if(A--,A===0){let D=W.substring(R,k.index),P=k.index+11;return{start:L,end:P,arrayExpr:V,itemVar:w,content:D}}M=k.index+11}}}return null}function G(W,q){let U=W;while(!0){let z=Q(U);if(!z)break;let{start:j,end:H,arrayExpr:B,itemVar:_,content:O}=z;try{let F=B.trim(),L;if(K0(F))L=W0(F,Object.keys(q))(...Object.values(q));else L=J0(F,q);let V=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),V=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),V=!0;else{console.warn(`[stx] @foreach(${F}) in ${Y}: ${F} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let k=Z0("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);U=U.substring(0,j)+k+U.substring(H);continue}let w=J?.loops?.useAltLoopVariable??pj,R=_.trim(),A=null,M,N=!1;if(R.includes("=>")){let k=R.split("=>").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])A=k[0],M=k[1];else M=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])M=k[0],A=k[1],N=!0;else M=R}else M=R;let I="",T=L;for(let k=0;k<T.length;k++){let D=T[k],P={index:k,iteration:k+1,first:k===0,last:k===T.length-1,count:T.length},y={...q,loop:P,$loop:P};if(M.startsWith("[")&&M.endsWith("]")){let m=M.slice(1,-1).split(",").map((l)=>l.trim());if(Array.isArray(D))m.forEach((l,Q0)=>{if(l)y[l]=D[Q0]});else y[M]=D}else y[M]=D;if(A)if(!N&&V&&Array.isArray(D)&&D.length===2)y[A]=D[0],y[M]=D[1];else y[A]=k;let S=sj(O,y),C=ZJ(S);if(C.hasContinue){I+=C.content;continue}let x=$J(S);if(x.hasBreak){I+=x.content;break}if(S=YJ(S,y),S=G(S,y),S=X5(S,y,Y),S=oj(S),x=$J(S),x.hasBreak){I+=x.content;break}if(C=ZJ(S),C.hasContinue){I+=C.content;continue}S=S1(S,y,Y),S=nj(S,y),S=ij(S,y),S=cj(S,y),I+=S}U=U.substring(0,j)+I+U.substring(H)}catch(F){let L=Z0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);U=U.substring(0,j)+L+U.substring(H)}}return U}X=G(X,Z),X=QJ(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??lj;return X=ej(X,Z,K),X}function XJ($){return Y4($)}function QJ($,Z,Y,J){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,q=T0(X,"(",")",W);if(q===-1)break;let U=X.slice(W+1,q),z=q+1,j=O4(X.slice(K),"for","endfor");if(j.length===0)break;let H=j[0].content,B=K+j[0].end;if(!XJ(U)){let _=Z0("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);X=X.substring(0,K)+_+X.substring(B),Q=!0;continue}try{let _=aj(U),O=/@(?:for|foreach|if|unless)\s*\(/.test(H);if(_.length>0&&O){let A=tj({forExpr:U,content:H,iterVarNames:_,context:Z,filePath:Y,options:J});X=X.substring(0,K)+A+X.substring(B),Q=!0;continue}let F=Object.keys(Z),L=Object.values(Z),V=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,M)=>{return`\${${M}}`});V=JJ(V);let R=Function(...F,`
1958
+ ${G}`,X++}return{functionCode:J,nextIndex:X}}function dY($,Z){let Y=J0($,Z)??J0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...h5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function dj($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),q=dY(W,Z);if(q!==void 0)Z[G]=q}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),q=dY(W,Z);if(q!==void 0)Z[G]=q}catch{}}}function tY($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function eY($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var u5=b(()=>{R$();E1();V0()});var GJ={};t(GJ,{processLoops:()=>E6,parseLoopBinding:()=>D6});function cj($,Z){let Y=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index+Q[0].length,K=Q.index+Q[0].indexOf("("),W=T0($,"(",")",K);if(W===-1)continue;let q=$.slice(G,W).trim();if(!q)continue;if(!Object.keys(Z).some((j)=>new RegExp(`(?:^|[^\\w$.])${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let z;try{let j=L0(q,Z);if(!j||typeof j!=="object")continue;z=JSON.stringify(j)}catch{continue}J+=$.slice(X,G)+z,X=W,Y.lastIndex=W}return X===0?$:J+$.slice(X)}function ij($,Z){let Y=/@component\s*\(/g,J=$,X,Q=[];while((X=Y.exec(J))!==null){let G=X.index,K=G+X[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")"){if(W--,W===0)break}q++}if(W!==0)continue;let U=J.substring(K+1,q),z=q+1,j=U.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let H=j[1],B=U.slice(j[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let O=B.slice(_[0].length).trim();if(!O)continue;try{let F=L0(O,Z),L=JSON.stringify(F),V=`@component('${H}', ${L})`;Q.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];J=J.substring(0,K)+q+J.substring(W)}return J}function f4($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1,U=null,z=!1;while(q<J.length&&W>0){let B=J[q];if(z){z=!1,q++;continue}if(B==="\\"&&U){z=!0,q++;continue}if(U){if(B===U)U=null;q++;continue}if(B==='"'||B==="'"||B==="`"){U=B,q++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}q++}if(W!==0)break;let j=J.substring(K+1,q),H=Y(j);J=J.substring(0,G)+H+J.substring(q+1)}return J}function nj($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,X)=>{if(X in Z)return`:${X}="${X}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);Z4(Q);let q=q0(Q,G)(...K),U=JSON.stringify(q),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${X}="${z}"`}catch(G){return J}}),Y}function sj($,Z){let Y=$;return Y=f4(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(Q,Z));return G?g4:""}catch{return""}}),Y=f4(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(Q,Z));return G?h4:""}catch{return""}}),Y}function oj($){let Z=$;return Z=Z.replace(/@break(?!\()/g,g4),Z=Z.replace(/@continue(?!\()/g,h4),Z}function $J($){let Z=$.includes(g4),Y=Z?$.substring(0,$.indexOf(g4)):$;return{hasBreak:Z,content:Y}}function ZJ($){let Z=$.includes(h4),Y=Z?$.substring(0,$.indexOf(h4)):$;return{hasContinue:Z,content:Y}}function JJ($){let Z=$;return Z=f4(Z,"@break",(Y)=>{let J=Y.trim();if(!Y4(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=f4(Z,"@continue",(Y)=>{let J=Y.trim();if(!Y4(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function rj($){let Z=/@forelse\s*\(/g,Y,J=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((U,z)=>U.pos-z.pos);let K=[],W=0;for(let U of J)W+=U.delta,K.push({pos:U.pos,depth:W});function q(U){let z=0,j=K.length-1,H=0;while(z<=j){let B=z+j>>1;if(K[B].pos<=U)H=K[B].depth,z=B+1;else j=B-1}return H}while((Y=Z.exec($))!==null){if(q(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,j=1,H=z+1,B=-1;while(H<$.length&&j>0){if($[H]==="(")j++;else if($[H]===")"){if(j--,j===0){B=H;break}}H++}if(B===-1)continue;let _=$.substring(z+1,B),O=D6(_);if(!O)continue;let{arrayExpr:F,itemVar:L}=O,V=B+1,w=1,R=V,A=/@forelse\s*\(/g,M=/@endforelse/g,N=-1;while(w>0&&R<$.length){A.lastIndex=R,M.lastIndex=R;let y=A.exec($),S=M.exec($);if(!S)break;if(y&&y.index<S.index)w++,R=y.index+y[0].length;else{if(w--,w===0){N=S.index;break}R=S.index+11}}if(N===-1)continue;let I=$.substring(V,N),T=N+11,k=-1,D=0,P=0;while(P<I.length){let y=I.indexOf("@",P);if(y===-1)break;let S=I.substring(y);if(/^@forelse\s*\(/.test(S))D++,P=y+1;else if(S.startsWith("@endforelse"))D--,P=y+11;else if(D===0&&S.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){k=y;break}P=y+1}else P=y+1}if(k===-1)continue;return{start:U,end:T,arrayExpr:F,itemVar:L,foreachContent:I.substring(0,k),emptyContent:I.substring(k+6)}}return null}function YJ($,Z){let Y=$;while(!0){let J=rj(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:q}=J;try{let U;if(W0(G))U=q0(G,Object.keys(Z))(...Object.values(Z));else U=J0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=q;else z=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,X)+z+Y.substring(Q)}catch(U){let z=U instanceof Error?U.message:String(U),j=Z0("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,o.EVALUATION_ERROR);Y=Y.substring(0,X)+j+Y.substring(Q)}}return Y}function D6($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let Y=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!Y)return null;let J=Y[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),X=Y[2].trim();return J&&X?{arrayExpr:X,itemVar:J}:null}function E6($,Z,Y,J){let X=$;X=YJ(X,Z);function Q(W){let q=/@foreach\s*\(/g,U;while((U=q.exec(W))!==null){let z=U.index,j=U.index+U[0].length-1,H=1,B=j+1,_=-1;while(B<W.length&&H>0){if(W[B]==="(")H++;else if(W[B]===")"){if(H--,H===0){_=B;break}}B++}if(_===-1)continue;let O=W.substring(j+1,_),F=D6(O);if(!F)continue;let L=z,{arrayExpr:V,itemVar:w}=F,R=_+1,A=1,M=R,N=/@foreach\s*\(/g,I=/@endforeach/g;while(A>0&&M<W.length){N.lastIndex=M,I.lastIndex=M;let T=N.exec(W),k=I.exec(W);if(!k)break;if(T&&T.index<k.index)A++,M=T.index+T[0].length;else{if(A--,A===0){let D=W.substring(R,k.index),P=k.index+11;return{start:L,end:P,arrayExpr:V,itemVar:w,content:D}}M=k.index+11}}}return null}function G(W,q){let U=W;while(!0){let z=Q(U);if(!z)break;let{start:j,end:H,arrayExpr:B,itemVar:_,content:O}=z;try{let F=B.trim(),L;if(W0(F))L=q0(F,Object.keys(q))(...Object.values(q));else L=J0(F,q);let V=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),V=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),V=!0;else{console.warn(`[stx] @foreach(${F}) in ${Y}: ${F} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let k=Z0("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);U=U.substring(0,j)+k+U.substring(H);continue}let w=J?.loops?.useAltLoopVariable??pj,R=_.trim(),A=null,M,N=!1;if(R.includes("=>")){let k=R.split("=>").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])A=k[0],M=k[1];else M=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])M=k[0],A=k[1],N=!0;else M=R}else M=R;let I="",T=L;for(let k=0;k<T.length;k++){let D=T[k],P={index:k,iteration:k+1,first:k===0,last:k===T.length-1,count:T.length},y={...q,loop:P,$loop:P};if(M.startsWith("[")&&M.endsWith("]")){let m=M.slice(1,-1).split(",").map((l)=>l.trim());if(Array.isArray(D))m.forEach((l,G0)=>{if(l)y[l]=D[G0]});else y[M]=D}else y[M]=D;if(A)if(!N&&V&&Array.isArray(D)&&D.length===2)y[A]=D[0],y[M]=D[1];else y[A]=k;let S=sj(O,y),C=ZJ(S);if(C.hasContinue){I+=C.content;continue}let x=$J(S);if(x.hasBreak){I+=x.content;break}if(S=YJ(S,y),S=G(S,y),S=X5(S,y,Y),S=oj(S),x=$J(S),x.hasBreak){I+=x.content;break}if(C=ZJ(S),C.hasContinue){I+=C.content;continue}S=S1(S,y,Y),S=nj(S,y),S=ij(S,y),S=cj(S,y),I+=S}U=U.substring(0,j)+I+U.substring(H)}catch(F){let L=Z0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);U=U.substring(0,j)+L+U.substring(H)}}return U}X=G(X,Z),X=QJ(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??lj;return X=ej(X,Z,K),X}function XJ($){return Y4($)}function QJ($,Z,Y,J){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,q=T0(X,"(",")",W);if(q===-1)break;let U=X.slice(W+1,q),z=q+1,j=O4(X.slice(K),"for","endfor");if(j.length===0)break;let H=j[0].content,B=K+j[0].end;if(!XJ(U)){let _=Z0("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);X=X.substring(0,K)+_+X.substring(B),Q=!0;continue}try{let _=aj(U),O=/@(?:for|foreach|if|unless)\s*\(/.test(H);if(_.length>0&&O){let A=tj({forExpr:U,content:H,iterVarNames:_,context:Z,filePath:Y,options:J});X=X.substring(0,K)+A+X.substring(B),Q=!0;continue}let F=Object.keys(Z),L=Object.values(Z),V=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,M)=>{return`\${${M}}`});V=JJ(V);let R=Function(...F,`
1959
1959
  let result = '';
1960
1960
  for (${U}) {
1961
1961
  result += \`${V}\`;
@@ -1977,7 +1977,7 @@ ${G}`,X++}return{functionCode:J,nextIndex:X}}function dY($,Z){let Y=J0($,Z)??J0(
1977
1977
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
1978
1978
  }
1979
1979
  return result;
1980
- `)(...B);J=J.substring(0,G)+F+J.substring(j),X=!0}catch(H){let B=Z0("While",`Error in @while(${q}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);J=J.substring(0,G)+B+J.substring(j),X=!0}}return J}var lj=1000,pj=!1,g4="<!--__STX_BREAK__-->",h4="<!--__STX_CONTINUE__-->";var k6=b(()=>{L4();V1();G1();F4();V0()});import B0 from"path";function b6($,Z){let Y=0;for(let J=Z;J<$.length;J++){let X=$[J];if(X==="("||X==="["||X==="{")Y++;else if(X===")"||X==="]"||X==="}")Y--;else if(X===","&&Y===0)return J}return-1}function $B($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=X.exec(J);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")")W--;q++}if(W!==0)break;let U=J.substring(K+1,q-1),z=`${Y}(${U})`;J=J.substring(0,G)+z+J.substring(q),X.lastIndex=G+z.length,Q=X.exec(J)}return J}function ZB($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function WJ($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K=(z)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===z){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let z=1;while(Q<G&&z>0)if(Z[Q]==="{")z++,Q++;else if(Z[Q]==="}")z--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
1980
+ `)(...B);J=J.substring(0,G)+F+J.substring(j),X=!0}catch(H){let B=Z0("While",`Error in @while(${q}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);J=J.substring(0,G)+B+J.substring(j),X=!0}}return J}var lj=1000,pj=!1,g4="<!--__STX_BREAK__-->",h4="<!--__STX_CONTINUE__-->";var k6=b(()=>{L4();V1();K1();F4();V0()});import B0 from"path";function b6($,Z){let Y=0;for(let J=Z;J<$.length;J++){let X=$[J];if(X==="("||X==="["||X==="{")Y++;else if(X===")"||X==="]"||X==="}")Y--;else if(X===","&&Y===0)return J}return-1}function $B($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=X.exec(J);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")")W--;q++}if(W!==0)break;let U=J.substring(K+1,q-1),z=`${Y}(${U})`;J=J.substring(0,G)+z+J.substring(q),X.lastIndex=G+z.length,Q=X.exec(J)}return J}function ZB($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function WJ($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K=(z)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===z){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let z=1;while(Q<G&&z>0)if(Z[Q]==="{")z++,Q++;else if(Z[Q]==="}")z--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
1981
1981
  `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},U=()=>{if(X!==0)return;let z=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!J.has(B))Y.push(B),J.add(B);return}let j=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Y.push(B),J.add(B);return}let H=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Y.push(B),J.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){W();continue}if(Z[Q]==="{"){X++,Q++;continue}if(Z[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))U();Q++}return Y.join(", ")}function qJ($,Z=""){let Y=WJ($).split(",").map((J)=>J.trim()).filter(Boolean);return`
1982
1982
  (function() {
1983
1983
  ${w5("var",Y)}
@@ -2012,17 +2012,17 @@ ${WJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
2012
2012
  } finally {
2013
2013
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2014
2014
  }
2015
- })();`}function JB($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let X=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function QB($){if($.__onceStore instanceof Set)return $.__onceStore;return XB}async function S6($,Z,Y,J,X,Q=new Set){let G=J.partialsDir||B0.join(B0.dirname(Y),"partials");if(G&&!B0.isAbsolute(G))G=B0.resolve(process.cwd(),G);let K=$B($,"@partial","@include"),W=QB(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,_,O)=>{let F=_.trim(),L=`${Y}:${F}`;if(W.has(L))return"";return W.add(L),_});{let B=/@includeIf\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=V;continue}let A=R[1],M=q(A,G,Y),N="";if(M&&await Bun.file(M).exists())X.add(M),N=`@include(${w})`;K=K.substring(0,O)+N+K.substring(V),B.lastIndex=0}}for(let[B,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(K))!==null){let L=F.index,V=L+F[0].length-1,w=1,R=V+1;while(R<K.length&&w>0){if(K[R]==="(")w++;else if(K[R]===")")w--;R++}if(w!==0)break;let A=K.substring(V+1,R-1),M=b6(A,0);if(M===-1){O.lastIndex=R;continue}let N=A.substring(0,M).trim(),I=A.substring(M+1).trim(),T=I.match(/^\s*['"]([^'"]+)['"]/);if(!T){O.lastIndex=R;continue}let k=T[1],D=I.substring(T[0].length),P,y=b6(D,0);if(y!==-1)P=D.substring(y+1).trim();try{let S=`Boolean(${N})`,C;if(K0(S)){let l=W0(S,Object.keys(Z));C=Boolean(l(...Object.values(Z)))}else C=Boolean(J0(S,Z));let x=_?!C:C,m="";if(x){let l=q(k,G,Y);if(l&&await Bun.file(l).exists())X.add(l);m=`@include('${k}'${P?`, ${P}`:""})`}K=K.substring(0,L)+m+K.substring(R),O.lastIndex=0}catch(S){let C=S instanceof Error?S.message:String(S),x=U0("Include",`Error evaluating ${B} condition: ${C}`,Y,$,L);K=K.substring(0,L)+x+K.substring(R),O.lastIndex=0}}}{let B=/@each\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),A=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){B.lastIndex=0,K=K.replace(R,"");continue}let[,M,N,I,T]=A;try{let k,D=N.trim();if(K0(D))k=W0(D,Object.keys(Z))(...Object.values(Z));else k=J0(D,Z);let P="";if(Array.isArray(k)&&k.length>0)for(let y of k){let S={...Z,[I]:y},C=await z(M,S,$,O);P+=C}else if(T)P=await z(T,{},$,O);K=K.substring(0,O)+P+K.substring(V+1),B.lastIndex=0}catch(k){let D=k instanceof Error?k.message:String(k);K=K.substring(0,O)+U0("Each",`Error in @each: ${D}`,Y,$,O)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),A=w.match(/^\s*(\[[^\]]+\])/);if(!A){B.lastIndex=0,K=K.replace(R,"");continue}let M=A[1],N=w.slice(A[0].length),I,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let P=1,y=1;while(y<N.length&&P>0){if(N[y]==="{")P++;else if(N[y]==="}"){if(P--,P===0)break}y++}I=N.substring(0,y+1),N=N.slice(y+1)}let k,D=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)k=D[1];try{let P=JSON.parse(M.replace(/'/g,'"')),y={};if(I)try{y=L0(I,Z)}catch(C){let x=C instanceof Error?C.message:String(C);if(J.debug){let m=U0("Include",`Error parsing includeFirst variables: ${x}`,Y,$,O,R);K=K.replace(R,()=>m)}else K=K.replace(R,()=>k||"");continue}let S=!1;for(let C of P){let x=q(C,G,Y);if(!x)continue;if(await i(x)){let m=await z(C,y,$,O);K=K.replace(R,()=>m),S=!0;break}}if(!S)if(k!==void 0)K=K.replace(R,()=>k);else if(J.debug){let C=U0("Include",`None of the includeFirst paths exist: ${M}`,Y,$,O,R);K=K.replace(R,()=>C)}else K=K.replace(R,"")}catch(P){let y=P instanceof Error?P.message:String(P),S=U0("Include",`Error processing @includeFirst: ${y}`,Y,$,O,R);K=K.replace(R,()=>S)}B.lastIndex=0}}function q(B,_,O){try{let F=B;if(!B.endsWith(".stx"))F=`${B}.stx`;let L=B0.resolve(_),V=B0.resolve(B0.dirname(O)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=B0.resolve(_,F);else w=B0.resolve(V,F);let R=B0.normalize(w),A=R.startsWith(L+B0.sep)||R===L,M=R.startsWith(V+B0.sep)||R===V,N=!1,I=B0.dirname(V);if(R.startsWith(I+B0.sep)){if(!B0.relative(I,R).split(B0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))N=!0}if(!A&&!M&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${B}: ${F}`),null}}let U=B0.resolve(Y);Q.add(U);async function z(B,_={},O,F){let L=q(B,G,Y);if(!L)return U0("Include",`Could not resolve path for include: ${B}`,Y,O,F);let V=B0.resolve(L);if(Q.has(V)){let w=[...Q,V].map((R)=>B0.basename(R)).join(" -> ");return U0("Include",`Circular include detected: ${w}`,Y,O,F)}try{X.add(L);let w;if(!w)try{w=await Bun.file(L).text()}catch(x){let m=x instanceof Error?x.message:String(x);return U0("Include",`Error loading include file ${B}: ${m}`,Y,O,F)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (o3(),s3));w=x(w,Z)}if(w&&(J.debug||!L$()&&!U4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (a3(),jY));x(w,L)}catch{}let R=w;try{let{processESImports:x}=await Promise.resolve().then(() => (N6(),gY));await x(w,Z,L,J,X)}catch(x){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let A=P5(R);if(A)R=A.content.trim();let N=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(N)I=`<style${N[1]}>${N[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=F1(w);for(let[x,m]of Object.entries(_))T[x]=m;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(k)],P="",y=null;for(let x of D){let m=x[1]||"",l=x[2]||"",Q0=m.includes("server"),l0=t1(m),A0="";try{let{extractAndStripCssImports:p,renderVendorStyleTags:_0}=await Promise.resolve().then(() => (N5(),MZ)),p0=p(l,{filePath:L,projectRoot:process.cwd()});l=p0.code,A0=_0(p0.styles)}catch(p){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,p instanceof Error?p.message:p)}if(l0&&l.trim())l=e1(l);if(!Q0)try{let{hasUserImports:p,bundleClientScript:_0}=await Promise.resolve().then(() => (U$(),q$));if(p(l))l=await _0(l,L,{projectRoot:process.cwd()})}catch(p){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,p instanceof Error?p.message:p)}let o0=ZB(l);if(o0&&!Q0){y=`stx_scope_${B0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++KJ}`;let p=g0(l),_0=YB(p,y);P+=`${A0}<script data-stx-scoped data-stx-run="always">${_0}</script>
2016
- `;continue}if(Q0)try{let{extractVariables:p}=await Promise.resolve().then(() => (u5(),x4));await p(l,T,L)}catch(p){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,p)}if(!Q0&&!o0){let p=m.replace(/\bclient\b/i,"").trim();y=`stx_scope_${B0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++KJ}`;let _0=g0(l),p0=UJ(_0,y),N1=qJ(_0,p0);P+=`${A0}<script data-stx-scoped data-stx-run="always"${p?` ${p}`:""}>${N1}</script>
2015
+ })();`}function JB($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let X=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function QB($){if($.__onceStore instanceof Set)return $.__onceStore;return XB}async function S6($,Z,Y,J,X,Q=new Set){let G=J.partialsDir||B0.join(B0.dirname(Y),"partials");if(G&&!B0.isAbsolute(G))G=B0.resolve(process.cwd(),G);let K=$B($,"@partial","@include"),W=QB(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,_,O)=>{let F=_.trim(),L=`${Y}:${F}`;if(W.has(L))return"";return W.add(L),_});{let B=/@includeIf\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=V;continue}let A=R[1],M=q(A,G,Y),N="";if(M&&await Bun.file(M).exists())X.add(M),N=`@include(${w})`;K=K.substring(0,O)+N+K.substring(V),B.lastIndex=0}}for(let[B,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(K))!==null){let L=F.index,V=L+F[0].length-1,w=1,R=V+1;while(R<K.length&&w>0){if(K[R]==="(")w++;else if(K[R]===")")w--;R++}if(w!==0)break;let A=K.substring(V+1,R-1),M=b6(A,0);if(M===-1){O.lastIndex=R;continue}let N=A.substring(0,M).trim(),I=A.substring(M+1).trim(),T=I.match(/^\s*['"]([^'"]+)['"]/);if(!T){O.lastIndex=R;continue}let k=T[1],D=I.substring(T[0].length),P,y=b6(D,0);if(y!==-1)P=D.substring(y+1).trim();try{let S=`Boolean(${N})`,C;if(W0(S)){let l=q0(S,Object.keys(Z));C=Boolean(l(...Object.values(Z)))}else C=Boolean(J0(S,Z));let x=_?!C:C,m="";if(x){let l=q(k,G,Y);if(l&&await Bun.file(l).exists())X.add(l);m=`@include('${k}'${P?`, ${P}`:""})`}K=K.substring(0,L)+m+K.substring(R),O.lastIndex=0}catch(S){let C=S instanceof Error?S.message:String(S),x=z0("Include",`Error evaluating ${B} condition: ${C}`,Y,$,L);K=K.substring(0,L)+x+K.substring(R),O.lastIndex=0}}}{let B=/@each\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),A=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){B.lastIndex=0,K=K.replace(R,"");continue}let[,M,N,I,T]=A;try{let k,D=N.trim();if(W0(D))k=q0(D,Object.keys(Z))(...Object.values(Z));else k=J0(D,Z);let P="";if(Array.isArray(k)&&k.length>0)for(let y of k){let S={...Z,[I]:y},C=await z(M,S,$,O);P+=C}else if(T)P=await z(T,{},$,O);K=K.substring(0,O)+P+K.substring(V+1),B.lastIndex=0}catch(k){let D=k instanceof Error?k.message:String(k);K=K.substring(0,O)+z0("Each",`Error in @each: ${D}`,Y,$,O)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),A=w.match(/^\s*(\[[^\]]+\])/);if(!A){B.lastIndex=0,K=K.replace(R,"");continue}let M=A[1],N=w.slice(A[0].length),I,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let P=1,y=1;while(y<N.length&&P>0){if(N[y]==="{")P++;else if(N[y]==="}"){if(P--,P===0)break}y++}I=N.substring(0,y+1),N=N.slice(y+1)}let k,D=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)k=D[1];try{let P=JSON.parse(M.replace(/'/g,'"')),y={};if(I)try{y=L0(I,Z)}catch(C){let x=C instanceof Error?C.message:String(C);if(J.debug){let m=z0("Include",`Error parsing includeFirst variables: ${x}`,Y,$,O,R);K=K.replace(R,()=>m)}else K=K.replace(R,()=>k||"");continue}let S=!1;for(let C of P){let x=q(C,G,Y);if(!x)continue;if(await i(x)){let m=await z(C,y,$,O);K=K.replace(R,()=>m),S=!0;break}}if(!S)if(k!==void 0)K=K.replace(R,()=>k);else if(J.debug){let C=z0("Include",`None of the includeFirst paths exist: ${M}`,Y,$,O,R);K=K.replace(R,()=>C)}else K=K.replace(R,"")}catch(P){let y=P instanceof Error?P.message:String(P),S=z0("Include",`Error processing @includeFirst: ${y}`,Y,$,O,R);K=K.replace(R,()=>S)}B.lastIndex=0}}function q(B,_,O){try{let F=B;if(!B.endsWith(".stx"))F=`${B}.stx`;let L=B0.resolve(_),V=B0.resolve(B0.dirname(O)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=B0.resolve(_,F);else w=B0.resolve(V,F);let R=B0.normalize(w),A=R.startsWith(L+B0.sep)||R===L,M=R.startsWith(V+B0.sep)||R===V,N=!1,I=B0.dirname(V);if(R.startsWith(I+B0.sep)){if(!B0.relative(I,R).split(B0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))N=!0}if(!A&&!M&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${B}: ${F}`),null}}let U=B0.resolve(Y);Q.add(U);async function z(B,_={},O,F){let L=q(B,G,Y);if(!L)return z0("Include",`Could not resolve path for include: ${B}`,Y,O,F);let V=B0.resolve(L);if(Q.has(V)){let w=[...Q,V].map((R)=>B0.basename(R)).join(" -> ");return z0("Include",`Circular include detected: ${w}`,Y,O,F)}try{X.add(L);let w;if(!w)try{w=await Bun.file(L).text()}catch(x){let m=x instanceof Error?x.message:String(x);return z0("Include",`Error loading include file ${B}: ${m}`,Y,O,F)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (o3(),s3));w=x(w,Z)}if(w&&(J.debug||!L$()&&!U4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (a3(),jY));x(w,L)}catch{}let R=w;try{let{processESImports:x}=await Promise.resolve().then(() => (N6(),gY));await x(w,Z,L,J,X)}catch(x){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let A=P5(R);if(A)R=A.content.trim();let N=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(N)I=`<style${N[1]}>${N[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=F1(w);for(let[x,m]of Object.entries(_))T[x]=m;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(k)],P="",y=null;for(let x of D){let m=x[1]||"",l=x[2]||"",G0=m.includes("server"),l0=t1(m),A0="";try{let{extractAndStripCssImports:p,renderVendorStyleTags:_0}=await Promise.resolve().then(() => (N5(),MZ)),p0=p(l,{filePath:L,projectRoot:process.cwd()});l=p0.code,A0=_0(p0.styles)}catch(p){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,p instanceof Error?p.message:p)}if(l0&&l.trim())l=e1(l);if(!G0)try{let{hasUserImports:p,bundleClientScript:_0}=await Promise.resolve().then(() => (U$(),q$));if(p(l))l=await _0(l,L,{projectRoot:process.cwd()})}catch(p){if(J.debug)console.warn(`[stx] bundler skipped for ${L}:`,p instanceof Error?p.message:p)}let o0=ZB(l);if(o0&&!G0){y=`stx_scope_${B0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++KJ}`;let p=g0(l),_0=YB(p,y);P+=`${A0}<script data-stx-scoped data-stx-run="always">${_0}</script>
2016
+ `;continue}if(G0)try{let{extractVariables:p}=await Promise.resolve().then(() => (u5(),x4));await p(l,T,L)}catch(p){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,p)}if(!G0&&!o0){let p=m.replace(/\bclient\b/i,"").trim();y=`stx_scope_${B0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++KJ}`;let _0=g0(l),p0=UJ(_0,y),N1=qJ(_0,p0);P+=`${A0}<script data-stx-scoped data-stx-run="always"${p?` ${p}`:""}>${N1}</script>
2017
2017
  `}}if(y){let x=JB(R,y);if(R=x.html,x.mergedIntoExisting)P=P.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),y=x.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await S6(R,T,L,J,X,Q);let{processLoops:S}=await Promise.resolve().then(() => (k6(),GJ)),C=S(R,T,L);if(C=X5(C,T,L),C=S1(C,T,L),I)C+=`
2018
2018
  `+I;if(P)C+=`
2019
- `+P;return C}catch(w){let R=w instanceof Error?w.message:String(w);return U0("Include",`Error processing include ${B}: ${R}`,Y,O,F)}}let j=/@include\s*\(/g,H;while((H=j.exec(K))!==null){let B=H.index,_=B+H[0].length-1,O=1,F=_+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let L=K.substring(B,F),V=K.substring(_+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=F;continue}let R=w[1],A,M=V.substring(w[0].length),N=b6(M,0);if(N!==-1)A=M.substring(N+1).trim();let I={};if(A)try{I=L0(A,Z)}catch(k){let D=k instanceof Error?k.message:String(k);K=K.replace(L,U0("Include",`Error parsing include variables for ${R}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let T=await z(R,I,$,B);K=K.substring(0,B)+T+K.substring(F),j.lastIndex=0}return K}function y6($,Z){let Y=$;function J(X,Q,G,K){let W=X,q=!0;while(q){q=!1;let U=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=W.match(U);if(!z||z.index===void 0)break;let j=z.index,H=z[1],B=j+z[0].length,_=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),F=1,L=B,V=-1;while(F>0&&L<W.length){let R=W.slice(L),A=R.match(_),M=R.match(O),N=A?L+A.index:1/0,I=M?L+M.index:1/0;if(N<I)F++,L=N+(A[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}L=I+G.length+1}else break}if(V===-1)break;let w=W.slice(B,V);if(!Z[H])Z[H]=[];if(K)Z[H].unshift(w);else Z[H].push(w);W=W.substring(0,j)+W.substring(V+`@${G}`.length),q=!0}return W}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function P6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
2020
- `)})}var KJ=0,DM,XB;var zJ=b(()=>{N4();L4();G1();X1();E5();V0();M0();DM=new Z5(500),XB=new Set});import*as C6 from"path";async function jJ($,Z,Y=""){if(C6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return HJ($,Z,Y,"@js","@endjs")}async function BJ($,Z,Y=""){if(C6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return HJ($,Z,Y,"@ts","@endts")}async function HJ($,Z,Y,J,X){let Q=$,G=D5(`${J}([\\s\\S]*?)${X}`,"g"),K=[],W;while((W=G.exec($))!==null)K.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:q,content:U,index:z}of K)try{let j={...Z,global:Z},H=Object.keys(j),B=Object.values(j),_=U.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let F=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",V=`
2019
+ `+P;return C}catch(w){let R=w instanceof Error?w.message:String(w);return z0("Include",`Error processing include ${B}: ${R}`,Y,O,F)}}let j=/@include\s*\(/g,H;while((H=j.exec(K))!==null){let B=H.index,_=B+H[0].length-1,O=1,F=_+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let L=K.substring(B,F),V=K.substring(_+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=F;continue}let R=w[1],A,M=V.substring(w[0].length),N=b6(M,0);if(N!==-1)A=M.substring(N+1).trim();let I={};if(A)try{I=L0(A,Z)}catch(k){let D=k instanceof Error?k.message:String(k);K=K.replace(L,z0("Include",`Error parsing include variables for ${R}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let T=await z(R,I,$,B);K=K.substring(0,B)+T+K.substring(F),j.lastIndex=0}return K}function y6($,Z){let Y=$;function J(X,Q,G,K){let W=X,q=!0;while(q){q=!1;let U=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=W.match(U);if(!z||z.index===void 0)break;let j=z.index,H=z[1],B=j+z[0].length,_=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),F=1,L=B,V=-1;while(F>0&&L<W.length){let R=W.slice(L),A=R.match(_),M=R.match(O),N=A?L+A.index:1/0,I=M?L+M.index:1/0;if(N<I)F++,L=N+(A[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}L=I+G.length+1}else break}if(V===-1)break;let w=W.slice(B,V);if(!Z[H])Z[H]=[];if(K)Z[H].unshift(w);else Z[H].push(w);W=W.substring(0,j)+W.substring(V+`@${G}`.length),q=!0}return W}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function P6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
2020
+ `)})}var KJ=0,DM,XB;var zJ=b(()=>{N4();L4();K1();Q1();E5();V0();M0();DM=new Z5(500),XB=new Set});import*as C6 from"path";async function jJ($,Z,Y=""){if(C6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return HJ($,Z,Y,"@js","@endjs")}async function BJ($,Z,Y=""){if(C6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return HJ($,Z,Y,"@ts","@endts")}async function HJ($,Z,Y,J,X){let Q=$,G=D5(`${J}([\\s\\S]*?)${X}`,"g"),K=[],W;while((W=G.exec($))!==null)K.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:q,content:U,index:z}of K)try{let j={...Z,global:Z},H=Object.keys(j),B=Object.values(j),_=U.trim();if(J==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let F=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",V=`
2021
2021
  ${_}
2022
2022
  ${L}
2023
- `,R=Function(...H,V)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(q,"")}catch(j){console.error(`Error executing ${J} code block in ${Y}:`,j);let H=j instanceof Error?j.message:String(j),B=U0(`${J} Directive`,`Error executing code: ${H}`,Y,$,z,q);console.error(B),Q=Q.replace(q,"")}return Q}var _J=b(()=>{E5();M0()});function GB($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function OJ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return GB(J,Q||"_method")})}async function FJ($,Z,Y,J,X){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((K)=>K.timing===X);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,J);if(typeof W==="string")Q=W;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(J.debug)console.error(`Error in middleware ${K.name}:`,W);if(J.debug){let q=U0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
2024
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${a0(q)}</div>
2025
- `)}}}return Q}async function LJ($,Z,Y,J){return FJ($,Z,Y,J,"before")}async function VJ($,Z,Y,J){return FJ($,Z,Y,J,"after")}var wJ=b(()=>{G1();M0()});import{defineRoute as uM,defineRoutes as mM,resetRoutes as dM,route as lM,setAppUrl as pM}from"stx-router";import{route as KB}from"stx-router";function RJ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?L0(X,{}):{};return KB(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var AJ=b(()=>{V0()});function MJ($,Z,Y,J){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,q)=>{if(!q&&W.includes(":")){let U=W.split(":"),z=W,j=U.length>1?U[1]:"";if(j&&Z[j])q=Z[j];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])q=Z.openGraph[U[1]];else q="";return q?`<meta property="${c(z)}" content="${c(q)}">`:""}return q?`<meta name="${c(W)}" content="${c(q)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,W=K+G[0].length-1,q=1,U=W+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")"){if(q--,q===0)break}U++}if(q!==0)break;let z=X.substring(W+1,U).trim(),j=U+1,H=(()=>{try{let B=L0(z,Z);if(!B)return"";let _="<meta";if(B.name)_+=` name="${c(String(B.name))}"`;if(B.property)_+=` property="${c(String(B.property))}"`;if(B.httpEquiv)_+=` http-equiv="${c(String(B.httpEquiv))}"`;if(B.content)_+=` content="${c(String(B.content))}"`;return _+=">",_}catch(B){let _=B instanceof Error?B.message:String(B);return Z0("MetaTag",_,o.EVALUATION_ERROR)}})();X=X.substring(0,K)+H+X.substring(j),Q.lastIndex=0}return X}function NJ($,Z,Y){let J=$,X=/@structuredData\s*\(/g,Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")"){if(W--,W===0)break}q++}if(W!==0)break;let U=J.substring(K+1,q).trim(),z=q+1,j=(()=>{try{let H=L0(U,Z);if(!H)return"";if(!H["@context"])H["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(H).replace(/<\//g,"<\\/")}</script>`}catch(H){let B=H instanceof Error?H.message:String(H);return Z0("StructuredData",B,o.EVALUATION_ERROR)}})();J=J.substring(0,G)+j+J.substring(z),X.lastIndex=0}return J}function TJ($,Z,Y,J){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),W=1,q=K+1,U=null,z=!1;while(q<X.length&&W>0){let F=X[q];if(z){z=!1,q++;continue}if(F==="\\"&&U){z=!0,q++;continue}if(U){if(F===U)U=null;q++;continue}if(F==='"'||F==="'"||F==="`"){U=F,q++;continue}if(F==="{")W++;else if(F==="}")W--;q++}if(W!==0)break;let j=X.substring(q).match(/^\s*\)/);if(!j)break;let H=q+j[0].length,B=X.substring(K,q),_=X.substring(G.index,H),O=((F)=>{try{let L=L0(F,Z);if(!L)return"";let V="";if(L.title)V+=`<title>${c(L.title)}</title>
2023
+ `,R=Function(...H,V)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(q,"")}catch(j){console.error(`Error executing ${J} code block in ${Y}:`,j);let H=j instanceof Error?j.message:String(j),B=z0(`${J} Directive`,`Error executing code: ${H}`,Y,$,z,q);console.error(B),Q=Q.replace(q,"")}return Q}var _J=b(()=>{E5();M0()});function GB($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function OJ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return GB(J,Q||"_method")})}async function FJ($,Z,Y,J,X){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((K)=>K.timing===X);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,J);if(typeof W==="string")Q=W;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(J.debug)console.error(`Error in middleware ${K.name}:`,W);if(J.debug){let q=z0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
2024
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${t0(q)}</div>
2025
+ `)}}}return Q}async function LJ($,Z,Y,J){return FJ($,Z,Y,J,"before")}async function VJ($,Z,Y,J){return FJ($,Z,Y,J,"after")}var wJ=b(()=>{K1();M0()});import{defineRoute as uM,defineRoutes as mM,resetRoutes as dM,route as lM,setAppUrl as pM}from"stx-router";import{route as KB}from"stx-router";function RJ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?L0(X,{}):{};return KB(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var AJ=b(()=>{V0()});function MJ($,Z,Y,J){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,q)=>{if(!q&&W.includes(":")){let U=W.split(":"),z=W,j=U.length>1?U[1]:"";if(j&&Z[j])q=Z[j];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])q=Z.openGraph[U[1]];else q="";return q?`<meta property="${c(z)}" content="${c(q)}">`:""}return q?`<meta name="${c(W)}" content="${c(q)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,W=K+G[0].length-1,q=1,U=W+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")"){if(q--,q===0)break}U++}if(q!==0)break;let z=X.substring(W+1,U).trim(),j=U+1,H=(()=>{try{let B=L0(z,Z);if(!B)return"";let _="<meta";if(B.name)_+=` name="${c(String(B.name))}"`;if(B.property)_+=` property="${c(String(B.property))}"`;if(B.httpEquiv)_+=` http-equiv="${c(String(B.httpEquiv))}"`;if(B.content)_+=` content="${c(String(B.content))}"`;return _+=">",_}catch(B){let _=B instanceof Error?B.message:String(B);return Z0("MetaTag",_,o.EVALUATION_ERROR)}})();X=X.substring(0,K)+H+X.substring(j),Q.lastIndex=0}return X}function NJ($,Z,Y){let J=$,X=/@structuredData\s*\(/g,Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")"){if(W--,W===0)break}q++}if(W!==0)break;let U=J.substring(K+1,q).trim(),z=q+1,j=(()=>{try{let H=L0(U,Z);if(!H)return"";if(!H["@context"])H["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(H).replace(/<\//g,"<\\/")}</script>`}catch(H){let B=H instanceof Error?H.message:String(H);return Z0("StructuredData",B,o.EVALUATION_ERROR)}})();J=J.substring(0,G)+j+J.substring(z),X.lastIndex=0}return J}function TJ($,Z,Y,J){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),W=1,q=K+1,U=null,z=!1;while(q<X.length&&W>0){let F=X[q];if(z){z=!1,q++;continue}if(F==="\\"&&U){z=!0,q++;continue}if(U){if(F===U)U=null;q++;continue}if(F==='"'||F==="'"||F==="`"){U=F,q++;continue}if(F==="{")W++;else if(F==="}")W--;q++}if(W!==0)break;let j=X.substring(q).match(/^\s*\)/);if(!j)break;let H=q+j[0].length,B=X.substring(K,q),_=X.substring(G.index,H),O=((F)=>{try{let L=L0(F,Z);if(!L)return"";let V="";if(L.title)V+=`<title>${c(L.title)}</title>
2026
2026
  `,V+=`<meta name="title" content="${c(L.title)}">
2027
2027
  `;if(L.description)V+=`<meta name="description" content="${c(L.description)}">
2028
2028
  `;if(L.keywords){let w=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;V+=`<meta name="keywords" content="${c(w)}">
@@ -2060,13 +2060,13 @@ ${WJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
2060
2060
  `;let U=$;if(!Q)U=U.replace(/<head[^>]*>/,`$&
2061
2061
  <title>${c(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
2062
2062
  ${q}
2063
- `)}function c($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var DJ,EJ;var v6=b(()=>{V1();V0();DJ={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return Z0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${c(X)}" content="${c(Q)}">`},hasEndTag:!1},EJ={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return Z0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let X=JSON.parse($);if(!X["@context"])X["@context"]="https://schema.org";if(!X["@type"])return Z0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(X)}</script>`}catch(X){let Q=X instanceof Error?X.message:String(X);return Z0("StructuredData",Q,o.EVALUATION_ERROR)}},hasEndTag:!0}});async function kJ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(S$.exact[$])for(let J of S$.exact[$])await Promise.resolve(J(Z,$));if(S$.exact[Y])for(let J of S$.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of S$.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var S$;var bJ=b(()=>{S$={patterns:[],exact:{}}});function SJ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>SJ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function yJ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(q){return X.some(([U,z])=>q>=U&&q<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let q=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,H=U,B=!1;while((j=z.exec(U))!==null){let _=j[1],O=j[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let F=Object.keys(Z),L=Object.values(Z),V=O.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${O})`)(...L);if(_==="class"){let A=SJ(R);if(A){let M=H.match(/\sclass="([^"]*)"/);if(M)H=H.replace(M[0],` class="${M[1]} ${A}"`);else H=H.replace(j[0],` class="${A}"`)}else H=H.replace(j[0],"");B=!0;continue}if(WB.has(_)){if(R)H=H.replace(j[0],` ${_}`);else H=H.replace(j[0],"");B=!0;continue}if(R===null||R===void 0||R===!1)H=H.replace(j[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");H=H.replace(j[0],` ${_}="${A}"`)}B=!0}catch{continue}}if(B){let _=q.endsWith("/>")?" /":"",F=`<${Q[1]}${H}${_}>`;W.push({start:Q.index,end:Q.index+q.length,replacement:F})}}for(let q=W.length-1;q>=0;q--){let{start:U,end:z,replacement:j}=W[q];Y=Y.slice(0,U)+j+Y.slice(z)}return Y}var WB;var PJ=b(()=>{WB=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function U5($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;let X=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&qB.has(J[1]),Q=X?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:X,start:J.index,end:J.index+J[0].length}}function zB($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)J++,X=K.index+K[0].length;else{if(J--,J===0)return W.index+W[0].length;X=W.index+W[0].length}}return-1}function W1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=zB($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function CJ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function m5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function g1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function h1($,Z,Y){let J=Z.selfClosing?" /":"",X=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function jB($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function BB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-for");if(X===null){Y=J.end;continue}let Q=X.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=J.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let O=G.split(",").map((V)=>V.trim()),F=O[0],L=O[1];W=`${K} as ${L} => ${F}`}else W=`${K} as ${G}`;let q=g1(J.attrs,"v-for"),U=g1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=W1(Z,J),j=Z.slice(z.outerStart,z.outerEnd),H=h1(j,{...J,start:0,end:J.end-J.start},U),B=`@foreach(${W})
2063
+ `)}function c($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var DJ,EJ;var v6=b(()=>{V1();V0();DJ={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return Z0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${c(X)}" content="${c(Q)}">`},hasEndTag:!1},EJ={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return Z0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let X=JSON.parse($);if(!X["@context"])X["@context"]="https://schema.org";if(!X["@type"])return Z0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(X)}</script>`}catch(X){let Q=X instanceof Error?X.message:String(X);return Z0("StructuredData",Q,o.EVALUATION_ERROR)}},hasEndTag:!0}});async function kJ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(S$.exact[$])for(let J of S$.exact[$])await Promise.resolve(J(Z,$));if(S$.exact[Y])for(let J of S$.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of S$.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var S$;var bJ=b(()=>{S$={patterns:[],exact:{}}});function SJ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>SJ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function yJ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(q){return X.some(([U,z])=>q>=U&&q<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let q=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,H=U,B=!1;while((j=z.exec(U))!==null){let _=j[1],O=j[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let F=Object.keys(Z),L=Object.values(Z),V=O.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${O})`)(...L);if(_==="class"){let A=SJ(R);if(A){let M=H.match(/\sclass="([^"]*)"/);if(M)H=H.replace(M[0],` class="${M[1]} ${A}"`);else H=H.replace(j[0],` class="${A}"`)}else H=H.replace(j[0],"");B=!0;continue}if(WB.has(_)){if(R)H=H.replace(j[0],` ${_}`);else H=H.replace(j[0],"");B=!0;continue}if(R===null||R===void 0||R===!1)H=H.replace(j[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");H=H.replace(j[0],` ${_}="${A}"`)}B=!0}catch{continue}}if(B){let _=q.endsWith("/>")?" /":"",F=`<${Q[1]}${H}${_}>`;W.push({start:Q.index,end:Q.index+q.length,replacement:F})}}for(let q=W.length-1;q>=0;q--){let{start:U,end:z,replacement:j}=W[q];Y=Y.slice(0,U)+j+Y.slice(z)}return Y}var WB;var PJ=b(()=>{WB=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function U5($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;let X=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&qB.has(J[1]),Q=X?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:X,start:J.index,end:J.index+J[0].length}}function zB($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)J++,X=K.index+K[0].length;else{if(J--,J===0)return W.index+W[0].length;X=W.index+W[0].length}}return-1}function q1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=zB($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function CJ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function m5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function g1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function h1($,Z,Y){let J=Z.selfClosing?" /":"",X=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function jB($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function BB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-for");if(X===null){Y=J.end;continue}let Q=X.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=J.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let O=G.split(",").map((V)=>V.trim()),F=O[0],L=O[1];W=`${K} as ${L} => ${F}`}else W=`${K} as ${G}`;let q=g1(J.attrs,"v-for"),U=g1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=q1(Z,J),j=Z.slice(z.outerStart,z.outerEnd),H=h1(j,{...J,start:0,end:J.end-J.start},U),B=`@foreach(${W})
2064
2064
  `,_=`${B}${H}
2065
- @endforeach`;Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+B.length}return Z}function HB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=W1(Z,J),K=g1(J.attrs,"v-if"),W=h1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},K);Q.push({type:"if",expr:X,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:J});let q=G.outerEnd,U=!0;while(U){let _=Z.slice(q).match(/^\s*/),O=_?_[0].length:0,F=U5(Z,q+O);if(!F){U=!1;break}let L=m5(F.attrs,"v-else-if"),V=CJ(F.attrs,"v-else");if(L!==null){let w=W1(Z,F),R=g1(F.attrs,"v-else-if"),A=h1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else-if",expr:L,outerStart:q,outerEnd:w.outerEnd,element:A,parsedTag:F}),q=w.outerEnd}else if(V){let w=W1(Z,F),R=g1(F.attrs,"v-else"),A=h1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:A,parsedTag:F}),U=!1}else U=!1}let z=[];for(let _ of Q)if(_.type==="if")z.push(`@if(${_.expr})
2065
+ @endforeach`;Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+B.length}return Z}function HB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=q1(Z,J),K=g1(J.attrs,"v-if"),W=h1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},K);Q.push({type:"if",expr:X,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:J});let q=G.outerEnd,U=!0;while(U){let _=Z.slice(q).match(/^\s*/),O=_?_[0].length:0,F=U5(Z,q+O);if(!F){U=!1;break}let L=m5(F.attrs,"v-else-if"),V=CJ(F.attrs,"v-else");if(L!==null){let w=q1(Z,F),R=g1(F.attrs,"v-else-if"),A=h1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else-if",expr:L,outerStart:q,outerEnd:w.outerEnd,element:A,parsedTag:F}),q=w.outerEnd}else if(V){let w=q1(Z,F),R=g1(F.attrs,"v-else"),A=h1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:A,parsedTag:F}),U=!1}else U=!1}let z=[];for(let _ of Q)if(_.type==="if")z.push(`@if(${_.expr})
2066
2066
  ${_.element}`);else if(_.type==="else-if")z.push(`@elseif(${_.expr})
2067
2067
  ${_.element}`);else z.push(`@else
2068
2068
  ${_.element}`);z.push("@endif");let j=z.join(`
2069
- `),H=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,H)+j+Z.slice(B),Y=H+j.length}return Z}function _B($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function OB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=X.match(G);while(K){Q=!0;let U=K[1],z=K[2],j=K[3];X=X.replace(K[0],""),X+=` :${U}="${j}" @update:${U}="${j} = $event"`,K=X.match(G)}if(Q){let U=W1(Z,J),z=Z.slice(U.outerStart,U.outerEnd),j=h1(z,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),Y=U.outerStart+j.length;continue}let W=m5(J.attrs,"v-model");if(W===null){Y=J.end;continue}if(UB.has(J.tag)){let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,z=W1(Z,J),j=Z.slice(z.outerStart,z.outerEnd),H=h1(j,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+H.length}else{let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let z=W1(Z,J),j=Z.slice(z.outerStart,z.outerEnd),H=h1(j,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+H.length}}return Z}function FB($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function LB($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function VB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=W1(Z,J),G=g1(J.attrs,"v-html"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{!! ${X} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function wB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=W1(Z,J),G=g1(J.attrs,"v-text"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{{ ${X} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function RB($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function AB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;if(!CJ(J.attrs,"v-once")){Y=J.end;continue}let X=g1(J.attrs,"v-once"),Q=W1(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
2069
+ `),H=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,H)+j+Z.slice(B),Y=H+j.length}return Z}function _B($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function OB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=X.match(G);while(K){Q=!0;let U=K[1],z=K[2],j=K[3];X=X.replace(K[0],""),X+=` :${U}="${j}" @update:${U}="${j} = $event"`,K=X.match(G)}if(Q){let U=q1(Z,J),z=Z.slice(U.outerStart,U.outerEnd),j=h1(z,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),Y=U.outerStart+j.length;continue}let W=m5(J.attrs,"v-model");if(W===null){Y=J.end;continue}if(UB.has(J.tag)){let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,z=q1(Z,J),j=Z.slice(z.outerStart,z.outerEnd),H=h1(j,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+H.length}else{let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let z=q1(Z,J),j=Z.slice(z.outerStart,z.outerEnd),H=h1(j,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+H.length}}return Z}function FB($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function LB($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function VB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=q1(Z,J),G=g1(J.attrs,"v-html"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{!! ${X} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function wB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;let X=m5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=q1(Z,J),G=g1(J.attrs,"v-text"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{{ ${X} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function RB($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function AB($){let Z=$,Y=0;while(Y<Z.length){let J=U5(Z,Y);if(!J)break;if(!CJ(J.attrs,"v-once")){Y=J.end;continue}let X=g1(J.attrs,"v-once"),Q=q1(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
2070
2070
  ${h1(G,{...J,start:0,end:J.end-J.start},X)}
2071
2071
  @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function MB($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function NB($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function vJ($){if(!jB($))return $;let Z=$;return Z=BB(Z),Z=HB(Z),Z=AB(Z),Z=FB(Z),Z=LB(Z),Z=OB(Z),Z=_B(Z),Z=NB(Z),Z=VB(Z),Z=wB(Z),Z=RB(Z),Z=MB(Z),Z}var qB,UB;var xJ=b(()=>{qB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),UB=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function u4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function fJ($,Z){let Y=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=Y?Y[1]:$,X=J0(J,Z);if(X&&typeof X==="string")return X;let Q=J.trim();return x6.has(Q)?Q:null}function gJ($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function hJ($,Z,Y){let J=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),X=J?`<${$} ${J}>`:`<${$}>`;if(TB.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${X}${Y}</${$}>`}async function uJ($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let q=K.length-1;q>=0;q--){let U=K[q];try{let z=fJ(U.expr,Z);if(!z||typeof z!=="string"){let L=`<!-- dynamic component: could not resolve "${u4(gJ(U.expr))}" -->`;Q=Q.slice(0,U.index)+L+Q.slice(U.index+U.full.length);continue}if(x6.has(z)){let L=hJ(z,U.attrs,U.slotContent);Q=Q.slice(0,U.index)+L+Q.slice(U.index+U.full.length);continue}let j=U.attrs.trim(),H={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=B.exec(j))!==null){let L=_[1]||_[2],V=_[3];if(_[1])try{H[L]=J0(V,Z)}catch{H[L]=V}else H[L]=V}let O=J.componentsDir||"components",F=await q5(z,H,U.slotContent,O,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,U.index)+F+Q.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),H=`<!-- dynamic component error: ${u4(j)} -->`;Q=Q.slice(0,U.index)+H+Q.slice(U.index+U.full.length)}}return Q=await IB(Q,Z,Y,J,X),Q}async function IB($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let q=K.length-1;q>=0;q--){let U=K[q];try{let z=fJ(U.expr,Z);if(!z||typeof z!=="string"){let B=`<!-- dynamic component: could not resolve "${u4(gJ(U.expr))}" -->`;Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length);continue}if(x6.has(z)){let B=hJ(z,U.attrs,"");Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length);continue}let j=J.componentsDir||"components",H=await q5(z,{},"",j,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,U.index)+H+Q.slice(U.index+U.full.length)}catch(z){let j=z instanceof Error?z.message:String(z),H=`<!-- dynamic component error: ${u4(j)} -->`;Q=Q.slice(0,U.index)+H+Q.slice(U.index+U.full.length)}}return Q}var x6,TB;var mJ=b(()=>{M0();V0();x6=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),TB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function dJ($,Z=""){let Y=`${$}${Z}`,J=0;for(let X=0;X<Y.length;X++){let Q=Y.charCodeAt(X);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function lJ($,Z,Y={}){let{prefix:J="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=f6($),W=[],q=new Map;if(Q)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let j=z[1],H=`${Z}_${j}`;q.set(j,H)}}for(let U of K){let z=pJ(U,Z,J,X,q,G);W.push(z)}return W.join(`
2072
2072
 
@@ -2074,7 +2074,7 @@ ${h1(G,{...J,start:0,end:J.end-J.start},X)}
2074
2074
  `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(X.trim()){X+=W;let q=X.match(/([^{]+)\{([^}]*)\}/);if(q)Z.push({selector:q[1].trim(),declarations:q[2].trim()});X=""}continue}}if(Q)G+=W;else X+=W}return Z}function pJ($,Z,Y,J,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=f6(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>pJ(j,Z,Y,J,X,Q)).join(`
2075
2075
  `);return`${G} {
2076
2076
  ${z}
2077
- }`}return`${G} { ${K} }`}let W=DB(G,Z,Y,J),q=K;for(let[U,z]of X)q=q.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(Q)q=q.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${q} }`}function DB($,Z,Y,J){let X=$.split(",").map((G)=>G.trim()),Q=[];for(let G of X){if(G.startsWith(":host")){if(J)Q.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(q)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let W=EB(G,Z);if(W)Q.push(Y?`${Y} ${W}`:W)}return Q.join(", ")}function EB($,Z){let Y=0,J=$.length;for(let W=0;W<$.length;W++){let q=$[W];if(q==="["||q==="(")Y++;else if(q==="]"||q===")")Y--;else if(Y===0&&(q===" "||q===">"||q==="+"||q==="~")){J=W;break}}let X=$.slice(0,J),Q=$.slice(J);if(!X)return"";let G=X.length,K=0;for(let W=0;W<X.length;W++){let q=X[W];if(q==="["||q==="(")K++;else if(q==="]"||q===")")K--;else if(Y===0&&K===0&&q===":"){G=W;break}}return`${X.slice(0,G)}.${Z}${X.slice(G)}${Q}`}function iJ($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let J=Y.trim();if(Z.has(J))return"";return Z.add(J),Y})}function m4($,Z){if(!kB.test($))return{html:$,hasScoped:!1};let Y=dJ(Z),J=`data-v-${Y}`,X=$,Q=new RegExp(`<style\\s+([^>]*${g6}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,W,q)=>{G=!0;let U=bB(q,J),z=W.replace(new RegExp(g6,"gi"),"").trim(),j=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${j}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return X=yB(X,J),{html:X,hasScoped:!0}}function bB($,Z){return lJ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function yB($,Z){let Y=Q1($,(X,Q)=>{let G=k1(X,Q);return G>Q?G:T5(X,Q)},(X,Q)=>SB(Q)),J=PB(Y.output,Z);return cJ.lastIndex=0,J.replace(cJ,(X,Q)=>Y.tokens[Number(Q)])}function PB($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,X,Q)=>{if(Y.has(X.toLowerCase()))return J;if(J.includes(Z))return J;if(X.toLowerCase()==="style"||X.toLowerCase()==="script")return J;if(Q)return J.replace(`<${X}${Q}`,`<${X} ${Z}${Q}`);if(J.endsWith("/>"))return`<${X} ${Z} />`;return`<${X} ${Z}>`})}var g6,kB,SB=($)=>`\x00stx-scope-mask-${$}\x00`,cJ;var h6=b(()=>{$5();g6=String.raw`(?<![\w-])scoped(?![\w-])`,kB=new RegExp(`<style\\s+[^>]*${g6}`,"i");cJ=/\u0000stx-scope-mask-(\d+)\u0000/g});function gB($){let Z=$.storageKey??"stx-color-mode",Y=$.initialMode??"auto",J=$.darkClass===void 0?"dark":$.darkClass,X=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!CB.has(Y))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!fB.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(X!==null&&(typeof X!=="string"||!xB.test(X)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(X)}`);if(Q!==null&&!vB.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(J===null&&X===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:Y==="system"?"auto":Y,darkClass:J,attribute:X,autoValue:Q}}function hB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function m6($={}){let Z=gB($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${hB(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function nJ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let Y=u6($);if(Y===null)return $;let J=m6(Z);return`${$.slice(0,Y)}
2077
+ }`}return`${G} { ${K} }`}let W=DB(G,Z,Y,J),q=K;for(let[U,z]of X)q=q.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(Q)q=q.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${q} }`}function DB($,Z,Y,J){let X=$.split(",").map((G)=>G.trim()),Q=[];for(let G of X){if(G.startsWith(":host")){if(J)Q.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(q)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let W=EB(G,Z);if(W)Q.push(Y?`${Y} ${W}`:W)}return Q.join(", ")}function EB($,Z){let Y=0,J=$.length;for(let W=0;W<$.length;W++){let q=$[W];if(q==="["||q==="(")Y++;else if(q==="]"||q===")")Y--;else if(Y===0&&(q===" "||q===">"||q==="+"||q==="~")){J=W;break}}let X=$.slice(0,J),Q=$.slice(J);if(!X)return"";let G=X.length,K=0;for(let W=0;W<X.length;W++){let q=X[W];if(q==="["||q==="(")K++;else if(q==="]"||q===")")K--;else if(Y===0&&K===0&&q===":"){G=W;break}}return`${X.slice(0,G)}.${Z}${X.slice(G)}${Q}`}function iJ($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let J=Y.trim();if(Z.has(J))return"";return Z.add(J),Y})}function m4($,Z){if(!kB.test($))return{html:$,hasScoped:!1};let Y=dJ(Z),J=`data-v-${Y}`,X=$,Q=new RegExp(`<style\\s+([^>]*${g6}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,W,q)=>{G=!0;let U=bB(q,J),z=W.replace(new RegExp(g6,"gi"),"").trim(),j=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${j}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return X=yB(X,J),{html:X,hasScoped:!0}}function bB($,Z){return lJ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function yB($,Z){let Y=G1($,(X,Q)=>{let G=k1(X,Q);return G>Q?G:T5(X,Q)},(X,Q)=>SB(Q)),J=PB(Y.output,Z);return cJ.lastIndex=0,J.replace(cJ,(X,Q)=>Y.tokens[Number(Q)])}function PB($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,X,Q)=>{if(Y.has(X.toLowerCase()))return J;if(J.includes(Z))return J;if(X.toLowerCase()==="style"||X.toLowerCase()==="script")return J;if(Q)return J.replace(`<${X}${Q}`,`<${X} ${Z}${Q}`);if(J.endsWith("/>"))return`<${X} ${Z} />`;return`<${X} ${Z}>`})}var g6,kB,SB=($)=>`\x00stx-scope-mask-${$}\x00`,cJ;var h6=b(()=>{$5();g6=String.raw`(?<![\w-])scoped(?![\w-])`,kB=new RegExp(`<style\\s+[^>]*${g6}`,"i");cJ=/\u0000stx-scope-mask-(\d+)\u0000/g});function gB($){let Z=$.storageKey??"stx-color-mode",Y=$.initialMode??"auto",J=$.darkClass===void 0?"dark":$.darkClass,X=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!CB.has(Y))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!fB.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(X!==null&&(typeof X!=="string"||!xB.test(X)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(X)}`);if(Q!==null&&!vB.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(J===null&&X===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:Y==="system"?"auto":Y,darkClass:J,attribute:X,autoValue:Q}}function hB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function m6($={}){let Z=gB($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${hB(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function nJ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let Y=u6($);if(Y===null)return $;let J=m6(Z);return`${$.slice(0,Y)}
2078
2078
  ${J}${$.slice(Y)}`}function u6($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let Y=Z.index+Z[0].length,J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(Y));if(J)Y+=J[0].length;return Y}function dB($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let Y=Z.index+Z[0].length,J=$.toLowerCase().indexOf("</head>",Y),X=$.slice(Y,J===-1?$.length:J),Q=mB.exec(X);if(!Q||X.slice(0,Q.index).trim()==="")return $;let G=X.slice(0,Q.index)+X.slice(Q.index+Q[0].length);return $.slice(0,Y)+`
2079
2079
  ${Q[0]}`+G+$.slice(Y+X.length)}function sJ($){return lB(dB($))}function lB($){let Z=uB.exec($);if(!Z)return $;let Y=u6($);if(Y===null)return $;if(Z.index<=Y||$.slice(Y,Z.index).trim()==="")return $;let J=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),X=u6(J);if(X===null)return $;return`${J.slice(0,X)}
2080
2080
  ${Z[0]}${J.slice(X)}`}var CB,vB,xB,fB,uB,mB;var d6=b(()=>{CB=new Set(["light","dark","auto","system"]),vB=new Set(["auto","system"]),xB=/^[a-z][\w:-]*$/i,fB=/^[\w-]+$/;uB=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),mB=/<meta\b[^>]*\bcharset\b[^>]*>/i});function pB(){if(l6===null)l6=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return l6}function oJ($,Z=pB()){if($.includes('name="stx-build"'))return $;let Y=/<head\b[^>]*>/i.exec($);if(!Y)return $;let J=Y.index+Y[0].length;return`${$.slice(0,J)}
@@ -2094,7 +2094,7 @@ ${I.join(`
2094
2094
  </body>
2095
2095
  </html>`}function c6($){let Z=0;while(Z<$.length){let Y=$.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let X=Y.match(/^<(script|style)\b[^>]*>/i);if(X){let Q=`</${X[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+X[0].length);if(G===-1)return!1;Z=G+Q.length;continue}return/^<!DOCTYPE\b/i.test(Y)||/^<html[\s>]/i.test(Y)}return!1}function i6($){return c6($)}function ZX($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:X=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),W=[];for(let q of J){let U=p6(q);if(U&&K.includes(U))continue;W.push(` <meta ${d5(q)}>`)}for(let q of X){if(q.href&&K.includes(`href="${q.href}"`))continue;W.push(` <link ${d5(q)}>`)}for(let q of Q)if(q.src){if(K.includes(`src="${q.src}"`))continue;W.push(` <script ${d5(q,(U)=>U==="content")}></script>`)}else if(q.content){if(K.includes(q.content))continue;W.push(` <script>${q.content}</script>`)}if(G&&!K.includes(G))W.push(` ${G}`);if(W.length===0)return $;return`${$.slice(0,Y)}${W.join(`
2096
2096
  `)}
2097
- ${$.slice(Y)}`}function YX($,Z={},Y={}){if(i6($))return $;return sB($,Z,Y)}var rJ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",d4="data-stx-html-attrs",l4="data-stx-html-class",aJ;var JX=b(()=>{d6();aJ=/^[A-Za-z_:][\w:.-]*$/});import{matchRoute as UN,Router as oB}from"stx-router";import{findErrorPage as BN,formatRoutes as HN,generateRouteManifest as _N,generateRouteTypes as ON,matchRoute as FN}from"stx-router";function XX($,Z={}){return new oB($,Z).routes}var QX=()=>{};async function KX($){let Z=$;if(!Z)try{Z=(await u1())?.pagesDir||"pages"}catch{Z="pages"}let Y=Z,J=GX.get(Y);if(J)return J;let X=[];try{X=XX(".",{pagesDir:Y}).map((Q)=>Q.regex.source).filter(Boolean)}catch{X=[]}return GX.set(Y,X),X}var GX;var WX=b(()=>{QX();O1();GX=new Map});function rB($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function qX($){return rB(JSON.stringify($))}function m1($){let Z=$,Y=new Set,J=new Set,X=()=>{if(m0)J.add(m0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),y$)J.forEach((K)=>c4.add(K));else J.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function n4($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,y$)J.forEach((G)=>c4.add(G));else J.forEach((G)=>G())},Q=()=>{if(m0)J.add(m0);if(Y){let G=m0;m0=X,p4.push(X);try{Z=$()}finally{p4.pop(),m0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function s4($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=m0;m0=X,p4.push(X);try{let G=$();Y=typeof G==="function"?G:void 0}finally{p4.pop(),m0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function s6($){if(y$){$();return}y$=!0;try{$()}finally{y$=!1,c4.forEach((Z)=>Z()),c4.clear()}}function o6($){n6.push($)}function r6($){i4.push($)}function aB(){UX(n6,"onMount",i4)}function tB(){UX(i4,"onDestroy")}function UX($,Z,Y){let J=$.splice(0,$.length);for(let X of J)try{let Q=X();if(Y&&typeof Q==="function")Y.push(Q)}catch(Q){console.error(`[stx] ${Z} callback threw:`,Q)}}function eB(){return{mount:n6.length,destroy:i4.length}}function o4($){return typeof $==="function"&&$._isSignal===!0}function r4($){return typeof $==="function"&&$._isDerived===!0}function a6($){if(o4($)||r4($))return $();return $}function a4($){let Z=m0;m0=null;try{return $()}finally{m0=Z}}function $H($,Z){let Y=typeof $==="function"?$:()=>$,J=m1([]),X=n4(()=>J().reduce((K,W)=>Z(K,W.action),Y())),Q=!1;return s4(()=>{if(Y(),!Q){Q=!0;return}if(a4(()=>J().length))J.set([])}),[X,(K,W)=>{let q={action:K};J.set([...J(),q]);let U=()=>{let z=J().filter((j)=>j!==q);if(z.length!==J().length)J.set(z)};if(W&&typeof W.then==="function")Promise.resolve(W).then(U,U);return U}]}var m0=null,p4,y$=!1,c4,n6,i4;var t4=b(()=>{p4=[],c4=new Set,n6=[],i4=[]});var jX={};a(jX,{useOptimistic:()=>$H,untrack:()=>a6,state:()=>m1,runMountCallbacks:()=>aB,runDestroyCallbacks:()=>tB,pendingLifecycleCounts:()=>eB,peek:()=>a4,onMount:()=>o6,onDestroy:()=>r6,isSignal:()=>o4,isDerived:()=>r4,generateSignalsRuntimeDev:()=>t6,generateSignalsRuntime:()=>zX,effect:()=>s4,derived:()=>n4,default:()=>YH,batch:()=>s6});function zX(){let $=ZH(t6());try{let Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return $}}function ZH($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let X=$.indexOf(J,Y);if(X===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,X));let Q=1,G=X+J.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function t6(){return`
2097
+ ${$.slice(Y)}`}function YX($,Z={},Y={}){if(i6($))return $;return sB($,Z,Y)}var rJ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",d4="data-stx-html-attrs",l4="data-stx-html-class",aJ;var JX=b(()=>{d6();aJ=/^[A-Za-z_:][\w:.-]*$/});import{matchRoute as UN,Router as oB}from"stx-router";import{findErrorPage as BN,formatRoutes as HN,generateRouteManifest as _N,generateRouteTypes as ON,matchRoute as FN}from"stx-router";function XX($,Z={}){return new oB($,Z).routes}var QX=()=>{};async function KX($){let Z=$;if(!Z)try{Z=(await u1())?.pagesDir||"pages"}catch{Z="pages"}let Y=Z,J=GX.get(Y);if(J)return J;let X=[];try{X=XX(".",{pagesDir:Y}).map((Q)=>Q.regex.source).filter(Boolean)}catch{X=[]}return GX.set(Y,X),X}var GX;var WX=b(()=>{QX();O1();GX=new Map});function rB($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function qX($){return rB(JSON.stringify($))}function m1($){let Z=$,Y=new Set,J=new Set,X=()=>{if(m0)J.add(m0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),y$)J.forEach((K)=>c4.add(K));else J.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function n4($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,y$)J.forEach((G)=>c4.add(G));else J.forEach((G)=>G())},Q=()=>{if(m0)J.add(m0);if(Y){let G=m0;m0=X,p4.push(X);try{Z=$()}finally{p4.pop(),m0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function s4($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=m0;m0=X,p4.push(X);try{let G=$();Y=typeof G==="function"?G:void 0}finally{p4.pop(),m0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function s6($){if(y$){$();return}y$=!0;try{$()}finally{y$=!1,c4.forEach((Z)=>Z()),c4.clear()}}function o6($){n6.push($)}function r6($){i4.push($)}function aB(){UX(n6,"onMount",i4)}function tB(){UX(i4,"onDestroy")}function UX($,Z,Y){let J=$.splice(0,$.length);for(let X of J)try{let Q=X();if(Y&&typeof Q==="function")Y.push(Q)}catch(Q){console.error(`[stx] ${Z} callback threw:`,Q)}}function eB(){return{mount:n6.length,destroy:i4.length}}function o4($){return typeof $==="function"&&$._isSignal===!0}function r4($){return typeof $==="function"&&$._isDerived===!0}function a6($){if(o4($)||r4($))return $();return $}function a4($){let Z=m0;m0=null;try{return $()}finally{m0=Z}}function $H($,Z){let Y=typeof $==="function"?$:()=>$,J=m1([]),X=n4(()=>J().reduce((K,W)=>Z(K,W.action),Y())),Q=!1;return s4(()=>{if(Y(),!Q){Q=!0;return}if(a4(()=>J().length))J.set([])}),[X,(K,W)=>{let q={action:K};J.set([...J(),q]);let U=()=>{let z=J().filter((j)=>j!==q);if(z.length!==J().length)J.set(z)};if(W&&typeof W.then==="function")Promise.resolve(W).then(U,U);return U}]}var m0=null,p4,y$=!1,c4,n6,i4;var t4=b(()=>{p4=[],c4=new Set,n6=[],i4=[]});var jX={};t(jX,{useOptimistic:()=>$H,untrack:()=>a6,state:()=>m1,runMountCallbacks:()=>aB,runDestroyCallbacks:()=>tB,pendingLifecycleCounts:()=>eB,peek:()=>a4,onMount:()=>o6,onDestroy:()=>r6,isSignal:()=>o4,isDerived:()=>r4,generateSignalsRuntimeDev:()=>t6,generateSignalsRuntime:()=>zX,effect:()=>s4,derived:()=>n4,default:()=>YH,batch:()=>s6});function zX(){let $=ZH(t6());try{let Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return $}}function ZH($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let X=$.indexOf(J,Y);if(X===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,X));let Q=1,G=X+J.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function t6(){return`
2098
2098
  // STX Signals Runtime (Development Build)
2099
2099
  console.log('[stx] signals runtime loading');
2100
2100
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -9855,7 +9855,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9855
9855
  }
9856
9856
  }
9857
9857
  })();
9858
- `}var YH;var BX=b(()=>{t4();X1();t4();YH={state:m1,derived:n4,effect:s4,batch:s6,onMount:o6,onDestroy:r6,isSignal:o4,isDerived:r4,untrack:a6,peek:a4,generateSignalsRuntime:zX,generateSignalsRuntimeDev:t6}});var e6={};a(e6,{templateCache:()=>HX,readFileCached:()=>JH,invalidateFileCacheByDir:()=>QH,invalidateFileCache:()=>XH,hashFilePath:()=>P$,getCachedSignalsRuntime:()=>WH,getCachedRouterScript:()=>qH,clearDevCaches:()=>UH,checkCache:()=>zH,cacheTemplate:()=>jH,__setSignalsGeneratorsForTest:()=>KH});import d1 from"fs";import l5 from"path";async function JH($){let Y;for(let J=0;J<3;J++)try{let Q=(await d1.promises.stat($)).mtime.getTime(),G=z5.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),q=(await d1.promises.stat($)).mtime.getTime();if(q!==Q)continue;return z5.set($,{content:K,mtime:q}),K}catch(X){Y=X;break}throw z5.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function XH($){z5.delete($)}function QH($){for(let Z of z5.keys())if(Z.startsWith($))z5.delete(Z)}function KH($){_X=$}async function WH($=!1){let Z=_X??await Promise.resolve().then(() => (BX(),jX));if($)return Z.generateSignalsRuntimeDev();if(e4===null)e4=Z.generateSignalsRuntime();return e4}async function qH(){if($7===null){let{getRouterScript:$}=await import("stx-router");$7=$()}return $7}function UH(){z5.clear(),FX(),e4=null,GH=null,$7=null}function OX($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function zH($,Z){try{if(!Z.cachePath)return null;let Y=l5.resolve(Z.cachePath),J=l5.join(Y,`${P$($)}.html`),X=l5.join(Y,`${P$($)}.meta.json`);if(!await i(J)||!await i(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==OX(Z))return null;if((await d1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await i(W)){if((await d1.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function jH($,Z,Y,J){try{if(!J.cachePath)return;let X=l5.resolve(J.cachePath);await d1.promises.mkdir(X,{recursive:!0});let Q=l5.join(X,`${P$($)}.html`),G=l5.join(X,`${P$($)}.meta.json`),K=await d1.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:OX(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),HX.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function P$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,BH)}var HX,z5,e4=null,GH=null,_X=null,$7=null,BH=16;var $9=b(()=>{M0();HX=new Map,z5=new Map});function LX($){return $.includes("data-stx-runtime")}function VX($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Y=Z.exec($);Y!==null;Y=Z.exec($)){let J=$.slice(Math.max(0,Y.index-80),Y.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}async function Z7($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
9858
+ `}var YH;var BX=b(()=>{t4();Q1();t4();YH={state:m1,derived:n4,effect:s4,batch:s6,onMount:o6,onDestroy:r6,isSignal:o4,isDerived:r4,untrack:a6,peek:a4,generateSignalsRuntime:zX,generateSignalsRuntimeDev:t6}});var e6={};t(e6,{templateCache:()=>HX,readFileCached:()=>JH,invalidateFileCacheByDir:()=>QH,invalidateFileCache:()=>XH,hashFilePath:()=>P$,getCachedSignalsRuntime:()=>WH,getCachedRouterScript:()=>qH,clearDevCaches:()=>UH,checkCache:()=>zH,cacheTemplate:()=>jH,__setSignalsGeneratorsForTest:()=>KH});import d1 from"fs";import l5 from"path";async function JH($){let Y;for(let J=0;J<3;J++)try{let Q=(await d1.promises.stat($)).mtime.getTime(),G=z5.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),q=(await d1.promises.stat($)).mtime.getTime();if(q!==Q)continue;return z5.set($,{content:K,mtime:q}),K}catch(X){Y=X;break}throw z5.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function XH($){z5.delete($)}function QH($){for(let Z of z5.keys())if(Z.startsWith($))z5.delete(Z)}function KH($){_X=$}async function WH($=!1){let Z=_X??await Promise.resolve().then(() => (BX(),jX));if($)return Z.generateSignalsRuntimeDev();if(e4===null)e4=Z.generateSignalsRuntime();return e4}async function qH(){if($7===null){let{getRouterScript:$}=await import("stx-router");$7=$()}return $7}function UH(){z5.clear(),FX(),e4=null,GH=null,$7=null}function OX($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function zH($,Z){try{if(!Z.cachePath)return null;let Y=l5.resolve(Z.cachePath),J=l5.join(Y,`${P$($)}.html`),X=l5.join(Y,`${P$($)}.meta.json`);if(!await i(J)||!await i(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==OX(Z))return null;if((await d1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await i(W)){if((await d1.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function jH($,Z,Y,J){try{if(!J.cachePath)return;let X=l5.resolve(J.cachePath);await d1.promises.mkdir(X,{recursive:!0});let Q=l5.join(X,`${P$($)}.html`),G=l5.join(X,`${P$($)}.meta.json`),K=await d1.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:OX(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),HX.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function P$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,BH)}var HX,z5,e4=null,GH=null,_X=null,$7=null,BH=16;var $9=b(()=>{M0();HX=new Map,z5=new Map});function LX($){return $.includes("data-stx-runtime")}function VX($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Y=Z.exec($);Y!==null;Y=Z.exec($)){let J=$.slice(Math.max(0,Y.index-80),Y.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}async function Z7($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
9859
9859
  `+$.slice(K);if($.includes("</head>")){let W=$.indexOf("</head>");return $.slice(0,W)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
9860
9860
  `+$.slice(W)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
9861
9861
  `+$}if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
@@ -9867,10 +9867,10 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9867
9867
  `+X+$.slice(K+1)}return X+`
9868
9868
  `+$}async function Z9($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";{let K={};if(Y){if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight}try{let W=await KX(Z?.pagesDir);if(W.length>0)K.ownedRoutes=W}catch{}if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${qX(K)};</script>
9869
9869
  `}let{getCachedRouterScript:X}=await Promise.resolve().then(() => ($9(),e6)),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await X()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
9870
- </body>`+$.slice(G+7)}var Y7=b(()=>{WX();R3()});var G7={};a(G7,{scanScriptTags:()=>IX,rewriteStxImportSpecifiers:()=>bX,processSignals:()=>G9,processScriptSetup:()=>EX,preEvalLiteralReactiveIfs:()=>X9,parseLoopExpression:()=>DX,hasSignalsSyntax:()=>Q7,findMarkupIndexOutsideScripts:()=>X7,extractExports:()=>kX,convertSignalLoopsToAttributes:()=>Q9,convertSignalDirectivesToAttributes:()=>J9});function IX($,Z={}){let Y=[];for(let J of z3($,k1)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let G=X[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=X[0].length,W=J.token.length-Q[0].length;Y.push({fullMatch:J.token,attrs:G,body:J.token.slice(K,W),start:J.start,end:J.end})}return Y}function DX($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=RX(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=RX(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function RX($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let X=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(X)return{itemVar:X[1],indexVar:X[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function Q7($){return n8($)}function _H($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let X=J[1];if(X.startsWith("if"))Y++;else if(X==="endif")Y--;else if(Y===0)return!0}return!1}function OH($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,X;while((X=Y.exec($))!==null){let Q=X[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function FH($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function MX($,Z,Y){if(!$)return!1;let J=FH($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,W;while((W=K.exec(J))!==null){let j=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(AX.has(j))continue;if(Z.has(j))X=!0;else if(Y&&j in Y)Q=!0}let q=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=q.exec(J))!==null){let j=U[1];if(J.slice(0,U.index).trimEnd().endsWith("."))continue;if(AX.has(j)||Y&&j in Y)continue;G=!0}return(X||G)&&!Q}function J7($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,X=$.trim(),Q=X.match(TX);if(Q&&LH(Q[3],Q[1])){let[,G,K,W]=Q;return`<${G}${K}${J}>${W}</${G}>`}return`<template${J}>${X}</template>`}function LH($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,X;while((X=Y.exec($))!==null)if(X[1]){if(J--,J<0)return!1}else J++;return!0}function J9($,Z){let Y=OH($);function J(X){let Q=X,G=/@if\s*\(/g,K,W=[];while((K=G.exec(Q))!==null){let q=K.index,U=q+K[0].length,z=1,j=U;while(j<Q.length&&z>0){if(Q[j]==="(")z++;else if(Q[j]===")")z--;j++}if(z!==0)continue;let H=Q.substring(U,j-1).trim(),B=j,_=1,O=B,F=/@(if\s*\(|endif)/g;F.lastIndex=B;let L;while((L=F.exec(Q))!==null)if(L[1].startsWith("if"))_++;else if(L[1]==="endif"){if(_--,_===0){O=L.index+L[0].length;break}}if(_!==0)continue;let V=Q.substring(B,O-6).trim(),w;if(_H(V)){let R=w$(Q.substring(q,O));if(R.length===0)continue;let A=R[0].branches.filter((I)=>I.type!=="else");if(!(A.length>0&&A.every((I)=>MX(I.condition,Y,Z))))continue;w=R[0].branches.map((I)=>{let T=J(I.content);if(I.type==="elseif")return J7(T,"@else-if",I.condition??"");if(I.type==="else")return J7(T,"@else");return J7(T,"@if",I.condition??"")}).join(`
9870
+ </body>`+$.slice(G+7)}var Y7=b(()=>{WX();R3()});var G7={};t(G7,{scanScriptTags:()=>IX,rewriteStxImportSpecifiers:()=>bX,processSignals:()=>G9,processScriptSetup:()=>EX,preEvalLiteralReactiveIfs:()=>X9,parseLoopExpression:()=>DX,hasSignalsSyntax:()=>Q7,findMarkupIndexOutsideScripts:()=>X7,extractExports:()=>kX,convertSignalLoopsToAttributes:()=>Q9,convertSignalDirectivesToAttributes:()=>J9});function IX($,Z={}){let Y=[];for(let J of z3($,k1)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let G=X[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=X[0].length,W=J.token.length-Q[0].length;Y.push({fullMatch:J.token,attrs:G,body:J.token.slice(K,W),start:J.start,end:J.end})}return Y}function DX($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=RX(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=RX(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function RX($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let X=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(X)return{itemVar:X[1],indexVar:X[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function Q7($){return n8($)}function _H($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let X=J[1];if(X.startsWith("if"))Y++;else if(X==="endif")Y--;else if(Y===0)return!0}return!1}function OH($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,X;while((X=Y.exec($))!==null){let Q=X[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function FH($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function MX($,Z,Y){if(!$)return!1;let J=FH($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,W;while((W=K.exec(J))!==null){let j=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(AX.has(j))continue;if(Z.has(j))X=!0;else if(Y&&j in Y)Q=!0}let q=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=q.exec(J))!==null){let j=U[1];if(J.slice(0,U.index).trimEnd().endsWith("."))continue;if(AX.has(j)||Y&&j in Y)continue;G=!0}return(X||G)&&!Q}function J7($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,X=$.trim(),Q=X.match(TX);if(Q&&LH(Q[3],Q[1])){let[,G,K,W]=Q;return`<${G}${K}${J}>${W}</${G}>`}return`<template${J}>${X}</template>`}function LH($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,X;while((X=Y.exec($))!==null)if(X[1]){if(J--,J<0)return!1}else J++;return!0}function J9($,Z){let Y=OH($);function J(X){let Q=X,G=/@if\s*\(/g,K,W=[];while((K=G.exec(Q))!==null){let q=K.index,U=q+K[0].length,z=1,j=U;while(j<Q.length&&z>0){if(Q[j]==="(")z++;else if(Q[j]===")")z--;j++}if(z!==0)continue;let H=Q.substring(U,j-1).trim(),B=j,_=1,O=B,F=/@(if\s*\(|endif)/g;F.lastIndex=B;let L;while((L=F.exec(Q))!==null)if(L[1].startsWith("if"))_++;else if(L[1]==="endif"){if(_--,_===0){O=L.index+L[0].length;break}}if(_!==0)continue;let V=Q.substring(B,O-6).trim(),w;if(_H(V)){let R=w$(Q.substring(q,O));if(R.length===0)continue;let A=R[0].branches.filter((I)=>I.type!=="else");if(!(A.length>0&&A.every((I)=>MX(I.condition,Y,Z))))continue;w=R[0].branches.map((I)=>{let T=J(I.content);if(I.type==="elseif")return J7(T,"@else-if",I.condition??"");if(I.type==="else")return J7(T,"@else");return J7(T,"@if",I.condition??"")}).join(`
9871
9871
  `)}else{if(!MX(H,Y,Z))continue;w=J7(J(V),"@if",H)}W.push({start:q,end:O,replacement:w}),G.lastIndex=O}for(let q=W.length-1;q>=0;q--){let{start:U,end:z,replacement:j}=W[q];Q=Q.substring(0,U)+j+Q.substring(z)}return Q}return J($)}function VH($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let X=Number(Z);return X!==0&&!Number.isNaN(X)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function wH($,Z,Y,J){if(Y9.has(Y.toLowerCase()))return J;let X=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,W=J;while(W<G){let q=$.indexOf("<",W);if(q===-1)return-1;if(W=q,$.startsWith("<!--",W)){let H=$.indexOf("-->",W+4);if(H===-1)return-1;W=H+3;continue}let U=/^<(script|style)\b/i.exec($.slice(W,W+8));if(U){let H=$.indexOf(">",W);if(H===-1)return-1;if($[H-1]==="/"){W=H+1;continue}let B=Q.indexOf(`</${U[1].toLowerCase()}`,W);if(B===-1)return-1;let _=$.indexOf(">",B);if(_===-1)return-1;W=_+1;continue}if($[W+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!H){W++;continue}if(H[1].toLowerCase()===X){if(K--,W+=H[0].length,K===0)return W;continue}W+=H[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!z){W++;continue}let j=$.indexOf(">",W);if(j===-1)return-1;if(z[1].toLowerCase()===X){let H=$.slice(W,j+1);if(!(/\/\s*>$/.test(H)||Y9.has(X)))K++}W=j+1}return-1}function AH($,Z){let Y=Z,J=$.length;for(;;){while(Y<J&&$[Y]!=="<")Y++;if(Y>=J)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let X=$.indexOf(">",Y);if(X===-1)return!1;let Q=$.slice(Y,X+1);return RH.test(Q)}function X9($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let X=(z)=>Z.some(([j,H])=>z>=j&&z<H),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(X(K.index))continue;let[z,j,H,B,_,O,F]=K,L=VH(_);if(L===void 0)continue;let V=K.index,w=V+z.length,M=!!F||/\/\s*>$/.test(z)||Y9.has(j.toLowerCase())?w:wH($,V,j,w);if(M===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&AH($,M)){Q.lastIndex=w;continue}if(L===!0){let I=`<${j}${H}${O}${F}>`;G.push({start:V,end:w,replacement:I});continue}G.push({start:V,end:M,replacement:""}),Q.lastIndex=M}if(G.length===0)return $;G.sort((z,j)=>z.start-j.start);let W=[],q=-1;for(let z of G){if(z.start<q)continue;W.push(z),q=z.end}let U=$;for(let z=W.length-1;z>=0;z--){let{start:j,end:H,replacement:B}=W[z];U=U.substring(0,j)+B+U.substring(H)}return U}function Q9($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,X,Q=[],G=[];while((X=J.exec(Y))!==null){let K=X[1],W=X.index,q=W+X[0].length,U=1,z=q;while(z<Y.length&&U>0){if(Y[z]==="(")U++;else if(Y[z]===")")U--;z++}if(U!==0)continue;let j=Y.substring(q,z-1).trim(),H=z,B=DX(j),_=K==="for"?"@endfor":"@endforeach",O=1,F=H,L=K==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${K}\\s*\\(|end${K})`,"g");L.lastIndex=H;let V;while((V=L.exec(Y))!==null)if(V[1].startsWith(K))O++;else if(O--,O===0){F=V.index+V[0].length;break}if(O!==0)continue;let w=()=>{let N=[B.itemVar,B.indexVar].filter(Boolean);if(N.length)G.push({start:W,end:F,vars:N})};if(B.iterable){let N=B.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N)){w();continue}let I=N.split(/[.[(]/)[0].trim(),T=Z?I in Z:!1,k=G.some((D)=>W>D.start&&W<D.end&&D.vars.includes(I));if(I&&(T||k)){w();continue}}if(B.style==="as")j=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=Y.substring(H,F-_.length).trim(),A=R.match(TX),M;if(A){let[,N,I,T]=A;M=`<${N}${I} @for="${j}">${T}</${N}>`}else M=`<template @for="${j}">${R}</template>`;Q.push({start:W,end:F,replacement:M})}for(let K=Q.length-1;K>=0;K--){let{start:W,end:q,replacement:U}=Q[K];Y=Y.substring(0,W)+U+Y.substring(q)}return Y}function MH($){let Z=new Set,Y=[],J=0,X=0,Q=$.length,G=(U)=>{let z=J+1;while(z<Q){let j=$[z];if(j==="\\"){z+=2;continue}if(j===U)return z+1;z++}return Q},K=()=>{let U=J+2;while(U<Q&&$[U]!==`
9872
9872
  `)U++;return U},W=()=>{let U=J+2;while(U<Q-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return Q},q=(U)=>{let z=U,j=0;while(z<Q){let H=$[z];if(H==="/"&&$[z+1]==="/"){let B=z+2;while(B<Q&&$[B]!==`
9873
- `)B++;z=B;continue}if(H==="/"&&$[z+1]==="*"){let B=z+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(H==='"'||H==="'"||H==="`"){let B=z+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===H){B++;break}B++}z=B;continue}if(H==="("||H==="["||H==="{"){j++,z++;continue}if(H===")"||H==="]"||H==="}"){j--,z++;continue}if(H===";"&&j===0)return z+1;z++}return Q};while(J<Q){let U=$[J];if(U==="/"&&$[J+1]==="/"){let z=K();Y.push($.slice(J,z)),J=z;continue}if(U==="/"&&$[J+1]==="*"){let z=W();Y.push($.slice(J,z)),J=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(J,z)),J=z;continue}if(U==="{"){X++,Y.push(U),J++;continue}if(U==="}"){X--,Y.push(U),J++;continue}if(X===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let H=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(H){let B=H[2],_=q(J+H[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),J=_;continue}Z.add(B),Y.push($.slice(J,_)),J=_;continue}}}Y.push(U),J++}return Y.join("")}async function EX($,Z,Y){let J=IX($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let O of J){let F=O.body;if(t1(O.attrs))F=e1(F);if(X.test(F))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:F})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${HH++}`,{hasUserImports:K,bundleClientScript:W}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (U$(),q$))),q=[];for(let O=0;O<Q.length;O++){let F=Q[O].content;if(F=M5(F).code,K(F))F=await W(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>bX(w));let L=g0(F);q.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
9873
+ `)B++;z=B;continue}if(H==="/"&&$[z+1]==="*"){let B=z+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(H==='"'||H==="'"||H==="`"){let B=z+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===H){B++;break}B++}z=B;continue}if(H==="("||H==="["||H==="{"){j++,z++;continue}if(H===")"||H==="]"||H==="}"){j--,z++;continue}if(H===";"&&j===0)return z+1;z++}return Q};while(J<Q){let U=$[J];if(U==="/"&&$[J+1]==="/"){let z=K();Y.push($.slice(J,z)),J=z;continue}if(U==="/"&&$[J+1]==="*"){let z=W();Y.push($.slice(J,z)),J=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(J,z)),J=z;continue}if(U==="{"){X++,Y.push(U),J++;continue}if(U==="}"){X--,Y.push(U),J++;continue}if(X===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let H=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(H){let B=H[2],_=q(J+H[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),J=_;continue}Z.add(B),Y.push($.slice(J,_)),J=_;continue}}}Y.push(U),J++}return Y.join("")}async function EX($,Z,Y){let J=IX($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let O of J){let F=O.body;if(t1(O.attrs))F=e1(F);if(X.test(F))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:F})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${HH++}`,{hasUserImports:K,bundleClientScript:W}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (U$(),q$))),q=[];for(let O=0;O<Q.length;O++){let F=Q[O].content;if(F=M5(F).code,K(F))F=await W(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>bX(w));let L=g0(F);q.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
9874
9874
  ${L}`)}let U=q.join(`
9875
9875
 
9876
9876
  `);U=MH(U);let z=kX(U),j=z.split(",").map((O)=>O.trim()).filter(Boolean),H=e$(U,Y),B=`
@@ -9887,13 +9887,13 @@ if(window.stx)window.stx._latestSetup=${G};
9887
9887
  `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},H=()=>{if(X!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let V=B[2];if(!J.has(V))Y.push(V),J.add(V);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let R=w.indexOf(":"),M=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(M&&!J.has(M))Y.push(M),J.add(M)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!J.has(R))Y.push(R),J.add(R)});return}let F=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!J.has(V))Y.push(V),J.add(V);return}let L=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!J.has(V))Y.push(V),J.add(V)}};while(Q<G){if(j())continue;if(Z[Q]==="'"||Z[Q]==='"'){U(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){z(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){W(),K="/";continue}if(Z[Q]==="{"){X++,K="{",Q++;continue}if(Z[Q]==="}"){X--,K="}",Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))H();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function G9($,Z,Y,J){if(!Q7($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await EX(X,Y,J);if(X=Q,X=await Z7(X,Z),G){let U=X7(X,/<\/head>/i),z=U===-1?X7(X,/<body[^>]*>/i):-1;if(U!==-1)X=`${X.slice(0,U)}${G}
9888
9888
  ${X.slice(U)}`;else if(z!==-1){let j=/<body[^>]*>/i.exec(X.slice(z))[0],H=z+j.length;X=`${X.slice(0,H)}
9889
9889
  ${G}${X.slice(H)}`}else X=`${X}
9890
- ${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=W&&/data-stx/.test(W[1]);if(!G&&!q&&W&&!/data-stx-auto/.test(W[1])){let U=/<body[^>]*>/i,z=X7(X,U);if(z!==-1){let j=X.slice(0,z),H=X.slice(z).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+H}}return X}function X7($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],X;while((X=Y.exec($))!==null)J.push([X.index,X.index+X[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let W=G+K.index;if(!J.some(([U,z])=>W>=U&&W<z))return W;G=W+Math.max(K[0].length,1)}return-1}function bX($){let Z=[];for(let Y of $.split(",")){let J=Y.trim();if(!J||J.startsWith("type "))continue;let X=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X&&X[1]!==X[2])Z.push(`${X[2]} = ${X[1]}`)}if(Z.length===0)return NX;return`var ${Z.join(", ")}; ${NX}`}var HH=0,wX=`(?:"[^"]*"|'[^']*'|[^>"'])*`,TX,AX,Y9,RH,NX="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var C$=b(()=>{N5();F4();X1();J3();M0();Y7();$5();X$();TX=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;AX=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"]);Y9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);RH=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import p5 from"path";function SX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function yX($,Z,Y){try{let J;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=p5.join(X,$);if(await Bun.file(G).exists())return G;X=p5.dirname(X)}J=p5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=p5.resolve(Z,$);else J=p5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function PX($,Z,Y){let J=$,X=p5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[q,U,z,j]=G;if(SX(z))continue;let H=await yX(z,X,Z);if(H)try{let B=await Bun.file(H).text();if(Y.add(H),z.endsWith(".ts")||z.endsWith(".tsx")){let O=await Bun.build({entrypoints:[H],target:"browser",minify:!1,define:P0()});if(O.outputs.length>0)B=await O.outputs[0].text()}let _=`<script>
9890
+ ${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=W&&/data-stx/.test(W[1]);if(!G&&!q&&W&&!/data-stx-auto/.test(W[1])){let U=/<body[^>]*>/i,z=X7(X,U);if(z!==-1){let j=X.slice(0,z),H=X.slice(z).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+H}}return X}function X7($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],X;while((X=Y.exec($))!==null)J.push([X.index,X.index+X[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let W=G+K.index;if(!J.some(([U,z])=>W>=U&&W<z))return W;G=W+Math.max(K[0].length,1)}return-1}function bX($){let Z=[];for(let Y of $.split(",")){let J=Y.trim();if(!J||J.startsWith("type "))continue;let X=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X&&X[1]!==X[2])Z.push(`${X[2]} = ${X[1]}`)}if(Z.length===0)return NX;return`var ${Z.join(", ")}; ${NX}`}var HH=0,wX=`(?:"[^"]*"|'[^']*'|[^>"'])*`,TX,AX,Y9,RH,NX="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var C$=b(()=>{N5();F4();Q1();J3();M0();Y7();$5();X$();TX=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;AX=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"]);Y9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);RH=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import p5 from"path";function SX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function yX($,Z,Y){try{let J;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=p5.join(X,$);if(await Bun.file(G).exists())return G;X=p5.dirname(X)}J=p5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=p5.resolve(Z,$);else J=p5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function PX($,Z,Y){let J=$,X=p5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[q,U,z,j]=G;if(SX(z))continue;let H=await yX(z,X,Z);if(H)try{let B=await Bun.file(H).text();if(Y.add(H),z.endsWith(".ts")||z.endsWith(".tsx")){let O=await Bun.build({entrypoints:[H],target:"browser",minify:!1,define:P0()});if(O.outputs.length>0)B=await O.outputs[0].text()}let _=`<script>
9891
9891
  // Source: ${z}
9892
9892
  ${B}
9893
9893
  </script>`;J=J.replace(q,_),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(J))!==null){let[q,U,z,j]=W,H=U+j;if(SX(z))continue;if(/rel=["']stylesheet["']/.test(H)||z.endsWith(".css")){let _=await yX(z,X,Z);if(_)try{let O=await Bun.file(_).text();Y.add(_);let F=`<style>
9894
9894
  /* Source: ${z} */
9895
9895
  ${O}
9896
- </style>`;J=J.replace(q,F),K.lastIndex=0}catch(O){}}}return J}var CX=b(()=>{E1()});function K9($,Z){let Y=$,J=/@json\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,q=null,U=!1;while(W<Y.length&&K>0){let V=Y[W];if(U){U=!1,W++;continue}if(V==="\\"&&q){U=!0,W++;continue}if(q){if(V===q)q=null;W++;continue}if(V==='"'||V==="'"||V==="`"){q=V,W++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}W++}if(K!==0)break;let z=Y.substring(G+1,W).trim(),j=Y.substring(Q,W+1),H=-1,B=0,_=null,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){H=V;break}}let F=H>=0?z.substring(0,H).trim():z,L=H>=0?z.substring(H+1).trim():void 0;try{let V=F.trim(),w;if(K0(V))w=W0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(L==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+A+Y.substring(W+1),J.lastIndex=Q+A.length}catch(V){$1.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),J.lastIndex=Q+j.length}}return Y}function W9($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function vX($){let Z=$,Y=/@memo\s*\(/g,J,X=[];while((J=Y.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let q=Z.slice(G,W-1).trim(),U=W,z=Z.slice(U),j=z.indexOf("@endmemo");if(j===-1)continue;let H=z.slice(0,j),B=U+j+8,_=H.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=_?_[0].length:0,F=H.slice(O),L=H.match(/(\s*)$/),V=L?L[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[M,N,I="",T]=R,k=`<${N}${I} data-stx-memo="${q}"${T}>`;A=H.slice(0,O)+k+w.slice(M.length)+H.slice(O+w.length)}else A=`${H.slice(0,O)}<div data-stx-memo="${q}">${w}</div>${H.slice(O+w.length)}`;X.push({start:Q,end:B,replacement:A}),Y.lastIndex=B}for(let Q=X.length-1;Q>=0;Q--){let G=X[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function q9($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function xX($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,q=!1,U=-1;while(K<$.length){let _=$[K];if(W){if(_==="'")W=!1}else if(q){if(_==='"')q=!1}else if(_==="'")W=!0;else if(_==='"')q=!0;else if(_===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let j=$.slice(U+1),H=j.indexOf("</"),B=H>=0?j.slice(0,H):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))J+=$.slice(X,U)+" x-cloak>",X=U+1}return J+=$.slice(X),J}function fX($){let Z=/<[a-z][\w-]*/gi,Y="",J=0,X;while((X=Z.exec($))!==null){let Q=X.index,G=X[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,_=$.toLowerCase().indexOf(B,Q);if(_!==-1)Z.lastIndex=_+B.length;continue}let K=Q+X[0].length,W=!1,q=!1,U=-1;while(K<$.length){let B=$[K];if(W){if(B==="'")W=!1}else if(q){if(B==='"')q=!1}else if(B==="'")W=!0;else if(B==='"')q=!0;else if(B===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(Q+X[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!NH.test(z))continue;let j=$[U-1]==="/",H=j?U-1:U;Y+=`${$.slice(J,H)} x-cloak${j?" ":""}`,J=H}return Y+=$.slice(J),Y}var NH;var U9=b(()=>{V1();V0();NH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function z9($,Z,Y,J){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],G=[];for(let{pattern:K,message:W,suggestion:q}of TH){if(Q.some((z)=>/\w/.test(z)&&W.includes(z)))continue;K.lastIndex=0;let U=$.match(K);if(U&&U.length>0){let z=$.split(`
9896
+ </style>`;J=J.replace(q,F),K.lastIndex=0}catch(O){}}}return J}var CX=b(()=>{E1()});function K9($,Z){let Y=$,J=/@json\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,q=null,U=!1;while(W<Y.length&&K>0){let V=Y[W];if(U){U=!1,W++;continue}if(V==="\\"&&q){U=!0,W++;continue}if(q){if(V===q)q=null;W++;continue}if(V==='"'||V==="'"||V==="`"){q=V,W++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}W++}if(K!==0)break;let z=Y.substring(G+1,W).trim(),j=Y.substring(Q,W+1),H=-1,B=0,_=null,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){H=V;break}}let F=H>=0?z.substring(0,H).trim():z,L=H>=0?z.substring(H+1).trim():void 0;try{let V=F.trim(),w;if(W0(V))w=q0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(L==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+A+Y.substring(W+1),J.lastIndex=Q+A.length}catch(V){Z1.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),J.lastIndex=Q+j.length}}return Y}function W9($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function vX($){let Z=$,Y=/@memo\s*\(/g,J,X=[];while((J=Y.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let q=Z.slice(G,W-1).trim(),U=W,z=Z.slice(U),j=z.indexOf("@endmemo");if(j===-1)continue;let H=z.slice(0,j),B=U+j+8,_=H.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=_?_[0].length:0,F=H.slice(O),L=H.match(/(\s*)$/),V=L?L[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[M,N,I="",T]=R,k=`<${N}${I} data-stx-memo="${q}"${T}>`;A=H.slice(0,O)+k+w.slice(M.length)+H.slice(O+w.length)}else A=`${H.slice(0,O)}<div data-stx-memo="${q}">${w}</div>${H.slice(O+w.length)}`;X.push({start:Q,end:B,replacement:A}),Y.lastIndex=B}for(let Q=X.length-1;Q>=0;Q--){let G=X[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function q9($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function xX($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,q=!1,U=-1;while(K<$.length){let _=$[K];if(W){if(_==="'")W=!1}else if(q){if(_==='"')q=!1}else if(_==="'")W=!0;else if(_==='"')q=!0;else if(_===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let j=$.slice(U+1),H=j.indexOf("</"),B=H>=0?j.slice(0,H):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))J+=$.slice(X,U)+" x-cloak>",X=U+1}return J+=$.slice(X),J}function fX($){let Z=/<[a-z][\w-]*/gi,Y="",J=0,X;while((X=Z.exec($))!==null){let Q=X.index,G=X[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,_=$.toLowerCase().indexOf(B,Q);if(_!==-1)Z.lastIndex=_+B.length;continue}let K=Q+X[0].length,W=!1,q=!1,U=-1;while(K<$.length){let B=$[K];if(W){if(B==="'")W=!1}else if(q){if(B==='"')q=!1}else if(B==="'")W=!0;else if(B==='"')q=!0;else if(B===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(Q+X[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!NH.test(z))continue;let j=$[U-1]==="/",H=j?U-1:U;Y+=`${$.slice(J,H)} x-cloak${j?" ":""}`,J=H}return Y+=$.slice(J),Y}var NH;var U9=b(()=>{V1();V0();NH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function z9($,Z,Y,J){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],G=[];for(let{pattern:K,message:W,suggestion:q}of TH){if(Q.some((z)=>/\w/.test(z)&&W.includes(z)))continue;K.lastIndex=0;let U=$.match(K);if(U&&U.length>0){let z=$.split(`
9897
9897
  `),j=[];z.forEach((O,F)=>{if(K.lastIndex=0,K.test(O))j.push(F+1)});let H=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",B=j.slice(0,3).map((O)=>` ${O} | ${(z[O-1]??"").trim().slice(0,100)}`).join(`
9898
9898
  `),_=B?`
9899
9899
  ${B}`:"";G.push(` \u2717 ${W}${H}
@@ -9901,15 +9901,15 @@ ${B}`:"";G.push(` \u2717 ${W}${H}
9901
9901
  ${G.join(`
9902
9902
  `)}
9903
9903
  Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(q);else console.warn(q)}}var TH;var j9=b(()=>{TH=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import IH from"fs";function K7($){return[...$].sort().map((Z)=>{try{let Y=IH.statSync(Z);return`${Z}:${Y.size}:${Y.mtimeMs}`}catch{return`${Z}:missing`}}).join(`
9904
- `)}function W7($,Z,Y){let J=$.get(Z);return J!==void 0&&J.signature===Y?J.value:void 0}function q1($,Z,Y,J){return $.set(Z,{signature:Y,value:J}),J}var B9=()=>{};var gX={};a(gX,{getStoreScript:()=>EH,clearStoreCache:()=>kH});import q7 from"path";function DH($,Z){for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Y[1])Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let J of(Y[1]??"").split(",")){let Q=((J.includes(":")?J.split(":").pop():J)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Q))Z.add(Q)}for(let Y of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let J of(Y[1]??"").split(",")){let X=J.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(X))Z.add(X)}}async function EH($){let Z;if($)Z=q7.resolve($);else{let B=await u1();Z=q7.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Y=new Bun.Glob("*.ts"),J=[];try{for await(let B of Y.scan({cwd:Z,absolute:!0})){let _=q7.basename(B,".ts");if(["index","types"].includes(_))continue;if(B.includes(".d.ts"))continue;J.push(B)}}catch{return q1(c5,Z,"",""),null}let X=K7(J),Q=W7(c5,Z,X);if(Q!==void 0)return Q||null;if(J.length===0)return q1(c5,Z,X,""),null;let G=[];for(let B of J){let _=await Bun.file(B).text();G.push({file:B,hasUseStore:/useStore\s*\(/.test(_)})}G.sort((B,_)=>{if(B.hasUseStore===_.hasUseStore)return 0;return B.hasUseStore?1:-1});let K=G.map((B)=>B.file),W=[],q=new Set,U=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()});for(let B of K)try{let _=await Bun.file(B).text(),O=q7.basename(B,".ts");DH(_,q),_=g0(_),_=s$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=U.transformSync(_),W.push(`// Store: ${O}
9905
- ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${B}:`,_)}if(W.length===0)return q1(c5,Z,X,""),null;let z=W.join(`
9904
+ `)}function W7($,Z,Y){let J=$.get(Z);return J!==void 0&&J.signature===Y?J.value:void 0}function U1($,Z,Y,J){return $.set(Z,{signature:Y,value:J}),J}var B9=()=>{};var gX={};t(gX,{getStoreScript:()=>EH,clearStoreCache:()=>kH});import q7 from"path";function DH($,Z){for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Y[1])Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let J of(Y[1]??"").split(",")){let Q=((J.includes(":")?J.split(":").pop():J)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Q))Z.add(Q)}for(let Y of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let J of(Y[1]??"").split(",")){let X=J.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(X))Z.add(X)}}async function EH($){let Z;if($)Z=q7.resolve($);else{let B=await u1();Z=q7.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Y=new Bun.Glob("*.ts"),J=[];try{for await(let B of Y.scan({cwd:Z,absolute:!0})){let _=q7.basename(B,".ts");if(["index","types"].includes(_))continue;if(B.includes(".d.ts"))continue;J.push(B)}}catch{return U1(c5,Z,"",""),null}let X=K7(J),Q=W7(c5,Z,X);if(Q!==void 0)return Q||null;if(J.length===0)return U1(c5,Z,X,""),null;let G=[];for(let B of J){let _=await Bun.file(B).text();G.push({file:B,hasUseStore:/useStore\s*\(/.test(_)})}G.sort((B,_)=>{if(B.hasUseStore===_.hasUseStore)return 0;return B.hasUseStore?1:-1});let K=G.map((B)=>B.file),W=[],q=new Set,U=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()});for(let B of K)try{let _=await Bun.file(B).text(),O=q7.basename(B,".ts");DH(_,q),_=g0(_),_=s$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=U.transformSync(_),W.push(`// Store: ${O}
9905
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${B}:`,_)}if(W.length===0)return U1(c5,Z,X,""),null;let z=W.join(`
9906
9906
 
9907
9907
  `),H=`;(function(){
9908
9908
  var __stx = window.stx || {};
9909
9909
  ${_1.filter((B)=>!q.has(B)&&new RegExp(`\\b${B}\\b`).test(z)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
9910
9910
  `)}
9911
9911
  ${z}
9912
- })();`;return q1(c5,Z,X,H),H}function kH(){c5.clear()}var c5;var hX=b(()=>{O1();E1();X1();B9();c5=new Map});var H9,XT;var uX=b(()=>{H9=["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"],XT=new Set(H9)});var lX={};a(lX,{selectComposableFiles:()=>mX,referencedFrameworkComposables:()=>dX,getFrameworkComposableScript:()=>PH,clearFrameworkComposableCache:()=>SH,__setRuntimeOwnedForTest:()=>CH});import U7 from"path";function SH(){v$.clear()}function mX($){let Z=new Map;for(let Y of $){let J=U7.basename(Y);if(J.endsWith(".d.ts"))continue;let X=J.replace(/\.[jt]s$/,"");if(X==="index")continue;if(X===J)continue;let Q=Z.get(X);if(Q&&!Q.endsWith(".js"))continue;Z.set(X,Y)}return[...Z.values()].sort()}function yH($,Z){let Y=Z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Y}\\b`).test($)}function dX($){if(!$)return[];let Z=$.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,""),Y=[];for(let J of bH){if(_9.has(J))continue;let X=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${X}\\s*\\(`).test(Z))Y.push(J)}return Y.sort()}async function PH($,Z){let Y=dX($);if(Y.length===0)return null;let J=Z??U7.join(import.meta.dir,"composables"),X=`${J}\x00${Y.join(",")}`,Q=v$.get(X);if(Q!==void 0)return Q||null;let G=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),K=new Set(Y),W=[],q=new Set,U=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let _ of B.scan({cwd:J,absolute:!0}))U.push(_)}catch{return v$.set(X,""),null}U=mX(U);for(let B of U){let _;try{_=await Bun.file(B).text()}catch{continue}let O=[];try{O=G.scan(_).exports.filter((F)=>F!=="default")}catch{continue}if(!O.some((F)=>K.has(F)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${U7.basename(B).replace(/\.[jt]s$/,"")}
9912
+ })();`;return U1(c5,Z,X,H),H}function kH(){c5.clear()}var c5;var hX=b(()=>{O1();E1();Q1();B9();c5=new Map});var H9,XT;var uX=b(()=>{H9=["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"],XT=new Set(H9)});var lX={};t(lX,{selectComposableFiles:()=>mX,referencedFrameworkComposables:()=>dX,getFrameworkComposableScript:()=>PH,clearFrameworkComposableCache:()=>SH,__setRuntimeOwnedForTest:()=>CH});import U7 from"path";function SH(){v$.clear()}function mX($){let Z=new Map;for(let Y of $){let J=U7.basename(Y);if(J.endsWith(".d.ts"))continue;let X=J.replace(/\.[jt]s$/,"");if(X==="index")continue;if(X===J)continue;let Q=Z.get(X);if(Q&&!Q.endsWith(".js"))continue;Z.set(X,Y)}return[...Z.values()].sort()}function yH($,Z){let Y=Z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Y}\\b`).test($)}function dX($){if(!$)return[];let Z=$.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,""),Y=[];for(let J of bH){if(_9.has(J))continue;let X=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${X}\\s*\\(`).test(Z))Y.push(J)}return Y.sort()}async function PH($,Z){let Y=dX($);if(Y.length===0)return null;let J=Z??U7.join(import.meta.dir,"composables"),X=`${J}\x00${Y.join(",")}`,Q=v$.get(X);if(Q!==void 0)return Q||null;let G=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),K=new Set(Y),W=[],q=new Set,U=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let _ of B.scan({cwd:J,absolute:!0}))U.push(_)}catch{return v$.set(X,""),null}U=mX(U);for(let B of U){let _;try{_=await Bun.file(B).text()}catch{continue}let O=[];try{O=G.scan(_).exports.filter((F)=>F!=="default")}catch{continue}if(!O.some((F)=>K.has(F)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${U7.basename(B).replace(/\.[jt]s$/,"")}
9913
9913
  ${G.transformSync(_).trim()}`);for(let F of O)q.add(F)}catch(F){console.warn(`[stx] framework composable ${U7.basename(B)} could not be bundled:`,F)}}let z=Y.filter((B)=>!q.has(B)&&!yH($,B));if(z.length>0)console.warn(`[stx] could not bundle ${z.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(W.length===0)return v$.set(X,""),null;let j=[...q].map((B)=>` try { if (!(${JSON.stringify(B)} in __s)) { __s[${JSON.stringify(B)}] = ${B}; if (!(${JSON.stringify(B)} in window)) window[${JSON.stringify(B)}] = ${B}; } } catch (e) {}`).join(`
9914
9914
  `),H=`<script data-stx-framework-composables>
9915
9915
  ;(function(){
@@ -9919,8 +9919,8 @@ ${W.join(`
9919
9919
  `)}
9920
9920
  ${j}
9921
9921
  })();
9922
- </script>`;return v$.set(X,H),H}function CH($){_9.clear();for(let Z of $)_9.add(Z)}var v$,_9,bH;var pX=b(()=>{E1();uX();v$=new Map,_9=new Set,bH=new Set(H9)});var iX={};a(iX,{getComposableScript:()=>gH,clearComposableCache:()=>hH});import x$ from"path";function cX($){let Z=x$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function xH($){if($)return x$.resolve($);let Z=`<default>:${process.cwd()}`,Y=O9.get(Z);if(Y!==void 0)return Y;let J=await fH();if(J!==null)O9.set(Z,J);return J}async function fH(){let $=await u1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return x$.resolve(Z,Y);for(let J of vH){let X=x$.resolve(Z,J);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:X,absolute:!0}))if(!cX(G))return X}catch{}}return null}async function gH($){let Z=await xH($);if(!Z)return null;let Y=[];try{let B=new Bun.Glob("**/*.ts");for await(let _ of B.scan({cwd:Z,absolute:!0})){if(cX(_))continue;Y.push(_)}}catch{return q1(i5,Z,"",""),null}let J=K7(Y),X=W7(i5,Z,J);if(X!==void 0)return X||null;if(Y.length===0)return q1(i5,Z,J,""),null;Y.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),G=[],K=new Set,W=new Set;for(let B of Y)try{let _=await Bun.file(B).text(),O=x$.basename(B,".ts");for(let F of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(F[1])W.add(F[1]);try{for(let F of Q.scan(_).exports)if(F!=="default")K.add(F)}catch{}_=g0(_),_=s$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=Q.transformSync(_),G.push(`// Composable: ${O}
9923
- ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${B}:`,_)}if(G.length===0||K.size===0)return q1(i5,Z,J,""),null;let q=[...K].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
9922
+ </script>`;return v$.set(X,H),H}function CH($){_9.clear();for(let Z of $)_9.add(Z)}var v$,_9,bH;var pX=b(()=>{E1();uX();v$=new Map,_9=new Set,bH=new Set(H9)});var iX={};t(iX,{getComposableScript:()=>gH,clearComposableCache:()=>hH});import x$ from"path";function cX($){let Z=x$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function xH($){if($)return x$.resolve($);let Z=`<default>:${process.cwd()}`,Y=O9.get(Z);if(Y!==void 0)return Y;let J=await fH();if(J!==null)O9.set(Z,J);return J}async function fH(){let $=await u1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return x$.resolve(Z,Y);for(let J of vH){let X=x$.resolve(Z,J);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:X,absolute:!0}))if(!cX(G))return X}catch{}}return null}async function gH($){let Z=await xH($);if(!Z)return null;let Y=[];try{let B=new Bun.Glob("**/*.ts");for await(let _ of B.scan({cwd:Z,absolute:!0})){if(cX(_))continue;Y.push(_)}}catch{return U1(i5,Z,"",""),null}let J=K7(Y),X=W7(i5,Z,J);if(X!==void 0)return X||null;if(Y.length===0)return U1(i5,Z,J,""),null;Y.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}),G=[],K=new Set,W=new Set;for(let B of Y)try{let _=await Bun.file(B).text(),O=x$.basename(B,".ts");for(let F of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(F[1])W.add(F[1]);try{for(let F of Q.scan(_).exports)if(F!=="default")K.add(F)}catch{}_=g0(_),_=s$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=Q.transformSync(_),G.push(`// Composable: ${O}
9923
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${B}:`,_)}if(G.length===0||K.size===0)return U1(i5,Z,J,""),null;let q=[...K].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
9924
9924
  `),U=JSON.stringify([...K]),z=G.join(`
9925
9925
 
9926
9926
  `),H=`;(function(){
@@ -9944,7 +9944,7 @@ ${q}
9944
9944
  }
9945
9945
  window[__n] = __c[__n];
9946
9946
  }
9947
- })();`;return q1(i5,Z,J,H),H}function hH(){i5.clear(),O9.clear()}var i5,O9,vH;var nX=b(()=>{O1();E1();B9();X1();i5=new Map,O9=new Map,vH=["composables","functions"]});var oX={};a(oX,{processDeferDirectives:()=>pH});function uH(){return`stx-defer-${++sX}`}function mH($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function dH($,Z,Y){let{trigger:J,value:X}=mH(Z),Q=Y,G,K,W,q=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(q)G=q[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)W=z[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:J,triggerValue:X,content:Q,placeholder:G,loading:K,error:W}}function lH($,Z){let{trigger:Y,triggerValue:J}=Z,X;switch(Y){case"visible":X=`
9947
+ })();`;return U1(i5,Z,J,H),H}function hH(){i5.clear(),O9.clear()}var i5,O9,vH;var nX=b(()=>{O1();E1();B9();Q1();i5=new Map,O9=new Map,vH=["composables","functions"]});var oX={};t(oX,{processDeferDirectives:()=>pH});function uH(){return`stx-defer-${++sX}`}function mH($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function dH($,Z,Y){let{trigger:J,value:X}=mH(Z),Q=Y,G,K,W,q=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(q)G=q[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)W=z[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:J,triggerValue:X,content:Q,placeholder:G,loading:K,error:W}}function lH($,Z){let{trigger:Y,triggerValue:J}=Z,X;switch(Y){case"visible":X=`
9948
9948
  const observer = new IntersectionObserver((entries) => {
9949
9949
  if (entries[0].isIntersecting) {
9950
9950
  observer.disconnect();
@@ -10025,7 +10025,7 @@ else {
10025
10025
  ${z}
10026
10026
  </div>
10027
10027
  ${H}
10028
- `})}var sX=0;var aX={};a(aX,{processTeleportDirectives:()=>sH,ensureTeleportTargets:()=>oH});function cH(){return`stx-teleport-${++rX}`}function iH($){let Z=$.split(",").map((X)=>X.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let X=1;X<Z.length;X++){let Q=Z[X].match(/disabled:\s*(.+)/);if(Q)J=Q[1].trim()}return{target:Y,disabled:J}}function nH($,Z){return`
10028
+ `})}var sX=0;var aX={};t(aX,{processTeleportDirectives:()=>sH,ensureTeleportTargets:()=>oH});function cH(){return`stx-teleport-${++rX}`}function iH($){let Z=$.split(",").map((X)=>X.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let X=1;X<Z.length;X++){let Q=Z[X].match(/disabled:\s*(.+)/);if(Q)J=Q[1].trim()}return{target:Y,disabled:J}}function nH($,Z){return`
10029
10029
  <script>
10030
10030
  (function() {
10031
10031
  const source = document.getElementById('${$}');
@@ -10093,7 +10093,7 @@ else {
10093
10093
  });
10094
10094
  })();
10095
10095
  </script>
10096
- `}var rX=0;var ZQ={};a(ZQ,{processTransitionDirectives:()=>eH,processTransitionAttributes:()=>J_,performLeave:()=>tH,performEnter:()=>aH,generateTransitionRuntime:()=>Y_,generateTransitionCSS:()=>Z_});function tX($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function rH($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=Z.animationDuration||"0s",X=(Q)=>{let G=Q.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(X(Y),X(J))}function eX($,Z){return new Promise((Y)=>{let J=Z??rH($);if(J===0){Y();return}let X=!1,Q=()=>{if(X)return;X=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,J+50)})}function $Q($){$.offsetHeight}async function aH($,Z={}){let Y=Z.name||"stx",J=tX(Y,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),$Q($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await eX($,X);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function tH($,Z={}){let Y=Z.name||"stx",J=tX(Y,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),$Q($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await eX($,X);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function eH($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(X,Q,G)=>{let K=$_(Q),W=K.name||"stx",q=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
10096
+ `}var rX=0;var ZQ={};t(ZQ,{processTransitionDirectives:()=>eH,processTransitionAttributes:()=>J_,performLeave:()=>tH,performEnter:()=>aH,generateTransitionRuntime:()=>Y_,generateTransitionCSS:()=>Z_});function tX($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function rH($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=Z.animationDuration||"0s",X=(Q)=>{let G=Q.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(X(Y),X(J))}function eX($,Z){return new Promise((Y)=>{let J=Z??rH($);if(J===0){Y();return}let X=!1,Q=()=>{if(X)return;X=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,J+50)})}function $Q($){$.offsetHeight}async function aH($,Z={}){let Y=Z.name||"stx",J=tX(Y,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),$Q($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await eX($,X);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function tH($,Z={}){let Y=Z.name||"stx",J=tX(Y,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),$Q($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await eX($,X);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function eH($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(X,Q,G)=>{let K=$_(Q),W=K.name||"stx",q=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
10097
10097
  <div
10098
10098
  class="stx-transition-wrapper"
10099
10099
  data-transition="${W}"
@@ -10411,7 +10411,7 @@ else {
10411
10411
 
10412
10412
  console.log('[stx] Transition runtime initialized');
10413
10413
  })();
10414
- `}function J_($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var JQ={};a(JQ,{withErrorBoundary:()=>YQ,processErrorBoundaryDirectives:()=>G_,generateErrorBoundaryRuntime:()=>z_,generateErrorBoundaryCSS:()=>U_,createErrorBoundary:()=>q_});function Q_(){return`eb-${++X_}-${Date.now().toString(36)}`}function G_($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q_(),q=K_(Q||"");return W_(W,G.trim(),K.trim(),q)})}function K_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4];switch(X){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function W_($,Z,Y,J){let X=J.logErrors!==!1;return`
10414
+ `}function J_($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var JQ={};t(JQ,{withErrorBoundary:()=>YQ,processErrorBoundaryDirectives:()=>G_,generateErrorBoundaryRuntime:()=>z_,generateErrorBoundaryCSS:()=>U_,createErrorBoundary:()=>q_});function Q_(){return`eb-${++X_}-${Date.now().toString(36)}`}function G_($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q_(),q=K_(Q||"");return W_(W,G.trim(),K.trim(),q)})}function K_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4];switch(X){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function W_($,Z,Y,J){let X=J.logErrors!==!1;return`
10415
10415
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
10416
10416
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
10417
10417
  ${Z}
@@ -10640,7 +10640,7 @@ else {
10640
10640
 
10641
10641
  console.log('[stx] Error boundary runtime initialized');
10642
10642
  })();
10643
- `}var X_=0;var XQ={};a(XQ,{renderSSRSuspense:()=>L_,processSuspenseDirectives:()=>H_,generateSuspenseRuntime:()=>w_,generateSuspenseCSS:()=>V_,createSSRSuspense:()=>F_});function B_(){return`suspense-${++j_}-${Date.now().toString(36)}`}function H_($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let W=B_(),q=__(Q||"");return O_(W,G.trim(),K.trim(),q)})}function __($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function O_($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
10643
+ `}var X_=0;var XQ={};t(XQ,{renderSSRSuspense:()=>L_,processSuspenseDirectives:()=>H_,generateSuspenseRuntime:()=>w_,generateSuspenseCSS:()=>V_,createSSRSuspense:()=>F_});function B_(){return`suspense-${++j_}-${Date.now().toString(36)}`}function H_($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let W=B_(),q=__(Q||"");return O_(W,G.trim(),K.trim(),q)})}function __($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function O_($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
10644
10644
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${Q}" data-status="pending">
10645
10645
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
10646
10646
  ${Y}
@@ -10978,7 +10978,7 @@ else {
10978
10978
 
10979
10979
  console.log('[stx] Suspense runtime initialized');
10980
10980
  })();
10981
- `}var j_=0;var WQ={};a(WQ,{processAsyncDirectives:()=>A_,isAsyncComponent:()=>N_,generateAsyncComponentRuntime:()=>I_,generateAsyncComponentCSS:()=>T_,defineAsyncComponent:()=>M_});function QQ(){return`async-${++R_}-${Date.now().toString(36)}`}function A_($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(J,(G,K,W,q)=>{let U=QQ(),z=GQ(K);return KQ(U,z,W.trim(),q.trim())}),Q=Q.replace(X,(G,K,W)=>{let q=QQ(),U=GQ(K);return KQ(q,U,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function GQ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4],K=J[5];switch(X){case"component":Z.component=Q||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function KQ($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:W}=Z;return`
10981
+ `}var j_=0;var WQ={};t(WQ,{processAsyncDirectives:()=>A_,isAsyncComponent:()=>N_,generateAsyncComponentRuntime:()=>I_,generateAsyncComponentCSS:()=>T_,defineAsyncComponent:()=>M_});function QQ(){return`async-${++R_}-${Date.now().toString(36)}`}function A_($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(J,(G,K,W,q)=>{let U=QQ(),z=GQ(K);return KQ(U,z,W.trim(),q.trim())}),Q=Q.replace(X,(G,K,W)=>{let q=QQ(),U=GQ(K);return KQ(q,U,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function GQ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4],K=J[5];switch(X){case"component":Z.component=Q||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function KQ($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:W}=Z;return`
10982
10982
  <div class="stx-async-component" data-async-id="${$}" data-component="${X}" data-status="pending">
10983
10983
  <div class="stx-async-loading" data-async-loading="${$}">
10984
10984
  ${Y}
@@ -11333,7 +11333,7 @@ catch (error) {
11333
11333
 
11334
11334
  console.log('[stx] Async component runtime initialized');
11335
11335
  })();
11336
- `}var R_=0;var UQ={};a(UQ,{shouldCacheComponent:()=>y_,processKeepAliveDirectives:()=>E_,onDeactivated:()=>x_,onActivated:()=>v_,generateKeepAliveRuntime:()=>C_,generateKeepAliveCSS:()=>P_,createKeepAliveCache:()=>S_});function qQ(){return`keep-alive-${++D_}-${Date.now().toString(36)}`}function E_($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(X,Q,G)=>{let K=qQ(),W=k_(Q||"");return b_(K,G.trim(),W)})}function k_($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=Q;break;case"exclude":Z.exclude=Q;break;case"id":Z.id=Q;break}}return Z}function b_($,Z,Y){let{max:J,include:X,exclude:Q}=Y,G=Y.id||$;return`
11336
+ `}var R_=0;var UQ={};t(UQ,{shouldCacheComponent:()=>y_,processKeepAliveDirectives:()=>E_,onDeactivated:()=>x_,onActivated:()=>v_,generateKeepAliveRuntime:()=>C_,generateKeepAliveCSS:()=>P_,createKeepAliveCache:()=>S_});function qQ(){return`keep-alive-${++D_}-${Date.now().toString(36)}`}function E_($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(X,Q,G)=>{let K=qQ(),W=k_(Q||"");return b_(K,G.trim(),W)})}function k_($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=Q;break;case"exclude":Z.exclude=Q;break;case"id":Z.id=Q;break}}return Z}function b_($,Z,Y){let{max:J,include:X,exclude:Q}=Y,G=Y.id||$;return`
11337
11337
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
11338
11338
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
11339
11339
  ${Z}
@@ -11681,7 +11681,7 @@ else {
11681
11681
 
11682
11682
  console.log('[stx] Keep-alive runtime initialized');
11683
11683
  })();
11684
- `}function v_($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function x_($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var D_=0;var _Q={};a(_Q,{useVirtualList:()=>jQ,processVirtualListDirectives:()=>L9,processVirtualGridDirectives:()=>HQ,processInfiniteListDirectives:()=>BQ,generateVirtualListCSS:()=>zQ,default:()=>f_,createVirtualList:()=>F9});function F9($,Z){let{itemHeight:Y,containerHeight:J,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:W="vertical"}=Z,q=[...$],U=0,z=new Map;function j(){if(G)return H();let A=Math.max(0,Math.floor(U/Y)-X),M=Math.ceil(J/Y),N=Math.min(q.length-1,A+M+X*2);return{startIndex:A,endIndex:N}}function H(){let A=0,M=0,N=q.length-1;for(let I=0;I<q.length;I++){let T=z.get(I)||K;if(A+T>U){M=Math.max(0,I-X);break}A+=T}A=0;for(let I=0;I<q.length;I++){let T=z.get(I)||K;if(A+=T,A>U+J){N=Math.min(q.length-1,I+X);break}}return{startIndex:M,endIndex:N}}function B(){if(G){let A=0;for(let M=0;M<q.length;M++)A+=z.get(M)||K;return A}return q.length*Y}function _(A){if(G){let M=0;for(let N=0;N<A;N++)M+=z.get(N)||K;return M}return A*Y}function O(){let{startIndex:A,endIndex:M}=j();return{startIndex:A,endIndex:M,scrollTop:U,totalHeight:B(),visibleItems:q.slice(A,M+1),itemHeights:new Map(z)}}function F(A,M="auto"){let N=_(A);L(N,M)}function L(A,M="auto"){U=Math.max(0,Math.min(A,B()-J))}function V(){j()}function w(A){q=[...A],z.clear(),V()}function R(){q=[],z.clear()}return{scrollToIndex:F,scrollToOffset:L,getState:O,refresh:V,setItems:w,destroy:R}}function L9($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let L=G.trim(),V=Function(`return ${L}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(U.containerHeight/U.itemHeight),H=U.overscan||3,B=0,_=Math.min(q.length-1,j+H),O="";for(let L=B;L<=_&&L<q.length;L++){let V=q[L],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));O+=`
11684
+ `}function v_($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function x_($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var D_=0;var _Q={};t(_Q,{useVirtualList:()=>jQ,processVirtualListDirectives:()=>L9,processVirtualGridDirectives:()=>HQ,processInfiniteListDirectives:()=>BQ,generateVirtualListCSS:()=>zQ,default:()=>f_,createVirtualList:()=>F9});function F9($,Z){let{itemHeight:Y,containerHeight:J,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:W="vertical"}=Z,q=[...$],U=0,z=new Map;function j(){if(G)return H();let A=Math.max(0,Math.floor(U/Y)-X),M=Math.ceil(J/Y),N=Math.min(q.length-1,A+M+X*2);return{startIndex:A,endIndex:N}}function H(){let A=0,M=0,N=q.length-1;for(let I=0;I<q.length;I++){let T=z.get(I)||K;if(A+T>U){M=Math.max(0,I-X);break}A+=T}A=0;for(let I=0;I<q.length;I++){let T=z.get(I)||K;if(A+=T,A>U+J){N=Math.min(q.length-1,I+X);break}}return{startIndex:M,endIndex:N}}function B(){if(G){let A=0;for(let M=0;M<q.length;M++)A+=z.get(M)||K;return A}return q.length*Y}function _(A){if(G){let M=0;for(let N=0;N<A;N++)M+=z.get(N)||K;return M}return A*Y}function O(){let{startIndex:A,endIndex:M}=j();return{startIndex:A,endIndex:M,scrollTop:U,totalHeight:B(),visibleItems:q.slice(A,M+1),itemHeights:new Map(z)}}function F(A,M="auto"){let N=_(A);L(N,M)}function L(A,M="auto"){U=Math.max(0,Math.min(A,B()-J))}function V(){j()}function w(A){q=[...A],z.clear(),V()}function R(){q=[],z.clear()}return{scrollToIndex:F,scrollToOffset:L,getState:O,refresh:V,setItems:w,destroy:R}}function L9($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let L=G.trim(),V=Function(`return ${L}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(U.containerHeight/U.itemHeight),H=U.overscan||3,B=0,_=Math.min(q.length-1,j+H),O="";for(let L=B;L<=_&&L<q.length;L++){let V=q[L],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));O+=`
11685
11685
  <div class="virtual-item ${U.itemClass||""}"
11686
11686
  style="position: absolute; top: ${L*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
11687
11687
  data-index="${L}">
@@ -12054,7 +12054,7 @@ else {
12054
12054
  stxIslands.initIslands();
12055
12055
  }
12056
12056
  })();
12057
- </script>`}function LQ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function VQ($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var bQ={};a(bQ,{processStaticDirectives:()=>EQ,processPartialHydrationDirectives:()=>RQ,onHydrated:()=>DQ,isHydrated:()=>IQ,hydrateIsland:()=>MQ,hydrateByStrategy:()=>NQ,hydrateAll:()=>TQ,generatePartialHydrationCSS:()=>AQ,generateIslandManifest:()=>kQ,default:()=>c_,createIslandRegistry:()=>wQ});function wQ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function g_($){return`
12057
+ </script>`}function LQ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function VQ($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var bQ={};t(bQ,{processStaticDirectives:()=>EQ,processPartialHydrationDirectives:()=>RQ,onHydrated:()=>DQ,isHydrated:()=>IQ,hydrateIsland:()=>MQ,hydrateByStrategy:()=>NQ,hydrateAll:()=>TQ,generatePartialHydrationCSS:()=>AQ,generateIslandManifest:()=>kQ,default:()=>c_,createIslandRegistry:()=>wQ});function wQ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function g_($){return`
12058
12058
  <script data-hydrate="${$}">
12059
12059
  (function() {
12060
12060
  const island = document.querySelector('[data-island="${$}"]');
@@ -12282,7 +12282,7 @@ else {
12282
12282
  <script type="application/json" id="stx-island-manifest">
12283
12283
  ${JSON.stringify(Z)}
12284
12284
  </script>
12285
- `}var c_;var SQ=b(()=>{c_={processPartialHydrationDirectives:RQ,processStaticDirectives:EQ,generatePartialHydrationCSS:AQ,generateIslandManifest:kQ,createIslandRegistry:wQ,hydrateIsland:MQ,hydrateByStrategy:NQ,hydrateAll:TQ,isHydrated:IQ,onHydrated:DQ}});var dQ={};a(dQ,{watchMultiple:()=>xQ,watchEffect:()=>fQ,watch:()=>vQ,unref:()=>yQ,toRefs:()=>PQ,throttledComputed:()=>mQ,stxWatchMultiple:()=>xQ,stxWatchEffect:()=>fQ,stxWatch:()=>vQ,stxUnref:()=>yQ,stxToRefs:()=>PQ,stxThrottledComputed:()=>mQ,stxShallowRef:()=>CQ,stxRef:()=>s5,stxIsRef:()=>l1,stxDebouncedComputed:()=>uQ,stxComputed:()=>g$,shallowRef:()=>CQ,ref:()=>s5,processWatchDirectives:()=>hQ,processComputedDirectives:()=>gQ,isRef:()=>l1,default:()=>i_,debouncedComputed:()=>uQ,computed:()=>g$});function s5($){let Z=$,Y=new Set,J={get value(){if(U1){let X=f$.get(J);if(!X)X=new Set,f$.set(J,X);X.add(U1)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,Y.forEach((G)=>G(X));let Q=f$.get(J);if(Q)Q.forEach((G)=>G())}},subscribe(X){return Y.add(X),()=>Y.delete(X)},peek(){return Z}};return J}function l1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function yQ($){return l1($)?$.value:$}function PQ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=s5($[Y]);return Z}function CQ($){return s5($)}function g$($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,X=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,W=new Set,q=()=>{if(G=!0,W.size>0){let j=z.value;W.forEach((H)=>H(j))}};function U(){K.clear();let j=U1;U1=q,z7.push(q);try{return Y()}finally{z7.pop(),U1=j}}let z={get value(){if(U1){let j=f$.get(z);if(!j)j=new Set,f$.set(z,j);j.add(U1)}if(G){let j=U();if(!X(Q,j))Q=j;G=!1}return Q},set value(j){if(J)J(j);else console.warn("Computed property is readonly")},subscribe(j){return W.add(j),()=>W.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function vQ($,Z,Y={}){let{immediate:J=!1,deep:X=!1,flush:Q="pre",once:G=!1}=Y,K,W=!0,q=!1,U=()=>{if(l1($))return X?j5($.value):$.value;return $()},z=()=>{if(!W||q)return;let B=U();if(K!==void 0&&Object.is(K,B)&&!X)return;let _=()=>{if(Z(B,K),K=X?j5(B):B,G)H()};if(Q==="sync")_();else if(Q==="post")queueMicrotask(_);else Promise.resolve().then(_)},j=null;if(l1($))j=$.subscribe(()=>z());else j=g$($).subscribe(()=>z());if(J)K=void 0,z();else K=U();let H=()=>{if(W=!1,j)j(),j=null};return H.pause=()=>{q=!0},H.resume=()=>{q=!1},H}function xQ($,Z,Y={}){let{immediate:J=!1,once:X=!1}=Y,Q=$.map((z)=>l1(z)?z.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let z=$.map((j)=>l1(j)?j.value:void 0);if(Z(z,Q),Q=[...z],X)U()},q=$.map((z)=>{if(l1(z))return z.subscribe(()=>W());return()=>{}});if(J)W();let U=()=>{G=!1,q.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function fQ($,Z={}){let{flush:Y="pre"}=Z,J,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(J)J();let W=U1;U1=G,z7.push(G);try{J=$()}finally{z7.pop(),U1=W}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(X=!1,J)J()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function gQ($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(X,Q,G)=>{try{let W=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=W,`<!-- computed: ${Q} = ${W} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function hQ($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(X,Q,G)=>{return`
12285
+ `}var c_;var SQ=b(()=>{c_={processPartialHydrationDirectives:RQ,processStaticDirectives:EQ,generatePartialHydrationCSS:AQ,generateIslandManifest:kQ,createIslandRegistry:wQ,hydrateIsland:MQ,hydrateByStrategy:NQ,hydrateAll:TQ,isHydrated:IQ,onHydrated:DQ}});var dQ={};t(dQ,{watchMultiple:()=>xQ,watchEffect:()=>fQ,watch:()=>vQ,unref:()=>yQ,toRefs:()=>PQ,throttledComputed:()=>mQ,stxWatchMultiple:()=>xQ,stxWatchEffect:()=>fQ,stxWatch:()=>vQ,stxUnref:()=>yQ,stxToRefs:()=>PQ,stxThrottledComputed:()=>mQ,stxShallowRef:()=>CQ,stxRef:()=>s5,stxIsRef:()=>l1,stxDebouncedComputed:()=>uQ,stxComputed:()=>g$,shallowRef:()=>CQ,ref:()=>s5,processWatchDirectives:()=>hQ,processComputedDirectives:()=>gQ,isRef:()=>l1,default:()=>i_,debouncedComputed:()=>uQ,computed:()=>g$});function s5($){let Z=$,Y=new Set,J={get value(){if(z1){let X=f$.get(J);if(!X)X=new Set,f$.set(J,X);X.add(z1)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,Y.forEach((G)=>G(X));let Q=f$.get(J);if(Q)Q.forEach((G)=>G())}},subscribe(X){return Y.add(X),()=>Y.delete(X)},peek(){return Z}};return J}function l1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function yQ($){return l1($)?$.value:$}function PQ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=s5($[Y]);return Z}function CQ($){return s5($)}function g$($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,X=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,W=new Set,q=()=>{if(G=!0,W.size>0){let j=z.value;W.forEach((H)=>H(j))}};function U(){K.clear();let j=z1;z1=q,z7.push(q);try{return Y()}finally{z7.pop(),z1=j}}let z={get value(){if(z1){let j=f$.get(z);if(!j)j=new Set,f$.set(z,j);j.add(z1)}if(G){let j=U();if(!X(Q,j))Q=j;G=!1}return Q},set value(j){if(J)J(j);else console.warn("Computed property is readonly")},subscribe(j){return W.add(j),()=>W.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function vQ($,Z,Y={}){let{immediate:J=!1,deep:X=!1,flush:Q="pre",once:G=!1}=Y,K,W=!0,q=!1,U=()=>{if(l1($))return X?j5($.value):$.value;return $()},z=()=>{if(!W||q)return;let B=U();if(K!==void 0&&Object.is(K,B)&&!X)return;let _=()=>{if(Z(B,K),K=X?j5(B):B,G)H()};if(Q==="sync")_();else if(Q==="post")queueMicrotask(_);else Promise.resolve().then(_)},j=null;if(l1($))j=$.subscribe(()=>z());else j=g$($).subscribe(()=>z());if(J)K=void 0,z();else K=U();let H=()=>{if(W=!1,j)j(),j=null};return H.pause=()=>{q=!0},H.resume=()=>{q=!1},H}function xQ($,Z,Y={}){let{immediate:J=!1,once:X=!1}=Y,Q=$.map((z)=>l1(z)?z.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let z=$.map((j)=>l1(j)?j.value:void 0);if(Z(z,Q),Q=[...z],X)U()},q=$.map((z)=>{if(l1(z))return z.subscribe(()=>W());return()=>{}});if(J)W();let U=()=>{G=!1,q.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function fQ($,Z={}){let{flush:Y="pre"}=Z,J,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(J)J();let W=z1;z1=G,z7.push(G);try{J=$()}finally{z7.pop(),z1=W}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(X=!1,J)J()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function gQ($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(X,Q,G)=>{try{let W=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=W,`<!-- computed: ${Q} = ${W} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function hQ($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(X,Q,G)=>{return`
12286
12286
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
12287
12287
  (function() {
12288
12288
  // Watch implementation for ${Q}
@@ -12294,9 +12294,9 @@ else {
12294
12294
  }
12295
12295
  })();
12296
12296
  </script>
12297
- `})}function j5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>j5(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set(j5(X),j5(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(j5(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=j5($[Y]);return Z}function uQ($,Z=100){let Y=s5($()),J=null,X=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return g$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}function mQ($,Z=100){let Y=s5($()),J=0,X=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return g$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}var U1=null,z7,f$,i_;var lQ=b(()=>{z7=[],f$=new WeakMap;i_={ref:s5,computed:g$,watch:vQ,watchMultiple:xQ,watchEffect:fQ,isRef:l1,unref:yQ,toRefs:PQ,shallowRef:CQ,debouncedComputed:uQ,throttledComputed:mQ,processComputedDirectives:gQ,processWatchDirectives:hQ}});function h$($,Z){let Y={};for(let J of $)Y[J]=m1(Z(J));return new Proxy({},{get:(J,X)=>Y[X]?.(),set:(J,X,Q)=>{if(Y[X])Y[X].set(Q);else Y[X]=m1(Q);return!0},has:(J,X)=>(X in Y),deleteProperty:(J,X)=>{return delete Y[X],!0},ownKeys:()=>Reflect.ownKeys(Y),getOwnPropertyDescriptor:(J,X)=>(X in Y)?{enumerable:!0,configurable:!0,writable:!0,value:Y[X]()}:void 0})}function n_($,Z){let Y={};for(let J of Z)Y[J]=$[J];return Y}function V9($,Z){let Y=Object.keys($),J=h$(Y,(L)=>Z?.[L]??$[L].getDefaultValue()),X=h$(Y,()=>[]),Q=h$(Y,()=>!1),G=h$(Y,()=>!1),K=h$(Y,()=>!1),W=m1(!1);async function q(L){K[L]=!0;let V=await $[L].validate(J[L],J);return X[L]=V,K[L]=!1,V.length===0}async function U(){W.set(!0);let L=await Promise.all(Y.map(q));return W.set(!1),L.every(Boolean)}function z(){for(let L of Y)J[L]=Z?.[L]??$[L].getDefaultValue(),X[L]=[],Q[L]=!1,G[L]=!1}function j(L){for(let V of Y)if(V in L)J[V]=L[V],G[V]=!0}function H(L,V){J[L]=V,G[L]=!0}function B(L,V=!0){if(Q[L]=V,V)q(L)}function _(L){return{value:J[L],errors:X[L],touched:Q[L],dirty:G[L],valid:X[L].length===0,validating:K[L]}}function O(L){return async(V)=>{V?.preventDefault?.();for(let R of Y)Q[R]=!0;if(await U())await L(n_(J,Y))}}return{values:J,errors:X,touched:Q,dirty:G,get isValid(){return Y.every((L)=>X[L].length===0)},get isValidating(){return W()||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>G[L])},validate:U,validateField:q,reset:z,setValues:j,setFieldValue:H,setFieldTouched:B,getFieldState:_,handleSubmit:O}}var pQ;var cQ=b(()=>{t4();pQ=V9});var oQ={};a(oQ,{v:()=>s_,useForm:()=>V9,processHasErrorsDirective:()=>sQ,processFormValidationDirectives:()=>o_,processErrorsDirective:()=>nQ,processErrorDirective:()=>iQ,defineForm:()=>pQ,Validator:()=>o5});class o5{rules=[];defaultValue="";addRule($){let Z=new o5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Y}})}length($,Z,Y){let J=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:J,validate:(X)=>{if(!X)return!0;let Q=String(X).length;return Q>=$&&Q<=Z||J}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Y}})}between($,Z,Y){let J=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:J,validate:(X)=>{if(!X&&X!==0)return!0;let Q=Number(X);return Q>=$&&Q<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,X)=>{if(!X)return!0;return J===X[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return $.includes(J)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),J=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new o5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(X,Q)=>{if(!$(X,Q||{}))return!0;return J.validate(X,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new o5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let X=await J.validate($,Z);if(X!==!0)Y.push(X)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let X=J.validate($,Z);if(X!==!0)Y.push(X)}return Y}}function iQ($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let U of K)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
12297
+ `})}function j5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>j5(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set(j5(X),j5(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(j5(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=j5($[Y]);return Z}function uQ($,Z=100){let Y=s5($()),J=null,X=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return g$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}function mQ($,Z=100){let Y=s5($()),J=0,X=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return g$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}var z1=null,z7,f$,i_;var lQ=b(()=>{z7=[],f$=new WeakMap;i_={ref:s5,computed:g$,watch:vQ,watchMultiple:xQ,watchEffect:fQ,isRef:l1,unref:yQ,toRefs:PQ,shallowRef:CQ,debouncedComputed:uQ,throttledComputed:mQ,processComputedDirectives:gQ,processWatchDirectives:hQ}});function h$($,Z){let Y={};for(let J of $)Y[J]=m1(Z(J));return new Proxy({},{get:(J,X)=>Y[X]?.(),set:(J,X,Q)=>{if(Y[X])Y[X].set(Q);else Y[X]=m1(Q);return!0},has:(J,X)=>(X in Y),deleteProperty:(J,X)=>{return delete Y[X],!0},ownKeys:()=>Reflect.ownKeys(Y),getOwnPropertyDescriptor:(J,X)=>(X in Y)?{enumerable:!0,configurable:!0,writable:!0,value:Y[X]()}:void 0})}function n_($,Z){let Y={};for(let J of Z)Y[J]=$[J];return Y}function V9($,Z){let Y=Object.keys($),J=h$(Y,(L)=>Z?.[L]??$[L].getDefaultValue()),X=h$(Y,()=>[]),Q=h$(Y,()=>!1),G=h$(Y,()=>!1),K=h$(Y,()=>!1),W=m1(!1);async function q(L){K[L]=!0;let V=await $[L].validate(J[L],J);return X[L]=V,K[L]=!1,V.length===0}async function U(){W.set(!0);let L=await Promise.all(Y.map(q));return W.set(!1),L.every(Boolean)}function z(){for(let L of Y)J[L]=Z?.[L]??$[L].getDefaultValue(),X[L]=[],Q[L]=!1,G[L]=!1}function j(L){for(let V of Y)if(V in L)J[V]=L[V],G[V]=!0}function H(L,V){J[L]=V,G[L]=!0}function B(L,V=!0){if(Q[L]=V,V)q(L)}function _(L){return{value:J[L],errors:X[L],touched:Q[L],dirty:G[L],valid:X[L].length===0,validating:K[L]}}function O(L){return async(V)=>{V?.preventDefault?.();for(let R of Y)Q[R]=!0;if(await U())await L(n_(J,Y))}}return{values:J,errors:X,touched:Q,dirty:G,get isValid(){return Y.every((L)=>X[L].length===0)},get isValidating(){return W()||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>G[L])},validate:U,validateField:q,reset:z,setValues:j,setFieldValue:H,setFieldTouched:B,getFieldState:_,handleSubmit:O}}var pQ;var cQ=b(()=>{t4();pQ=V9});var oQ={};t(oQ,{v:()=>s_,useForm:()=>V9,processHasErrorsDirective:()=>sQ,processFormValidationDirectives:()=>o_,processErrorsDirective:()=>nQ,processErrorDirective:()=>iQ,defineForm:()=>pQ,Validator:()=>o5});class o5{rules=[];defaultValue="";addRule($){let Z=new o5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Y}})}length($,Z,Y){let J=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:J,validate:(X)=>{if(!X)return!0;let Q=String(X).length;return Q>=$&&Q<=Z||J}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Y}})}between($,Z,Y){let J=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:J,validate:(X)=>{if(!X&&X!==0)return!0;let Q=Number(X);return Q>=$&&Q<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,X)=>{if(!X)return!0;return J===X[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return $.includes(J)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),J=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new o5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(X,Q)=>{if(!$(X,Q||{}))return!0;return J.validate(X,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new o5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let X=await J.validate($,Z);if(X!==!0)Y.push(X)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let X=J.validate($,Z);if(X!==!0)Y.push(X)}return Y}}function iQ($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let U of K)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
12298
12298
  `)}catch{return""}})}function nQ($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let U of K)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
12299
- `)}catch{return""}})}function sQ($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let U of K)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return G}catch{return""}})}function o_($,Z,Y){let J=$;return J=iQ(J,Z,Y),J=nQ(J,Z,Y),J=sQ(J,Z,Y),J}var s_;var rQ=b(()=>{cQ();s_=new o5});var eQ={};a(eQ,{processXElementDirectives:()=>r_,hasXElementDirectives:()=>tQ,generateXElementRuntime:()=>aQ});function aQ(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
12299
+ `)}catch{return""}})}function sQ($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let U of K)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return G}catch{return""}})}function o_($,Z,Y){let J=$;return J=iQ(J,Z,Y),J=nQ(J,Z,Y),J=sQ(J,Z,Y),J}var s_;var rQ=b(()=>{cQ();s_=new o5});var eQ={};t(eQ,{processXElementDirectives:()=>r_,hasXElementDirectives:()=>tQ,generateXElementRuntime:()=>aQ});function aQ(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
12300
12300
  (function() {
12301
12301
  'use strict';
12302
12302
 
@@ -12582,7 +12582,7 @@ else {
12582
12582
  })();
12583
12583
  </script>`}function tQ($){return/\bx-data(?:\s|=)/.test($)}function r_($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],J=Y.length>0?$.replace(Z,""):$;if(!tQ(J))return J;let X=Y[0]?.trim()||aQ(),Q=J.lastIndexOf("</body>");if(Q!==-1)return J.slice(0,Q)+X+`
12584
12584
  `+J.slice(Q);return J+`
12585
- `+X}var $G={};a($G,{rewriteImagesWithSiblings:()=>e_});import M1 from"path";async function e_($,Z){let Y=Z.formats??t_;if(!Z.publicDir)return $;let J=YO($),X=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let z=K[0],j=z.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(JO(K.index,J))continue;G.push({idx:K.index,length:z.length,src:j[1],raw:z})}if(G.length===0)return $;let W=await Promise.all(G.map(async(z)=>{let j=await $O(z.src,Z.publicDir,Y);return{match:z,sources:j}}));for(let{match:z,sources:j}of W){if(j.length===0)continue;let B=`<picture>${j.map((_)=>`<source type="${_.mime}" srcset="${XO(_.url)}">`).join("")}${z.raw}</picture>`;X.push({start:z.idx,end:z.idx+z.length,replacement:B})}if(X.length===0)return $;let q="",U=0;for(let z of X)q+=$.slice(U,z.start),q+=z.replacement,U=z.end;return q+=$.slice(U),q}async function $O($,Z,Y){if(!ZO($))return[];let J=M1.extname($).toLowerCase();if(!a_.has(J))return[];if(!$.startsWith("/"))return[];let X=M1.join(Z,$.slice(1)),Q=M1.dirname(X),G=M1.basename(X,J),K=M1.resolve(Q),W=M1.resolve(Z);if(!K.startsWith(W))return[];let q=M1.posix.dirname($),U=Y.map(async(j)=>{let H=M1.join(Q,`${G}${j.ext}`);if(!await Bun.file(H).exists())return null;return{url:M1.posix.join(q,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(U)).filter((j)=>j!==null)}function ZO($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function YO($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);return Z}function JO($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function XO($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var a_,t_;var ZG=b(()=>{a_=new Set([".jpg",".jpeg",".png",".gif"]),t_=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var YG=()=>{};function w9($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var JG=b(()=>{YG()});var XG={};a(XG,{injectPwaTags:()=>QO,generateThemeColorMeta:()=>WO,generateSwRegistrationScript:()=>GO,generatePwaTags:()=>j7,generateManifestLink:()=>KO});function j7($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=w9($),Q=`
12585
+ `+X}var $G={};t($G,{rewriteImagesWithSiblings:()=>e_});import M1 from"path";async function e_($,Z){let Y=Z.formats??t_;if(!Z.publicDir)return $;let J=YO($),X=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let z=K[0],j=z.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(JO(K.index,J))continue;G.push({idx:K.index,length:z.length,src:j[1],raw:z})}if(G.length===0)return $;let W=await Promise.all(G.map(async(z)=>{let j=await $O(z.src,Z.publicDir,Y);return{match:z,sources:j}}));for(let{match:z,sources:j}of W){if(j.length===0)continue;let B=`<picture>${j.map((_)=>`<source type="${_.mime}" srcset="${XO(_.url)}">`).join("")}${z.raw}</picture>`;X.push({start:z.idx,end:z.idx+z.length,replacement:B})}if(X.length===0)return $;let q="",U=0;for(let z of X)q+=$.slice(U,z.start),q+=z.replacement,U=z.end;return q+=$.slice(U),q}async function $O($,Z,Y){if(!ZO($))return[];let J=M1.extname($).toLowerCase();if(!a_.has(J))return[];if(!$.startsWith("/"))return[];let X=M1.join(Z,$.slice(1)),Q=M1.dirname(X),G=M1.basename(X,J),K=M1.resolve(Q),W=M1.resolve(Z);if(!K.startsWith(W))return[];let q=M1.posix.dirname($),U=Y.map(async(j)=>{let H=M1.join(Q,`${G}${j.ext}`);if(!await Bun.file(H).exists())return null;return{url:M1.posix.join(q,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(U)).filter((j)=>j!==null)}function ZO($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function YO($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);return Z}function JO($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function XO($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var a_,t_;var ZG=b(()=>{a_=new Set([".jpg",".jpeg",".png",".gif"]),t_=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var YG=()=>{};function w9($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var JG=b(()=>{YG()});var XG={};t(XG,{injectPwaTags:()=>QO,generateThemeColorMeta:()=>WO,generateSwRegistrationScript:()=>GO,generatePwaTags:()=>j7,generateManifestLink:()=>KO});function j7($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=w9($),Q=`
12586
12586
  <!-- stx PWA Meta Tags -->
12587
12587
  <link rel="manifest" href="/manifest.json">
12588
12588
  <meta name="theme-color" content="${R9(Y?.themeColor||"#000000")}">
@@ -12648,38 +12648,38 @@ if ('serviceWorker' in navigator) {
12648
12648
  `+X.slice(Q)}async function w0($,Z,Y,J,X){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=F1($);let Q=!Z.__stxProcessingDepth;if(Q)TZ(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!L$()&&!U4())&&Y&&Y.endsWith(".stx"))r3($,Y);try{return await nZ.timeAsync("template-processing",async()=>{let G=await BO($,Z,Y,J,X);if(Q)G=q9(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},q=(Z.__stx_runtime_head||null)??v3(),U=(Z.__stx_head_raw||"").trim(),z,j=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)z=j[1].trim(),U=U.replace(j[0],"").trim();let H=Z.__sections?.title,B=q.title||z||H,_=!q.title&&(!!z||!!H),O={...K,...B&&{title:B},meta:[...K.meta||[],...q.meta||[]],link:[...K.link||[],...q.link||[]],script:[...K.script||[],...q.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
12649
12649
  `),...q.htmlAttrs&&{htmlAttrs:tJ(K.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...q.bodyAttrs}}},F=i6(G);if(G=YX(G,O,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),F)G=ZX(G,K),G=eJ(G,O.htmlAttrs);let L=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&G.includes("<head")){let R=L[1],A=UO(R);G=G.replace(/<head\b[^>]*>/i,(M)=>`${M}
12650
12650
  <meta name="stx-layout" content="${GG(R)}">
12651
- <meta name="stx-layout-group" content="${GG(A)}">`)}let V=G.match(/function (__stx_setup_\d+_\d+)\(/),w=V?K4(G):null;if(V&&w&&!/\bdata-stx=/.test(w.tag)){G=w3(G,(A,M)=>`<body${M} data-stx="${V[1]}">`);let R=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${V[1]}"`,"i");G=G.replace(R,"$1")}}if(Q){G=$X(G);let K=J.app?.colorMode;if(K)G=nJ(G,K);G=oJ(G),G=jO(G)}if(Q)try{let{getStoreScript:K}=await e("stx/store-loader",()=>Promise.resolve().then(() => (hX(),gX))),W=J.storesDir,q=await K(W);if(q){let U=`<script data-stx-stores>${q}</script>`,z=r5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
12652
- `+U+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:K}=await e("stx/framework-composables",()=>Promise.resolve().then(() => (pX(),lX))),W=await K(G);if(W){let q=r5(G,"data-stx-stores")||r5(G,"data-stx-runtime");if(q)G=G.slice(0,q.end)+`
12653
- `+W+G.slice(q.end)}}catch{}if(Q)try{let{getComposableScript:K}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (nX(),iX))),W=J.composablesDir,q=await K(W);if(q){let U=`<script data-stx-composables>${q}</script>`,z=r5(G,"data-stx-stores")||r5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
12654
- `+U+G.slice(z.end)}}catch{}if(Q)G=sJ(G);if(Q&&Z.__stx_inject_css!==!1)G=await L3(G,void 0,J.buildMode==="serve");if(Q)G=iJ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof H4)throw G;let K=G instanceof Error?G.message:String(G),W=new Y5(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if($1.log(W,{filePath:Y,context:Z}),k3.logDetailedError(W,{filePath:Y,template:$.substring(0,500)}),J.debug)throw W;return D3.createFallbackContent("Template Processing",W)}}async function BO($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!E0.isAbsolute(J.partialsDir)?E0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!E0.isAbsolute(J.componentsDir)?E0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!E0.isAbsolute(J.layoutsDir)?E0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,W=$;await OO(Y,Z),_O(Z,K),W=await b5(()=>LJ(W,Z,Y,K),W,(V)=>{$1.log(V,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${V.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=Q1(W,B$,(V,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);W=q.output;let U=q.tokens,z=(V)=>U.length===0?V:V.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>U[Number(R)]??""),j="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,j),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(V,w)=>{return`{{ ${w} }}`}),W=vJ(W),W=await PX(W,Y,X);let H={};W=y6(W,H);let B={...Z.__sections||{}},_="",O=B2(j2($)),F=/@nolayout\b/.test(W)||O===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let L=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)_=L[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(W))W=`@section('content')
12651
+ <meta name="stx-layout-group" content="${GG(A)}">`)}let V=G.match(/function (__stx_setup_\d+_\d+)\(/),w=V?K4(G):null;if(V&&w&&!/\bdata-stx=/.test(w.tag)){G=w3(G,(A,M)=>`<body${M} data-stx="${V[1]}">`);let R=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${V[1]}"`,"i");G=G.replace(R,"$1")}}if(Q){G=$X(G);let K=J.app?.colorMode;if(K)G=nJ(G,K);G=oJ(G),G=jO(G)}if(Q)try{let{getStoreScript:K}=await $0("stx/store-loader",()=>Promise.resolve().then(() => (hX(),gX))),W=J.storesDir,q=await K(W);if(q){let U=`<script data-stx-stores>${q}</script>`,z=r5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
12652
+ `+U+G.slice(z.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:K}=await $0("stx/framework-composables",()=>Promise.resolve().then(() => (pX(),lX))),W=await K(G);if(W){let q=r5(G,"data-stx-stores")||r5(G,"data-stx-runtime");if(q)G=G.slice(0,q.end)+`
12653
+ `+W+G.slice(q.end)}}catch{}if(Q)try{let{getComposableScript:K}=await $0("stx/composable-loader",()=>Promise.resolve().then(() => (nX(),iX))),W=J.composablesDir,q=await K(W);if(q){let U=`<script data-stx-composables>${q}</script>`,z=r5(G,"data-stx-stores")||r5(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
12654
+ `+U+G.slice(z.end)}}catch{}if(Q)G=sJ(G);if(Q&&Z.__stx_inject_css!==!1)G=await L3(G,void 0,J.buildMode==="serve");if(Q)G=iJ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof H4)throw G;let K=G instanceof Error?G.message:String(G),W=new Y5(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(Z1.log(W,{filePath:Y,context:Z}),k3.logDetailedError(W,{filePath:Y,template:$.substring(0,500)}),J.debug)throw W;return D3.createFallbackContent("Template Processing",W)}}async function BO($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!E0.isAbsolute(J.partialsDir)?E0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!E0.isAbsolute(J.componentsDir)?E0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!E0.isAbsolute(J.layoutsDir)?E0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,W=$;await OO(Y,Z),_O(Z,K),W=await b5(()=>LJ(W,Z,Y,K),W,(V)=>{Z1.log(V,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${V.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=G1(W,B$,(V,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);W=q.output;let U=q.tokens,z=(V)=>U.length===0?V:V.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>U[Number(R)]??""),j="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,j),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(V,w)=>{return`{{ ${w} }}`}),W=vJ(W),W=await PX(W,Y,X);let H={};W=y6(W,H);let B={...Z.__sections||{}},_="",O=B2(j2($)),F=/@nolayout\b/.test(W)||O===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let L=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)_=L[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(W))W=`@section('content')
12655
12655
  ${W.trim()}
12656
12656
  @endsection`}if(!_&&!F&&K.defaultLayout){let V=c6(W),w=/@section\s*\(/.test(W);if(!V||w){let R="",A=E0.dirname(Y),M=K.layoutsDir?E0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let I=E0.join(A,"_layout.stx");if(await i(I)){R=I;break}let T=E0.dirname(A);if(T===A||T.length<M.length)break;A=T}if(R)_=R;else if(K.layoutsDir){let N=E0.isAbsolute(K.layoutsDir)?K.layoutsDir:E0.resolve(process.cwd(),K.layoutsDir),I=E0.join(N,`${K.defaultLayout}.stx`);if(await i(I))_=I}if(_&&!w)W=`@section('content')
12657
12657
  ${W.trim()}
12658
- @endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(V,w,R)=>{return B[w]=R,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(V,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return V;try{let A=J0(R.trim(),Z);if(A===void 0)return V;return B[w]=String(A??""),""}catch{return V}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(V,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",B5);else B[w]=R.trim();return""}),Z.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(V,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=P6(W,H),_){let V=[],w=b1(W),R=Q1(w.output,T5,(A,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(W=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,M,N)=>{let I=M==="SCRIPT"?w.scripts[Number(N)]:R.tokens[Number(N)];if(I)V.push(I);return""}),V.length>0){let A=V.join(`
12658
+ @endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(V,w,R)=>{return B[w]=R,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(V,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return V;try{let A=J0(R.trim(),Z);if(A===void 0)return V;return B[w]=String(A??""),""}catch{return V}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(V,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",B5);else B[w]=R.trim();return""}),Z.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(V,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=P6(W,H),_){let V=[],w=b1(W),R=G1(w.output,T5,(A,M)=>`\x00STX_ORPHAN_STYLE_${M}\x00`);if(W=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,M,N)=>{let I=M==="SCRIPT"?w.scripts[Number(N)]:R.tokens[Number(N)];if(I)V.push(I);return""}),V.length>0){let A=V.join(`
12659
12659
  `);B.content=B.content?`${B.content}
12660
- ${A}`:A,Z.__sections=B}}if(_)try{let V;if(E0.isAbsolute(_))V=_,X.add(_);else V=await b5(()=>A9(_,Y,G,X),null,()=>{throw new Y5(`Failed to resolve layout path: ${_}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!V){let I=[];try{let k=G.layoutsDir;if(k){let D=E0.isAbsolute(k)?k:E0.resolve(process.cwd(),k);I=qO.readdirSync(D).filter((P)=>P.endsWith(".stx")).map((P)=>P.replace(/\.stx$/,"")).sort()}}catch{}let T=`Layout not found: ${_} (referenced from ${Y})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if($1.log(Error(T),{layoutPath:_,filePath:Y,available:I},"error"),console.error(`[stx] ${T}`),G.debug)throw new Y5(T,Y);return W}let w=await b5(()=>Bun.file(V).text(),"",()=>{throw new Y5(`Failed to read layout file: ${V}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${V}`);let I={},T=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(P,y,S)=>{return I[y]=S.trim(),""});for(let[P,y]of Object.entries(I))if(B[P]&&B[P].includes(B5)){let S=B[P].indexOf(B5);B[P]=B[P].slice(0,S)+y+B[P].slice(S+B5.length)}else if(!B[P])B[P]=y;let k={...Z,__sections:B},D=`@layout('${R[1]}')${T}`;return await w0(D,k,V,G,X)}let A=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=y6(A,H),N={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,T,k)=>{return N[T]=k.trim(),`@slot('${T}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(I,T,k)=>{if(B[T]){let D=B[T];if(D.includes(B5)){let P=N[T]||"",y=D.indexOf(B5);D=D.slice(0,y)+P+D.slice(y+B5.length)}return D}return k||""}),M=HO(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=P6(M,H),Z.__originalFilePath=Y,W=await WG(M,Z,V,G,X),W=`<!-- stx-layout: ${_} -->
12661
- ${W}`,z(W)}catch(V){return $1.log(V instanceof Error?V:Error(String(V)),{layoutPath:_,filePath:Y},"error"),`[Error processing layout: ${V instanceof Error?V.message:String(V)}]`}return z(await WG(W,Z,Y,G,X))}function HO($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,X)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function _O($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(Y)&&Q!==void 0)J[X]=Q;$.$env=J}async function OO($,Z){await b5(()=>kJ($,Z),void 0,(Y)=>{$1.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function FO($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (u5(),x4)));await W(G,Z,Y,{preserveExisting:!0})}catch(W){let q=W instanceof Error?W:Error(String(W));$1.log(q,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${q.message}`)}}}async function LO($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await e("stx/expressions",()=>Promise.resolve().then(() => (G1(),pZ)));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return $1.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function WG($,Z,Y,J,X){let Q=$,G=J;if(await FO(Q,Z,Y),Q=await LO(Q,Z,Y),Q=await jJ(Q,Z,Y),Q=await BJ(Q,Z,Y),Q=await d2(Q,Z,Y,G),F1(Q))Q=J9(Q,Z),Q=Q9(Q,Z);Q=X9(Q);let{processStreamDirectives:K}=await e("stx/streaming",()=>Promise.resolve().then(() => (o3(),s3)));Q=K(Q,Z),Q=E6(Q,Z,Y,G),Q=await uJ(Q,Z,Y,G,X),Q=await v4(Q,Z,Y,G,X),Q=g8(Q,Z,Y,G);let{processDeferDirectives:W}=await e("stx/defer",()=>Promise.resolve().then(() => oX));Q=W(Q,Z,Y);let{processTeleportDirectives:q}=await e("stx/teleport",()=>Promise.resolve().then(() => aX));Q=q(Q,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await e("stx/transitions",()=>Promise.resolve().then(() => ZQ));Q=U(Q,Z,Y),Q=z(Q);let{processErrorBoundaryDirectives:j}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => JQ));Q=j(Q,Z,Y);let{processSuspenseDirectives:H}=await e("stx/suspense",()=>Promise.resolve().then(() => XQ));Q=H(Q,Z,Y);let{processAsyncDirectives:B}=await e("stx/async-components",()=>Promise.resolve().then(() => WQ));Q=B(Q,Z,Y);let{processKeepAliveDirectives:_}=await e("stx/keep-alive",()=>Promise.resolve().then(() => UQ));Q=_(Q,Z,Y);let{processVirtualListDirectives:O,processVirtualGridDirectives:F,processInfiniteListDirectives:L}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (OQ(),_Q)));Q=O(Q,Z,Y),Q=F(Q,Z,Y),Q=L(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (SQ(),bQ)));Q=V(Q,Z,Y),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:A}=await e("stx/computed",()=>Promise.resolve().then(() => (lQ(),dQ)));Q=R(Q,Z,Y),Q=A(Q,Z,Y);let{processFormValidationDirectives:M}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (rQ(),oQ)));Q=M(Q,Z,Y);let{processHeadDirective:N,processTitleDirective:I,processMetaDirective:T,resetHead:k}=await e("stx/head",()=>Promise.resolve().then(() => (R$(),f3)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let D=N(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
12660
+ ${A}`:A,Z.__sections=B}}if(_)try{let V;if(E0.isAbsolute(_))V=_,X.add(_);else V=await b5(()=>A9(_,Y,G,X),null,()=>{throw new Y5(`Failed to resolve layout path: ${_}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!V){let I=[];try{let k=G.layoutsDir;if(k){let D=E0.isAbsolute(k)?k:E0.resolve(process.cwd(),k);I=qO.readdirSync(D).filter((P)=>P.endsWith(".stx")).map((P)=>P.replace(/\.stx$/,"")).sort()}}catch{}let T=`Layout not found: ${_} (referenced from ${Y})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(Z1.log(Error(T),{layoutPath:_,filePath:Y,available:I},"error"),console.error(`[stx] ${T}`),G.debug)throw new Y5(T,Y);return W}let w=await b5(()=>Bun.file(V).text(),"",()=>{throw new Y5(`Failed to read layout file: ${V}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${V}`);let I={},T=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(P,y,S)=>{return I[y]=S.trim(),""});for(let[P,y]of Object.entries(I))if(B[P]&&B[P].includes(B5)){let S=B[P].indexOf(B5);B[P]=B[P].slice(0,S)+y+B[P].slice(S+B5.length)}else if(!B[P])B[P]=y;let k={...Z,__sections:B},D=`@layout('${R[1]}')${T}`;return await w0(D,k,V,G,X)}let A=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),M=y6(A,H),N={};return M=M.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,T,k)=>{return N[T]=k.trim(),`@slot('${T}')`}),M=M.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(I,T,k)=>{if(B[T]){let D=B[T];if(D.includes(B5)){let P=N[T]||"",y=D.indexOf(B5);D=D.slice(0,y)+P+D.slice(y+B5.length)}return D}return k||""}),M=HO(M,B),M=M.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),M=P6(M,H),Z.__originalFilePath=Y,W=await WG(M,Z,V,G,X),W=`<!-- stx-layout: ${_} -->
12661
+ ${W}`,z(W)}catch(V){return Z1.log(V instanceof Error?V:Error(String(V)),{layoutPath:_,filePath:Y},"error"),`[Error processing layout: ${V instanceof Error?V.message:String(V)}]`}return z(await WG(W,Z,Y,G,X))}function HO($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,X)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function _O($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(Y)&&Q!==void 0)J[X]=Q;$.$env=J}async function OO($,Z){await b5(()=>kJ($,Z),void 0,(Y)=>{Z1.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function FO($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await $0("stx/variable-extractor",()=>Promise.resolve().then(() => (u5(),x4)));await W(G,Z,Y,{preserveExisting:!0})}catch(W){let q=W instanceof Error?W:Error(String(W));Z1.log(q,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${q.message}`)}}}async function LO($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await $0("stx/expressions",()=>Promise.resolve().then(() => (K1(),pZ)));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return Z1.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function WG($,Z,Y,J,X){let Q=$,G=J;if(await FO(Q,Z,Y),Q=await LO(Q,Z,Y),Q=await jJ(Q,Z,Y),Q=await BJ(Q,Z,Y),Q=await d2(Q,Z,Y,G),F1(Q))Q=J9(Q,Z),Q=Q9(Q,Z);Q=X9(Q);let{processStreamDirectives:K}=await $0("stx/streaming",()=>Promise.resolve().then(() => (o3(),s3)));Q=K(Q,Z),Q=E6(Q,Z,Y,G),Q=await uJ(Q,Z,Y,G,X),Q=await v4(Q,Z,Y,G,X),Q=g8(Q,Z,Y,G);let{processDeferDirectives:W}=await $0("stx/defer",()=>Promise.resolve().then(() => oX));Q=W(Q,Z,Y);let{processTeleportDirectives:q}=await $0("stx/teleport",()=>Promise.resolve().then(() => aX));Q=q(Q,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await $0("stx/transitions",()=>Promise.resolve().then(() => ZQ));Q=U(Q,Z,Y),Q=z(Q);let{processErrorBoundaryDirectives:j}=await $0("stx/error-boundaries",()=>Promise.resolve().then(() => JQ));Q=j(Q,Z,Y);let{processSuspenseDirectives:H}=await $0("stx/suspense",()=>Promise.resolve().then(() => XQ));Q=H(Q,Z,Y);let{processAsyncDirectives:B}=await $0("stx/async-components",()=>Promise.resolve().then(() => WQ));Q=B(Q,Z,Y);let{processKeepAliveDirectives:_}=await $0("stx/keep-alive",()=>Promise.resolve().then(() => UQ));Q=_(Q,Z,Y);let{processVirtualListDirectives:O,processVirtualGridDirectives:F,processInfiniteListDirectives:L}=await $0("stx/virtual-scrolling",()=>Promise.resolve().then(() => (OQ(),_Q)));Q=O(Q,Z,Y),Q=F(Q,Z,Y),Q=L(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await $0("stx/partial-hydration",()=>Promise.resolve().then(() => (SQ(),bQ)));Q=V(Q,Z,Y),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:A}=await $0("stx/computed",()=>Promise.resolve().then(() => (lQ(),dQ)));Q=R(Q,Z,Y),Q=A(Q,Z,Y);let{processFormValidationDirectives:M}=await $0("stx/forms-validation",()=>Promise.resolve().then(() => (rQ(),oQ)));Q=M(Q,Z,Y);let{processHeadDirective:N,processTitleDirective:I,processMetaDirective:T,resetHead:k}=await $0("stx/head",()=>Promise.resolve().then(() => (R$(),f3)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let D=N(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
12662
12662
  `;if(Q=I(Q,Z),Q=T(Q,Z),Q=RJ(Q),Q=S3(Q,Z),Q=u2(Q),Q=OJ(Q),Q=await S6(Q,Z,Y,G,X),Q=await v4(Q,Z,Y,G,X),Z.__stxProcessingDepth===1)Q=DZ(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=q9(Q),Q=X5(Q,Z,Y),Q=y3(Q,Z),Q=P3(Q,Z),Q=M4(Q,Z),Q=t2(Q,Z),Q=e2(Q,Z),Q=await V2(Q,Z,Y,G),Q=await qG(Q,Z,Y),Q=await XY(Q,Z,Y,G),Q=S8(Q,Z,Y,G),Q=MJ(Q,Z,Y,G),Q=NJ(Q,Z,Y),Q=TJ(Q,Z,Y,G),Q=f2(Q,Z,Y,G),Q=K9(Q,Z),Q=W9(Q),Q=vX(Q),!G.skipEventDirectives)Q=JZ(Q,Z,Y);if(Q=F2(Q,Z,Y),G.debug){let s=/\bx-data\s*=/.test(Q),r=Q7($);if(s&&r)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
12663
12663
  Both work on the same page, but they manage separate scopes.
12664
- Prefer signals (state/derived/effect) for new components.`)}Q=yJ(Q,Z),Q=await S1(Q,Z,Y),Q=xX(Q),Q=fX(Q),Q=W2(Q);let{processXElementDirectives:P}=await e("stx/x-element",()=>Promise.resolve().then(() => eQ));Q=P(Q);let y=Z.__originalFilePath||Y,S=r1(Z);if(Q=await G9(Q,G,y,S),Q=n2(Q,Z),Q=await VJ(Q,Z,Y,G),G.media?.image?.autoSiblings){let s=G.publicDir||"public",{rewriteImagesWithSiblings:r}=await e("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (ZG(),$G)));Q=await r(Q,{publicDir:s})}if(G.seo?.enabled)Q=IJ(Q,Z,G);let C=(s,r,q0=!0)=>{if(!r)return s;let N0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),G0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(N0&&G0){if(q0)s=s.replace(G0[0],N0[0]);if(r=r.replace(N0[0],"").trim(),!r)return s}if(/<\/head>/i.test(s))return s.replace(/<\/head>/i,`${r}
12664
+ Prefer signals (state/derived/effect) for new components.`)}Q=yJ(Q,Z),Q=await S1(Q,Z,Y),Q=xX(Q),Q=fX(Q),Q=W2(Q);let{processXElementDirectives:P}=await $0("stx/x-element",()=>Promise.resolve().then(() => eQ));Q=P(Q);let y=Z.__originalFilePath||Y,S=r1(Z);if(Q=await G9(Q,G,y,S),Q=n2(Q,Z),Q=await VJ(Q,Z,Y,G),G.media?.image?.autoSiblings){let s=G.publicDir||"public",{rewriteImagesWithSiblings:r}=await $0("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (ZG(),$G)));Q=await r(Q,{publicDir:s})}if(G.seo?.enabled)Q=IJ(Q,Z,G);let C=(s,r,U0=!0)=>{if(!r)return s;let N0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),K0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(N0&&K0){if(U0)s=s.replace(K0[0],N0[0]);if(r=r.replace(N0[0],"").trim(),!r)return s}if(/<\/head>/i.test(s))return s.replace(/<\/head>/i,`${r}
12665
12665
  </head>`);if(/<head\b[^>]*>/i.test(s))return s.replace(/(<head\b[^>]*>)/i,`$1
12666
12666
  ${r}`);if(/<html\b[^>]*>/i.test(s))return s.replace(/(<html\b[^>]*>)/i,`$1
12667
12667
  <head>
12668
12668
  ${r}
12669
- </head>`);return s},{renderHead:x,getHead:m}=await e("stx/head",()=>Promise.resolve().then(() => (R$(),f3))),Q0=Z.__stx_runtime_head??m();if(Q0.title||Q0.meta?.length||Q0.link?.length){let s=x(Q0);if(s)Q=C(Q,s)}if(D.headContent)Q=C(Q,D.headContent,!Q0.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=v2(Q,G.csp,Z);if(G.analytics?.enabled)Q=U2(Q,G);if(G.heatmap?.enabled)Q=l8(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:s}=await e("stx/pwa/inject",()=>Promise.resolve().then(() => (QG(),XG)));Q=s(Q,G)}let l0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),A0=/\bSTX\.\w+/.test(Q),o0=/window\.STX\s*=/.test(Q);if(l0&&A0&&!o0){let r=`<script data-stx-scoped data-stx-run="once">
12669
+ </head>`);return s},{renderHead:x,getHead:m}=await $0("stx/head",()=>Promise.resolve().then(() => (R$(),f3))),G0=Z.__stx_runtime_head??m();if(G0.title||G0.meta?.length||G0.link?.length){let s=x(G0);if(s)Q=C(Q,s)}if(D.headContent)Q=C(Q,D.headContent,!G0.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=v2(Q,G.csp,Z);if(G.analytics?.enabled)Q=U2(Q,G);if(G.heatmap?.enabled)Q=l8(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:s}=await $0("stx/pwa/inject",()=>Promise.resolve().then(() => (QG(),XG)));Q=s(Q,G)}let l0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),A0=/\bSTX\.\w+/.test(Q),o0=/window\.STX\s*=/.test(Q);if(l0&&A0&&!o0){let r=`<script data-stx-scoped data-stx-run="once">
12670
12670
  ${X2()}
12671
- </script>`;if(Q.includes("</head>")){let q0=Q.indexOf("</head>"),G0=Q.slice(0,q0).indexOf("<script");if(G0!==-1){let E=Q.slice(0,G0),v=Q.slice(G0);Q=E+r+`
12671
+ </script>`;if(Q.includes("</head>")){let U0=Q.indexOf("</head>"),K0=Q.slice(0,U0).indexOf("<script");if(K0!==-1){let E=Q.slice(0,K0),v=Q.slice(K0);Q=E+r+`
12672
12672
  `+v}else Q=Q.replace("</head>",`${r}
12673
12673
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
12674
12674
  ${r}`);else Q=r+`
12675
- `+Q}{let{scanScriptTags:s}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (C$(),G7))),r=[];for(let q0 of s(Q)){if(!/\bserver\b/i.test(q0.attrs))continue;let N0=q0.start+q0.fullMatch.indexOf(">")+1,G0=zO(Q,N0);if(G0===-1)continue;let E=G0+9;while(E<Q.length&&/\s/.test(Q[E]))E++;r.push({start:q0.start,end:E})}for(let q0=r.length-1;q0>=0;q0--){let{start:N0,end:G0}=r[q0];Q=Q.substring(0,N0)+Q.substring(G0)}}let p=m4(Q,Y);if(p.hasScoped)Q=p.html;let _0=Z.__stx_event_bindings||[],p0=!1,N1=[],O5=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:F5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (C$(),G7)));for(let s of F5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))N1.push({match:s.fullMatch,attrs:s.attrs,content:s.body});for(let{match:s,attrs:r,content:q0}of N1){p0=!0;let N0=q0;z9(q0,Y,J.strict,Z.__originalFilePath);let G0=await a1(q0,{eventBindings:_0,attrs:r,hasColonDirectives:O5,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:S});Q=Q.replace(s,()=>G0)}if(p0)Z.__stx_event_bindings=[];if(!p0&&Z.__stxProcessingDepth===1){let s=Z.__stx_event_bindings||[];if(s.length>0){let r=Z3(s);if(r){let q0=Q.lastIndexOf("</body>");Q=q0===-1?Q+r:Q.slice(0,q0)+r+`
12676
- `+Q.slice(q0)}Z.__stx_event_bindings=[]}}if(!LX(Q)&&VX(Q))Q=await Z7(Q,G);if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=x2(Q,Z.cspNonce);return Q}var B5="<!--PARENT_CONTENT_PLACEHOLDER-->";var I4=b(()=>{V3();R3();$5();s7();Q2();q2();z2();a7();o7();Y3();N5();L2();w2();L4();g2();m2();p2();s2();V1();R$();G1();$Y();QY();zJ();_J();k6();M9();wJ();E5();AJ();v6();M0();bJ();PJ();xJ();mJ();h6();d6();JX();C$();N6();CX();U9();j9();V0();a3();q3();X$();Y7();Y7();U9();j9()});var UG=()=>{};var N9={};a(N9,{renderSlot:()=>jG,processSlots:()=>HG,parseSlots:()=>zG,parseSlotElement:()=>MO,extractSlotContent:()=>IO,applySlots:()=>DO});function VO($,Z){let Y=1,J=Z,X="<template",Q="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(X,J)&&(J+X.length>=$.length||/[\s>\/]/.test($[J+X.length]))){Y++,J+=X.length;continue}if($.startsWith(Q,J)){let K=$.indexOf(">",J+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function RO($,Z){let Y=null;for(let J=Z;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"){Y=X;continue}if(X===">")return J+1}return-1}function AO($){let Z=[],Y=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=RO($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){X=G;continue}let q=W[1]==="/",U=W[2].toLowerCase();if(q){let j=Y.lastIndexOf(U);if(j!==-1)Y.splice(j);X=G;continue}if(U==="template"&&Y.length===0){let j=K.match(J);if(j){let H=VO($,G);if(H!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:H,slotName:B,content:$.slice(G,H-11).trim(),propsBinding:j[4]||void 0}),X=H;continue}}}if(!/\/\s*>$/.test(K)&&!wO.has(U)){if(Y.push(U),U==="script"||U==="style"){let j=$.toLowerCase().indexOf(`</${U}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function zG($){let Z={default:"",named:new Map},Y=$,J=AO($);for(let W of J)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});J.sort((W,q)=>q.start-W.start);for(let W of J)Y=Y.slice(0,W.start)+Y.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[W,q,U,z,j,H]=G,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(B+_).trim(),F=`<${q}${O?" "+O:""}>${H}</${q}>`;X.push({start:G.index,end:G.index+W.length,slotName:z,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[W,q,U,z,j]=G,H=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(H+B).trim(),O=`<${q}${_?" "+_:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:z,element:O})}X.sort((W,q)=>q.start-W.start);for(let W of X){let q=Z.named.get(W.slotName);if(q)q.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function MO($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)J[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function jG($,Z,Y,J){if(!$)return Y;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...J};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[q,U]=W.split(":").map((j)=>j.trim()),z=U||q;if(Z[q]!==void 0)G[z]=Z[q]}}else G[Q]=Z;X=NO(X,G)}return X}function NO($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=BG(X,Z);return a0(String(Q??""))}catch{return`{{ ${J} }}`}})}function BG($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),X=Z;for(let Q of J)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,X,Q]=Y,G=Z[J],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!K0($))return;return W0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function HG($,Z,Y){let J=$;J=await TO(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,q)=>{let U=Z.named.get(K),z=q?.trim()||"",j=W||"",H={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(j))!==null){let O=_[1],F=_[2];H[O]=BG(F,Y)}return await jG(U,H,z,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),J}async function TO($,Z,Y){let J=[],X=[];$.replace(Z,(K,...W)=>{let q=W[W.length-2];return X.push({match:K,index:q}),J.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:q}=X[K];G=G.slice(0,q)+Q[K]+G.slice(q+W.length)}return G}function IO($){let Z=zG($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function DO($,Z,Y,J){return await HG($,{default:Z,named:Y},J)}var wO;var T9=b(()=>{G1();V0();wO=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import EO from"fs";import f from"path";function bO($){let Z=new WeakSet;try{let Y=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(Y);let X={};for(let Q of Object.keys(J).sort())X[Q]=Y(J[Q]);return X};return JSON.stringify(Y($))}catch{return null}}function _G($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function SO($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function t1($){return!SO($)}function e1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let X=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)X=X.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),X=X.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return X}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function yO($){let Z=[],Y=new Set,J=0,X=0,Q=$.length,G=(U)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===U){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let U=1;while(X<Q&&U>0)if($[X]==="{")U++,X++;else if($[X]==="}")U--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},W=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
12677
- `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},q=()=>{if(J!==0)return;let U=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Y.has(_))Z.push(_),Y.add(_);return}let z=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let H=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){J++,X++;continue}if($[X]==="}"){J--,X++;continue}if(J===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))q();X++}return Z}function PO($){let Z=[],Y=0,J=0,X=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G==="\\"){Q++;continue}if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function CO($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function vO($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let X=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of PO(K)){let q=W.trim();if(!q||q.startsWith("..."))continue;let U=CO(q);if(U===-1)continue;let z=q.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let j=q.slice(U+1).trim();if(!j)continue;try{let H=Object.keys(Z),B=Function(...H,`"use strict"; return (${j});`);Z[z]=B(...H.map((_)=>Z[_]))}catch{}}}catch{}}async function P4($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],U=typeof X.root==="string"?f.resolve(X.root):void 0,z=U??f.dirname(J),j=[],H=(O)=>{if(O&&!j.includes(O))j.push(O)},B=Y.__originalFilePath;if(B)H(f.join(f.dirname(B),"components"));H(Z),H(X._rootComponentsDir),H(f.join(f.dirname(J),"components")),H(X.componentsDir);let _=X._pluginComponentDirs;if(Array.isArray(_))for(let O of _)H(typeof O==="string"?O:null);if(U)H(f.resolve(U,"resources/views/components")),H(f.resolve(U,"resources/components")),H(f.resolve(U,"src/components")),H(f.resolve(U,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return i(f.resolve(f.dirname(J),`${Q}.stx`));for(let O of j){let F=f.isAbsolute(O)?O:f.resolve(z,O);for(let L of q)if(await i(f.join(F,L)))return!0}return!1}function xO($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function fO($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function gO($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let X;while((X=Y.exec(J))!==null)Z.add(X[1]);Y.lastIndex=0}return[...Z]}async function q5($,Z,Y,J,X,Q,G,K=new Set,W){let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (u5(),x4))),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let H=j&&j!=="load"&&xO(j)?j:"";try{let B=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,F=null,L=X.__importedComponents;if(L){let E=[O,O.toLowerCase(),B(O),_(O)];for(let v of E)if(L.has(v)){F=L.get(v);break}}let V=[];if(!F){let E=[`${O}.stx`,`${B(O)}.stx`,`${_(O)}.stx`],v=[...new Set(E)],u=X.__originalFilePath,h=[];if(u){let j0=f.join(f.dirname(u),"components");h.push(j0)}if(J)h.push(J);let $0=G._rootComponentsDir;if(typeof $0==="string"&&!h.includes($0))h.push($0);let z0=f.join(f.dirname(Q),"components");if(!h.includes(z0))h.push(z0);if(G.componentsDir&&G.componentsDir!==J&&!h.includes(G.componentsDir))h.push(G.componentsDir);let z1=G._pluginComponentDirs;if(Array.isArray(z1)){for(let j0 of z1)if(typeof j0==="string"&&!h.includes(j0))h.push(j0)}let y0=typeof G.root==="string"?f.resolve(G.root):void 0,x0=y0??f.dirname(Q),r0=[];if(y0)r0.push(f.resolve(y0,"resources/views/components")),r0.push(f.resolve(y0,"resources/components")),r0.push(f.resolve(y0,"src/components")),r0.push(f.resolve(y0,"components"));r0.push(f.resolve(import.meta.dir,"components"));for(let j0 of r0)if(!h.includes(j0))h.push(j0);let L5=[...new Set(h.map((j0)=>{if(!j0)return j0;return f.isAbsolute(j0)?j0:f.resolve(x0,j0)}))];h.length=0,h.push(...L5);let T1=`${O}\x00${Q}\x00${L5.join("\x00")}`,I1=H7.get(T1);if(I1)if(await i(I1))F=I1;else H7.delete(T1);if(!F&&(O.startsWith("./")||O.startsWith("../")))F=f.resolve(f.dirname(Q),`${O}.stx`),V.push(F);else if(!F)for(let j0 of h){if(!j0)continue;for(let Y1 of v){let n=f.join(j0,Y1);if(V.push(n),await i(n)){F=n;break}}if(F)break;if(!F)try{let Y1=await import("fs");if(!Y1.statSync(j0,{throwIfNoEntry:!1})?.isDirectory())continue;let J1=8,i1=[{path:j0,depth:0}];while(i1.length>0&&!F){let j1=i1.pop();if(j1.depth>=J1)continue;let l$;try{l$=Y1.readdirSync(j1.path,{withFileTypes:!0})}catch{continue}for(let p$ of l$){if(!p$.isDirectory())continue;if(p$.name==="node_modules"||p$.name.startsWith("."))continue;let W8=f.join(j1.path,p$.name);for(let PK of v){let l7=f.join(W8,PK);if(V.push(l7),await i(l7)){F=l7;break}}if(F)break;i1.push({path:W8,depth:j1.depth+1})}}}catch{}if(F)break}if(F)H7.set(T1,F)}if(!F||!await i(F)){let E=V.length>0?`
12675
+ `+Q}{let{scanScriptTags:s}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (C$(),G7))),r=[];for(let U0 of s(Q)){if(!/\bserver\b/i.test(U0.attrs))continue;let N0=U0.start+U0.fullMatch.indexOf(">")+1,K0=zO(Q,N0);if(K0===-1)continue;let E=K0+9;while(E<Q.length&&/\s/.test(Q[E]))E++;r.push({start:U0.start,end:E})}for(let U0=r.length-1;U0>=0;U0--){let{start:N0,end:K0}=r[U0];Q=Q.substring(0,N0)+Q.substring(K0)}}let p=m4(Q,Y);if(p.hasScoped)Q=p.html;let _0=Z.__stx_event_bindings||[],p0=!1,N1=[],O5=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:F5}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (C$(),G7)));for(let s of F5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))N1.push({match:s.fullMatch,attrs:s.attrs,content:s.body});for(let{match:s,attrs:r,content:U0}of N1){p0=!0;let N0=U0;z9(U0,Y,J.strict,Z.__originalFilePath);let K0=await a1(U0,{eventBindings:_0,attrs:r,hasColonDirectives:O5,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:S});Q=Q.replace(s,()=>K0)}if(p0)Z.__stx_event_bindings=[];if(!p0&&Z.__stxProcessingDepth===1){let s=Z.__stx_event_bindings||[];if(s.length>0){let r=Z3(s);if(r){let U0=Q.lastIndexOf("</body>");Q=U0===-1?Q+r:Q.slice(0,U0)+r+`
12676
+ `+Q.slice(U0)}Z.__stx_event_bindings=[]}}if(!LX(Q)&&VX(Q))Q=await Z7(Q,G);if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=x2(Q,Z.cspNonce);return Q}var B5="<!--PARENT_CONTENT_PLACEHOLDER-->";var I4=b(()=>{V3();R3();$5();s7();Q2();q2();z2();a7();o7();Y3();N5();L2();w2();L4();g2();m2();p2();s2();V1();R$();K1();$Y();QY();zJ();_J();k6();M9();wJ();E5();AJ();v6();M0();bJ();PJ();xJ();mJ();h6();d6();JX();C$();N6();CX();U9();j9();V0();a3();q3();X$();Y7();Y7();U9();j9()});var UG=()=>{};var N9={};t(N9,{renderSlot:()=>jG,processSlots:()=>HG,parseSlots:()=>zG,parseSlotElement:()=>MO,extractSlotContent:()=>IO,applySlots:()=>DO});function VO($,Z){let Y=1,J=Z,X="<template",Q="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(X,J)&&(J+X.length>=$.length||/[\s>\/]/.test($[J+X.length]))){Y++,J+=X.length;continue}if($.startsWith(Q,J)){let K=$.indexOf(">",J+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function RO($,Z){let Y=null;for(let J=Z;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"){Y=X;continue}if(X===">")return J+1}return-1}function AO($){let Z=[],Y=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=RO($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){X=G;continue}let q=W[1]==="/",U=W[2].toLowerCase();if(q){let j=Y.lastIndexOf(U);if(j!==-1)Y.splice(j);X=G;continue}if(U==="template"&&Y.length===0){let j=K.match(J);if(j){let H=VO($,G);if(H!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:H,slotName:B,content:$.slice(G,H-11).trim(),propsBinding:j[4]||void 0}),X=H;continue}}}if(!/\/\s*>$/.test(K)&&!wO.has(U)){if(Y.push(U),U==="script"||U==="style"){let j=$.toLowerCase().indexOf(`</${U}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function zG($){let Z={default:"",named:new Map},Y=$,J=AO($);for(let W of J)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});J.sort((W,q)=>q.start-W.start);for(let W of J)Y=Y.slice(0,W.start)+Y.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[W,q,U,z,j,H]=G,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(B+_).trim(),F=`<${q}${O?" "+O:""}>${H}</${q}>`;X.push({start:G.index,end:G.index+W.length,slotName:z,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[W,q,U,z,j]=G,H=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(H+B).trim(),O=`<${q}${_?" "+_:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:z,element:O})}X.sort((W,q)=>q.start-W.start);for(let W of X){let q=Z.named.get(W.slotName);if(q)q.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function MO($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)J[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function jG($,Z,Y,J){if(!$)return Y;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...J};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[q,U]=W.split(":").map((j)=>j.trim()),z=U||q;if(Z[q]!==void 0)G[z]=Z[q]}}else G[Q]=Z;X=NO(X,G)}return X}function NO($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=BG(X,Z);return t0(String(Q??""))}catch{return`{{ ${J} }}`}})}function BG($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),X=Z;for(let Q of J)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,X,Q]=Y,G=Z[J],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!W0($))return;return q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function HG($,Z,Y){let J=$;J=await TO(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,q)=>{let U=Z.named.get(K),z=q?.trim()||"",j=W||"",H={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(j))!==null){let O=_[1],F=_[2];H[O]=BG(F,Y)}return await jG(U,H,z,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),J}async function TO($,Z,Y){let J=[],X=[];$.replace(Z,(K,...W)=>{let q=W[W.length-2];return X.push({match:K,index:q}),J.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:q}=X[K];G=G.slice(0,q)+Q[K]+G.slice(q+W.length)}return G}function IO($){let Z=zG($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function DO($,Z,Y,J){return await HG($,{default:Z,named:Y},J)}var wO;var T9=b(()=>{K1();V0();wO=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import EO from"fs";import f from"path";function bO($){let Z=new WeakSet;try{let Y=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(Y);let X={};for(let Q of Object.keys(J).sort())X[Q]=Y(J[Q]);return X};return JSON.stringify(Y($))}catch{return null}}function _G($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function SO($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function t1($){return!SO($)}function e1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let X=new Bun.Transpiler({loader:"ts",target:"browser",define:P0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)X=X.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),X=X.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return X}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function yO($){let Z=[],Y=new Set,J=0,X=0,Q=$.length,G=(U)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===U){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let U=1;while(X<Q&&U>0)if($[X]==="{")U++,X++;else if($[X]==="}")U--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},W=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
12677
+ `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},q=()=>{if(J!==0)return;let U=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Y.has(_))Z.push(_),Y.add(_);return}let z=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let H=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){J++,X++;continue}if($[X]==="}"){J--,X++;continue}if(J===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))q();X++}return Z}function PO($){let Z=[],Y=0,J=0,X=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G==="\\"){Q++;continue}if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function CO($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function vO($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let X=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of PO(K)){let q=W.trim();if(!q||q.startsWith("..."))continue;let U=CO(q);if(U===-1)continue;let z=q.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let j=q.slice(U+1).trim();if(!j)continue;try{let H=Object.keys(Z),B=Function(...H,`"use strict"; return (${j});`);Z[z]=B(...H.map((_)=>Z[_]))}catch{}}}catch{}}async function P4($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],U=typeof X.root==="string"?f.resolve(X.root):void 0,z=U??f.dirname(J),j=[],H=(O)=>{if(O&&!j.includes(O))j.push(O)},B=Y.__originalFilePath;if(B)H(f.join(f.dirname(B),"components"));H(Z),H(X._rootComponentsDir),H(f.join(f.dirname(J),"components")),H(X.componentsDir);let _=X._pluginComponentDirs;if(Array.isArray(_))for(let O of _)H(typeof O==="string"?O:null);if(U)H(f.resolve(U,"resources/views/components")),H(f.resolve(U,"resources/components")),H(f.resolve(U,"src/components")),H(f.resolve(U,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return i(f.resolve(f.dirname(J),`${Q}.stx`));for(let O of j){let F=f.isAbsolute(O)?O:f.resolve(z,O);for(let L of q)if(await i(f.join(F,L)))return!0}return!1}function xO($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function fO($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function gO($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let X;while((X=Y.exec(J))!==null)Z.add(X[1]);Y.lastIndex=0}return[...Z]}async function q5($,Z,Y,J,X,Q,G,K=new Set,W){let{extractVariables:q}=await $0("stx/variable-extractor",()=>Promise.resolve().then(() => (u5(),x4))),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let H=j&&j!=="load"&&xO(j)?j:"";try{let B=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,F=null,L=X.__importedComponents;if(L){let E=[O,O.toLowerCase(),B(O),_(O)];for(let v of E)if(L.has(v)){F=L.get(v);break}}let V=[];if(!F){let E=[`${O}.stx`,`${B(O)}.stx`,`${_(O)}.stx`],v=[...new Set(E)],u=X.__originalFilePath,g=[];if(u){let j0=f.join(f.dirname(u),"components");g.push(j0)}if(J)g.push(J);let a=G._rootComponentsDir;if(typeof a==="string"&&!g.includes(a))g.push(a);let Q0=f.join(f.dirname(Q),"components");if(!g.includes(Q0))g.push(Q0);if(G.componentsDir&&G.componentsDir!==J&&!g.includes(G.componentsDir))g.push(G.componentsDir);let r0=G._pluginComponentDirs;if(Array.isArray(r0)){for(let j0 of r0)if(typeof j0==="string"&&!g.includes(j0))g.push(j0)}let y0=typeof G.root==="string"?f.resolve(G.root):void 0,x0=y0??f.dirname(Q),a0=[];if(y0)a0.push(f.resolve(y0,"resources/views/components")),a0.push(f.resolve(y0,"resources/components")),a0.push(f.resolve(y0,"src/components")),a0.push(f.resolve(y0,"components"));a0.push(f.resolve(import.meta.dir,"components"));for(let j0 of a0)if(!g.includes(j0))g.push(j0);let L5=[...new Set(g.map((j0)=>{if(!j0)return j0;return f.isAbsolute(j0)?j0:f.resolve(x0,j0)}))];g.length=0,g.push(...L5);let T1=`${O}\x00${Q}\x00${L5.join("\x00")}`,I1=H7.get(T1);if(I1)if(await i(I1))F=I1;else H7.delete(T1);if(!F&&(O.startsWith("./")||O.startsWith("../")))F=f.resolve(f.dirname(Q),`${O}.stx`),V.push(F);else if(!F)for(let j0 of g){if(!j0)continue;for(let J1 of v){let n=f.join(j0,J1);if(V.push(n),await i(n)){F=n;break}}if(F)break;if(!F)try{let J1=await import("fs");if(!J1.statSync(j0,{throwIfNoEntry:!1})?.isDirectory())continue;let X1=8,i1=[{path:j0,depth:0}];while(i1.length>0&&!F){let j1=i1.pop();if(j1.depth>=X1)continue;let l$;try{l$=J1.readdirSync(j1.path,{withFileTypes:!0})}catch{continue}for(let p$ of l$){if(!p$.isDirectory())continue;if(p$.name==="node_modules"||p$.name.startsWith("."))continue;let W8=f.join(j1.path,p$.name);for(let PK of v){let l7=f.join(W8,PK);if(V.push(l7),await i(l7)){F=l7;break}}if(F)break;i1.push({path:W8,depth:j1.depth+1})}}}catch{}if(F)break}if(F)H7.set(T1,F)}if(!F||!await i(F)){let E=V.length>0?`
12678
12678
  Searched paths:
12679
12679
  ${V.map((v)=>` - ${v}`).join(`
12680
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${E}`}W.add(F);let w;if(B7.has(F))w=B7.get(F);else try{w=await Bun.file(F).text(),B7.set(F,w)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let R=new Set(["__originalFilePath","__importedComponents",$4]),A={};for(let[E,v]of Object.entries(X))if(!E.startsWith("__")||R.has(E))A[E]=v;let{extractSlotContent:M}=await e("stx/slots",()=>Promise.resolve().then(() => (T9(),N9))),N=M(Y),I={};if(N.defaultSlot?.trim())I.default=N.defaultSlot;for(let[E,v]of N.namedSlots)I[E]=v.content;let T={...A,...Z,props:Z,slot:Y,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:F1(w)||fO(Y)};vO(w,T);let k=w,D=P5(k);if(D)k=D.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...w.matchAll(P)],S=[],C=y.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&y.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,m=null;if(C){let E=bO({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(E!==null){x=`${F}\x00${E}`;let v=I9.get(x);if(v){for(let u of v.dependencies)W.add(u);return v.output}m=new Set(W)}}for(let E of y){let v=E[1]||"",u=E[2]||"",h=v.includes("server");if(t1(v)&&u.trim())u=e1(u);if(h&&u)try{await q(u,T,F)}catch(z0){}if(!h){let z0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),z1=z0.includes("{{")&&z0.includes("}}"),y0=z0.includes("{!!")&&z0.includes("!!}");if(z1||y0)z0=X4(z0,T);let x0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");S.push(`<script${x0}>${z0}</script>`)}}let l=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Q0=l?l[1]:"",l0=l?l[2]:"",A0="",o0=Q0&&/\bscoped\b/i.test(Q0);if(l)A0=`<style${Q0}>${l0}</style>`;let p=k;if(p=p.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)p=p.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(p=p.replace(E,(u,h)=>{let $0=h.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if($0)v.push(`<style${$0[1]}>${$0[2]}</style>`);return""}),p=p.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)A0=`${A0}${v.join(`
12681
- `)}`}if(Y&&p.includes("{{ text || slot }}"))p=p.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:_0}=await e("stx/slots",()=>Promise.resolve().then(() => (T9(),N9))),{defaultSlot:p0,namedSlots:N1}=N;p=await _0(p,p0,N1,T);let O5=S.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),F5=gO(S);if(F5.length>0)T.__stx_client_signal_names=F5;let s={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:O5||S.length===0,defaultLayout:void 0};T.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let r=await w0(p,T,F,s,W),q0=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let E of r.matchAll(/\{\{([\s\S]*?)\}\}/g))q0.add(E[1].trim());if(q0.size>0)X.__stx_preserved_client_expressions=[...q0];let N0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++kO}_${Math.random().toString(36).slice(2,8)}`,G0=r;if(O5){let E="";if(Object.keys(Z).length>0)try{E=` data-stx-props="${_G(JSON.stringify(Z))}"`}catch{}let v=H?` stx-hydrate="${_G(H)}"`:"";G0=`<div data-stx-scope="${N0}"${E}${v}>${r}</div>`;let u=await Promise.all(S.map(async(h)=>{let $0=h.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!$0)return h;let[,z0,z1]=$0,y0=r$(z1,{filePath:F,projectRoot:process.cwd()}),x0=y0.code,r0=a$(y0.styles);x0=M5(x0).code;let{hasUserImports:L5,bundleClientScript:T1}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (U$(),q$)));if(L5(x0))x0=await T1(x0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:I1}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (C$(),G7)));x0=x0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(j1,l$)=>I1(l$));let j0=g0(x0),Y1=yO(j0),n=`function(__scopeId) {
12682
- ${w5("const",[...i8,...Y1],j0)}
12680
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${E}`}W.add(F);let w;if(B7.has(F))w=B7.get(F);else try{w=await Bun.file(F).text(),B7.set(F,w)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let R=new Set(["__originalFilePath","__importedComponents",$4]),A={};for(let[E,v]of Object.entries(X))if(!E.startsWith("__")||R.has(E))A[E]=v;let{extractSlotContent:M}=await $0("stx/slots",()=>Promise.resolve().then(() => (T9(),N9))),N=M(Y),I={};if(N.defaultSlot?.trim())I.default=N.defaultSlot;for(let[E,v]of N.namedSlots)I[E]=v.content;let T={...A,...Z,props:Z,slot:Y,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:F1(w)||fO(Y)};vO(w,T);let k=w,D=P5(k);if(D)k=D.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...w.matchAll(P)],S=[],C=y.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&y.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,m=null;if(C){let E=bO({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(E!==null){x=`${F}\x00${E}`;let v=I9.get(x);if(v){for(let u of v.dependencies)W.add(u);return v.output}m=new Set(W)}}for(let E of y){let v=E[1]||"",u=E[2]||"",g=v.includes("server");if(t1(v)&&u.trim())u=e1(u);if(g&&u)try{await q(u,T,F)}catch(Q0){}if(!g){let Q0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),r0=Q0.includes("{{")&&Q0.includes("}}"),y0=Q0.includes("{!!")&&Q0.includes("!!}");if(r0||y0)Q0=X4(Q0,T);let x0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");S.push(`<script${x0}>${Q0}</script>`)}}let l=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),G0=l?l[1]:"",l0=l?l[2]:"",A0="",o0=G0&&/\bscoped\b/i.test(G0);if(l)A0=`<style${G0}>${l0}</style>`;let p=k;if(p=p.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)p=p.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(p=p.replace(E,(u,g)=>{let a=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(a)v.push(`<style${a[1]}>${a[2]}</style>`);return""}),p=p.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)A0=`${A0}${v.join(`
12681
+ `)}`}if(Y&&p.includes("{{ text || slot }}"))p=p.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:_0}=await $0("stx/slots",()=>Promise.resolve().then(() => (T9(),N9))),{defaultSlot:p0,namedSlots:N1}=N;p=await _0(p,p0,N1,T);let O5=S.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),F5=gO(S);if(F5.length>0)T.__stx_client_signal_names=F5;let s={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:O5||S.length===0,defaultLayout:void 0};T.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let r=await w0(p,T,F,s,W),U0=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let E of r.matchAll(/\{\{([\s\S]*?)\}\}/g))U0.add(E[1].trim());if(U0.size>0)X.__stx_preserved_client_expressions=[...U0];let N0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++kO}_${Math.random().toString(36).slice(2,8)}`,K0=r;if(O5){let E="";if(Object.keys(Z).length>0)try{E=` data-stx-props="${_G(JSON.stringify(Z))}"`}catch{}let v=H?` stx-hydrate="${_G(H)}"`:"";K0=`<div data-stx-scope="${N0}"${E}${v}>${r}</div>`;let u=await Promise.all(S.map(async(g)=>{let a=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!a)return g;let[,Q0,r0]=a,y0=r$(r0,{filePath:F,projectRoot:process.cwd()}),x0=y0.code,a0=a$(y0.styles);x0=M5(x0).code;let{hasUserImports:L5,bundleClientScript:T1}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (U$(),q$)));if(L5(x0))x0=await T1(x0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:I1}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (C$(),G7)));x0=x0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(j1,l$)=>I1(l$));let j0=g0(x0),J1=yO(j0),n=`function(__scopeId) {
12682
+ ${w5("const",[...i8,...J1],j0)}
12683
12683
  const __scope = window.stx._scopes = window.stx._scopes || {};
12684
12684
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
12685
12685
  const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
@@ -12697,7 +12697,7 @@ ${j0}
12697
12697
  // Register all defined signals and functions in this scope
12698
12698
  const __localVars = {};
12699
12699
  try {
12700
- ${Y1.map((j1)=>`if (typeof ${j1} !== 'undefined') __localVars['${j1}'] = ${j1};`).join(`
12700
+ ${J1.map((j1)=>`if (typeof ${j1} !== 'undefined') __localVars['${j1}'] = ${j1};`).join(`
12701
12701
  `)}
12702
12702
  }
12703
12703
  catch (e) {}
@@ -12706,15 +12706,15 @@ catch (e) {}
12706
12706
  finally {
12707
12707
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
12708
12708
  }
12709
- }`,J1=H?null:IZ(X,n),i1=J1?`window.__stxComponentFactories[${JSON.stringify(J1)}](${JSON.stringify(N0)});`:`(${n})(${JSON.stringify(N0)});`;if(H)return`${r0}<script type="stx/island" data-stx-island="${N0}" data-stx-scoped${z0}>${i1}</script>`;return`${r0}<script data-stx-scoped data-stx-run="always"${z0}>${i1}</script>`}));if(G0=G0+`
12709
+ }`,X1=H?null:IZ(X,n),i1=X1?`window.__stxComponentFactories[${JSON.stringify(X1)}](${JSON.stringify(N0)});`:`(${n})(${JSON.stringify(N0)});`;if(H)return`${a0}<script type="stx/island" data-stx-island="${N0}" data-stx-scoped${Q0}>${i1}</script>`;return`${a0}<script data-stx-scoped data-stx-run="always"${Q0}>${i1}</script>`}));if(K0=K0+`
12710
12710
  `+u.join(`
12711
- `),A0)G0+=`
12712
- `+A0}else{if(A0)G0+=`
12713
- `+A0;if(S.length>0){let E=T.__stx_event_bindings||[],v=r1(T),u=await Promise.all(S.map(async(h)=>{let $0=h.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!$0)return h;return await a1($0[1],{eventBindings:E,templateContent:G0,filePath:F,projectRoot:process.cwd(),serverData:v})}));G0+=`
12711
+ `),A0)K0+=`
12712
+ `+A0}else{if(A0)K0+=`
12713
+ `+A0;if(S.length>0){let E=T.__stx_event_bindings||[],v=r1(T),u=await Promise.all(S.map(async(g)=>{let a=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!a)return g;return await a1(a[1],{eventBindings:E,templateContent:K0,filePath:F,projectRoot:process.cwd(),serverData:v})}));K0+=`
12714
12714
  `+u.join(`
12715
- `),T.__stx_event_bindings=[]}}if(o0){let E=m4(G0,F);if(E.hasScoped)G0=E.html}if(x&&m)I9.set(x,{output:G0,dependencies:[...W].filter((E)=>!m.has(E))});return G0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function i($){return Bun.file($).exists()}function D9($,Z){let Y=f.resolve(Z),J=f.resolve($),X=Y.endsWith(f.sep)?Y:Y+f.sep;if(J===Y||J.startsWith(X))return J;return null}async function A9($,Z,Y,J){let X=await hO($,Z,Y,J);if(X===null)return null;let Q=D9(X,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=f.isAbsolute(K)?K:f.resolve(process.cwd(),K);if(D9(X,W))return f.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function hO($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=f.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=f.join(Q,$),H=D9(j,Q);if(!H)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${H}`);if(await i(H)&&J)J.add(H);return H}let G=f.join(X,$);if(await i(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let H=`${G}${j}`;if(await i(H)){if(Y.debug)console.log(`Found direct path with extension: ${H}`);if(J)J.add(H);return H}}let K="",W=f.resolve(X),q=process.cwd();for(let j=0;j<10;j++){let H=f.join(W,"layouts"),B=!1;try{B=EO.statSync(H,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=H;break}let _=f.dirname(W);if(_===W||_.length<q.length)break;W=_}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,H=f.join(K,j);if(await i(H)){if(Y.debug)console.log(`Found in current layouts dir: ${H}`);if(J)J.add(H);return H}if(!j.endsWith(".stx")){let B=`${H}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.layoutsDir){let j=f.isAbsolute(Y.layoutsDir)?Y.layoutsDir:f.resolve(process.cwd(),Y.layoutsDir),H=$.startsWith("layouts/")?$.slice(8):$,B=f.join(j,H);if(await i(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(J)J.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),H=f.join(Y.partialsDir||X,"layouts",j[1]);if(await i(H)){if(Y.debug)console.log(`Found in layouts path: ${H}`);if(J)J.add(H);return H}if(!H.endsWith(".stx")){let B=`${H}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.partialsDir){if(K=f.join(Y.partialsDir,"layouts"),await i(K)){let j=f.join(K,$);if(await i(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${H}`);if(J)J.add(H);return H}}}}let U=Y.partialsDir||f.join(process.cwd(),"views"),z=f.join(U,$);if(await i(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(J)J.add(z);return z}if(!$.endsWith(".stx")){let j=`${z}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(J)J.add(j);return j}}if(X.includes("temp")){let j=f.join(f.dirname(X),"layouts",$);if(await i(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${H}`);if(J)J.add(H);return H}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function OG($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
12715
+ `),T.__stx_event_bindings=[]}}if(o0){let E=m4(K0,F);if(E.hasScoped)K0=E.html}if(x&&m)I9.set(x,{output:K0,dependencies:[...W].filter((E)=>!m.has(E))});return K0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function i($){return Bun.file($).exists()}function D9($,Z){let Y=f.resolve(Z),J=f.resolve($),X=Y.endsWith(f.sep)?Y:Y+f.sep;if(J===Y||J.startsWith(X))return J;return null}async function A9($,Z,Y,J){let X=await hO($,Z,Y,J);if(X===null)return null;let Q=D9(X,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=f.isAbsolute(K)?K:f.resolve(process.cwd(),K);if(D9(X,W))return f.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function hO($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=f.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=f.join(Q,$),H=D9(j,Q);if(!H)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${H}`);if(await i(H)&&J)J.add(H);return H}let G=f.join(X,$);if(await i(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let H=`${G}${j}`;if(await i(H)){if(Y.debug)console.log(`Found direct path with extension: ${H}`);if(J)J.add(H);return H}}let K="",W=f.resolve(X),q=process.cwd();for(let j=0;j<10;j++){let H=f.join(W,"layouts"),B=!1;try{B=EO.statSync(H,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=H;break}let _=f.dirname(W);if(_===W||_.length<q.length)break;W=_}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,H=f.join(K,j);if(await i(H)){if(Y.debug)console.log(`Found in current layouts dir: ${H}`);if(J)J.add(H);return H}if(!j.endsWith(".stx")){let B=`${H}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.layoutsDir){let j=f.isAbsolute(Y.layoutsDir)?Y.layoutsDir:f.resolve(process.cwd(),Y.layoutsDir),H=$.startsWith("layouts/")?$.slice(8):$,B=f.join(j,H);if(await i(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(J)J.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),H=f.join(Y.partialsDir||X,"layouts",j[1]);if(await i(H)){if(Y.debug)console.log(`Found in layouts path: ${H}`);if(J)J.add(H);return H}if(!H.endsWith(".stx")){let B=`${H}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.partialsDir){if(K=f.join(Y.partialsDir,"layouts"),await i(K)){let j=f.join(K,$);if(await i(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${H}`);if(J)J.add(H);return H}}}}let U=Y.partialsDir||f.join(process.cwd(),"views"),z=f.join(U,$);if(await i(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(J)J.add(z);return z}if(!$.endsWith(".stx")){let j=`${z}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(J)J.add(j);return j}}if(X.includes("temp")){let j=f.join(f.dirname(X),"layouts",$);if(await i(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${H}`);if(J)J.add(H);return H}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function OG($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
12716
12716
  `),K=0;for(let W=0;W<G.length;W++)if(K+=G[W].length+1,K>=Z){J=W+1,X=G[W].trim();let q=Math.max(0,W-2),U=Math.min(G.length,W+3);Q=G.slice(q,U).map((z,j)=>{let H=q+j+1;return`${H===J?"> ":" "}${H}: ${z}`}).join(`
12717
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return OG($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function U0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=OG(J,X,Q),W=Y.split("/").pop(),q=0;if(typeof X==="number"&&X>=0&&J){let z=J.lastIndexOf(`
12717
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return OG($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function z0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=OG(J,X,Q),W=Y.split("/").pop(),q=0;if(typeof X==="number"&&X>=0&&J){let z=J.lastIndexOf(`
12718
12718
  `,Math.max(0,X-1));q=X-(z+1)+1}let U="";if(G>0)U+=`
12719
12719
  ${Y}:${G}${q>0?`:${q}`:""}: ${$.toLowerCase()} error: ${Z}
12720
12720
  `;if(U+=`
@@ -12727,8 +12727,8 @@ ${Y0.yellow}${Y0.bold}Message:${Y0.reset} ${Z}
12727
12727
  `,K)U+=`
12728
12728
  ${Y0.blue}${Y0.bold}Context:${Y0.reset}
12729
12729
  ${Y0.dim}${K}${Y0.reset}
12730
- `;return U}function FX(){B7.clear(),H7.clear(),I9.clear()}var B7,H7,I9,kO=0,Y0;var M0=b(()=>{N5();q3();G1();X1();E5();I4();E1();h6();N4();X$();UG();u5();B7=new Z5(500),H7=new Z5(1000),I9=new Z5(2000);Y0={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 qG($,Z,Y=""){let J=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),q=W?W[1]:"",U=K+G[0].length,z=1,j=U,H=-1;while(z>0&&j<$.length){let O=$.indexOf("@markdown",j),F=$.indexOf("@endmarkdown",j);if(F===-1)break;if(O!==-1&&O<F&&O!==K){let L=$[O+9];if(L==="("||L===`
12731
- `||L==="\r"||L===" "||L===void 0)z++;j=O+9}else{if(z--,z===0){H=F;break}j=F+12}}if(H===-1)continue;let B=$.slice(U,H),_=$.slice(K,H+12);X.push({fullMatch:_,options:q,content:B,index:K}),Q.lastIndex=H+12}for(let{fullMatch:K,options:W,content:q,index:U}of X)try{let z={};if(W)W.split(",").forEach((B)=>{let _=B.trim();if(_)z[_]=!0});let j={gfm:z.gfm??!0,breaks:z.breaks??!1},H=n1(q.trim(),j);J=J.split(K).join(H)}catch(z){let j=z instanceof Error?z.message:String(z),H=U0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,U,K);J=J.split(K).join(H)}return J}async function FG($,Z,Y,J){let X={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")X.breaks=!0;if(G==="no-gfm")X.gfm=!1}),n1($.trim(),X)}var M9=b(()=>{M0()});function dO($){if(uO.set($.name,$),$.client)mO.set($.name,$.client)}function _7($){return dO($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=lO(J,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let q=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(q)}}let K=Y;if($.transform)K=await $.transform(Y,G,X,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function lO($,Z){let Y={...Z};for(let J of $){let X=J.indexOf(":"),Q=J.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=J.slice(0,G).trim(),W=J.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var uO,mO;var E9=b(()=>{uO=new Map,mO=new Map});function k9($,Z=a5,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${m$($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function LG($,Z,Y=pO,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${m$($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function b9($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([X,Q])=>{let G=/^\d+$/.test(X)?`${X}px`:X;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((X,Q)=>X.numericBp-Q.numericBp).map(({bp:X,size:Q})=>`(max-width: ${X}) ${Q}`);return J.push(Z),J.join(", ")}function m$($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let J=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${J}`}function S9($){return cO[$]||"application/octet-stream"}var a5,pO,u$,cO;var y9=b(()=>{a5=[320,480,640,768,1024,1280,1536,1920,2560],pO=[1,1.5,2,3],u$=["avif","webp","jpeg"],cO={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function nO(){try{return await import("ts-images")}catch{return null}}async function sO($,Z={}){let Y={...iO,...Z},J=await nO();if(J)try{return await oO($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return rO($,Y)}async function oO($,Z,Y){let{generatePlaceholder:J,generateThumbHash:X}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await X($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function rO($,Z){let Y=Z.width||20,J=Z.height||Y,X="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function VG($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
12730
+ `;return U}function FX(){B7.clear(),H7.clear(),I9.clear()}var B7,H7,I9,kO=0,Y0;var M0=b(()=>{N5();q3();K1();Q1();E5();I4();E1();h6();N4();X$();UG();u5();B7=new Z5(500),H7=new Z5(1000),I9=new Z5(2000);Y0={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 qG($,Z,Y=""){let J=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),q=W?W[1]:"",U=K+G[0].length,z=1,j=U,H=-1;while(z>0&&j<$.length){let O=$.indexOf("@markdown",j),F=$.indexOf("@endmarkdown",j);if(F===-1)break;if(O!==-1&&O<F&&O!==K){let L=$[O+9];if(L==="("||L===`
12731
+ `||L==="\r"||L===" "||L===void 0)z++;j=O+9}else{if(z--,z===0){H=F;break}j=F+12}}if(H===-1)continue;let B=$.slice(U,H),_=$.slice(K,H+12);X.push({fullMatch:_,options:q,content:B,index:K}),Q.lastIndex=H+12}for(let{fullMatch:K,options:W,content:q,index:U}of X)try{let z={};if(W)W.split(",").forEach((B)=>{let _=B.trim();if(_)z[_]=!0});let j={gfm:z.gfm??!0,breaks:z.breaks??!1},H=n1(q.trim(),j);J=J.split(K).join(H)}catch(z){let j=z instanceof Error?z.message:String(z),H=z0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,U,K);J=J.split(K).join(H)}return J}async function FG($,Z,Y,J){let X={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")X.breaks=!0;if(G==="no-gfm")X.gfm=!1}),n1($.trim(),X)}var M9=b(()=>{M0()});function dO($){if(uO.set($.name,$),$.client)mO.set($.name,$.client)}function _7($){return dO($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=lO(J,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let q=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(q)}}let K=Y;if($.transform)K=await $.transform(Y,G,X,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function lO($,Z){let Y={...Z};for(let J of $){let X=J.indexOf(":"),Q=J.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=J.slice(0,G).trim(),W=J.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var uO,mO;var E9=b(()=>{uO=new Map,mO=new Map});function k9($,Z=a5,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${m$($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function LG($,Z,Y=pO,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${m$($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function b9($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([X,Q])=>{let G=/^\d+$/.test(X)?`${X}px`:X;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((X,Q)=>X.numericBp-Q.numericBp).map(({bp:X,size:Q})=>`(max-width: ${X}) ${Q}`);return J.push(Z),J.join(", ")}function m$($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let J=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${J}`}function S9($){return cO[$]||"application/octet-stream"}var a5,pO,u$,cO;var y9=b(()=>{a5=[320,480,640,768,1024,1280,1536,1920,2560],pO=[1,1.5,2,3],u$=["avif","webp","jpeg"],cO={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function nO(){try{return await import("ts-images")}catch{return null}}async function sO($,Z={}){let Y={...iO,...Z},J=await nO();if(J)try{return await oO($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return rO($,Y)}async function oO($,Z,Y){let{generatePlaceholder:J,generateThumbHash:X}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await X($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function rO($,Z){let Y=Z.width||20,J=Z.height||Y,X="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function VG($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
12732
12732
  #${$} {
12733
12733
  --stx-img-transition-duration: ${J}ms;
12734
12734
  --stx-img-transition-easing: ${X};
@@ -12774,7 +12774,7 @@ ${Y0.dim}${K}${Y0.reset}
12774
12774
  filter: blur(0);
12775
12775
  transform: scale(1);
12776
12776
  }
12777
- `.trim();P9=new Map});import{createHash as MG}from"crypto";import{readFile as aO,stat as NG}from"fs/promises";async function S0($){try{let Z=await aO($);return MG("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function AG($){return MG("sha256").update($).digest("hex").slice(0,16)}function O7($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${AG($)}-${AG(Y)}`}async function v9($){try{return(await NG($)).mtimeMs}catch{return 0}}async function k0($){try{return await NG($),!0}catch{return!1}}var H5=()=>{};import{mkdir as tO,readFile as eO,writeFile as $F,readdir as OD,rm as ZF,stat as FD}from"fs/promises";import{join as IG,dirname as YF}from"path";async function JF($){try{await tO($,{recursive:!0})}catch{}}function DG($,Z,Y){return IG($,Y,`${Z}.json`)}async function TG($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await v9(Z)!==$.srcMtime)return!1;return!0}async function F7($,Z,Y,J=x9){if(!J.enabled)return null;let X=O7($,Z),Q=t5.get(X);if(Q){if(await TG(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;t5.delete(X)}let G=DG(J.directory,X,Y);if(await k0(G))try{let K=await eO(G,"utf-8"),W=JSON.parse(K);if(await TG(W,$,J.maxAge))return W.lastAccessedAt=Date.now(),t5.set(X,W),W.data}catch{}return null}async function L7($,Z,Y,J,X=x9){if(!X.enabled)return;let Q=O7($,Z),G=await S0($),K=await v9($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:O7("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};t5.set(Q,W);let q=DG(X.directory,Q,J);try{await JF(YF(q)),await $F(q,JSON.stringify(W,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function V7($,Z=x9){if($==="all")t5.clear();else t5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=IG(Z.directory,J);try{await ZF(X,{recursive:!0,force:!0})}catch{}}}var t5,x9;var f9=b(()=>{H5();t5=new Map,x9={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class R7{config;constructor($={}){this.config={...XF,...$}}async get($,Z){return F7($,Z,"image",this.config)}async set($,Z,Y){return L7($,Z,Y,"image",this.config)}async clear(){return V7("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function g9($){if(!w7)w7=new R7($);else if($)w7.updateConfig($);return w7}async function A7($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return g9(J).get($,Z)}async function M7($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return g9(X).set($,Z,Y)}async function EG(){return g9().clear()}var XF,w7=null;var h9=b(()=>{f9();XF={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as QF,basename as GF,extname as KF,join as WF}from"path";import{mkdir as qF}from"fs/promises";async function u9(){try{return await import("ts-images")}catch{return null}}function kG($){switch($){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 UF($,Z){let Y=Z?kG(Z):kG("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function bG($,Z,Y){let J=await u9();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await A7($,Z,Y);if(X)return X;try{let Q=QF($);if(!await k0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=UF(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await qF(K,{recursive:!0});let q=await S0(Q),U=GF($,KF($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:q},H=null;if(Z.transformations&&Z.transformations.length>0)H=await m9(Q,Z.transformations,J);for(let B of z){let _=G[B]||{},O=`${U}-${q}.${B}`,F=WF(K,O);try{let L=await J.optimizeImage({input:H||Q,output:F,format:B,quality:_.quality,progressive:_.progressive});if(L){if(j.variants.push({path:F,url:`${W}/${O}`,width:L.width||0,height:L.height||0,format:B,size:L.outputSize||0}),!j.originalWidth&&L.width)j.originalWidth=L.width,j.originalHeight=L.height}}catch(L){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await J.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await J.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await M7($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function SG($,Z,Y,J){let X=await u9();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function m9($,Z,Y){let J=Y||await u9();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await J.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await J.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await J.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await J.sharpen(X,G.amount);break;case"grayscale":X=await J.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await J.rotate(X,G.angle);break;case"flip":X=await J.flip(X);break;case"flop":X=await J.flop(X);break;case"brightness":if(G.value!==void 0)X=await J.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await J.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await J.saturation(X,G.value);break}}return await J.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var yG=b(()=>{H5();h9()});import{resolve as zF,basename as jF,extname as BF,join as HF}from"path";import{mkdir as _F}from"fs/promises";async function OF(){try{return await import("ts-images")}catch{return null}}async function PG($,Z,Y){let J=await OF();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=zF($);if(!await k0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||FF,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await _F(K,{recursive:!0});let q=await S0(X),U=jF($,BF($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let _=[];for(let O of Q){let F=`${U}-${O}w-${q}.${B}`,L=HF(K,F),V=`${W}/${F}`;try{let w=z[B]?.quality||80;if(await k0(L)){j.byFormat[B].push({path:L,url:V,width:O,height:0,format:B,size:0}),_.push(`${V} ${O}w`);continue}let R=await J.processImage({input:X,output:L,format:B,quality:w,resize:{width:O}});if(R)j.byFormat[B].push({path:L,url:V,width:O,height:R.height||Math.round(O*(R.height||1)/(R.width||1)),format:B,size:R.outputSize||0}),_.push(`${V} ${O}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${O}w: ${w}`)}}j.srcsets[B]=_.join(", ")}let H=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(H!=="none")try{if(H==="thumbhash"){let B=await J.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await J.generatePlaceholder(X,{strategy:H,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:H}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||LF(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function LF($){let Z=[...$].sort((J,X)=>J-X),Y=[];for(let J=0;J<Z.length-1;J++){let X=Z[J];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function CG($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var FF;var vG=b(()=>{H5();FF=[320,480,640,768,1024,1280,1536,1920]});var xG={};a(xG,{setCachedImageResult:()=>M7,processImage:()=>bG,optimizeImage:()=>SG,getCachedImageResult:()=>A7,generateSrcset:()=>CG,generateResponsiveVariants:()=>PG,clearImageCache:()=>EG,applyTransformations:()=>m9,ImageProcessorCache:()=>R7});var fG=b(()=>{yG();vG();h9()});async function VF(){try{return await Promise.resolve().then(() => (fG(),xG))}catch($){if(!gG)console.warn("[stx-media] Image processor not available, some features disabled:",$),gG=!0;return null}}async function N7($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return MF(J,Y)}if(Y.processedResult?.processed)return c9($,Y.processedResult,Z);if(Y.responsiveVariants)return dG($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=a5,dpr:U,formats:z=u$,quality:j=d9,params:H={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":I7,decoding:V=T7,fetchpriority:w,objectFit:R,objectPosition:A,crossorigin:M,referrerpolicy:N}=$,I=$.class,T=$.style,k=$.id,D=$.data||{},{isDev:P=!1,baseUrl:y=""}=Z;if(P&&!Z.optimize)return AF($);let S,C,x=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!F)try{S=await wG(X,{strategy:B,..._}),C=VG(x,S,_)}catch{}let m=U!==void 0&&G!==void 0,l;if(m)l=RF($,x,S,Z);else l=await wF($,x,S,Z);let Q0;if(F){let o0=z.includes("webp")?"webp":z[0],p=k9(X,q,{...H,q:j},o0),_0=typeof W==="object"?b9(W):W||"100vw";Q0=`<link rel="preload" as="image" imagesrcset="${p}" imagesizes="${_0}" />`}let l0=[];if(!hG&&B!=="none")l0.push(C9),hG=!0;if(C)l0.push(C);let A0=O?mG(x):void 0;return{html:l,preloadLink:Q0,css:l0.length>0?l0.join(`
12777
+ `.trim();P9=new Map});import{createHash as MG}from"crypto";import{readFile as aO,stat as NG}from"fs/promises";async function S0($){try{let Z=await aO($);return MG("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function AG($){return MG("sha256").update($).digest("hex").slice(0,16)}function O7($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${AG($)}-${AG(Y)}`}async function v9($){try{return(await NG($)).mtimeMs}catch{return 0}}async function k0($){try{return await NG($),!0}catch{return!1}}var H5=()=>{};import{mkdir as tO,readFile as eO,writeFile as $F,readdir as OD,rm as ZF,stat as FD}from"fs/promises";import{join as IG,dirname as YF}from"path";async function JF($){try{await tO($,{recursive:!0})}catch{}}function DG($,Z,Y){return IG($,Y,`${Z}.json`)}async function TG($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await v9(Z)!==$.srcMtime)return!1;return!0}async function F7($,Z,Y,J=x9){if(!J.enabled)return null;let X=O7($,Z),Q=t5.get(X);if(Q){if(await TG(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;t5.delete(X)}let G=DG(J.directory,X,Y);if(await k0(G))try{let K=await eO(G,"utf-8"),W=JSON.parse(K);if(await TG(W,$,J.maxAge))return W.lastAccessedAt=Date.now(),t5.set(X,W),W.data}catch{}return null}async function L7($,Z,Y,J,X=x9){if(!X.enabled)return;let Q=O7($,Z),G=await S0($),K=await v9($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:O7("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};t5.set(Q,W);let q=DG(X.directory,Q,J);try{await JF(YF(q)),await $F(q,JSON.stringify(W,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function V7($,Z=x9){if($==="all")t5.clear();else t5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=IG(Z.directory,J);try{await ZF(X,{recursive:!0,force:!0})}catch{}}}var t5,x9;var f9=b(()=>{H5();t5=new Map,x9={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class R7{config;constructor($={}){this.config={...XF,...$}}async get($,Z){return F7($,Z,"image",this.config)}async set($,Z,Y){return L7($,Z,Y,"image",this.config)}async clear(){return V7("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function g9($){if(!w7)w7=new R7($);else if($)w7.updateConfig($);return w7}async function A7($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return g9(J).get($,Z)}async function M7($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return g9(X).set($,Z,Y)}async function EG(){return g9().clear()}var XF,w7=null;var h9=b(()=>{f9();XF={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as QF,basename as GF,extname as KF,join as WF}from"path";import{mkdir as qF}from"fs/promises";async function u9(){try{return await import("ts-images")}catch{return null}}function kG($){switch($){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 UF($,Z){let Y=Z?kG(Z):kG("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function bG($,Z,Y){let J=await u9();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await A7($,Z,Y);if(X)return X;try{let Q=QF($);if(!await k0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=UF(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await qF(K,{recursive:!0});let q=await S0(Q),U=GF($,KF($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:q},H=null;if(Z.transformations&&Z.transformations.length>0)H=await m9(Q,Z.transformations,J);for(let B of z){let _=G[B]||{},O=`${U}-${q}.${B}`,F=WF(K,O);try{let L=await J.optimizeImage({input:H||Q,output:F,format:B,quality:_.quality,progressive:_.progressive});if(L){if(j.variants.push({path:F,url:`${W}/${O}`,width:L.width||0,height:L.height||0,format:B,size:L.outputSize||0}),!j.originalWidth&&L.width)j.originalWidth=L.width,j.originalHeight=L.height}}catch(L){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await J.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await J.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await M7($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function SG($,Z,Y,J){let X=await u9();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function m9($,Z,Y){let J=Y||await u9();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await J.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await J.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await J.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await J.sharpen(X,G.amount);break;case"grayscale":X=await J.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await J.rotate(X,G.angle);break;case"flip":X=await J.flip(X);break;case"flop":X=await J.flop(X);break;case"brightness":if(G.value!==void 0)X=await J.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await J.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await J.saturation(X,G.value);break}}return await J.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var yG=b(()=>{H5();h9()});import{resolve as zF,basename as jF,extname as BF,join as HF}from"path";import{mkdir as _F}from"fs/promises";async function OF(){try{return await import("ts-images")}catch{return null}}async function PG($,Z,Y){let J=await OF();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=zF($);if(!await k0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||FF,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await _F(K,{recursive:!0});let q=await S0(X),U=jF($,BF($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let _=[];for(let O of Q){let F=`${U}-${O}w-${q}.${B}`,L=HF(K,F),V=`${W}/${F}`;try{let w=z[B]?.quality||80;if(await k0(L)){j.byFormat[B].push({path:L,url:V,width:O,height:0,format:B,size:0}),_.push(`${V} ${O}w`);continue}let R=await J.processImage({input:X,output:L,format:B,quality:w,resize:{width:O}});if(R)j.byFormat[B].push({path:L,url:V,width:O,height:R.height||Math.round(O*(R.height||1)/(R.width||1)),format:B,size:R.outputSize||0}),_.push(`${V} ${O}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${O}w: ${w}`)}}j.srcsets[B]=_.join(", ")}let H=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(H!=="none")try{if(H==="thumbhash"){let B=await J.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await J.generatePlaceholder(X,{strategy:H,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:H}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||LF(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function LF($){let Z=[...$].sort((J,X)=>J-X),Y=[];for(let J=0;J<Z.length-1;J++){let X=Z[J];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function CG($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var FF;var vG=b(()=>{H5();FF=[320,480,640,768,1024,1280,1536,1920]});var xG={};t(xG,{setCachedImageResult:()=>M7,processImage:()=>bG,optimizeImage:()=>SG,getCachedImageResult:()=>A7,generateSrcset:()=>CG,generateResponsiveVariants:()=>PG,clearImageCache:()=>EG,applyTransformations:()=>m9,ImageProcessorCache:()=>R7});var fG=b(()=>{yG();vG();h9()});async function VF(){try{return await Promise.resolve().then(() => (fG(),xG))}catch($){if(!gG)console.warn("[stx-media] Image processor not available, some features disabled:",$),gG=!0;return null}}async function N7($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return MF(J,Y)}if(Y.processedResult?.processed)return c9($,Y.processedResult,Z);if(Y.responsiveVariants)return dG($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=a5,dpr:U,formats:z=u$,quality:j=d9,params:H={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":I7,decoding:V=T7,fetchpriority:w,objectFit:R,objectPosition:A,crossorigin:M,referrerpolicy:N}=$,I=$.class,T=$.style,k=$.id,D=$.data||{},{isDev:P=!1,baseUrl:y=""}=Z;if(P&&!Z.optimize)return AF($);let S,C,x=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!F)try{S=await wG(X,{strategy:B,..._}),C=VG(x,S,_)}catch{}let m=U!==void 0&&G!==void 0,l;if(m)l=RF($,x,S,Z);else l=await wF($,x,S,Z);let G0;if(F){let o0=z.includes("webp")?"webp":z[0],p=k9(X,q,{...H,q:j},o0),_0=typeof W==="object"?b9(W):W||"100vw";G0=`<link rel="preload" as="image" imagesrcset="${p}" imagesizes="${_0}" />`}let l0=[];if(!hG&&B!=="none")l0.push(C9),hG=!0;if(C)l0.push(C);let A0=O?mG(x):void 0;return{html:l,preloadLink:G0,css:l0.length>0?l0.join(`
12778
12778
  `):void 0,script:A0}}async function wF($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=a5,formats:U=u$,quality:z=d9,params:j={},lazy:H=!0,priority:B=!1,loading:_=B?"eager":I7,decoding:O=T7,fetchpriority:F,objectFit:L,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,A=$.class,M=$.style,N=$.data||{},I=typeof W==="object"?b9(W):W||"100vw",T=[];for(let P of U){let y=k9(X,q,{...j,q:z},P),S=S9(P);if(H&&!B)T.push(` <source type="${S}" data-srcset="${y}" data-sizes="${I}" />`);else T.push(` <source type="${S}" srcset="${y}" sizes="${I}" />`)}let k=l9({src:m$(X,{...j,q:z}),alt:Q,width:G,height:K,loading:B?void 0:_,decoding:O,fetchpriority:B?"high":F,objectFit:L,objectPosition:V,crossorigin:w,referrerpolicy:R,className:uG(A,Y),style:p9(M,L,V,Y),lazy:H&&!B,data:N}),D;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
12779
12779
  <picture>
12780
12780
  ${T.join(`
@@ -12787,7 +12787,7 @@ ${T.join(`
12787
12787
  <img ${k} />
12788
12788
  </picture>`;return D}function RF($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,dpr:W=[1,2,3],quality:q=d9,params:U={},lazy:z=!0,priority:j=!1,loading:H=j?"eager":I7,decoding:B=T7,fetchpriority:_,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V}=$,w=$.class,R=$.style,A=$.data||{},M=typeof G==="number"?G:Number.parseInt(String(G),10),N=LG(X,M,W,{...U,q}),I=l9({src:m$(X,{...U,w:M,q}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:B,fetchpriority:j?"high":_,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V,className:uG(w,Y),style:p9(R,O,F,Y),lazy:z&&!j,data:A}),T=z&&!j?`data-srcset="${N}"`:`srcset="${N}"`;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
12789
12789
  <img ${I} ${T} />
12790
- </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${T} />`}function AF($){let{src:Z,alt:Y,width:J,height:X,loading:Q=I7,decoding:G=T7,fetchpriority:K,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:z,priority:j=!1}=$,H=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${l9({src:Z,alt:Y,width:J,height:X,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:z,className:H,style:p9(B,W,q),id:_,data:O})} />`}}function l9($){let Z=[];if($.lazy)Z.push(`data-src="${Z1($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${Z1($.src)}"`);if(Z.push(`alt="${Z1($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${Z1($.className)}"`);if($.style)Z.push(`style="${Z1($.style)}"`);if($.id)Z.push(`id="${Z1($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${Z1(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function uG($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function p9($,Z,Y,J){let X=[];if(Z)X.push(`object-fit: ${Z}`);if(Y)X.push(`object-position: ${Y}`);if(J)X.push("opacity: 0; transition: opacity 300ms ease-out");if($)X.push($);return X.join("; ")}function Z1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mG($){return`
12790
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${T} />`}function AF($){let{src:Z,alt:Y,width:J,height:X,loading:Q=I7,decoding:G=T7,fetchpriority:K,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:z,priority:j=!1}=$,H=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${l9({src:Z,alt:Y,width:J,height:X,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:z,className:H,style:p9(B,W,q),id:_,data:O})} />`}}function l9($){let Z=[];if($.lazy)Z.push(`data-src="${Y1($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${Y1($.src)}"`);if(Z.push(`alt="${Y1($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${Y1($.className)}"`);if($.style)Z.push(`style="${Y1($.style)}"`);if($.id)Z.push(`id="${Y1($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${Y1(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function uG($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function p9($,Z,Y,J){let X=[];if(Z)X.push(`object-fit: ${Z}`);if(Y)X.push(`object-position: ${Y}`);if(J)X.push("opacity: 0; transition: opacity 300ms ease-out");if($)X.push($);return X.join("; ")}function Y1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mG($){return`
12791
12791
  (function() {
12792
12792
  const container = document.getElementById('${$}');
12793
12793
  if (!container) return;
@@ -12824,7 +12824,7 @@ ${T.join(`
12824
12824
 
12825
12825
  observer.observe(container);
12826
12826
  })();
12827
- `.trim()}async function MF($,Z){let Y=await VF();if(!Y)return N7({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,J);if(Q)return dG($,Q,Z)}else{let Q=await Y.processImage($.src,$,J);if(Q.processed)return c9($,Q,Z)}return N7({...$,process:!1},Z)}async function c9($,Z,Y){let{alt:J,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:z}=$,j=$.class,H=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],F=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],L=F?.url||$.src,V=O.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of O){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],A=["avif","webp","jpeg","png"];for(let C of A){let x=w.get(C);if(x&&x.length>0){let m=x.map((Q0)=>`${Q0.url} ${Q0.width}w`).join(", "),l=S9(C);if(G&&!K)R.push(` <source type="${l}" data-srcset="${m}" />`);else R.push(` <source type="${l}" srcset="${m}" />`)}}let M=[];if(G&&!K){if(M.push(`data-src="${Z1(L)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)M.push(`data-srcset="${V}"`)}else if(M.push(`src="${Z1(L)}"`),V)M.push(`srcset="${V}"`);M.push(`alt="${Z1(J)}"`);let N=X||Z.originalWidth,I=Q||Z.originalHeight;if(N)M.push(`width="${N}"`);if(I)M.push(`height="${I}"`);if(!K)M.push(`loading="${G?"lazy":"eager"}"`);if(M.push('decoding="async"'),K)M.push('fetchpriority="high"');if(U)M.push(`crossorigin="${U}"`);if(z)M.push(`referrerpolicy="${z}"`);let T=[];if(W)T.push(`object-fit: ${W}`);if(q)T.push(`object-position: ${q}`);if(Z.placeholder&&G)T.push("opacity: 0; transition: opacity 300ms ease-out");if(H)T.push(H);if(T.length>0)M.push(`style="${T.join("; ")}"`);let k=[];if(j)k.push(j);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)M.push(`class="${k.join(" ")}"`);if(G&&!K)M.push("data-stx-lazy");for(let[C,x]of Object.entries(_))M.push(`data-${C}="${Z1(x)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${C}">
12827
+ `.trim()}async function MF($,Z){let Y=await VF();if(!Y)return N7({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,J);if(Q)return dG($,Q,Z)}else{let Q=await Y.processImage($.src,$,J);if(Q.processed)return c9($,Q,Z)}return N7({...$,process:!1},Z)}async function c9($,Z,Y){let{alt:J,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:q,crossorigin:U,referrerpolicy:z}=$,j=$.class,H=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],F=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],L=F?.url||$.src,V=O.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of O){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],A=["avif","webp","jpeg","png"];for(let C of A){let x=w.get(C);if(x&&x.length>0){let m=x.map((G0)=>`${G0.url} ${G0.width}w`).join(", "),l=S9(C);if(G&&!K)R.push(` <source type="${l}" data-srcset="${m}" />`);else R.push(` <source type="${l}" srcset="${m}" />`)}}let M=[];if(G&&!K){if(M.push(`data-src="${Y1(L)}"`),M.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)M.push(`data-srcset="${V}"`)}else if(M.push(`src="${Y1(L)}"`),V)M.push(`srcset="${V}"`);M.push(`alt="${Y1(J)}"`);let N=X||Z.originalWidth,I=Q||Z.originalHeight;if(N)M.push(`width="${N}"`);if(I)M.push(`height="${I}"`);if(!K)M.push(`loading="${G?"lazy":"eager"}"`);if(M.push('decoding="async"'),K)M.push('fetchpriority="high"');if(U)M.push(`crossorigin="${U}"`);if(z)M.push(`referrerpolicy="${z}"`);let T=[];if(W)T.push(`object-fit: ${W}`);if(q)T.push(`object-position: ${q}`);if(Z.placeholder&&G)T.push("opacity: 0; transition: opacity 300ms ease-out");if(H)T.push(H);if(T.length>0)M.push(`style="${T.join("; ")}"`);let k=[];if(j)k.push(j);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)M.push(`class="${k.join(" ")}"`);if(G&&!K)M.push("data-stx-lazy");for(let[C,x]of Object.entries(_))M.push(`data-${C}="${Y1(x)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${C}">
12828
12828
  <picture>
12829
12829
  ${R.join(`
12830
12830
  `)}
@@ -12865,7 +12865,7 @@ ${R.join(`
12865
12865
  </Representation>
12866
12866
  `}K+=` </AdaptationSet>
12867
12867
  `}return K+=` </Period>
12868
- </MPD>`,K}function sG($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(Y>0)X+=`${Y}M`;return X+=`${J}S`,X}var $K;var Z8=b(()=>{H5();$K=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as ZK,basename as bF,extname as SF,join as yF}from"path";import{mkdir as PF}from"fs/promises";async function YK(){try{return await import("ts-videos")}catch{return null}}function CF($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function vF($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function Y8($){let Z=await YK();if(!Z)return null;try{let Y=ZK($),X=await new Z.Input(Y).getInfo();return{duration:X.duration||0,width:X.width||0,height:X.height||0,frameRate:X.frameRate||0,bitrate:X.bitrate||0,codec:X.videoCodec||"",audioCodec:X.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function JK($,Z,Y,J){let X=await YK();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await k7($,Z,Y);if(Q)return Q;try{let G=ZK($);if(!await k0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await PF(K,{recursive:!0});let q=await S0(G),U=bF($,SF($)),z={src:$,processed:!0,hash:q};J?.({percentage:5,stage:"analyzing"}),z.metadata=await Y8(G)||void 0;let j={};if(Z.quality)j.bitrate=CF(Z.quality);if(Z.platform)Object.assign(j,vF(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let H=`${U}-${q}.mp4`,B=yF(K,H);try{let _=await xF(G,B,j,X,(O)=>J?.({percentage:10+O*0.5,stage:"transcoding"}));if(_)z.transcoded={path:B,url:`${W}/${H}`,duration:_.duration,size:_.size,video:{codec:j.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(_){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${_}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let H=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await y7(G,H,K,W);if(B)z.poster=B}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let H=await P7(G,Y.thumbnails,K,W);if(H.length>0)z.thumbnails=H}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let H=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(H.format==="hls"||H.format===void 0){let B=await v7(G,H.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)z.streaming={...z.streaming,hls:B}}if(H.format==="dash"){let B=await x7(G,H.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)z.streaming={...z.streaming,dash:B}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await b7($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function xF($,Z,Y,J,X){try{let G=await new J.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{X?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var XK=b(()=>{H5();s9();$8();Z8()});var QK={};a(QK,{setCachedVideoResult:()=>b7,processVideo:()=>JK,getCachedVideoResult:()=>k7,generateThumbnails:()=>P7,generateSpriteSheet:()=>nG,generatePoster:()=>y7,generateHLSManifest:()=>v7,generateDASHManifest:()=>x7,clearVideoCache:()=>iG,analyzeVideo:()=>Y8,VideoProcessorCache:()=>E7});var GK=b(()=>{XK();$8();Z8();s9()});async function WK(){try{return await Promise.resolve().then(() => (GK(),QK))}catch($){if(!KK)console.warn("[stx-media] Video processor not available, some features disabled:",$),KK=!0;return null}}async function f7($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return dF(J,Y)}if(Y.processedResult?.processed)return jK($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await lF(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:q=qK,autoplay:U=!1,muted:z=!1,loop:j=!1,preload:H=UK,playsinline:B=!0,lazy:_=!0,player:O="native",type:F,width:L,height:V,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,M=X||K,N=$.class,I=$.style,T=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return hF($,Z);if(F&&F!=="video")return gF(Q||"",F,$);let k=G.length>0?G:Q?[{src:Q,type:zK(Q)}]:[],D=[`id="${T}"`];if(q)D.push("controls");if(U)D.push("autoplay");if(z)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(R)D.push("disablepictureinpicture");if(A)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(_){if(D.push(`data-preload="${H}"`),D.push('preload="none"'),M)D.push(`data-poster="${R0(M)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${H}"`),M)D.push(`poster="${R0(M)}"`);if(L)D.push(`width="${L}"`);if(V)D.push(`height="${V}"`);if(N)D.push(`class="${R0(N)}"`);if(I)D.push(`style="${R0(I)}"`);let P=k.map((C)=>{return` <source ${_?`data-src="${R0(C.src)}"`:`src="${R0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
12868
+ </MPD>`,K}function sG($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(Y>0)X+=`${Y}M`;return X+=`${J}S`,X}var $K;var Z8=b(()=>{H5();$K=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as ZK,basename as bF,extname as SF,join as yF}from"path";import{mkdir as PF}from"fs/promises";async function YK(){try{return await import("ts-videos")}catch{return null}}function CF($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function vF($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function Y8($){let Z=await YK();if(!Z)return null;try{let Y=ZK($),X=await new Z.Input(Y).getInfo();return{duration:X.duration||0,width:X.width||0,height:X.height||0,frameRate:X.frameRate||0,bitrate:X.bitrate||0,codec:X.videoCodec||"",audioCodec:X.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function JK($,Z,Y,J){let X=await YK();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await k7($,Z,Y);if(Q)return Q;try{let G=ZK($);if(!await k0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await PF(K,{recursive:!0});let q=await S0(G),U=bF($,SF($)),z={src:$,processed:!0,hash:q};J?.({percentage:5,stage:"analyzing"}),z.metadata=await Y8(G)||void 0;let j={};if(Z.quality)j.bitrate=CF(Z.quality);if(Z.platform)Object.assign(j,vF(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let H=`${U}-${q}.mp4`,B=yF(K,H);try{let _=await xF(G,B,j,X,(O)=>J?.({percentage:10+O*0.5,stage:"transcoding"}));if(_)z.transcoded={path:B,url:`${W}/${H}`,duration:_.duration,size:_.size,video:{codec:j.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(_){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${_}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let H=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await y7(G,H,K,W);if(B)z.poster=B}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let H=await P7(G,Y.thumbnails,K,W);if(H.length>0)z.thumbnails=H}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let H=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(H.format==="hls"||H.format===void 0){let B=await v7(G,H.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)z.streaming={...z.streaming,hls:B}}if(H.format==="dash"){let B=await x7(G,H.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)z.streaming={...z.streaming,dash:B}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await b7($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function xF($,Z,Y,J,X){try{let G=await new J.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{X?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var XK=b(()=>{H5();s9();$8();Z8()});var QK={};t(QK,{setCachedVideoResult:()=>b7,processVideo:()=>JK,getCachedVideoResult:()=>k7,generateThumbnails:()=>P7,generateSpriteSheet:()=>nG,generatePoster:()=>y7,generateHLSManifest:()=>v7,generateDASHManifest:()=>x7,clearVideoCache:()=>iG,analyzeVideo:()=>Y8,VideoProcessorCache:()=>E7});var GK=b(()=>{XK();$8();Z8();s9()});async function WK(){try{return await Promise.resolve().then(() => (GK(),QK))}catch($){if(!KK)console.warn("[stx-media] Video processor not available, some features disabled:",$),KK=!0;return null}}async function f7($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return dF(J,Y)}if(Y.processedResult?.processed)return jK($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await lF(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:q=qK,autoplay:U=!1,muted:z=!1,loop:j=!1,preload:H=UK,playsinline:B=!0,lazy:_=!0,player:O="native",type:F,width:L,height:V,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,M=X||K,N=$.class,I=$.style,T=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return hF($,Z);if(F&&F!=="video")return gF(Q||"",F,$);let k=G.length>0?G:Q?[{src:Q,type:zK(Q)}]:[],D=[`id="${T}"`];if(q)D.push("controls");if(U)D.push("autoplay");if(z)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(R)D.push("disablepictureinpicture");if(A)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(_){if(D.push(`data-preload="${H}"`),D.push('preload="none"'),M)D.push(`data-poster="${R0(M)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${H}"`),M)D.push(`poster="${R0(M)}"`);if(L)D.push(`width="${L}"`);if(V)D.push(`height="${V}"`);if(N)D.push(`class="${R0(N)}"`);if(I)D.push(`style="${R0(I)}"`);let P=k.map((C)=>{return` <source ${_?`data-src="${R0(C.src)}"`:`src="${R0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
12869
12869
  `),y=`<video ${D.join(" ")}>
12870
12870
  ${P}
12871
12871
  Your browser does not support the video tag.
@@ -13476,7 +13476,7 @@ ${U}
13476
13476
  customElements.define('${Z}', ${G});
13477
13477
  `}async function LK($,Z,Y,J){if(Z.length<1)return Z0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[d$.join(d$.dirname(J),G,`${X}.stx`),d$.join(process.cwd(),G,`${X}.stx`),d$.join(d$.dirname(J),`${X}.stx`)],W=null;for(let z of K)if(await i(z)){W=await Bun.file(z).text();break}if(!W)return Z0("WebComponent",`Component file not found: ${X}.stx`,o.FILE_NOT_FOUND);let q=$L(W,X);return`<script type="module">
13478
13478
  ${ZL(q)}
13479
- </script>`}var VK=b(()=>{V1();M0()});var wK={};a(wK,{timingPlugin:()=>GL,pluginManager:()=>YL,definePlugin:()=>g7,debugPlugin:()=>QL,createVariablesPlugin:()=>KL,createFilterPlugin:()=>XL,createDirectivePlugin:()=>JL,PluginManager:()=>Q8});function g7($){return $}class Q8{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let X=J[$];if(X)try{let Q=await X(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return J}}function JL($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function XL($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function KL($){return g7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var YL,QL,GL;var RK=b(()=>{YL=new Q8;QL=g7({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),GL=g7({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var J2={};a(J2,{validateConfig:()=>HL,resolveStxDirectories:()=>NK,loadStxConfig:()=>u1,defineStxConfig:()=>BL,defaultConfig:()=>R1,config:()=>z$});import h7 from"fs";import d0 from"path";import{loadConfigWithResult as WL}from"bunfig";function qL($,Z,Y){let J=Z||"pages";if($)return{root:$,pagesDir:J};let X=Y||process.cwd(),Q=d0.join(X,"resources","views"),G=d0.join(X,"resources","layouts");if(h7.existsSync(Q)&&h7.existsSync(G))return{root:"resources",pagesDir:"views"};let K=d0.join(X,"resources","views","pages");if(h7.existsSync(K))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}function UL($,Z){let Y=Z.replace(/[\\/]+$/,"");if(!Y||Y===".")return!0;let J=$.replace(/\\/g,"/"),X=Y.replace(/\\/g,"/");return J===X||J.startsWith(`${X}/`)}function NK($,Z){let Y=!$.root,J=qL($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,Y&&J.root!=="."){let X=`${Z}::${J.root}`;if(!AK.has(X))AK.add(X),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let X=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(d0.isAbsolute(G)||UL(G,X))continue;$[Q]=d0.join(X,G)}}return $}function zL($,Z){let Y=["componentsDir","layoutsDir","partialsDir"];for(let J of Y){let X=$[J];if(typeof X!=="string"||!X)continue;let Q=d0.isAbsolute(X)?X:d0.join(Z,X);if(h7.existsSync(Q))continue;let G=$.root,K=!!G&&G!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${X}"`+(K?`, resolved under root "${G}".`:"."))}}function jL($){if(GZ($.stateDir),$.stateDir=G$(),$.cachePath=W$($.cachePath),$.build)$.build.cacheDir=W$($.build.cacheDir);if($.media?.cache)$.media.cache.directory=W$($.media.cache.directory);if($.story)$.story.outDir=W$($.story.outDir)}async function u1($){if(!$){if(e5)return e5;if(u7)return u7}let Z=$?d0.resolve($):process.cwd(),Y=MK.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await WL({name:"stx",alias:"ui",cwd:Z,defaultConfig:R1,verbose:!1})).config;if(jL(Q),NK(Q,Z),zL(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await Promise.resolve().then(() => (RK(),wK)),K=[],W=[];for(let q of Q.plugins){let U=typeof q==="string"?q:q[0],z=typeof q==="string"?{}:q[1]||{};try{let j,H;try{j=await import(U),H=d0.dirname(t.resolve(U))}catch{let _=d0.resolve(process.cwd(),U);j=await import(_),H=d0.dirname(_)}let B=j.default||j;if(G.register(B,Q),B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)K.push(d0.resolve(H,O))}if(B.pages){let _=d0.resolve(H,B.pages),O=z.path||"/";W.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,F)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=F},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:H,config:Q};await B.setup(z,_)}console.log(`[stx] Plugin loaded: ${B.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}Q._pluginComponentDirs=K,Q._pluginPageDirs=W}return Q})();if(MK.set(Z,J),!$)u7=J,J.then((X)=>{e5=X}).catch(()=>{});return J}function BL($){return $}function HL($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${X}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((X,Q)=>{if(!X.pattern||typeof X.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(X.maxAgeSeconds!==void 0&&(typeof X.maxAgeSeconds!=="number"||X.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(X.maxEntries!==void 0&&(typeof X.maxEntries!=="number"||X.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((X)=>typeof X!=="number"||X<16||X>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var R1,AK,e5=null,MK,u7=null,z$;var O1=b(()=>{s7();o7();r7();a7();M9();cG();X8();FK();v6();o$();VK();R1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:A5,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:FG,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:LK,hasEndTag:!1,description:"Include a web component in the template"},y8,P8,DJ,EJ,C8,x8,f8,v8,m8,p8,pG,J8,...OK],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};AK=new Set;MK=new Map;z$=new Proxy(R1,{get($,Z){if(e5&&Z in e5)return e5[Z];if(!u7)u1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var xL=`
13479
+ </script>`}var VK=b(()=>{V1();M0()});var wK={};t(wK,{timingPlugin:()=>GL,pluginManager:()=>YL,definePlugin:()=>g7,debugPlugin:()=>QL,createVariablesPlugin:()=>KL,createFilterPlugin:()=>XL,createDirectivePlugin:()=>JL,PluginManager:()=>Q8});function g7($){return $}class Q8{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let X=J[$];if(X)try{let Q=await X(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return J}}function JL($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function XL($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function KL($){return g7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var YL,QL,GL;var RK=b(()=>{YL=new Q8;QL=g7({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),GL=g7({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var J2={};t(J2,{validateConfig:()=>HL,resolveStxDirectories:()=>NK,loadStxConfig:()=>u1,defineStxConfig:()=>BL,defaultConfig:()=>R1,config:()=>z$});import h7 from"fs";import d0 from"path";import{loadConfigWithResult as WL}from"bunfig";function qL($,Z,Y){let J=Z||"pages";if($)return{root:$,pagesDir:J};let X=Y||process.cwd(),Q=d0.join(X,"resources","views"),G=d0.join(X,"resources","layouts");if(h7.existsSync(Q)&&h7.existsSync(G))return{root:"resources",pagesDir:"views"};let K=d0.join(X,"resources","views","pages");if(h7.existsSync(K))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}function UL($,Z){let Y=Z.replace(/[\\/]+$/,"");if(!Y||Y===".")return!0;let J=$.replace(/\\/g,"/"),X=Y.replace(/\\/g,"/");return J===X||J.startsWith(`${X}/`)}function NK($,Z){let Y=!$.root,J=qL($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,Y&&J.root!=="."){let X=`${Z}::${J.root}`;if(!AK.has(X))AK.add(X),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let X=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(d0.isAbsolute(G)||UL(G,X))continue;$[Q]=d0.join(X,G)}}return $}function zL($,Z){let Y=["componentsDir","layoutsDir","partialsDir"];for(let J of Y){let X=$[J];if(typeof X!=="string"||!X)continue;let Q=d0.isAbsolute(X)?X:d0.join(Z,X);if(h7.existsSync(Q))continue;let G=$.root,K=!!G&&G!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${X}"`+(K?`, resolved under root "${G}".`:"."))}}function jL($){if(GZ($.stateDir),$.stateDir=G$(),$.cachePath=W$($.cachePath),$.build)$.build.cacheDir=W$($.build.cacheDir);if($.media?.cache)$.media.cache.directory=W$($.media.cache.directory);if($.story)$.story.outDir=W$($.story.outDir)}async function u1($){if(!$){if(e5)return e5;if(u7)return u7}let Z=$?d0.resolve($):process.cwd(),Y=MK.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await WL({name:"stx",alias:"ui",cwd:Z,defaultConfig:R1,verbose:!1})).config;if(jL(Q),NK(Q,Z),zL(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await Promise.resolve().then(() => (RK(),wK)),K=[],W=[];for(let q of Q.plugins){let U=typeof q==="string"?q:q[0],z=typeof q==="string"?{}:q[1]||{};try{let j,H;try{j=await import(U),H=d0.dirname(e.resolve(U))}catch{let _=d0.resolve(process.cwd(),U);j=await import(_),H=d0.dirname(_)}let B=j.default||j;if(G.register(B,Q),B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)K.push(d0.resolve(H,O))}if(B.pages){let _=d0.resolve(H,B.pages),O=z.path||"/";W.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,F)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=F},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:H,config:Q};await B.setup(z,_)}console.log(`[stx] Plugin loaded: ${B.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}Q._pluginComponentDirs=K,Q._pluginPageDirs=W}return Q})();if(MK.set(Z,J),!$)u7=J,J.then((X)=>{e5=X}).catch(()=>{});return J}function BL($){return $}function HL($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${X}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((X,Q)=>{if(!X.pattern||typeof X.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(X.maxAgeSeconds!==void 0&&(typeof X.maxAgeSeconds!=="number"||X.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(X.maxEntries!==void 0&&(typeof X.maxEntries!=="number"||X.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((X)=>typeof X!=="number"||X<16||X>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var R1,AK,e5=null,MK,u7=null,z$;var O1=b(()=>{s7();o7();r7();a7();M9();cG();X8();FK();v6();o$();VK();R1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:A5,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:FG,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:LK,hasEndTag:!1,description:"Include a web component in the template"},y8,P8,DJ,EJ,C8,x8,f8,v8,m8,p8,pG,J8,...OK],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};AK=new Set;MK=new Map;z$=new Proxy(R1,{get($,Z){if(e5&&Z in e5)return e5[Z];if(!u7)u1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var xL=`
13480
13480
  <script>
13481
13481
  (function() {
13482
13482
  'use strict';
@@ -16444,7 +16444,7 @@ ${Y} `)}]`:"";return`Craft.create("${$.zigType}", ${X}${G})`}function tK($,Z,
16444
16444
  `),hydrationData:Q,metadata:{renderTime:G,cacheHit:!1,totalSize:X.length,componentCount:$.metadata.componentCount}}}function sL($,Z){let Y=[],J=[],X=[],Q=new Map,G=[];return J$($.tree,(K,W)=>{if(K.type==="component"&&K.componentName){if(b8(K.componentName))Y.push(K.componentName)}if(K.type==="element"&&K.tag){let q=PW(K);if(q)G.push(q);if(K.props){for(let[U,z]of Object.entries(K.props))if(U.startsWith("on")&&typeof z==="string"){let j=`handler_${Q.size}`;Q.set(j,z)}}}if(K.isStatic&&K.type==="element")J.push(I8(K));else if(!K.isStatic&&K.type!=="text")X.push(K.tag||K.componentName||"unknown")}),{nativeComponents:Y,staticHTML:J,dynamicParts:X,eventHandlers:Q,nativeWidgets:G}}function oL($,Z={}){let Y=FW($),J=RW(Y,Z),X=new Map,Q=[];return J$(Y.tree,(G)=>{if(G.type==="component"&&G.componentName){if(b8(G.componentName)){Q.push(G.componentName);let K=`<!--craft:${G.componentName}:${G.hydrationKey||"default"}-->`;X.set(G.hydrationKey||G.componentName,K)}}}),{staticHTML:J,dynamicPlaceholders:X,craftComponents:Q}}function LW($){let Z={type:"fragment",children:[]},Y=Z,J=[Z],X=$,Q=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(X.length>0){let G=X.match(/^<(@?[\w-]+)([^>]*)>/);if(G){let[q,U,z]=G,j=VW(z),H=U.startsWith("@craft-"),B=H?U:U.toLowerCase(),_={type:H?"component":"element",tag:B,props:j,children:[],componentName:H?B.slice(1):void 0,isStatic:!N8(z),hydrationKey:yW()};if(Y.children=Y.children||[],Y.children.push(_),!Q.has(B)&&!z.endsWith("/"))J.push(_),Y=_;X=X.slice(q.length);continue}let K=X.match(/^<\/(@?[\w-]+)>/);if(K){let[q,U]=K,j=U.startsWith("@craft-")?U:U.toLowerCase();while(J.length>1){let H=J.pop();if(Y=J[J.length-1],H.tag===j)break}X=X.slice(q.length);continue}let W=X.match(/^[^<]+/);if(W){let q=W[0];if(q.trim()){let U={type:"text",text:q,isStatic:!N8(q)};Y.children=Y.children||[],Y.children.push(U)}X=X.slice(q.length);continue}X=X.slice(1)}return Z}function VW($){let Z={},Y=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,J;while((J=Y.exec($))!==null){let[,X,Q,G,K]=J,W=Q??G??K??!0;Z[X]=W}return Z}function J$($,Z,Y=[]){if(Z($,Y),$.children)$.children.forEach((J,X)=>{J$(J,Z,[...Y,`${X}`])})}function Y$($,Z){switch($.type){case"text":return E8($.text||"",Z);case"element":case"component":{let Y=$.tag||"div",J=D8($.props||{},Z),X=($.children||[]).map((Q)=>Y$(Q,Z)).join("");if(!$.children||$.children.length===0){if(["input","br","hr","img","meta","link"].includes(Y))return`<${Y}${J} />`}return`<${Y}${J}>${X}</${Y}>`}case"fragment":return($.children||[]).map((Y)=>Y$(Y,Z)).join("");case"slot":return`<!--slot:${$.slotName||"default"}-->`;default:return""}}function I8($){if($.type==="text")return $.text||"";let Z=$.tag||"div",Y=D8($.props||{},{});return`<${Z}${Y}></${Z}>`}function D8($,Z){let Y=[];for(let[J,X]of Object.entries($))if(X===!0)Y.push(` ${J}`);else if(X!==!1&&X!==null&&X!==void 0){let Q=E8(String(X),Z);Y.push(` ${J}="${k8(Q)}"`)}return Y.join("")}async function wW($,Z){return Y$($,Z)}function RW($,Z){let Y=[];return J$($.tree,(J)=>{if(J.isStatic)Y.push(Y$(J,Z))}),Y.join("")}function AW($,Z,Y){let J={templateId:Z.id,context:Y,dynamicParts:Array.from(Z.dynamicParts.entries())},X=`
16445
16445
  <script data-craft-hydration>
16446
16446
  window.__CRAFT_HYDRATION__ = ${JSON.stringify(J)};
16447
- </script>`;return{html:$+X,data:J}}function MW($){let Z=!1,Y=!1,J=!1,X=!1,Q=0,G=0;function K(W,q){if(G=Math.max(G,q),W.type==="slot")Z=!0;if(W.type==="component")Q++;if(!W.isStatic)Y=!0;if(W.props)for(let U of Object.keys(W.props)){if(U.startsWith("on"))J=!0;if(U==="@async"||U==="data-async")X=!0}if(W.children)W.children.forEach((U)=>K(U,q+1))}return K($,0),{hasSlots:Z,hasDynamicContent:Y,hasEventHandlers:J,hasAsyncContent:X,componentCount:Q,maxDepth:G,estimatedSize:JSON.stringify($).length}}function NW($){let Z=new Map,Y=new Map;return J$($,(J,X)=>{let Q=X.join(".");if(J.isStatic)Z.set(Q,I8(J));else Y.set(Q,J.tag||J.componentName||"dynamic")}),{staticParts:Z,dynamicParts:Y}}function TW($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec($))!==null)Z.push(J[1]);return Z}function IW($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,J;while((J=Y.exec($))!==null)Z.push(J[1]);return Z}function DW($){let Z=[],Y=/@include\s*\(\s*['"]([^'"]+)['"]/g,J;while((J=Y.exec($))!==null)Z.push(J[1]);let X=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((J=X.exec($))!==null)Z.push(J[1]);let Q=/<@craft-[\w-]+/g;while((J=Q.exec($))!==null)Z.push(J[0].slice(2));return[...new Set(Z)]}function N8($){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test($)}function E8($,Z){let Y=$.replace(/\{\{\s*(.+?)\s*\}\}/g,(J,X)=>{try{let Q=T8(X.trim(),Z);return k8(String(Q??""))}catch{return""}});return Y=Y.replace(/\{!!\s*(.+?)\s*!!\}/g,(J,X)=>{try{let Q=T8(X.trim(),Z);return String(Q??"")}catch{return""}}),Y}function T8($,Z){if(/^[\w.]+$/.test($)){let Y=$.split("."),J=Z;for(let X of Y)if(J&&typeof J==="object"&&X in J)J=J[X];else return;return J}try{return Function(...Object.keys(Z),`return ${$}`)(...Object.values(Z))}catch{return}}function k8($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function EW($){return $.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function kW($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return`tpl_${Math.abs(Z).toString(36)}`}function bW($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return Math.abs(Z).toString(36)}var SW=0;function yW(){return`h_${++SW}`}function b8($){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($)}function PW($){let Z=$.tag?.toLowerCase(),Y=$.props?.type,J={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"}},X=Y?`${Z}:${Y}`:Z,Q=J[X||""]||J[Z||""];if(Q)return{htmlSelector:X||Z||"",nativeComponent:Q.component,confidence:Q.confidence,reason:Q.reason};return null}function CW(){$$.clear()}function vW(){Z$.clear()}function rL(){CW(),vW()}function aL(){return{templateCacheSize:$$.size,renderCacheSize:Z$.size,totalEntries:$$.size+Z$.size}}import{existsSync as SK,mkdirSync as s0,copyFileSync as p1,chmodSync as c1}from"fs";import{join as g,basename as VL}from"path";import{spawn as d7,execSync as wL}from"child_process";import{tmpdir as yK,homedir as K8,platform as RL}from"os";O1();u5();I4();N5();N4();import{dirname as OL,resolve as DK}from"path";function TK($){return $.endsWith(".md")||$.endsWith(".markdown")}function _L($){let Z=[];J(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let Y=[...Z];J(/<code\b[^>]*>[\s\S]*?<\/code>/gi,Y);function J(G,K){let W;while((W=G.exec($))!==null){let q=W.index,U=q+W[0].length;if(K?.some((z)=>q>=z.start&&U<=z.end))continue;Z.push({start:q,end:U})}}if(Z.length===0)return $;Z.sort((G,K)=>G.start-K.start);let X="",Q=0;for(let G of Z){if(G.start<Q)continue;X+=$.slice(Q,G.start),X+=`@raw${$.slice(G.start,G.end)}@endraw`,Q=G.end}return X+=$.slice(Q),X}async function IK($,Z={}){let{data:Y,content:J}=n$($),Q=await(Z.renderer??((G)=>n1(G)))(J);return{html:_L(Q),frontmatter:Y??{}}}function FL($){let Z=$,Y=P5($);if(Y)Z=Y.content.trim();let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X=[],Q=[],G=[],K=(U)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(U),W;while((W=J.exec($))!==null){let U=W[1],z=W[2],j=W[0],H=U.includes("server");if(K(z))G.push(j);else if(H)Q.push(z);else X.push(j)}let q=Z;{let U=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,z,j=[];while((z=U.exec(q))!==null){let H=z.index+z[0].length,B=1,_=H;while(_<q.length&&B>0){let O=q.indexOf("<script",_),F=q.indexOf("</script>",_);if(F===-1)break;if(O!==-1&&O<F)B++,_=O+7;else{if(B--,B===0){j.push({start:z.index,end:F+9});break}_=F+9}}}for(let H=j.length-1;H>=0;H--)q=q.substring(0,j[H].start)+q.substring(j[H].end)}for(let U of X)q=q.replace(U,"");return{templateContent:q,serverScripts:Q,clientScripts:X,signalsScripts:G}}function LL($,Z){return`<!DOCTYPE html>
16447
+ </script>`;return{html:$+X,data:J}}function MW($){let Z=!1,Y=!1,J=!1,X=!1,Q=0,G=0;function K(W,q){if(G=Math.max(G,q),W.type==="slot")Z=!0;if(W.type==="component")Q++;if(!W.isStatic)Y=!0;if(W.props)for(let U of Object.keys(W.props)){if(U.startsWith("on"))J=!0;if(U==="@async"||U==="data-async")X=!0}if(W.children)W.children.forEach((U)=>K(U,q+1))}return K($,0),{hasSlots:Z,hasDynamicContent:Y,hasEventHandlers:J,hasAsyncContent:X,componentCount:Q,maxDepth:G,estimatedSize:JSON.stringify($).length}}function NW($){let Z=new Map,Y=new Map;return J$($,(J,X)=>{let Q=X.join(".");if(J.isStatic)Z.set(Q,I8(J));else Y.set(Q,J.tag||J.componentName||"dynamic")}),{staticParts:Z,dynamicParts:Y}}function TW($){let Z=[],Y=/<script[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec($))!==null)Z.push(J[1]);return Z}function IW($){let Z=[],Y=/<style[^>]*>([\s\S]*?)<\/style>/gi,J;while((J=Y.exec($))!==null)Z.push(J[1]);return Z}function DW($){let Z=[],Y=/@include\s*\(\s*['"]([^'"]+)['"]/g,J;while((J=Y.exec($))!==null)Z.push(J[1]);let X=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((J=X.exec($))!==null)Z.push(J[1]);let Q=/<@craft-[\w-]+/g;while((J=Q.exec($))!==null)Z.push(J[0].slice(2));return[...new Set(Z)]}function N8($){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test($)}function E8($,Z){let Y=$.replace(/\{\{\s*(.+?)\s*\}\}/g,(J,X)=>{try{let Q=T8(X.trim(),Z);return k8(String(Q??""))}catch{return""}});return Y=Y.replace(/\{!!\s*(.+?)\s*!!\}/g,(J,X)=>{try{let Q=T8(X.trim(),Z);return String(Q??"")}catch{return""}}),Y}function T8($,Z){if(/^[\w.]+$/.test($)){let Y=$.split("."),J=Z;for(let X of Y)if(J&&typeof J==="object"&&X in J)J=J[X];else return;return J}try{return Function(...Object.keys(Z),`return ${$}`)(...Object.values(Z))}catch{return}}function k8($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function EW($){return $.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function kW($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return`tpl_${Math.abs(Z).toString(36)}`}function bW($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return Math.abs(Z).toString(36)}var SW=0;function yW(){return`h_${++SW}`}function b8($){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($)}function PW($){let Z=$.tag?.toLowerCase(),Y=$.props?.type,J={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"}},X=Y?`${Z}:${Y}`:Z,Q=J[X||""]||J[Z||""];if(Q)return{htmlSelector:X||Z||"",nativeComponent:Q.component,confidence:Q.confidence,reason:Q.reason};return null}function CW(){$$.clear()}function vW(){Z$.clear()}function rL(){CW(),vW()}function aL(){return{templateCacheSize:$$.size,renderCacheSize:Z$.size,totalEntries:$$.size+Z$.size}}import{existsSync as SK,mkdirSync as s0,copyFileSync as p1,chmodSync as c1}from"fs";import{join as h,basename as VL}from"path";import{spawn as d7,execSync as wL}from"child_process";import{tmpdir as yK,homedir as K8,platform as RL}from"os";O1();u5();I4();N5();N4();import{dirname as OL,resolve as DK}from"path";function TK($){return $.endsWith(".md")||$.endsWith(".markdown")}function _L($){let Z=[];J(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let Y=[...Z];J(/<code\b[^>]*>[\s\S]*?<\/code>/gi,Y);function J(G,K){let W;while((W=G.exec($))!==null){let q=W.index,U=q+W[0].length;if(K?.some((z)=>q>=z.start&&U<=z.end))continue;Z.push({start:q,end:U})}}if(Z.length===0)return $;Z.sort((G,K)=>G.start-K.start);let X="",Q=0;for(let G of Z){if(G.start<Q)continue;X+=$.slice(Q,G.start),X+=`@raw${$.slice(G.start,G.end)}@endraw`,Q=G.end}return X+=$.slice(Q),X}async function IK($,Z={}){let{data:Y,content:J}=n$($),Q=await(Z.renderer??((G)=>n1(G)))(J);return{html:_L(Q),frontmatter:Y??{}}}function FL($){let Z=$,Y=P5($);if(Y)Z=Y.content.trim();let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X=[],Q=[],G=[],K=(U)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(U),W;while((W=J.exec($))!==null){let U=W[1],z=W[2],j=W[0],H=U.includes("server");if(K(z))G.push(j);else if(H)Q.push(z);else X.push(j)}let q=Z;{let U=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,z,j=[];while((z=U.exec(q))!==null){let H=z.index+z[0].length,B=1,_=H;while(_<q.length&&B>0){let O=q.indexOf("<script",_),F=q.indexOf("</script>",_);if(F===-1)break;if(O!==-1&&O<F)B++,_=O+7;else{if(B--,B===0){j.push({start:z.index,end:F+9});break}_=F+9}}}for(let H=j.length-1;H>=0;H--)q=q.substring(0,j[H].start)+q.substring(j[H].end)}for(let U of X)q=q.replace(U,"");return{templateContent:q,serverScripts:Q,clientScripts:X,signalsScripts:G}}function LL($,Z){return`<!DOCTYPE html>
16448
16448
  <html lang="en">
16449
16449
  <head>
16450
16450
  <meta charset="UTF-8">
@@ -16459,15 +16459,15 @@ ${Q.join(`
16459
16459
  `)}`}else{if(Y.processClientScripts!==!1&&Q.length>0){let U=K.__stx_event_bindings||[],z=r1(K),H=(await Promise.all(Q.map(async(_)=>{let O=_.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!O)return _;return await a1(O[1],{eventBindings:U,templateContent:q,serverData:z,filePath:Z})}))).join(`
16460
16460
  `);if(q.match(/(<\/body>)/i))q=q.replace(/(<\/body>)/i,`${H}
16461
16461
  $1`);else q+=`
16462
- ${H}`}q=await Z9(q)}if(Y.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=LL(q,Y.title)}if(Y.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (V3(),Y2));q=await U(q)}catch{}return q}async function Zk($){let Z=Date.now();try{if(!await Bun.file($.input).exists())return{success:!1,target:$.target||m7(),format:$.format||"app",error:`Input file not found: ${$.input}`};let Y=$.target||m7(),J=$.format||bL(Y),X=$.output||g(process.cwd(),"dist","native");if(!SK(X))s0(X,{recursive:!0});let Q=await kK($.input,{context:$.context,options:{isDev:!1}});if(Q=U8(Q,{debug:$.verbose}),Q=w8(Q),!Q.includes("craft-component-styles")){if(Q.includes("</head>"))Q=Q.replace("</head>",`${V8}
16463
- </head>`)}let G=$.name||VL($.input,".stx"),K=$.version||"1.0.0",W=$.craftPath||await kL();if(!W)return{success:!1,target:Y,format:J,error:"Craft binary not found. Please install Craft or specify craftPath."};if($.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Y}...`),console.log(` Input: ${$.input}`),console.log(` Output: ${X}`),console.log(` Craft: ${W}`);let q;switch(Y){case"macos":q=await AL(Q,G,K,X,J,$,W);break;case"windows":q=await TL(Q,G,K,X,J,$,W);break;case"linux":q=await IL(Q,G,K,X,J,$,W);break;case"ios":q=await DL(Q,G,K,X,$,W);break;case"android":q=await EL(Q,G,K,X,$,W);break;default:q={success:!1,target:Y,format:J,error:`Unsupported target: ${Y}`}}return q.duration=Date.now()-Z,q}catch(Y){return{success:!1,target:$.target||m7(),format:$.format||"app",error:Y.message,duration:Date.now()-Z}}}async function AL($,Z,Y,J,X,Q,G){let K=Q.bundleId||`com.stx.${Z.toLowerCase().replace(/[^a-z0-9]/g,"")}`,W=g(J,`${Z}.app`),q=g(W,"Contents"),U=g(q,"MacOS"),z=g(q,"Resources");s0(U,{recursive:!0}),s0(z,{recursive:!0});let j=g(z,"index.html");await Bun.write(j,$);let H="";if(Q.sidebar?.enabled&&Q.sidebar?.config)H=g(z,"sidebar-config.json"),await Bun.write(H,JSON.stringify(Q.sidebar.config));let B=Q.sidebar?.enabled?`--native-sidebar --sidebar-width ${Q.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",_=Q.menubarOnly??Q.systemTray;if((Q.bundleStyle||(await ML(G)?"executable":"launcher"))==="executable"){let V=g(U,Z);p1(G,V),c1(V,493);let w={html:"index.html",title:Q.window?.title||Z,width:Q.window?.width||1200,height:Q.window?.height||800,devTools:Boolean(Q.devTools)};if(_)w.menubarOnly=!0;else if(Q.systemTray)w.systemTray=!0;if(Q.window?.frameless)w.frameless=!0;if(Q.window?.transparent)w.transparent=!0;if(Q.window?.alwaysOnTop)w.alwaysOnTop=!0;if(Q.window?.resizable===!1)w.resizable=!1;await Bun.write(g(z,"craft.json"),`${JSON.stringify(w,null,2)}
16464
- `)}else{let V=g(U,"craft");p1(G,V),c1(V,493);let w=Q.sidebar?.enabled?`--native-sidebar --sidebar-width ${Q.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",A=`#!/bin/bash
16462
+ ${H}`}q=await Z9(q)}if(Y.wrapInDocument){if(!q.trim().toLowerCase().startsWith("<!doctype")&&!q.trim().toLowerCase().startsWith("<html"))q=LL(q,Y.title)}if(Y.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (V3(),Y2));q=await U(q)}catch{}return q}async function Zk($){let Z=Date.now();try{if(!await Bun.file($.input).exists())return{success:!1,target:$.target||m7(),format:$.format||"app",error:`Input file not found: ${$.input}`};let Y=$.target||m7(),J=$.format||bL(Y),X=$.output||h(process.cwd(),"dist","native");if(!SK(X))s0(X,{recursive:!0});let Q=await kK($.input,{context:$.context,options:{isDev:!1}});if(Q=U8(Q,{debug:$.verbose}),Q=w8(Q),!Q.includes("craft-component-styles")){if(Q.includes("</head>"))Q=Q.replace("</head>",`${V8}
16463
+ </head>`)}let G=$.name||VL($.input,".stx"),K=$.version||"1.0.0",W=$.craftPath||await kL();if(!W)return{success:!1,target:Y,format:J,error:"Craft binary not found. Please install Craft or specify craftPath."};if($.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Y}...`),console.log(` Input: ${$.input}`),console.log(` Output: ${X}`),console.log(` Craft: ${W}`);let q;switch(Y){case"macos":q=await AL(Q,G,K,X,J,$,W);break;case"windows":q=await TL(Q,G,K,X,J,$,W);break;case"linux":q=await IL(Q,G,K,X,J,$,W);break;case"ios":q=await DL(Q,G,K,X,$,W);break;case"android":q=await EL(Q,G,K,X,$,W);break;default:q={success:!1,target:Y,format:J,error:`Unsupported target: ${Y}`}}return q.duration=Date.now()-Z,q}catch(Y){return{success:!1,target:$.target||m7(),format:$.format||"app",error:Y.message,duration:Date.now()-Z}}}async function AL($,Z,Y,J,X,Q,G){let K=Q.bundleId||`com.stx.${Z.toLowerCase().replace(/[^a-z0-9]/g,"")}`,W=h(J,`${Z}.app`),q=h(W,"Contents"),U=h(q,"MacOS"),z=h(q,"Resources");s0(U,{recursive:!0}),s0(z,{recursive:!0});let j=h(z,"index.html");await Bun.write(j,$);let H="";if(Q.sidebar?.enabled&&Q.sidebar?.config)H=h(z,"sidebar-config.json"),await Bun.write(H,JSON.stringify(Q.sidebar.config));let B=Q.sidebar?.enabled?`--native-sidebar --sidebar-width ${Q.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",_=Q.menubarOnly??Q.systemTray;if((Q.bundleStyle||(await ML(G)?"executable":"launcher"))==="executable"){let V=h(U,Z);p1(G,V),c1(V,493);let w={html:"index.html",title:Q.window?.title||Z,width:Q.window?.width||1200,height:Q.window?.height||800,devTools:Boolean(Q.devTools)};if(_)w.menubarOnly=!0;else if(Q.systemTray)w.systemTray=!0;if(Q.window?.frameless)w.frameless=!0;if(Q.window?.transparent)w.transparent=!0;if(Q.window?.alwaysOnTop)w.alwaysOnTop=!0;if(Q.window?.resizable===!1)w.resizable=!1;await Bun.write(h(z,"craft.json"),`${JSON.stringify(w,null,2)}
16464
+ `)}else{let V=h(U,"craft");p1(G,V),c1(V,493);let w=Q.sidebar?.enabled?`--native-sidebar --sidebar-width ${Q.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",A=`#!/bin/bash
16465
16465
  set -euo pipefail
16466
16466
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
16467
16467
  RESOURCES="$DIR/../Resources"
16468
16468
  exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
16469
16469
  ${[`--title "${Q.window?.title||Z}"`,`--width ${Q.window?.width||1200}`,`--height ${Q.window?.height||800}`,_?"--menubar-only":Q.systemTray?"--system-tray":"",Q.devTools?"":"--no-devtools",Q.window?.frameless?"--frameless":"",Q.window?.transparent?"--transparent":"",Q.window?.alwaysOnTop?"--always-on-top":"",Q.window?.resizable===!1?"--no-resize":"",w].filter(Boolean).join(" \\\n ")}
16470
- `,M=g(U,Z);await Bun.write(M,A),c1(M,493)}let F=Boolean(Q.icon&&await Bun.file(Q.icon).exists());if(F)p1(Q.icon,g(z,"AppIcon.icns"));let L={CFBundleExecutable:Z,CFBundleIdentifier:K,CFBundleName:Z,CFBundleDisplayName:Z,CFBundleShortVersionString:Y,CFBundleVersion:Y,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:Q.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:Q.menubarOnly??Boolean(Q.systemTray),...F?{CFBundleIconFile:"AppIcon"}:{},...Q.category?{LSApplicationCategoryType:Q.category}:{},...Q.copyright?{NSHumanReadableCopyright:Q.copyright}:{},...Q.infoPlist||{}};if(await Bun.write(g(q,"Info.plist"),NL(L)),X==="dmg"){let V=g(J,`${Z}-${Y}.dmg`),w=await SL(W,V,Z);if(!w.success)return{success:!1,target:"macos",format:"dmg",error:w.error};return{success:!0,target:"macos",format:"dmg",outputPath:V}}return{success:!0,target:"macos",format:"app",outputPath:W}}async function ML($){try{let Z=Bun.spawn([$,"--version"],{stdout:"pipe",stderr:"pipe"}),[Y,J]=await Promise.all([new Response(Z.stdout).text(),new Response(Z.stderr).text()]);await Z.exited;let Q=`${Y}
16470
+ `,M=h(U,Z);await Bun.write(M,A),c1(M,493)}let F=Boolean(Q.icon&&await Bun.file(Q.icon).exists());if(F)p1(Q.icon,h(z,"AppIcon.icns"));let L={CFBundleExecutable:Z,CFBundleIdentifier:K,CFBundleName:Z,CFBundleDisplayName:Z,CFBundleShortVersionString:Y,CFBundleVersion:Y,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:Q.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:Q.menubarOnly??Boolean(Q.systemTray),...F?{CFBundleIconFile:"AppIcon"}:{},...Q.category?{LSApplicationCategoryType:Q.category}:{},...Q.copyright?{NSHumanReadableCopyright:Q.copyright}:{},...Q.infoPlist||{}};if(await Bun.write(h(q,"Info.plist"),NL(L)),X==="dmg"){let V=h(J,`${Z}-${Y}.dmg`),w=await SL(W,V,Z);if(!w.success)return{success:!1,target:"macos",format:"dmg",error:w.error};return{success:!0,target:"macos",format:"dmg",outputPath:V}}return{success:!0,target:"macos",format:"app",outputPath:W}}async function ML($){try{let Z=Bun.spawn([$,"--version"],{stdout:"pipe",stderr:"pipe"}),[Y,J]=await Promise.all([new Response(Z.stdout).text(),new Response(Z.stderr).text()]);await Z.exited;let Q=`${Y}
16471
16471
  ${J}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!Q)return!1;let[G,K,W]=Q.slice(1).map(Number);if(G>0||K>0)return!0;return W>=57}catch{return!1}}function bK($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function NL($){return`<?xml version="1.0" encoding="UTF-8"?>
16472
16472
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
16473
16473
  <plist version="1.0">
@@ -16477,7 +16477,7 @@ ${Object.entries($).map(([Y,J])=>{let X=typeof J==="boolean"?`<${J}/>`:typeof J=
16477
16477
  `)}
16478
16478
  </dict>
16479
16479
  </plist>
16480
- `}async function TL($,Z,Y,J,X,Q,G){let K=g(J,Z);s0(K,{recursive:!0});let W=g(K,"index.html");await Bun.write(W,$),p1(G,g(K,"craft.exe"));let q=`@echo off
16480
+ `}async function TL($,Z,Y,J,X,Q,G){let K=h(J,Z);s0(K,{recursive:!0});let W=h(K,"index.html");await Bun.write(W,$),p1(G,h(K,"craft.exe"));let q=`@echo off
16481
16481
  set DIR=%~dp0
16482
16482
  "%DIR%craft.exe" --html-file "%DIR%index.html" ^
16483
16483
  --title "${Q.window?.title||Z}" ^
@@ -16485,7 +16485,7 @@ set DIR=%~dp0
16485
16485
  --height ${Q.window?.height||800} ^
16486
16486
  ${Q.systemTray?"--system-tray":""} ^
16487
16487
  ${Q.devTools?"":"--no-devtools"}
16488
- `;if(await Bun.write(g(K,`${Z}.bat`),q),X==="zip"){let U=g(J,`${Z}-${Y}-windows.zip`),z=await yL(K,U);if(!z.success)return{success:!1,target:"windows",format:"zip",error:z.error};return{success:!0,target:"windows",format:"zip",outputPath:U}}return{success:!0,target:"windows",format:"app",outputPath:K}}async function IL($,Z,Y,J,X,Q,G){let K=g(J,Z);s0(K,{recursive:!0});let W=g(K,"index.html");await Bun.write(W,$);let q=g(K,"craft");p1(G,q),c1(q,493);let U=`#!/bin/bash
16488
+ `;if(await Bun.write(h(K,`${Z}.bat`),q),X==="zip"){let U=h(J,`${Z}-${Y}-windows.zip`),z=await yL(K,U);if(!z.success)return{success:!1,target:"windows",format:"zip",error:z.error};return{success:!0,target:"windows",format:"zip",outputPath:U}}return{success:!0,target:"windows",format:"app",outputPath:K}}async function IL($,Z,Y,J,X,Q,G){let K=h(J,Z);s0(K,{recursive:!0});let W=h(K,"index.html");await Bun.write(W,$);let q=h(K,"craft");p1(G,q),c1(q,493);let U=`#!/bin/bash
16489
16489
  set -euo pipefail
16490
16490
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
16491
16491
  exec "$DIR/craft" --html-file "$DIR/index.html" \\
@@ -16494,15 +16494,15 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
16494
16494
  --height ${Q.window?.height||800} \\
16495
16495
  ${Q.systemTray?"--system-tray":""} \\
16496
16496
  ${Q.devTools?"":"--no-devtools"}
16497
- `,z=g(K,Z.toLowerCase());await Bun.write(z,U),c1(z,493);let j=`[Desktop Entry]
16497
+ `,z=h(K,Z.toLowerCase());await Bun.write(z,U),c1(z,493);let j=`[Desktop Entry]
16498
16498
  Type=Application
16499
16499
  Name=${Z}
16500
16500
  Exec=${z}
16501
16501
  Terminal=false
16502
16502
  Categories=Utility;
16503
- `;if(await Bun.write(g(K,`${Z.toLowerCase()}.desktop`),j),X==="deb"){let H=g(J,`${Z.toLowerCase()}_${Y}_amd64.deb`),B=await PL(K,H,Z,Y,Q);if(!B.success)return{success:!1,target:"linux",format:"deb",error:B.error};return{success:!0,target:"linux",format:"deb",outputPath:H}}if(X==="appimage"){let H=g(J,`${Z}-${Y}-x86_64.AppImage`),B=await CL(K,H,Z,Q);if(!B.success)return{success:!1,target:"linux",format:"appimage",error:B.error};return{success:!0,target:"linux",format:"appimage",outputPath:H}}return{success:!0,target:"linux",format:"app",outputPath:K}}async function DL($,Z,Y,J,X,Q){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${Z}' to create an iOS project.`}}async function EL($,Z,Y,J,X,Q){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${Z}' to create an Android project.`}}async function kL(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let $=[g(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),g(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),g(K8(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),g(K8(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",g(K8(),".local/bin/craft"),g(process.env.LOCALAPPDATA||"","craft","craft.exe"),g(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let Z of $)if(await Bun.file(Z).exists())return Z;try{let Y=wL("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
16504
- `)[0];if(Y&&await Bun.file(Y).exists())return Y}catch{}return null}function m7(){switch(RL()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function bL($){switch($){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 SL($,Z,Y){return new Promise((J)=>{let X=d7("hdiutil",["create","-volname",Y,"-srcfolder",$,"-ov","-format","UDZO",Z]);X.on("close",(Q)=>{if(Q===0)J({success:!0});else J({success:!1,error:`hdiutil exited with code ${Q}`})}),X.on("error",(Q)=>{J({success:!1,error:Q.message})})})}async function yL($,Z){return new Promise((Y)=>{let J=d7("zip",["-r",Z,"."],{cwd:$});J.on("close",(X)=>{if(X===0)Y({success:!0});else Y({success:!1,error:`zip exited with code ${X}`})}),J.on("error",(X)=>{Y({success:!1,error:X.message})})})}async function PL($,Z,Y,J,X){return new Promise((Q)=>{try{let G=g(yK(),`stx-deb-${Date.now()}`),K=g(G,"DEBIAN"),W=g(G,"usr","bin"),q=g(G,"usr","share","applications"),U=g(G,"usr","share",Y.toLowerCase());s0(K,{recursive:!0}),s0(W,{recursive:!0}),s0(q,{recursive:!0}),s0(U,{recursive:!0});let z=t("fs").readdirSync($);for(let _ of z)p1(g($,_),g(U,_));let j=`#!/bin/bash
16505
- exec /usr/share/${Y.toLowerCase()}/${Y.toLowerCase()} "$@"`;t("fs").writeFileSync(g(W,Y.toLowerCase()),j),c1(g(W,Y.toLowerCase()),493);let H=`Package: ${Y.toLowerCase()}
16503
+ `;if(await Bun.write(h(K,`${Z.toLowerCase()}.desktop`),j),X==="deb"){let H=h(J,`${Z.toLowerCase()}_${Y}_amd64.deb`),B=await PL(K,H,Z,Y,Q);if(!B.success)return{success:!1,target:"linux",format:"deb",error:B.error};return{success:!0,target:"linux",format:"deb",outputPath:H}}if(X==="appimage"){let H=h(J,`${Z}-${Y}-x86_64.AppImage`),B=await CL(K,H,Z,Q);if(!B.success)return{success:!1,target:"linux",format:"appimage",error:B.error};return{success:!0,target:"linux",format:"appimage",outputPath:H}}return{success:!0,target:"linux",format:"app",outputPath:K}}async function DL($,Z,Y,J,X,Q){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${Z}' to create an iOS project.`}}async function EL($,Z,Y,J,X,Q){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${Z}' to create an Android project.`}}async function kL(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let $=[h(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),h(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),h(K8(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),h(K8(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",h(K8(),".local/bin/craft"),h(process.env.LOCALAPPDATA||"","craft","craft.exe"),h(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let Z of $)if(await Bun.file(Z).exists())return Z;try{let Y=wL("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
16504
+ `)[0];if(Y&&await Bun.file(Y).exists())return Y}catch{}return null}function m7(){switch(RL()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function bL($){switch($){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 SL($,Z,Y){return new Promise((J)=>{let X=d7("hdiutil",["create","-volname",Y,"-srcfolder",$,"-ov","-format","UDZO",Z]);X.on("close",(Q)=>{if(Q===0)J({success:!0});else J({success:!1,error:`hdiutil exited with code ${Q}`})}),X.on("error",(Q)=>{J({success:!1,error:Q.message})})})}async function yL($,Z){return new Promise((Y)=>{let J=d7("zip",["-r",Z,"."],{cwd:$});J.on("close",(X)=>{if(X===0)Y({success:!0});else Y({success:!1,error:`zip exited with code ${X}`})}),J.on("error",(X)=>{Y({success:!1,error:X.message})})})}async function PL($,Z,Y,J,X){return new Promise((Q)=>{try{let G=h(yK(),`stx-deb-${Date.now()}`),K=h(G,"DEBIAN"),W=h(G,"usr","bin"),q=h(G,"usr","share","applications"),U=h(G,"usr","share",Y.toLowerCase());s0(K,{recursive:!0}),s0(W,{recursive:!0}),s0(q,{recursive:!0}),s0(U,{recursive:!0});let z=e("fs").readdirSync($);for(let _ of z)p1(h($,_),h(U,_));let j=`#!/bin/bash
16505
+ exec /usr/share/${Y.toLowerCase()}/${Y.toLowerCase()} "$@"`;e("fs").writeFileSync(h(W,Y.toLowerCase()),j),c1(h(W,Y.toLowerCase()),493);let H=`Package: ${Y.toLowerCase()}
16506
16506
  Version: ${J}
16507
16507
  Section: utils
16508
16508
  Priority: optional
@@ -16510,16 +16510,16 @@ Architecture: amd64
16510
16510
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
16511
16511
  Maintainer: ${X.author||"Unknown"}
16512
16512
  Description: ${X.description||Y}
16513
- `;t("fs").writeFileSync(g(K,"control"),H);let B=d7("dpkg-deb",["--build",G,Z]);B.on("close",(_)=>{if(t("fs").rmSync(G,{recursive:!0,force:!0}),_===0)Q({success:!0});else Q({success:!1,error:`dpkg-deb exited with code ${_}`})}),B.on("error",(_)=>{t("fs").rmSync(G,{recursive:!0,force:!0}),Q({success:!1,error:_.message})})}catch(G){Q({success:!1,error:G.message})}})}async function CL($,Z,Y,J){return new Promise((X)=>{try{let Q=g(yK(),`stx-appimage-${Date.now()}`),G=g(Q,`${Y}.AppDir`),K=g(G,"usr"),W=g(K,"bin"),q=g(K,"share");s0(W,{recursive:!0}),s0(q,{recursive:!0});let U=g(q,Y.toLowerCase());s0(U,{recursive:!0});let z=t("fs").readdirSync($);for(let O of z)p1(g($,O),g(U,O));let j=`#!/bin/bash
16513
+ `;e("fs").writeFileSync(h(K,"control"),H);let B=d7("dpkg-deb",["--build",G,Z]);B.on("close",(_)=>{if(e("fs").rmSync(G,{recursive:!0,force:!0}),_===0)Q({success:!0});else Q({success:!1,error:`dpkg-deb exited with code ${_}`})}),B.on("error",(_)=>{e("fs").rmSync(G,{recursive:!0,force:!0}),Q({success:!1,error:_.message})})}catch(G){Q({success:!1,error:G.message})}})}async function CL($,Z,Y,J){return new Promise((X)=>{try{let Q=h(yK(),`stx-appimage-${Date.now()}`),G=h(Q,`${Y}.AppDir`),K=h(G,"usr"),W=h(K,"bin"),q=h(K,"share");s0(W,{recursive:!0}),s0(q,{recursive:!0});let U=h(q,Y.toLowerCase());s0(U,{recursive:!0});let z=e("fs").readdirSync($);for(let O of z)p1(h($,O),h(U,O));let j=`#!/bin/bash
16514
16514
  SELF=$(readlink -f "$0")
16515
16515
  HERE=\${SELF%/*}
16516
16516
  export PATH="\${HERE}/usr/bin:\${PATH}"
16517
16517
  exec "\${HERE}/usr/share/${Y.toLowerCase()}/${Y.toLowerCase()}" "$@"
16518
- `;t("fs").writeFileSync(g(G,"AppRun"),j),c1(g(G,"AppRun"),493);let H=`[Desktop Entry]
16518
+ `;e("fs").writeFileSync(h(G,"AppRun"),j),c1(h(G,"AppRun"),493);let H=`[Desktop Entry]
16519
16519
  Type=Application
16520
16520
  Name=${Y}
16521
16521
  Exec=${Y.toLowerCase()}
16522
16522
  Terminal=false
16523
16523
  Categories=Utility;
16524
16524
  Icon=${Y.toLowerCase()}
16525
- `;t("fs").writeFileSync(g(G,`${Y.toLowerCase()}.desktop`),H);let B=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(t("fs").writeFileSync(g(G,`${Y.toLowerCase()}.png`),B),J.icon&&SK(J.icon))p1(J.icon,g(G,`${Y.toLowerCase()}.png`));let _=d7("appimagetool",[G,Z],{env:{...process.env,ARCH:"x86_64"}});_.on("close",(O)=>{if(t("fs").rmSync(Q,{recursive:!0,force:!0}),O===0)c1(Z,493),X({success:!0});else X({success:!1,error:`appimagetool exited with code ${O}. Install from https://appimage.github.io/appimagetool/`})}),_.on("error",(O)=>{t("fs").rmSync(Q,{recursive:!0,force:!0}),X({success:!1,error:`appimagetool not found: ${O.message}`})})}catch(Q){X({success:!1,error:Q.message})}})}function Yk(){return[m7()]}function Jk($){switch($){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{nL as renderSSR,pL as registerCraftComponent,gL as processCraftDirective,w8 as processCraftComponents,oL as prerenderForCraft,fL as isCraftEnvironment,U8 as injectCraftBridge,aL as getSSRCacheStats,cL as getCraftComponents,Yk as getAvailableTargets,Jk as getAvailableFormats,sL as generateCraftOptimizations,q8 as generateCraftBridgeScript,mL as createHotReloadServer,uL as compileToNative,FW as compileTemplate,CW as clearTemplateCache,vW as clearRenderCache,rL as clearAllCaches,Zk as buildNative,fK as NATIVE_COMPONENTS,V8 as CRAFT_COMPONENT_STYLES,lL as CRAFT_COMPONENT_RUNTIME,n7 as CRAFT_COMPONENTS,xL as CRAFT_BRIDGE_SCRIPT};
16525
+ `;e("fs").writeFileSync(h(G,`${Y.toLowerCase()}.desktop`),H);let B=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(e("fs").writeFileSync(h(G,`${Y.toLowerCase()}.png`),B),J.icon&&SK(J.icon))p1(J.icon,h(G,`${Y.toLowerCase()}.png`));let _=d7("appimagetool",[G,Z],{env:{...process.env,ARCH:"x86_64"}});_.on("close",(O)=>{if(e("fs").rmSync(Q,{recursive:!0,force:!0}),O===0)c1(Z,493),X({success:!0});else X({success:!1,error:`appimagetool exited with code ${O}. Install from https://appimage.github.io/appimagetool/`})}),_.on("error",(O)=>{e("fs").rmSync(Q,{recursive:!0,force:!0}),X({success:!1,error:`appimagetool not found: ${O.message}`})})}catch(Q){X({success:!1,error:Q.message})}})}function Yk(){return[m7()]}function Jk($){switch($){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{nL as renderSSR,pL as registerCraftComponent,gL as processCraftDirective,w8 as processCraftComponents,oL as prerenderForCraft,fL as isCraftEnvironment,U8 as injectCraftBridge,aL as getSSRCacheStats,cL as getCraftComponents,Yk as getAvailableTargets,Jk as getAvailableFormats,sL as generateCraftOptimizations,q8 as generateCraftBridgeScript,mL as createHotReloadServer,uL as compileToNative,FW as compileTemplate,CW as clearTemplateCache,vW as clearRenderCache,rL as clearAllCaches,Zk as buildNative,fK as NATIVE_COMPONENTS,V8 as CRAFT_COMPONENT_STYLES,lL as CRAFT_COMPONENT_RUNTIME,n7 as CRAFT_COMPONENTS,xL as CRAFT_BRIDGE_SCRIPT};