@stacksjs/stx 0.2.101 → 0.2.103

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/ssg.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var $X=Object.defineProperty;var ZX=($)=>$;function YX($,Z){this[$]=ZX.bind(null,Z)}var r=($,Z)=>{for(var Y in Z)$X($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:YX.bind(Z,Y)})};var S=($,Z)=>()=>($&&(Z=$($=0)),Z);var z0=import.meta.require;import _5 from"path";function H6($){j6=$?.trim()||null}function B5(){return process.env[XX]?.trim()||j6||m1}function Q1($=process.cwd(),...Z){let Y=B5();return _5.isAbsolute(Y)?_5.join(Y,...Z):_5.join($,Y,...Z)}function j5($){if(!$||_5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==m1&&!Z.startsWith(`${m1}/`))return $;let Y=Z.slice(m1.length+1);return Y?_5.join(B5(),Y):B5()}var m1=".stx",XX="STX_DIR",j6=null;var H5=()=>{};var B0;var O6=S(()=>{B0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function L6($,Z,Y,J){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let z={"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: ${q||z} -->`});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,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),X}var F6,V6;var S$=S(()=>{F6={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},V6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function QX($,Z={}){let{duration:Y,delay:J,ease:X,direction:Q,custom:G}={...e0,...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 YX=Object.defineProperty;var JX=($)=>$;function XX($,Z){this[$]=JX.bind(null,Z)}var r=($,Z)=>{for(var Y in Z)YX($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:XX.bind(Z,Y)})};var S=($,Z)=>()=>($&&(Z=$($=0)),Z);var z0=import.meta.require;import _5 from"path";function O6($){H6=$?.trim()||null}function B5(){return process.env[GX]?.trim()||H6||m1}function Q1($=process.cwd(),...Z){let Y=B5();return _5.isAbsolute(Y)?_5.join(Y,...Z):_5.join($,Y,...Z)}function j5($){if(!$||_5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==m1&&!Z.startsWith(`${m1}/`))return $;let Y=Z.slice(m1.length+1);return Y?_5.join(B5(),Y):B5()}var m1=".stx",GX="STX_DIR",H6=null;var H5=()=>{};var B0;var L6=S(()=>{B0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function F6($,Z,Y,J){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let z={"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: ${q||z} -->`});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,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),X}var V6,w6;var S$=S(()=>{V6={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},w6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function KX($,Z={}){let{duration:Y,delay:J,ease:X,direction:Q,custom:G}={...e0,...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; } }
@@ -9,7 +9,7 @@ var $X=Object.defineProperty;var ZX=($)=>$;function YX($,Z){this[$]=ZX.bind(null
9
9
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
10
10
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${Q==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
11
11
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
12
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function GX(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function qX(){return`
13
13
  <script data-stx-scoped>
14
14
  // Motion preferences handling
15
15
  (function() {
@@ -37,7 +37,7 @@ else {
37
37
  });
38
38
  })();
39
39
  </script>
40
- `}function KX($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function qX($=0.1,Z="0px"){return`
40
+ `}function zX($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function WX($=0.1,Z="0px"){return`
41
41
  <script data-stx-scoped>
42
42
  // Intersection Observer for scroll animations
43
43
  (function() {
@@ -80,7 +80,7 @@ else {
80
80
  }
81
81
  })();
82
82
  </script>
83
- `}function zX(){return`
83
+ `}function UX(){return`
84
84
  <style id="stx-animation-base">
85
85
  :root {
86
86
  --stx-transition-duration: 300ms;
@@ -195,7 +195,7 @@ else {
195
195
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
196
196
  }
197
197
  </style>
198
- `}function WX($,Z,Y={}){let{staggerDelay:J=50,sequence:X=!1}=Y;return`
198
+ `}function _X($,Z,Y={}){let{staggerDelay:J=50,sequence:X=!1}=Y;return`
199
199
  <script data-stx-scoped>
200
200
  // Animation Group: ${$}
201
201
  (function() {
@@ -232,11 +232,11 @@ else {
232
232
  }
233
233
  })();
234
234
  </script>
235
- `}function T6($,Z,Y,J){let X=$;if(J.animation?.enabled===!1)return X;let Q=Y.includes("test")&&Y.includes("animation");if(!KX(X)&&!Q)return X;if(!X.includes('<style id="stx-animation-base">')){let K=zX();X=X.replace("</head>",`${K}
236
- </head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let q=qX(),W=X.lastIndexOf("</body>");if(W!==-1)X=X.slice(0,W)+q+`
237
- `+X.slice(W)}}return X}var e0,w6,A6,N6,R6;var y$=S(()=>{e0={duration:300,delay:0,ease:"ease",direction:"both"};w6={name:"transition",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||e0.duration:e0.duration,G=Z.length>2?Z[2]||e0.ease:e0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||e0.delay:e0.delay,q=Z.length>4?Z[4]||e0.direction:e0.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=QX(X,{duration:Q,delay:K,ease:G,direction:q}),U="stx-transition",_="";if(X==="fade")_="stx-fade";else if(X==="slide")_="stx-slide";else if(X==="scale")_="stx-scale";else if(X==="flip")_="stx-flip";else if(X==="rotate")_="stx-rotate";return`<div id="${W}" class="${U} ${_} ${q==="out"?"stx-out":""}"
238
- style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},A6={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,z=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(X==="fade")U+=" stx-fade";else if(X==="slide-up"||X==="slide")U+=" stx-from-bottom";else if(X==="slide-down")U+=" stx-from-top";else if(X==="slide-left")U+=" stx-from-right";else if(X==="slide-right")U+=" stx-from-left";else if(X==="scale")U+=" stx-scale";else if(X.includes("-"))U+=` stx-${X}`;else U+=` stx-${X}`;return`<div id="${W}" class="${U}" style="${z}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},N6={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let X=Z[0],Q=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=WX(X,Q,{staggerDelay:G,sequence:K});return`${$}
239
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},R6={name:"motion",handler:($,Z,Y,J)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=GX();return`<div data-animate="${X?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as M6}from"stx-router";var I6=S(()=>{C$()});async function UX($,Z,Y,J){let X=Z[0]?.replace(/['"]/g,"")||"main",Q=M6();if(X!=="main")Q=Q.replace("container:'main'",`container:'${X}'`);return`<script data-stx-router>${Q}</script>`}var D6;var C$=S(()=>{I6();D6={name:"stxRouter",handler:UX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function E6($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={..._X,...Z};return`
235
+ `}function M6($,Z,Y,J){let X=$;if(J.animation?.enabled===!1)return X;let Q=Y.includes("test")&&Y.includes("animation");if(!zX(X)&&!Q)return X;if(!X.includes('<style id="stx-animation-base">')){let K=UX();X=X.replace("</head>",`${K}
236
+ </head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let q=WX(),W=X.lastIndexOf("</body>");if(W!==-1)X=X.slice(0,W)+q+`
237
+ `+X.slice(W)}}return X}var e0,A6,N6,R6,T6;var y$=S(()=>{e0={duration:300,delay:0,ease:"ease",direction:"both"};A6={name:"transition",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||e0.duration:e0.duration,G=Z.length>2?Z[2]||e0.ease:e0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||e0.delay:e0.delay,q=Z.length>4?Z[4]||e0.direction:e0.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=KX(X,{duration:Q,delay:K,ease:G,direction:q}),U="stx-transition",_="";if(X==="fade")_="stx-fade";else if(X==="slide")_="stx-slide";else if(X==="scale")_="stx-scale";else if(X==="flip")_="stx-flip";else if(X==="rotate")_="stx-rotate";return`<div id="${W}" class="${U} ${_} ${q==="out"?"stx-out":""}"
238
+ style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},N6={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,z=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(X==="fade")U+=" stx-fade";else if(X==="slide-up"||X==="slide")U+=" stx-from-bottom";else if(X==="slide-down")U+=" stx-from-top";else if(X==="slide-left")U+=" stx-from-right";else if(X==="slide-right")U+=" stx-from-left";else if(X==="scale")U+=" stx-scale";else if(X.includes("-"))U+=` stx-${X}`;else U+=` stx-${X}`;return`<div id="${W}" class="${U}" style="${z}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},R6={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let X=Z[0],Q=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=_X(X,Q,{staggerDelay:G,sequence:K});return`${$}
239
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},T6={name:"motion",handler:($,Z,Y,J)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=qX();return`<div data-animate="${X?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as I6}from"stx-router";var D6=S(()=>{C$()});async function BX($,Z,Y,J){let X=Z[0]?.replace(/['"]/g,"")||"main",Q=I6();if(X!=="main")Q=Q.replace("container:'main'",`container:'${X}'`);return`<script data-stx-router>${Q}</script>`}var E6;var C$=S(()=>{D6();E6={name:"stxRouter",handler:BX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function k6($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...jX,...Z};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
241
241
  <script>
242
242
  (function() {
@@ -619,8 +619,8 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function k6($,Z){let Y=E6(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function BX($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[X,Q]=J.split("="),G=Q?.replace(/["']/g,"");switch(X){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var _X,b6;var P$=S(()=>{_X={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};b6={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let X=Y.__stx_config||{};if(Z.length>0){let Q=BX(Z.join(" "));X.heatmap={...X.heatmap,...Q,enabled:!0}}return E6(X)}}});function G1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function S6($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function y6($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],X=$.slice(Y[0].length),Q={};for(let G of J.split(`
623
- `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let W=K.slice(0,q).trim(),z=K.slice(q+1).trim();if(typeof z==="string"){if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))z=z.slice(1,-1);else if(z.startsWith("[")&&z.endsWith("]"))try{z=JSON.parse(z)}catch{}else if(z==="true")z=!0;else if(z==="false")z=!1;else if(/^-?\d+(?:\.\d+)?$/.test(z))z=Number(z)}Q[W]=z}return{data:Q,content:X.trim()}}function O5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,X=$,Q=[];if(X=X.replace(/```(\w*)\n([\s\S]*?)```/g,(z,U,_)=>{let B=Q.length,j=U?` class="language-${G1(U)}"`:"";return Q.push(`<pre><code${j}>${G1(_.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),X=X.replace(/`([^`]*)`/g,(z,U)=>`<code>${G1(U)}</code>`),X=X.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),X=X.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),X=X.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),X=X.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),X=X.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),X=X.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),X=X.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),X=X.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),X=X.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),X=X.replace(/__(.+?)__/g,"<strong>$1</strong>"),X=X.replace(/\*(.+?)\*/g,"<em>$1</em>"),X=X.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)X=X.replace(/~~(.+?)~~/g,"<del>$1</del>");if(X=X.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(z,U,_)=>{return`<img src="${S6(_)?G1(_):""}" alt="${G1(U)}" />`}),X=X.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(z,U,_)=>{return`<a href="${S6(_)?G1(_):""}">${U}</a>`}),X=X.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),X=X.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),X=X.replace(/<\/blockquote>\n<blockquote>/g,`
622
+ `}function b6($,Z){let Y=k6(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function HX($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[X,Q]=J.split("="),G=Q?.replace(/["']/g,"");switch(X){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var jX,S6;var P$=S(()=>{jX={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};S6={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let X=Y.__stx_config||{};if(Z.length>0){let Q=HX(Z.join(" "));X.heatmap={...X.heatmap,...Q,enabled:!0}}return k6(X)}}});function G1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function y6($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function C6($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],X=$.slice(Y[0].length),Q={};for(let G of J.split(`
623
+ `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let W=K.slice(0,q).trim(),z=K.slice(q+1).trim();if(typeof z==="string"){if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))z=z.slice(1,-1);else if(z.startsWith("[")&&z.endsWith("]"))try{z=JSON.parse(z)}catch{}else if(z==="true")z=!0;else if(z==="false")z=!1;else if(/^-?\d+(?:\.\d+)?$/.test(z))z=Number(z)}Q[W]=z}return{data:Q,content:X.trim()}}function O5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,X=$,Q=[];if(X=X.replace(/```(\w*)\n([\s\S]*?)```/g,(z,U,_)=>{let B=Q.length,j=U?` class="language-${G1(U)}"`:"";return Q.push(`<pre><code${j}>${G1(_.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),X=X.replace(/`([^`]*)`/g,(z,U)=>`<code>${G1(U)}</code>`),X=X.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),X=X.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),X=X.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),X=X.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),X=X.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),X=X.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),X=X.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),X=X.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),X=X.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),X=X.replace(/__(.+?)__/g,"<strong>$1</strong>"),X=X.replace(/\*(.+?)\*/g,"<em>$1</em>"),X=X.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)X=X.replace(/~~(.+?)~~/g,"<del>$1</del>");if(X=X.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(z,U,_)=>{return`<img src="${y6(_)?G1(_):""}" alt="${G1(U)}" />`}),X=X.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(z,U,_)=>{return`<a href="${y6(_)?G1(_):""}">${U}</a>`}),X=X.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),X=X.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),X=X.replace(/<\/blockquote>\n<blockquote>/g,`
624
624
  `),X=X.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),X=X.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),X=X.replace(/<\/ul>\n<ul>/g,""),X=X.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),X=X.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),X=X.replace(/<\/ol>\n<ol>/g,""),X=X.replace(/<li data-ul>/g,"<li>"),X=X.replace(/<li data-ol>/g,"<li>"),Y)X=X.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(z,U,_)=>{let j=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${G1(L)}</th>`).join("")}</tr>`,H=_.trim().split(`
625
625
  `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${G1(O)}</td>`).join("")}</tr>`}).join(`
626
626
  `);return`<table>
@@ -639,23 +639,23 @@ ${H}
639
639
  `),J)X=X.replace(/\n/g,`<br />
640
640
  `);for(let z=0;z<Q.length;z++)X=X.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function $1($){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__
641
641
  `});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
642
- `}),$}import jX from"process";function o0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(jX.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 u1=()=>{};var a5={};r(a5,{hasUserImports:()=>HX,bundleClientScript:()=>LX});import w0 from"path";import h0 from"fs";function HX($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let J=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,X;while((X=J.exec($))!==null){let G=X[1];if(!C6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let Q=/^\s*import\s+['"]([^'"]+)['"]/gm;while((X=Q.exec($))!==null){let G=X[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!C6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function OX($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:w0.dirname(Q),q=w0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,w0.join(q,"index.ts"),w0.join(q,"index.tsx"),w0.join(q,"index.js"),w0.join(q,"index.mjs")];for(let z of W)try{if(h0.existsSync(z)&&h0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({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=w0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,w0.join(K,"index.ts"),w0.join(K,"index.tsx"),w0.join(K,"index.js"),w0.join(K,"index.mjs")];for(let W of q)if(h0.existsSync(W)&&h0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),J.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function LX($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||Q1(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=w0.join(Q,`${K}.js`),W=w0.join(Q,`${K}.deps.json`),z=Bun.file(q);if(await z.exists()){let A=Bun.file(W),N=!0;if(await A.exists())try{let R=JSON.parse(await A.text());for(let T of R.files)try{if(h0.statSync(T.path).mtimeMs!==T.mtimeMs){N=!1;break}}catch{N=!1;break}}catch{N=!1}if(N)return console.log("[stx:bundler] cache hit:",K),await z.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=Q1(J,"bundle-tmp"),_=w0.join(U,`${K}.ts`),B=w0.join(U,"out",K);h0.mkdirSync(U,{recursive:!0}),h0.mkdirSync(B,{recursive:!0});let j=w0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((A)=>{let N=A.split(":")[0].trim();if(N)H.push(N)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
643
- export { ${H.join(", ")} }`:"";await Bun.write(_,$+V),console.log("[stx:bundler] bundling:",K,"from:",w0.basename(Z));let w=new Set;try{let A=await Bun.build({entrypoints:[_],outdir:B,target:"browser",format:"esm",minify:X,plugins:[OX(J,j,_,w)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...o0()},root:J});if(!A.success){let M=A.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",M),$}let N="";for(let M of A.outputs){N=await M.text();break}let R=[];for(let M of N.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of M[1].split(",")){let D=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D&&D[1]!==D[2])R.push([D[2],D[1]])}if(N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),R.length>0){let M=R.map(([I,D])=>`${JSON.stringify(I)}: ${D}`).join(", ");N+=`
642
+ `}),$}import OX from"process";function o0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(OX.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 u1=()=>{};var a5={};r(a5,{hasUserImports:()=>LX,bundleClientScript:()=>VX});import w0 from"path";import h0 from"fs";function LX($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let J=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,X;while((X=J.exec($))!==null){let G=X[1];if(!P6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let Q=/^\s*import\s+['"]([^'"]+)['"]/gm;while((X=Q.exec($))!==null){let G=X[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!P6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function FX($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:w0.dirname(Q),q=w0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,w0.join(q,"index.ts"),w0.join(q,"index.tsx"),w0.join(q,"index.js"),w0.join(q,"index.mjs")];for(let z of W)try{if(h0.existsSync(z)&&h0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({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=w0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,w0.join(K,"index.ts"),w0.join(K,"index.tsx"),w0.join(K,"index.js"),w0.join(K,"index.mjs")];for(let W of q)if(h0.existsSync(W)&&h0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),J.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function VX($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||Q1(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=w0.join(Q,`${K}.js`),W=w0.join(Q,`${K}.deps.json`),z=Bun.file(q);if(await z.exists()){let A=Bun.file(W),N=!0;if(await A.exists())try{let R=JSON.parse(await A.text());for(let T of R.files)try{if(h0.statSync(T.path).mtimeMs!==T.mtimeMs){N=!1;break}}catch{N=!1;break}}catch{N=!1}if(N)return console.log("[stx:bundler] cache hit:",K),await z.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=Q1(J,"bundle-tmp"),_=w0.join(U,`${K}.ts`),B=w0.join(U,"out",K);h0.mkdirSync(U,{recursive:!0}),h0.mkdirSync(B,{recursive:!0});let j=w0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((A)=>{let N=A.split(":")[0].trim();if(N)H.push(N)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
643
+ export { ${H.join(", ")} }`:"";await Bun.write(_,$+V),console.log("[stx:bundler] bundling:",K,"from:",w0.basename(Z));let w=new Set;try{let A=await Bun.build({entrypoints:[_],outdir:B,target:"browser",format:"esm",minify:X,plugins:[FX(J,j,_,w)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...o0()},root:J});if(!A.success){let M=A.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",M),$}let N="";for(let M of A.outputs){N=await M.text();break}let R=[];for(let M of N.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of M[1].split(",")){let D=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D&&D[1]!==D[2])R.push([D[2],D[1]])}if(N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),R.length>0){let M=R.map(([I,D])=>`${JSON.stringify(I)}: ${D}`).join(", ");N+=`
644
644
  var __stxScopeRenames = { ${M} };`}console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),h0.mkdirSync(Q,{recursive:!0}),await Bun.write(q,N);let T=Array.from(w).map((M)=>{try{return{path:M,mtimeMs:h0.statSync(M).mtimeMs}}catch{return null}}).filter((M)=>M!==null);return await Bun.write(W,JSON.stringify({files:T})),N}catch(A){let N=A instanceof Error?A.message:String(A),R=A?.errors,T=Array.isArray(R)&&R.length>0?`
645
645
  ${R.map((M)=>`- ${M?.message??M}`).join(`
646
- `)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{h0.rmSync(_,{force:!0}),h0.rmSync(B,{recursive:!0,force:!0})}catch{}}}var C6;var t5=S(()=>{u1();H5();C6=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var f6={};r(f6,{renderVendorStyleTags:()=>x6,processClientScript:()=>V5,generateServerDataBridge:()=>e5,extractBridgeData:()=>F5,extractAndStripCssImports:()=>v6});import w1 from"path";import L5 from"fs";function VX($){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 wX($,Z){let Y=Z;while(!0){let J=w1.join(Y,"node_modules",$,"package.json");if(L5.existsSync(J))return w1.dirname(J);let X=w1.dirname(Y);if(X===Y)return null;Y=X}}function AX($,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 NX($,Z){let Y=VX($);if(!Y||!Y.subpath)return null;let J=wX(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(L5.readFileSync(w1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=AX(X.exports,Q);if(!G)return null;let K=w1.resolve(J,G);return L5.existsSync(K)?K:null}function v6($,Z){let Y=Z.filePath?w1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(FX,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:w1.resolve(Y,q),!L5.existsSync(W))throw Error(`file not found: ${W}`)}else{let z=null;try{z=Bun.resolveSync(q,J)}catch{z=NX(q,J)}if(!z)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(X.has(W))return"";X.add(W);try{let z=L5.readFileSync(W,"utf8");Q.push({source:q,resolvedPath:W,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${W}: ${z?.message||z}`)}return""}),styles:Q}}function RX($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function x6($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${RX(Z.source)}" data-stx-layer="vendor">
646
+ `)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{h0.rmSync(_,{force:!0}),h0.rmSync(B,{recursive:!0,force:!0})}catch{}}}var P6;var t5=S(()=>{u1();H5();P6=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var g6={};r(g6,{renderVendorStyleTags:()=>f6,processClientScript:()=>V5,generateServerDataBridge:()=>e5,extractBridgeData:()=>F5,extractAndStripCssImports:()=>x6});import w1 from"path";import L5 from"fs";function AX($){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 NX($,Z){let Y=Z;while(!0){let J=w1.join(Y,"node_modules",$,"package.json");if(L5.existsSync(J))return w1.dirname(J);let X=w1.dirname(Y);if(X===Y)return null;Y=X}}function RX($,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 TX($,Z){let Y=AX($);if(!Y||!Y.subpath)return null;let J=NX(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(L5.readFileSync(w1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=RX(X.exports,Q);if(!G)return null;let K=w1.resolve(J,G);return L5.existsSync(K)?K:null}function x6($,Z){let Y=Z.filePath?w1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(wX,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:w1.resolve(Y,q),!L5.existsSync(W))throw Error(`file not found: ${W}`)}else{let z=null;try{z=Bun.resolveSync(q,J)}catch{z=TX(q,J)}if(!z)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(X.has(W))return"";X.add(W);try{let z=L5.readFileSync(W,"utf8");Q.push({source:q,resolvedPath:W,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${W}: ${z?.message||z}`)}return""}),styles:Q}}function MX($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function f6($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${MX(Z.source)}" data-stx-layer="vendor">
647
647
  @layer vendor {
648
648
  ${Z.contents}
649
649
  }
650
650
  </style>`}).join(`
651
651
  `)}
652
- `}function DX($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=Y.exec($))!==null)if(!IX.has(J[1]))Z.add(J[1]);return Array.from(Z)}function EX($){let Z=new Set,Y=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let X=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let q=G[1],W=G[2];if(G[0].includes("import type"))continue;q.split(",").map((U)=>U.trim().split(/\s+as\s+/)[0]).filter((U)=>U.length>0).forEach((U)=>{if(X.add(U),W==="stx")Z.add(U);else Y.add(U)}),J=J.replace(G[0],"// [auto-import processed]")}for(let q of TX){if(X.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(J))Z.add(q)}for(let q of MX){if(X.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let K=DX(J);for(let q of K)if(!X.has(q))Y.add(q);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function kX($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
652
+ `}function kX($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=Y.exec($))!==null)if(!EX.has(J[1]))Z.add(J[1]);return Array.from(Z)}function bX($){let Z=new Set,Y=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let X=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let q=G[1],W=G[2];if(G[0].includes("import type"))continue;q.split(",").map((U)=>U.trim().split(/\s+as\s+/)[0]).filter((U)=>U.length>0).forEach((U)=>{if(X.add(U),W==="stx")Z.add(U);else Y.add(U)}),J=J.replace(G[0],"// [auto-import processed]")}for(let q of IX){if(X.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(J))Z.add(q)}for(let q of DX){if(X.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let K=kX(J);for(let q of K)if(!X.has(q))Y.add(q);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function SX($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
653
653
  ${Y.join(`
654
654
  `)}
655
655
  `;return""}function F5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function e5($,Z){if(!Z)return"";let Y=[];for(let[J,X]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(J))continue;if(!new RegExp(`\\b${J}\\b`).test($))continue;if(new RegExp(`(?:const|let|var|function|class)\\s+${J}\\b`).test($))continue;let Q;try{Q=JSON.stringify(X)}catch{continue}if(Q===void 0)continue;Y.push(` var ${J} = ${Q.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
656
656
  ${Y.join(`
657
657
  `)}
658
- `}function SX($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=bX[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function yX($,Z){let{elementId:Y,event:J,handler:X,modifiers:Q}=$,G=SX(Q),K=[];if(Q.once)K.push("once: true");if(Q.capture)K.push("capture: true");if(Q.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let z=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function U(_){return`var scope = $el.closest('[data-stx-scope]');
658
+ `}function CX($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=yX[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function PX($,Z){let{elementId:Y,event:J,handler:X,modifiers:Q}=$,G=CX(Q),K=[];if(Q.once)K.push("once: true");if(Q.capture)K.push("capture: true");if(Q.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let z=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function U(_){return`var scope = $el.closest('[data-stx-scope]');
659
659
  if (scope && scope.__stx_execute) {
660
660
  scope.__stx_execute('${z}', $event, $el);
661
661
  }
@@ -691,11 +691,11 @@ else {
691
691
  else {
692
692
  ${X}
693
693
  }
694
- }${q})`}function CX($){if($.length===0)return"";return`
694
+ }${q})`}function vX($){if($.length===0)return"";return`
695
695
  // STX: auto-generated event bindings
696
- ${$.map((Y,J)=>yX(Y,J)).join(`
697
- `)}`}function P6($){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 q=K;if(G++,q==="`"){let W=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&W===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){W++,G+=2;continue}if(J[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===q){G++;break}G++}continue}if(K==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
698
- `)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 q=J.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let _=W[1];if(!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_);G+=W[0].length;continue}let z=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((_)=>{let B=_.trim(),j=B.indexOf(":"),H=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=z[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let _=U[1];if(!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_);G+=U[0].length;continue}}G++}return Z}function vX($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(_){let B;while((B=Y.exec(_))!==null){let j=B[0];if(!PX.has(j))Z.add(j)}}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 q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);return Z}async function V5($,Z={}){let Y=$,J="",X=!1,Q=v6(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=Q.code;let G=x6(Q.styles),{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (t5(),a5));if(K(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let L=EX(Y);Y=L.code,J=kX(L.stxImports,L.browserImports)}if(J=`${e5(Y,Z.serverData)}${J}`,Y=$1(Y),!X&&A1(Z.attrs||""))Y=N1(Y);let W=CX(Z.eventBindings||[]),z=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(z)){let L=z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${G}<script ${F}>
696
+ ${$.map((Y,J)=>PX(Y,J)).join(`
697
+ `)}`}function v6($){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 q=K;if(G++,q==="`"){let W=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&W===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){W++,G+=2;continue}if(J[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===q){G++;break}G++}continue}if(K==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
698
+ `)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 q=J.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let _=W[1];if(!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_);G+=W[0].length;continue}let z=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((_)=>{let B=_.trim(),j=B.indexOf(":"),H=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=z[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let _=U[1];if(!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_);G+=U[0].length;continue}}G++}return Z}function fX($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(_){let B;while((B=Y.exec(_))!==null){let j=B[0];if(!xX.has(j))Z.add(j)}}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 q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)J(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);return Z}async function V5($,Z={}){let Y=$,J="",X=!1,Q=x6(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=Q.code;let G=f6(Q.styles),{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (t5(),a5));if(K(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let L=bX(Y);Y=L.code,J=SX(L.stxImports,L.browserImports)}if(J=`${e5(Y,Z.serverData)}${J}`,Y=$1(Y),!X&&A1(Z.attrs||""))Y=N1(Y);let W=vX(Z.eventBindings||[]),z=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(z)){let L=z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${G}<script ${F}>
699
699
  ${J}${Y}
700
700
  ${W}
701
701
  </script>`}let _=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),B=/function __stx_setup_/.test(Y),j=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function H(L){let F=L.length>0?`
@@ -704,12 +704,12 @@ window.stx.mount(function() {
704
704
  'use strict';
705
705
  ${J}${Y}
706
706
  ${W}${F}
707
- })</script>`}if(!j&&!B){if(_)return H(P6($));if(Z.templateContent){let L=P6($);if(L.length>0){let F=vX(Z.templateContent);if(L.some((V)=>F.has(V)))return H(L)}}}return`${G}<script data-stx-scoped>
707
+ })</script>`}if(!j&&!B){if(_)return H(v6($));if(Z.templateContent){let L=v6($);if(L.length>0){let F=fX(Z.templateContent);if(L.some((V)=>F.has(V)))return H(L)}}}return`${G}<script data-stx-scoped>
708
708
  ;(function() {
709
709
  'use strict';
710
710
  ${J}${Y}
711
711
  ${W}
712
- })()</script>`}var FX,TX,MX,IX,bX,PX;var w5=S(()=>{A0();FX=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;TX=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],MX=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],IX=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"]);bX={left:0,middle:1,right:2};PX=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function hX($){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 dX($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(fX.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&m6.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function mX($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!m6.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 $4($){let Z=$.trim(),Y=hX(Z);dX(Y,Z),mX(Z);for(let J of d6)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!h6.allowBracketNotation&&gX.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function uX($){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("__")||d6.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=v$(J);else Z[Y]=J}return Z}function v$($,Z=0){if(Z>=h6.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>v$(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]=v$(X,Z+1);else Y[J]=X}return Y}function Z0($,Z){try{let Y=uX(Z),J=Object.keys(Y),X=Object.values(Y);return G0($,J)(...X)}catch{return}}function Q0($){try{return $4($),!0}catch{return!1}}function N0($,Z){try{let Y=Z0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function G0($,Z){let Y=$4($),J=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let W=0;W<Z.length;W++){let z=Z[W];if(!J.test(z))continue;if(u6.has(z))continue;X.push(W),Q.push(z)}let G=(W)=>Function(...Q,...W,`
712
+ })()</script>`}var wX,IX,DX,EX,yX,xX;var w5=S(()=>{A0();wX=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;IX=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],DX=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],EX=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"]);yX={left:0,middle:1,right:2};xX=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function mX($){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 uX($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(hX.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&u6.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function pX($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!u6.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 $4($){let Z=$.trim(),Y=mX(Z);uX(Y,Z),pX(Z);for(let J of m6)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!d6.allowBracketNotation&&dX.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function cX($){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("__")||m6.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=v$(J);else Z[Y]=J}return Z}function v$($,Z=0){if(Z>=d6.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>v$(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]=v$(X,Z+1);else Y[J]=X}return Y}function Z0($,Z){try{let Y=cX(Z),J=Object.keys(Y),X=Object.values(Y);return G0($,J)(...X)}catch{return}}function Q0($){try{return $4($),!0}catch{return!1}}function N0($,Z){try{let Y=Z0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function G0($,Z){let Y=$4($),J=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let W=0;W<Z.length;W++){let z=Z[W];if(!J.test(z))continue;if(p6.has(z))continue;X.push(W),Q.push(z)}let G=(W)=>Function(...Q,...W,`
713
713
  'use strict';
714
714
  try {
715
715
  return ${Y};
@@ -720,7 +720,7 @@ catch (e) {
720
720
  }
721
721
  throw e;
722
722
  }
723
- `),K=G([]);if(Q.length===Z.length)return g6(K,Q,G);return g6((...W)=>{let z=Array(X.length);for(let U=0;U<X.length;U++)z[U]=W[X[U]];return K(...z)},Q,G,(W)=>{K=G(W)})}function g6($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let z=0;z<=8;z++)try{return G(...W)}catch(U){let _=U instanceof Error?U.message:"",B=Q.exec(_);if(!(U instanceof ReferenceError)||!B)return;let j=B[1];if(q.has(j)||u6.has(j))return;q.add(j),K.push(j),G=Y(K),J?.(K)}return}}function Z4($){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 xX,h6,d6,fX,m6,gX,u6;var R0=S(()=>{xX={maxSanitizeDepth:10,allowBracketNotation:!1},h6={...xX},d6=[/\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/],fX=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"]),m6=new Set(["__proto__","constructor","prototype"]),gX=/[\w)\]]\s*\[\s*['"]/;u6=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 Y4($,Z){let Y=pX++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return cX.set(J,{type:$,expression:Z}),J}var pX=0,cX;var p6=S(()=>{cX=new Map});function c6($,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 J4($,Z){return c6($,Z,lX,iX)}function l6($,Z){return c6($,Z,nX,oX)}function i6($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function A5($,Z,Y){let J=[],X="",Q=0,G=$.length,K=!1,q=null;while(Q<G){let W=$[Q];if(K){if(X+=W,q){if(W===q)q=null}else if(W==='"'||W==="'")q=W;else if(W===">")K=!1;Q++;continue}if(W==="<"){let z=Z($,Q);if(z>Q){X+=Y($.slice(Q,z),J.length),J.push($.slice(Q,z)),Q=z;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Q,Q+2)))K=!0;X+=W,Q++;continue}X+=W,Q++}return{output:X,tokens:J}}function x$($){let{output:Z,tokens:Y}=A5($,J4,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function f$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var lX,iX,nX,oX;var X4=S(()=>{lX=/<script\b[^>]*>/iy,iX=/<\/script\s*>/ig,nX=/<style\b[^>]*>/iy,oX=/<\/style\s*>/ig});var e6={};r(e6,{usesSignalsInScript:()=>p1,unescapeHtml:()=>g$,registerFilters:()=>rX,registerFilter:()=>s6,processExpressions:()=>s0,interpolateScriptsInTemplate:()=>tX,interpolateScriptExpressions:()=>a6,getAllFilters:()=>r6,evaluateExpression:()=>d0,escapeHtml:()=>u0,defaultFilters:()=>R5,clearCustomFilters:()=>aX,applyFilters:()=>t6});function sX($){let Z=n6.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),n6.set($,Z)}return Z.lastIndex=0,Z}function s6($,Z){if($ in R5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);N5[$]=Z}function rX($){for(let[Z,Y]of Object.entries($))s6(Z,Y)}function r6(){return{...R5,...N5}}function aX(){for(let $ of Object.keys(N5))delete N5[$]}function u0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function p1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function o6($,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 W=0;W<J.length;W++){let z=J[W];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&J[W+1]==="{"){G++,W++;continue}if(z==="}"&&G>0){G--;continue}continue}X+=z}J=X;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(J))!==null){let W=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function a6($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=d0(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=d0(X,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function tX($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(J,X,Q)=>{if(/\bsrc\s*=/.test(X))return J;if(/\bdata-raw\b/.test(X))return J;if(/\btype\s*=\s*["']application\/json["']/.test(X))return J;if(Y.skipServer&&/\bserver\b/.test(X))return J;let G=a6(Q,Z);return`<script${X}>${G}</script>`})}function s0($,Z,Y,J){let X=$,Q=(z,U)=>{let _=l6(z,U);if(_===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(U,_))?-1:_},G=(z,U,_,B)=>{let j=_.length,{output:H,tokens:L}=A5(z,U,(F,O)=>B(j+O));return _.push(...L),H},K=[];X=G(X,Q,K,(z)=>`<!--__STX_STYLE_${z}__-->`);let q=[];X=G(X,J4,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let W=J?.forceSignals===!0||p1($);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,U,_)=>{try{let B=d0(U,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let j=B instanceof Error?B.message:String(B);return K0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${j}`,Y,$,_,z)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,_)=>{try{let B=d0(U,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return Y4("raw",U.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return Y4("raw",U.trim());let j=B instanceof Error?B.message:String(B);return K0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${j}`,Y,$,_,z)}}),X=G(X,J4,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),X=G(X,Q,K,(z)=>`<!--__STX_STYLE_${z}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(z,U,_)=>{let B=U.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=B.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,w=B.match(V),A=w&&!j.includes(w[1])&&!(w[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let N=d0(U,Z);if(N===void 0&&W&&!o6(B,Z))return z;if(N===void 0&&Z.__stx_buildMode==="compile"&&!W)return Y4("expr",B);return N!==void 0&&N!==null?u0(String(N)):""}catch(N){if(W&&!o6(B,Z))return z;if(A)return z;let R=N instanceof Error?N.message:String(N);return K0("Expression",`Error evaluating: {{ ${B} }}: ${R}`,Y,$,_,z)}});for(let z=0;z<q.length;z++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>q[z]);for(let z=0;z<K.length;z++)X=X.replace(`<!--__STX_STYLE_${z}__-->`,()=>K[z]);return X}function t6($,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=N5[G]||R5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(r6()).join(", ")}`);let q=[];if(X.startsWith(":")){let W=X.match(/^:([^|\s]+)/);if(W){let z=W[1].trim();try{let U=Number(z);q=[Number.isNaN(U)?z:U]}catch{q=[z]}X=X.substring(W[0].length).trim()}}else if(X.startsWith("(")){let W=1,z=1;while(W>0&&z<X.length){if(X[z]==="(")W++;if(X[z]===")")W--;z++}if(W===0){let U=X.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[d0(`(${U})`,Y,!0)];else{let _=[],B="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){B+=w,O=!1;continue}if(w==="\\"){B+=w,O=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){_.push(B),B="";continue}B+=w}if(B)_.push(B);q=_.map((V)=>{let w=V.trim();return d0(w,Y,!0)})}}catch{q=[U]}X=X.substring(z).trim()}}try{J=K(J,Y,...q)}catch(W){let z=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${z}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function eX($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>0)K++}continue}if(Z)continue;if(q==="(")J++;else if(q===")")J--;else if(q==="[")X++;else if(q==="]")X--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&J===0&&X===0&&Q===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function d0($,Z,Y=!1){try{let J=$.trim(),X=eX(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=d0(Q,Z,!0);return t6(K,G,Z)}if(!Q0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return Z0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return G0(J,Q)(...G)}catch{return Z0(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=$Q(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 $Q($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=ZQ($,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 ZQ($,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 q=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+q)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function g$($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var N5,n6,R5;var r0=S(()=>{R0();A0();p6();X4();N5={},n6=new Map;R5={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 u0(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 q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(sX(q),String(W))}),K},t:($,Z,Y={})=>{return R5.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 T5{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 l1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!c1.has(Y)){if(c1.size>=YQ){let J=c1.keys().next().value;if(J)c1.delete(J)}c1.set(Y,new RegExp($,Z))}return c1.get(Y)}class $9{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(q)=>{try{let W=`${Y}:${q}`,z=X.get(W);if(!z){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}z=Function(...Z,`
723
+ `),K=G([]);if(Q.length===Z.length)return h6(K,Q,G);return h6((...W)=>{let z=Array(X.length);for(let U=0;U<X.length;U++)z[U]=W[X[U]];return K(...z)},Q,G,(W)=>{K=G(W)})}function h6($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let z=0;z<=8;z++)try{return G(...W)}catch(U){let _=U instanceof Error?U.message:"",B=Q.exec(_);if(!(U instanceof ReferenceError)||!B)return;let j=B[1];if(q.has(j)||p6.has(j))return;q.add(j),K.push(j),G=Y(K),J?.(K)}return}}function Z4($){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 gX,d6,m6,hX,u6,dX,p6;var R0=S(()=>{gX={maxSanitizeDepth:10,allowBracketNotation:!1},d6={...gX},m6=[/\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/],hX=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"]),u6=new Set(["__proto__","constructor","prototype"]),dX=/[\w)\]]\s*\[\s*['"]/;p6=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 Y4($,Z){let Y=lX++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return iX.set(J,{type:$,expression:Z}),J}var lX=0,iX;var c6=S(()=>{iX=new Map});function l6($,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 J4($,Z){return l6($,Z,nX,oX)}function i6($,Z){return l6($,Z,sX,rX)}function n6($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function A5($,Z,Y){let J=[],X="",Q=0,G=$.length,K=!1,q=null;while(Q<G){let W=$[Q];if(K){if(X+=W,q){if(W===q)q=null}else if(W==='"'||W==="'")q=W;else if(W===">")K=!1;Q++;continue}if(W==="<"){let z=Z($,Q);if(z>Q){X+=Y($.slice(Q,z),J.length),J.push($.slice(Q,z)),Q=z;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Q,Q+2)))K=!0;X+=W,Q++;continue}X+=W,Q++}return{output:X,tokens:J}}function x$($){let{output:Z,tokens:Y}=A5($,J4,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function f$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var nX,oX,sX,rX;var X4=S(()=>{nX=/<script\b[^>]*>/iy,oX=/<\/script\s*>/ig,sX=/<style\b[^>]*>/iy,rX=/<\/style\s*>/ig});var $9={};r($9,{usesSignalsInScript:()=>p1,unescapeHtml:()=>g$,registerFilters:()=>tX,registerFilter:()=>r6,processExpressions:()=>s0,interpolateScriptsInTemplate:()=>$Q,interpolateScriptExpressions:()=>t6,getAllFilters:()=>a6,evaluateExpression:()=>d0,escapeHtml:()=>u0,defaultFilters:()=>R5,clearCustomFilters:()=>eX,applyFilters:()=>e6});function aX($){let Z=o6.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),o6.set($,Z)}return Z.lastIndex=0,Z}function r6($,Z){if($ in R5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);N5[$]=Z}function tX($){for(let[Z,Y]of Object.entries($))r6(Z,Y)}function a6(){return{...R5,...N5}}function eX(){for(let $ of Object.keys(N5))delete N5[$]}function u0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function p1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function s6($,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 W=0;W<J.length;W++){let z=J[W];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&J[W+1]==="{"){G++,W++;continue}if(z==="}"&&G>0){G--;continue}continue}X+=z}J=X;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(J))!==null){let W=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function t6($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=d0(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=d0(X,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function $Q($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(J,X,Q)=>{if(/\bsrc\s*=/.test(X))return J;if(/\bdata-raw\b/.test(X))return J;if(/\btype\s*=\s*["']application\/json["']/.test(X))return J;if(Y.skipServer&&/\bserver\b/.test(X))return J;let G=t6(Q,Z);return`<script${X}>${G}</script>`})}function s0($,Z,Y,J){let X=$,Q=(z,U)=>{let _=i6(z,U);if(_===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(U,_))?-1:_},G=(z,U,_,B)=>{let j=_.length,{output:H,tokens:L}=A5(z,U,(F,O)=>B(j+O));return _.push(...L),H},K=[];X=G(X,Q,K,(z)=>`<!--__STX_STYLE_${z}__-->`);let q=[];X=G(X,J4,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let W=J?.forceSignals===!0||p1($);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,U,_)=>{try{let B=d0(U,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let j=B instanceof Error?B.message:String(B);return K0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${j}`,Y,$,_,z)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,_)=>{try{let B=d0(U,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return Y4("raw",U.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return Y4("raw",U.trim());let j=B instanceof Error?B.message:String(B);return K0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${j}`,Y,$,_,z)}}),X=G(X,J4,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),X=G(X,Q,K,(z)=>`<!--__STX_STYLE_${z}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(z,U,_)=>{let B=U.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=B.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,w=B.match(V),A=w&&!j.includes(w[1])&&!(w[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let N=d0(U,Z);if(N===void 0&&W&&!s6(B,Z))return z;if(N===void 0&&Z.__stx_buildMode==="compile"&&!W)return Y4("expr",B);return N!==void 0&&N!==null?u0(String(N)):""}catch(N){if(W&&!s6(B,Z))return z;if(A)return z;let R=N instanceof Error?N.message:String(N);return K0("Expression",`Error evaluating: {{ ${B} }}: ${R}`,Y,$,_,z)}});for(let z=0;z<q.length;z++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>q[z]);for(let z=0;z<K.length;z++)X=X.replace(`<!--__STX_STYLE_${z}__-->`,()=>K[z]);return X}function e6($,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=N5[G]||R5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(a6()).join(", ")}`);let q=[];if(X.startsWith(":")){let W=X.match(/^:([^|\s]+)/);if(W){let z=W[1].trim();try{let U=Number(z);q=[Number.isNaN(U)?z:U]}catch{q=[z]}X=X.substring(W[0].length).trim()}}else if(X.startsWith("(")){let W=1,z=1;while(W>0&&z<X.length){if(X[z]==="(")W++;if(X[z]===")")W--;z++}if(W===0){let U=X.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[d0(`(${U})`,Y,!0)];else{let _=[],B="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){B+=w,O=!1;continue}if(w==="\\"){B+=w,O=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){_.push(B),B="";continue}B+=w}if(B)_.push(B);q=_.map((V)=>{let w=V.trim();return d0(w,Y,!0)})}}catch{q=[U]}X=X.substring(z).trim()}}try{J=K(J,Y,...q)}catch(W){let z=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${z}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function ZQ($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>0)K++}continue}if(Z)continue;if(q==="(")J++;else if(q===")")J--;else if(q==="[")X++;else if(q==="]")X--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&J===0&&X===0&&Q===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function d0($,Z,Y=!1){try{let J=$.trim(),X=ZQ(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=d0(Q,Z,!0);return e6(K,G,Z)}if(!Q0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return Z0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return G0(J,Q)(...G)}catch{return Z0(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=YQ(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 YQ($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=JQ($,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 JQ($,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 q=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+q)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function g$($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var N5,o6,R5;var r0=S(()=>{R0();A0();c6();X4();N5={},o6=new Map;R5={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 u0(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 q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(aX(q),String(W))}),K},t:($,Z,Y={})=>{return R5.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 T5{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 l1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!c1.has(Y)){if(c1.size>=XQ){let J=c1.keys().next().value;if(J)c1.delete(J)}c1.set(Y,new RegExp($,Z))}return c1.get(Y)}class Z9{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(q)=>{try{let W=`${Y}:${q}`,z=X.get(W);if(!z){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}z=Function(...Z,`
724
724
  'use strict';
725
725
  try {
726
726
  return ${q};
@@ -731,38 +731,38 @@ catch (e) {
731
731
  }
732
732
  throw e;
733
733
  }
734
- `),X.set(W,z)}return z(...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 Z9{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 q of this.violationHandlers)try{q(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 JQ(){if(!h$)h$=new Z9;return h$}var c1,YQ=500,NB,h$=null,Y9;var i1=S(()=>{c1=new Map;NB=new $9;Y9=new Proxy({},{get($,Z){return JQ()[Z]}})});function J9($,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 X9($,Z,Y={}){let{prefix:J="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=d$($),q=[],W=new Map;if(Q)for(let z of K){let U=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let _=U[1],B=`${Z}_${_}`;W.set(_,B)}}for(let z of K){let U=Q9(z,Z,J,X,W,G);q.push(U)}return q.join(`
734
+ `),X.set(W,z)}return z(...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 Y9{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 q of this.violationHandlers)try{q(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 QQ(){if(!h$)h$=new Y9;return h$}var c1,XQ=500,TB,h$=null,J9;var i1=S(()=>{c1=new Map;TB=new Z9;J9=new Proxy({},{get($,Z){return QQ()[Z]}})});function X9($,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 Q9($,Z,Y={}){let{prefix:J="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=d$($),q=[],W=new Map;if(Q)for(let z of K){let U=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let _=U[1],B=`${Z}_${_}`;W.set(_,B)}}for(let z of K){let U=G9(z,Z,J,X,W,G);q.push(U)}return q.join(`
735
735
 
736
736
  `)}function d$($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,X="",Q=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&J===0)Q=!0;if(q==="{")J++;else if(q==="}"){if(J--,J===0){if(Q){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,z,U,_]=W;if(z==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:_.trim()});else if(z==="media"||z==="supports"||z==="container"){let B=d$(_);Z.push({selector:`@${z} ${U.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
737
- `)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:_.trim()})}G="",Q=!1}else if(X.trim()){X+=q;let W=X.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});X=""}continue}}if(Q)G+=q;else X+=q}return Z}function Q9($,Z,Y,J,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=d$(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((_)=>Q9(_,Z,Y,J,X,Q)).join(`
737
+ `)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:_.trim()})}G="",Q=!1}else if(X.trim()){X+=q;let W=X.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});X=""}continue}}if(Q)G+=q;else X+=q}return Z}function G9($,Z,Y,J,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=d$(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((_)=>G9(_,Z,Y,J,X,Q)).join(`
738
738
  `);return`${G} {
739
739
  ${U}
740
- }`}return`${G} { ${K} }`}let q=XQ(G,Z,Y,J),W=K;for(let[z,U]of X)W=W.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(Q)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function XQ($,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}`)}return Q.join(", ")}function Q4($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Y=J9(Z),J=`data-v-${Y}`,X=$,Q=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(X=X.replace(Q,(K,q,W)=>{G=!0;let z=QQ(W,J),U=q.replace(/\bscoped\b/gi,"").trim(),_=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${_}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return X=GQ(X,J),{html:X,hasScoped:!0}}function QQ($,Z){return X9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function GQ($,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 m$=()=>{};var G9=()=>{};function S0($,Z,Y,J=0){let X=0,Q=J,G=null,K=0,q=!1;while(Q<$.length){let W=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&W==="\\"){q=!0,Q++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,Q++;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&W==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&W==="}"){K--,Q++;continue}if(W==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(W===Z)X++;else if(W===Y){if(X--,X===0)return Q}Q++}return-1}var u$={};r(u$,{useTitle:()=>_Q,useSeoMeta:()=>K4,usePageTitle:()=>_Q,useHead:()=>T1,resetHead:()=>zQ,renderHtmlAttrs:()=>jQ,renderHead:()=>BQ,renderBodyAttrs:()=>HQ,processTitleDirective:()=>FQ,processMetaDirective:()=>VQ,processHeadDirective:()=>LQ,getPageMeta:()=>qQ,getHead:()=>M5,definePageMeta:()=>UQ,applyHead:()=>OQ});function M5(){return K1}function qQ(){return G4}function zQ(){K1={},KQ.length=0,G4={}}function T1($){K1=WQ(K1,$)}function WQ($,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 K4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}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 q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});T1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function UQ($){if(G4={...G4,...$},$.title||$.description)K4({title:$.title,description:$.description})}function _Q($){let Z=typeof $==="function"?$():$;T1({title:Z})}function BQ($=K1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${R1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,X])=>`${J}="${R1(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}="${R1(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}="${R1(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}="${R1(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(`
741
- `)}function jQ($=K1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${R1(Y)}"`).join(" ")}function HQ($=K1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${R1(Y)}"`).join(" ")}function R1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function OQ($=K1){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))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function LQ($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,X)=>{return Z+=X.trim()+`
742
- `,""}),headContent:Z.trim()}}function FQ($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,X,Q)=>{let G=J?X:Z[(Q||"").trim()]??Q;return T1({title:G}),""})}function VQ($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,X,Q,G,K)=>{let q=Q?G:K,W=Q?q:Z[(q||"").trim()]??q,U=X.includes(":")?{property:X,content:W}:{name:X,content:W};return T1({meta:[U]}),""})}var K1,KQ,G4;var I5=S(()=>{K1={},KQ=[],G4={}});var q4={};r(q4,{stripTypeScript:()=>U9,hasVariables:()=>O9,extractVariables:()=>M1,extractScriptFromTemplate:()=>H9,convertToCommonJS:()=>c$});import n1 from"path";import D5 from"process";function wQ($){let Z=[],Y=0,J=$.split(`
743
- `);for(let X of J){let Q=Y,G=null,K=!1;for(let q=0;q<X.length;q++){let W=X[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<X.length&&X[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(Q===0){let q=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let W=X.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let U=W[1].slice(1,-1).split(",").map((_)=>{let B=_.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((_)=>/^\w+$/.test(_));Z.push(...U)}}}}return[...new Set(Z)]}function U9($){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,q=null;for(let W=0;W<J.length;W++){let z=J[W];if(q){if(Q+=z,z===q)q=null;continue}if(z==='"'||z==="'"||z==="`"){q=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")K++;else if(z===")")K--;if(z===","&&G===0&&K===0){X.push(Q),Q="";continue}Q+=z}if(Q)X.push(Q);return X.map((W)=>{let z=W.trim(),U=z.startsWith("..."),_=U?z.slice(3):z,B=-1,j=0;for(let A=0;A<_.length;A++)if(_[A]==="<")j++;else if(_[A]===">")j--;else if(_[A]===":"&&j===0){B=A;break}if(B===-1)return W;let L=_.substring(0,B).trim().replace(/\?$/,""),F=_.substring(B+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).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,q=G+1,W=0,z=null;while(q<Z.length&&K>0){let B=Z[q];if(z){if(B===z)z=null;q++;continue}if(B==='"'||B==="'"||B==="`"){z=B,q++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")K++;else if(B===")")K--}if(K>0)q++}if(K!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let _=Y(U);Q.push({start:G+1,end:q,replacement:_})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];Z=Z.substring(0,K)+W+Z.substring(q)}}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,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
740
+ }`}return`${G} { ${K} }`}let q=GQ(G,Z,Y,J),W=K;for(let[z,U]of X)W=W.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(Q)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function GQ($,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}`)}return Q.join(", ")}function Q4($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Y=X9(Z),J=`data-v-${Y}`,X=$,Q=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(X=X.replace(Q,(K,q,W)=>{G=!0;let z=KQ(W,J),U=q.replace(/\bscoped\b/gi,"").trim(),_=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${_}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return X=qQ(X,J),{html:X,hasScoped:!0}}function KQ($,Z){return Q9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function qQ($,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 m$=()=>{};var K9=()=>{};function S0($,Z,Y,J=0){let X=0,Q=J,G=null,K=0,q=!1;while(Q<$.length){let W=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&W==="\\"){q=!0,Q++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,Q++;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&W==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&W==="}"){K--,Q++;continue}if(W==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(W===Z)X++;else if(W===Y){if(X--,X===0)return Q}Q++}return-1}var u$={};r(u$,{useTitle:()=>jQ,useSeoMeta:()=>K4,usePageTitle:()=>jQ,useHead:()=>T1,resetHead:()=>UQ,renderHtmlAttrs:()=>OQ,renderHead:()=>HQ,renderBodyAttrs:()=>LQ,processTitleDirective:()=>wQ,processMetaDirective:()=>AQ,processHeadDirective:()=>VQ,getPageMeta:()=>WQ,getHead:()=>M5,definePageMeta:()=>BQ,applyHead:()=>FQ});function M5(){return K1}function WQ(){return G4}function UQ(){K1={},zQ.length=0,G4={}}function T1($){K1=_Q(K1,$)}function _Q($,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 K4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}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 q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});T1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function BQ($){if(G4={...G4,...$},$.title||$.description)K4({title:$.title,description:$.description})}function jQ($){let Z=typeof $==="function"?$():$;T1({title:Z})}function HQ($=K1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${R1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,X])=>`${J}="${R1(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}="${R1(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}="${R1(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}="${R1(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(`
741
+ `)}function OQ($=K1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${R1(Y)}"`).join(" ")}function LQ($=K1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${R1(Y)}"`).join(" ")}function R1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function FQ($=K1){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))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function VQ($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,X)=>{return Z+=X.trim()+`
742
+ `,""}),headContent:Z.trim()}}function wQ($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,X,Q)=>{let G=J?X:Z[(Q||"").trim()]??Q;return T1({title:G}),""})}function AQ($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,X,Q,G,K)=>{let q=Q?G:K,W=Q?q:Z[(q||"").trim()]??q,U=X.includes(":")?{property:X,content:W}:{name:X,content:W};return T1({meta:[U]}),""})}var K1,zQ,G4;var I5=S(()=>{K1={},zQ=[],G4={}});var q4={};r(q4,{stripTypeScript:()=>_9,hasVariables:()=>L9,extractVariables:()=>M1,extractScriptFromTemplate:()=>O9,convertToCommonJS:()=>c$});import n1 from"path";import D5 from"process";function NQ($){let Z=[],Y=0,J=$.split(`
743
+ `);for(let X of J){let Q=Y,G=null,K=!1;for(let q=0;q<X.length;q++){let W=X[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<X.length&&X[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(Q===0){let q=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let W=X.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let U=W[1].slice(1,-1).split(",").map((_)=>{let B=_.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((_)=>/^\w+$/.test(_));Z.push(...U)}}}}return[...new Set(Z)]}function _9($){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,q=null;for(let W=0;W<J.length;W++){let z=J[W];if(q){if(Q+=z,z===q)q=null;continue}if(z==='"'||z==="'"||z==="`"){q=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")K++;else if(z===")")K--;if(z===","&&G===0&&K===0){X.push(Q),Q="";continue}Q+=z}if(Q)X.push(Q);return X.map((W)=>{let z=W.trim(),U=z.startsWith("..."),_=U?z.slice(3):z,B=-1,j=0;for(let A=0;A<_.length;A++)if(_[A]==="<")j++;else if(_[A]===">")j--;else if(_[A]===":"&&j===0){B=A;break}if(B===-1)return W;let L=_.substring(0,B).trim().replace(/\?$/,""),F=_.substring(B+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).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,q=G+1,W=0,z=null;while(q<Z.length&&K>0){let B=Z[q];if(z){if(B===z)z=null;q++;continue}if(B==='"'||B==="'"||B==="`"){z=B,q++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")K++;else if(B===")")K--}if(K>0)q++}if(K!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let _=Y(U);Q.push({start:G+1,end:q,replacement:_})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];Z=Z.substring(0,K)+W+Z.substring(q)}}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,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
744
744
 
745
- `),Z}async function M1($,Z,Y,J={}){if(!$.trim())return;let X;try{let v=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}),f=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");f=f.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=v.transformSync(f)}catch{X=U9($)}let Q={exports:{}},G=Q.exports,K=D5.cwd(),q={},W=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((v)=>v[1]).filter((v)=>!v.startsWith("node:")&&!v.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(v));for(let v of W)try{let f=n1.resolve(K,"node_modules",v),C=n1.join(f,"package.json"),x=JSON.parse(z0("fs").readFileSync(C,"utf8")),u=x.main||"index.js";if(x.exports){let p=typeof x.exports==="string"?x.exports:x.exports["."];if(typeof p==="string")u=p;else if(p?.bun)u=p.bun;else if(p?.import)u=p.import;else if(p?.default)u=p.default}q[v]=await import(n1.resolve(f,u))}catch{}let z=(v)=>{if(q[v])return q[v];return z0(v)},U=Z.props||{},_=(v)=>{if(!v)return U;let f={};for(let[C,x]of Object.entries(v)){let u=U[C];if(u!==void 0)f[C]=u;else if(typeof x==="function")f[C]=x();else f[C]=x}return f};for(let[v,f]of Object.entries(U))Object.defineProperty(_,v,{value:f,enumerable:!0,configurable:!0,writable:!0});let B=(v)=>{if(!v)return U;let f={...U};for(let[C,x]of Object.entries(v)){let u=x&&typeof x==="object"&&!Array.isArray(x)?x:{type:x};if(f[C]===void 0&&u.default!==void 0)f[C]=typeof u.default==="function"?u.default():u.default}return f},j=()=>Z.slots||{},H=(v,f)=>{let C={...v};for(let[x,u]of Object.entries(f))if(C[x]===void 0)if(typeof u==="function")C[x]=u();else C[x]=u;return C},L=(v)=>{let f=()=>v;return f.set=(C)=>{},f.update=(C)=>{},f},F=(v)=>{let f,C=!1;return()=>{if(!C)try{f=v(),C=!0}catch{f=void 0}return f}},O=(v)=>{},V=(v)=>v(),w=(v)=>{},A=(v)=>{},N=(v)=>{},R=()=>{let v=Z.__stxServeContext,f=Z.__stxServeSearch??v?.search??"",C=v?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(f)),path:C,name:"",fullPath:C+f,hash:"",matched:[]}},T=()=>({push:(v)=>{},replace:(v)=>{},back:()=>{},forward:()=>{},go:(v)=>{}}),M=(v)=>{T1(v);let f=Z.__stx_runtime_head||{},C=v||{};Z.__stx_runtime_head={...f,...C.title&&{title:C.title},meta:[...f.meta||[],...C.meta||[]],link:[...f.link||[],...C.link||[]],script:[...f.script||[],...C.script||[]],htmlAttrs:{...f.htmlAttrs||{},...C.htmlAttrs||{}},bodyAttrs:{...f.bodyAttrs||{},...C.bodyAttrs||{}}}},I=(v)=>{K4(v);let f=M5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...f.title&&{title:f.title},meta:f.meta?[...f.meta]:[]}},D=(v)=>({value:v}),E=(v)=>v,P=(v)=>({value:typeof v==="function"?v():v}),b=(v,f)=>{},k=(v)=>{},y=(v)=>{},g=(v)=>v?v():Promise.resolve(),h=(v)=>(f,...C)=>{},m=(v)=>{},i=(v,f)=>{},c=(v,f)=>f,q0=()=>({value:"light"}),F0=()=>({value:!1}),_0={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:{}},$0=new Proxy(_0,{get(v,f){if(f in v)return v[f];return},set(v,f,C){return v[f]=C,!0}}),k0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},f0=console;try{let v=c$(X,Y),f=new Set(Object.keys(U)),C=Object.keys(Z).filter((a)=>!f.has(a)&&a!=="props"),x=C.map((a)=>Z[a]),u=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"]),p=[],X0=[];for(let[a,V1]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(u.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(v))continue;p.push(a),X0.push(V1)}let b0=wQ(v).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
745
+ `),Z}async function M1($,Z,Y,J={}){if(!$.trim())return;let X;try{let v=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}),f=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");f=f.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=v.transformSync(f)}catch{X=_9($)}let Q={exports:{}},G=Q.exports,K=D5.cwd(),q={},W=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((v)=>v[1]).filter((v)=>!v.startsWith("node:")&&!v.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(v));for(let v of W)try{let f=n1.resolve(K,"node_modules",v),C=n1.join(f,"package.json"),x=JSON.parse(z0("fs").readFileSync(C,"utf8")),u=x.main||"index.js";if(x.exports){let p=typeof x.exports==="string"?x.exports:x.exports["."];if(typeof p==="string")u=p;else if(p?.bun)u=p.bun;else if(p?.import)u=p.import;else if(p?.default)u=p.default}q[v]=await import(n1.resolve(f,u))}catch{}let z=(v)=>{if(q[v])return q[v];return z0(v)},U=Z.props||{},_=(v)=>{if(!v)return U;let f={};for(let[C,x]of Object.entries(v)){let u=U[C];if(u!==void 0)f[C]=u;else if(typeof x==="function")f[C]=x();else f[C]=x}return f};for(let[v,f]of Object.entries(U))Object.defineProperty(_,v,{value:f,enumerable:!0,configurable:!0,writable:!0});let B=(v)=>{if(!v)return U;let f={...U};for(let[C,x]of Object.entries(v)){let u=x&&typeof x==="object"&&!Array.isArray(x)?x:{type:x};if(f[C]===void 0&&u.default!==void 0)f[C]=typeof u.default==="function"?u.default():u.default}return f},j=()=>Z.slots||{},H=(v,f)=>{let C={...v};for(let[x,u]of Object.entries(f))if(C[x]===void 0)if(typeof u==="function")C[x]=u();else C[x]=u;return C},L=(v)=>{let f=()=>v;return f.set=(C)=>{},f.update=(C)=>{},f},F=(v)=>{let f,C=!1;return()=>{if(!C)try{f=v(),C=!0}catch{f=void 0}return f}},O=(v)=>{},V=(v)=>v(),w=(v)=>{},A=(v)=>{},N=(v)=>{},R=()=>{let v=Z.__stxServeContext,f=Z.__stxServeSearch??v?.search??"",C=v?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(f)),path:C,name:"",fullPath:C+f,hash:"",matched:[]}},T=()=>({push:(v)=>{},replace:(v)=>{},back:()=>{},forward:()=>{},go:(v)=>{}}),M=(v)=>{T1(v);let f=Z.__stx_runtime_head||{},C=v||{};Z.__stx_runtime_head={...f,...C.title&&{title:C.title},meta:[...f.meta||[],...C.meta||[]],link:[...f.link||[],...C.link||[]],script:[...f.script||[],...C.script||[]],htmlAttrs:{...f.htmlAttrs||{},...C.htmlAttrs||{}},bodyAttrs:{...f.bodyAttrs||{},...C.bodyAttrs||{}}}},I=(v)=>{K4(v);let f=M5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...f.title&&{title:f.title},meta:f.meta?[...f.meta]:[]}},D=(v)=>({value:v}),E=(v)=>v,P=(v)=>({value:typeof v==="function"?v():v}),b=(v,f)=>{},k=(v)=>{},y=(v)=>{},g=(v)=>v?v():Promise.resolve(),h=(v)=>(f,...C)=>{},m=(v)=>{},i=(v,f)=>{},c=(v,f)=>f,q0=()=>({value:"light"}),F0=()=>({value:!1}),_0={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:{}},$0=new Proxy(_0,{get(v,f){if(f in v)return v[f];return},set(v,f,C){return v[f]=C,!0}}),k0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},f0=console;try{let v=c$(X,Y),f=new Set(Object.keys(U)),C=Object.keys(Z).filter((a)=>!f.has(a)&&a!=="props"),x=C.map((a)=>Z[a]),u=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"]),p=[],X0=[];for(let[a,V1]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(u.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(v))continue;p.push(a),X0.push(V1)}let b0=NQ(v).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
746
746
  `),d1=Z.params??{},g0=[],X1=[];for(let a=0;a<C.length;a++){if(C[a]==="params")continue;g0.push(C[a]),X1.push(x[a])}let F1=await Function("module","exports","require","props","$props","defineProps","withDefaults","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","window","document","console","confirm","alert","fetch","params",...p,...g0,`return (async () => {
747
747
  ${v}
748
748
  ${b0}
749
749
  return module.exports
750
- })()`)(Q,G,z,U,_,B,H,L,F,O,V,w,A,N,R,T,M,I,D,E,P,b,k,y,g,h,m,j,i,c,q0,F0,$0,k0,f0,_0.confirm,_0.alert,_0.fetch,d1,...X0,...X1);if(J.preserveExisting){for(let[a,V1]of Object.entries(F1))if(!(a in Z)||Z[a]===void 0)Z[a]=V1}else Object.assign(Z,F1);for(let[a,V1]of Object.entries(U))if(!(a in Z))Z[a]=V1}catch(v){if(D5.env.STX_DEBUG){let f=v instanceof Error?v.message:String(v);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${f}`)}try{await MQ(X,Z,Y)}catch(f){if(D5.env.STX_DEBUG){let C=f instanceof Error?f.message:String(f);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${C}`)}}}}function c$($,Z){let Y=Z?n1.dirname(Z):D5.cwd(),J=$.split(`
751
- `),X=[],Q=0;while(Q<J.length){let G=J[Q].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;Q<J.length;Q++){for(let q of J[Q])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}Q++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let W=Q;W<J.length&&!q;W++){let z=null,U=!1,_=J[W];for(let B=0;B<_.length;B++){let j=_[B];if(U){U=!1;continue}if(j==="\\"){U=!0;continue}if(z){if(j===z)z=null;continue}if(j==='"'||j==="'"||j==="`"){z=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){Q=W+1,q=!0;break}}}}if(!q)Q=J.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+['"](.+)['"]/),z=(U)=>{if(U.startsWith("."))return n1.resolve(Y,U);return U};if(K){let[,U,_]=K,B=z(_);X.push(`const ${U} = await import('${B}')`),X.push(`module.exports.${U} = ${U};`)}else if(q){let[,U,_]=q,B=U.trim(),j=z(_);X.push(`const { ${B} } = await import('${j}')`);for(let H of B.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)X.push(`module.exports.${L} = ${L};`)}}else if(W){let U=z(W[1]);X.push(`await import('${U}')`)}else X.push(G);Q++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))X.push(J[Q]),Q++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=K9(J,Q),{type:q,name:W,value:z}=K;X.push(`${q} ${W} = ${z};`),X.push(`module.exports.${W} = ${W};`),Q=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=p$(J,Q);X.push(K.functionCode),X.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=K9(J,Q),{type:q,name:W,value:z}=K;X.push(`${q} ${W} = ${z};`),X.push(`module.exports.${W} = ${W};`),Q=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=p$(J,Q);X.push(K.functionCode),X.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...J];q[Q]=K;let W=p$(q,Q);if(X.push(W.functionCode),W.name)X.push(`module.exports.default = ${W.name};`);Q=W.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");X.push(`module.exports.default = ${K};`),Q++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=J[Q].replace(/^export\s+/,""),z=0,U=Q;for(;U<J.length;U++){let _=J[U];for(let B of _)if(B==="{")z++;else if(B==="}")z--;if(U>Q)W+=`
752
- `+_;if(z<=0&&U>=Q)break}X.push(W),X.push(`module.exports.${q} = ${q};`),Q=U+1}else X.push(G),Q++}else if(G.includes("module.exports"))X.push(G),Q++;else if(G.trim()&&!G.startsWith("//"))X.push(G),Q++;else Q++}return AQ(X.join(`
753
- `),Y)}function AQ($,Z){let Y=$.length,J="",X=0,Q=null,G=!1,K=!1,q=0;while(X<Y){let W=$[X],z=$[X+1];if(G){if(J+=W,W===`
754
- `)G=!1;X++;continue}if(K){if(J+=W,W==="*"&&z==="/"){J+=z,X+=2,K=!1;continue}X++;continue}if(!Q&&W==="/"&&z==="/"){G=!0,J+=W,X++;continue}if(!Q&&W==="/"&&z==="*"){K=!0,J+=W,X++;continue}if(Q){if(J+=W,W==="\\"){J+=z,X+=2;continue}if(W===Q&&Q!=="`"){Q=null,X++;continue}if(Q==="`"){if(W==="$"&&z==="{"){q++,J+=z,X+=2;continue}if(W==="`"){Q=null,X++;continue}}X++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){Q=W,J+=W,X++;continue}if(W==="a"&&$.startsWith("await",X)){let U=NQ($,X);if(U){let{quote:_,path:B,end:j}=U;if(B.startsWith(".")){let H=n1.resolve(Z,B);J+=`await import(${_}${H}${_})`,X=j;continue}}}J+=W,X++}return J}function NQ($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let J=$[Y];if(J!=="'"&&J!=='"')return null;Y++;let X=Y;while(Y<$.length&&$[Y]!==J)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let Q=$.slice(X,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:J,path:Q,end:Y+1}}function _9($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let X=S0($,Y,Y==="{"?"}":"]",Z);if(X===-1)return null;return{pattern:$.slice(Z,X+1),endPos:X+1}}function B9($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,X=0,Q="";while(J<Y.length){let G=Y[J];if(G==="{"||G==="["){if(X++,X===1){let K=_9(Y,J);if(K){let q=B9(K.pattern);Z.push(...q),J=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")X--;if(X>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<Y.length&&Y[J]!==","&&X===0){if(Y[J]==="{"||Y[J]==="[")X++;else if(Y[J]==="}"||Y[J]==="]")X--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function K9($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!J){let W=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let z=Y.slice(W[0].length),U=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let B=z.startsWith("{")?"}":"]",j=z;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),U=H,$[H].includes(B))break;z=j}let _=_9(z,0);if(_){let B=W[1],j=_.pattern,H=z.slice(_.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(U,Z);if(q9(L)){let N=z9($,O,L);F=N.value,O=N.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=B9(j),w=`__stx_src_${Z}`,A=V.map((N)=>`module.exports.${N} = ${N};`).join(`
750
+ })()`)(Q,G,z,U,_,B,H,L,F,O,V,w,A,N,R,T,M,I,D,E,P,b,k,y,g,h,m,j,i,c,q0,F0,$0,k0,f0,_0.confirm,_0.alert,_0.fetch,d1,...X0,...X1);if(J.preserveExisting){for(let[a,V1]of Object.entries(F1))if(!(a in Z)||Z[a]===void 0)Z[a]=V1}else Object.assign(Z,F1);for(let[a,V1]of Object.entries(U))if(!(a in Z))Z[a]=V1}catch(v){if(D5.env.STX_DEBUG){let f=v instanceof Error?v.message:String(v);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${f}`)}try{await DQ(X,Z,Y)}catch(f){if(D5.env.STX_DEBUG){let C=f instanceof Error?f.message:String(f);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${C}`)}}}}function c$($,Z){let Y=Z?n1.dirname(Z):D5.cwd(),J=$.split(`
751
+ `),X=[],Q=0;while(Q<J.length){let G=J[Q].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;Q<J.length;Q++){for(let q of J[Q])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}Q++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let W=Q;W<J.length&&!q;W++){let z=null,U=!1,_=J[W];for(let B=0;B<_.length;B++){let j=_[B];if(U){U=!1;continue}if(j==="\\"){U=!0;continue}if(z){if(j===z)z=null;continue}if(j==='"'||j==="'"||j==="`"){z=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){Q=W+1,q=!0;break}}}}if(!q)Q=J.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+['"](.+)['"]/),z=(U)=>{if(U.startsWith("."))return n1.resolve(Y,U);return U};if(K){let[,U,_]=K,B=z(_);X.push(`const ${U} = await import('${B}')`),X.push(`module.exports.${U} = ${U};`)}else if(q){let[,U,_]=q,B=U.trim(),j=z(_);X.push(`const { ${B} } = await import('${j}')`);for(let H of B.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)X.push(`module.exports.${L} = ${L};`)}}else if(W){let U=z(W[1]);X.push(`await import('${U}')`)}else X.push(G);Q++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))X.push(J[Q]),Q++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=q9(J,Q),{type:q,name:W,value:z}=K;X.push(`${q} ${W} = ${z};`),X.push(`module.exports.${W} = ${W};`),Q=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=p$(J,Q);X.push(K.functionCode),X.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=q9(J,Q),{type:q,name:W,value:z}=K;X.push(`${q} ${W} = ${z};`),X.push(`module.exports.${W} = ${W};`),Q=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=p$(J,Q);X.push(K.functionCode),X.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...J];q[Q]=K;let W=p$(q,Q);if(X.push(W.functionCode),W.name)X.push(`module.exports.default = ${W.name};`);Q=W.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");X.push(`module.exports.default = ${K};`),Q++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=J[Q].replace(/^export\s+/,""),z=0,U=Q;for(;U<J.length;U++){let _=J[U];for(let B of _)if(B==="{")z++;else if(B==="}")z--;if(U>Q)W+=`
752
+ `+_;if(z<=0&&U>=Q)break}X.push(W),X.push(`module.exports.${q} = ${q};`),Q=U+1}else X.push(G),Q++}else if(G.includes("module.exports"))X.push(G),Q++;else if(G.trim()&&!G.startsWith("//"))X.push(G),Q++;else Q++}return RQ(X.join(`
753
+ `),Y)}function RQ($,Z){let Y=$.length,J="",X=0,Q=null,G=!1,K=!1,q=0;while(X<Y){let W=$[X],z=$[X+1];if(G){if(J+=W,W===`
754
+ `)G=!1;X++;continue}if(K){if(J+=W,W==="*"&&z==="/"){J+=z,X+=2,K=!1;continue}X++;continue}if(!Q&&W==="/"&&z==="/"){G=!0,J+=W,X++;continue}if(!Q&&W==="/"&&z==="*"){K=!0,J+=W,X++;continue}if(Q){if(J+=W,W==="\\"){J+=z,X+=2;continue}if(W===Q&&Q!=="`"){Q=null,X++;continue}if(Q==="`"){if(W==="$"&&z==="{"){q++,J+=z,X+=2;continue}if(W==="`"){Q=null,X++;continue}}X++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){Q=W,J+=W,X++;continue}if(W==="a"&&$.startsWith("await",X)){let U=TQ($,X);if(U){let{quote:_,path:B,end:j}=U;if(B.startsWith(".")){let H=n1.resolve(Z,B);J+=`await import(${_}${H}${_})`,X=j;continue}}}J+=W,X++}return J}function TQ($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let J=$[Y];if(J!=="'"&&J!=='"')return null;Y++;let X=Y;while(Y<$.length&&$[Y]!==J)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let Q=$.slice(X,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:J,path:Q,end:Y+1}}function B9($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let X=S0($,Y,Y==="{"?"}":"]",Z);if(X===-1)return null;return{pattern:$.slice(Z,X+1),endPos:X+1}}function j9($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,X=0,Q="";while(J<Y.length){let G=Y[J];if(G==="{"||G==="["){if(X++,X===1){let K=B9(Y,J);if(K){let q=j9(K.pattern);Z.push(...q),J=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")X--;if(X>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<Y.length&&Y[J]!==","&&X===0){if(Y[J]==="{"||Y[J]==="[")X++;else if(Y[J]==="}"||Y[J]==="]")X--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function q9($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!J){let W=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let z=Y.slice(W[0].length),U=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let B=z.startsWith("{")?"}":"]",j=z;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),U=H,$[H].includes(B))break;z=j}let _=B9(z,0);if(_){let B=W[1],j=_.pattern,H=z.slice(_.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(U,Z);if(z9(L)){let N=W9($,O,L);F=N.value,O=N.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=j9(j),w=`__stx_src_${Z}`,A=V.map((N)=>`module.exports.${N} = ${N};`).join(`
755
755
  `);return{type:B,name:w,value:`${F}; ${B} ${j} = ${w};
756
- ${A}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,X,Q,G]=J,K=G,q=Z;if(q9(G)){let W=z9($,Z,G);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
757
- ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:X,name:Q,value:K,nextIndex:q}}function p$($,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(RQ(Y)){let K=TQ($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function q9($){let Z=$.trim();if(Z.startsWith("{"))return S0(Z,"{","}",0)===-1;if(Z.startsWith("["))return S0(Z,"[","]",0)===-1;return!j9(Z)}function j9($){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 RQ($){let Z=$.indexOf("{");if(Z===-1)return!0;return S0($,"{","}",Z)===-1}function z9($,Z,Y){let J=Y,X=Z+1;while(X<$.length&&!j9(J)){let Q=$[X];J+=`
756
+ ${A}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,X,Q,G]=J,K=G,q=Z;if(z9(G)){let W=W9($,Z,G);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
757
+ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:X,name:Q,value:K,nextIndex:q}}function p$($,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(MQ(Y)){let K=IQ($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function z9($){let Z=$.trim();if(Z.startsWith("{"))return S0(Z,"{","}",0)===-1;if(Z.startsWith("["))return S0(Z,"[","]",0)===-1;return!H9(Z)}function H9($){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 MQ($){let Z=$.indexOf("{");if(Z===-1)return!0;return S0($,"{","}",Z)===-1}function W9($,Z,Y){let J=Y,X=Z+1;while(X<$.length&&!H9(J)){let Q=$[X];J+=`
758
758
  ${Q}`,X++}while(X<$.length){let Q=$[X].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
759
- ${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function TQ($,Z,Y){let J=Y,X=Z+1;while(X<$.length){let Q=J.indexOf("{");if(Q!==-1){if(S0(J,"{","}",Q)!==-1)break}let G=$[X];J+=`
760
- ${G}`,X++}return{functionCode:J,nextIndex:X}}function W9($,Z){let Y=Z0($,Z)??Z0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...D5.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 MQ($,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 q=K.trim().replace(/;$/,""),W=W9(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}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 q=K.trim().replace(/;$/,""),W=W9(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function H9($){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 O9($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var E5=S(()=>{I5();u1();R0()});var l$={};r(l$,{renderSlot:()=>F9,processSlots:()=>w9,parseSlots:()=>L9,parseSlotElement:()=>DQ,extractSlotContent:()=>bQ,applySlots:()=>SQ});function IQ($,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 L9($){let Z={default:"",named:new Map},Y=$,J=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,X=[],Q;while((Q=J.exec($))!==null){let[z,U,_,B,j]=Q,H=U||_||B,L=Q.index+z.length,F=IQ($,L);if(F!==-1){let O=$.slice(L,F-11).trim();X.push({start:Q.index,end:F,slotName:H,content:O,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:O,propsBinding:j||void 0})}}X.sort((z,U)=>U.start-z.start);for(let z of X)Y=Y.slice(0,z.start)+Y.slice(z.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Y))!==null){let[z,U,_,B,j,H]=q,L=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(L+F).trim(),V=`<${U}${O?" "+O:""}>${H}</${U}>`;G.push({start:q.index,end:q.index+z.length,slotName:B,element:V})}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=W.exec(Y))!==null){let[z,U,_,B,j]=q,H=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+L).trim(),O=`<${U}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+z.length,slotName:B,element:O})}G.sort((z,U)=>U.start-z.start);for(let z of G){let U=Z.named.get(z.slotName);if(U)U.content+=z.element;else Z.named.set(z.slotName,{name:z.slotName,content:z.element});Y=Y.slice(0,z.start)+Y.slice(z.end)}return Z.default=Y.trim(),Z}function DQ($){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 F9($,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((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,z]=q.split(":").map((_)=>_.trim()),U=z||W;if(Z[W]!==void 0)G[U]=Z[W]}}else G[Q]=Z;X=EQ(X,G)}return X}function EQ($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=V9(X,Z);return u0(String(Q??""))}catch{return`{{ ${J} }}`}})}function V9($,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(!Q0($))return;return G0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function w9($,Z,Y){let J=$;J=await kQ(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let z=Z.named.get(K),U=W?.trim()||"",_=q||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(_))!==null){let L=H[1],F=H[2];B[L]=V9(F,Y)}return await F9(z,B,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),J}async function kQ($,Z,Y){let J=[],X=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return X.push({match:K,index:W}),J.push(Y(K,...q.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:q,index:W}=X[K];G=G.slice(0,W)+Q[K]+G.slice(W+q.length)}return G}function bQ($){let Z=L9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function SQ($,Z,Y,J){return await w9($,{default:Z,named:Y},J)}var i$=S(()=>{r0();R0()});import yQ from"fs";import d from"path";function A9($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function PQ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!PQ($)}function N1($){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:o0()}).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 vQ($){let Z=[],Y=new Set,J=0,X=0,Q=$.length,G=(z)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===z){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let z=1;while(X<Q&&z>0)if($[X]==="{")z++,X++;else if($[X]==="}")z--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},q=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
761
- `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},W=()=>{if(J!==0)return;let z=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(X<Q){if(q())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])))W();X++}return Z}function xQ($){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 fQ($){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 gQ($,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 q=$[J];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let q of xQ(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let z=fQ(W);if(z===-1)continue;let U=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let _=W.slice(z+1).trim();if(!_)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${_});`);Z[U]=j(...B.map((H)=>Z[H]))}catch{}}}catch{}}async function z4($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[Q,Q.toLowerCase(),G(Q),K(Q)])if(q.has(L))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],z=typeof X.root==="string"?d.resolve(X.root):void 0,U=z??d.dirname(J),_=[],B=(L)=>{if(L&&!_.includes(L))_.push(L)},j=Y.__originalFilePath;if(j)B(d.join(d.dirname(j),"components"));B(Z),B(d.join(d.dirname(J),"components")),B(X.componentsDir);let H=X._pluginComponentDirs;if(Array.isArray(H))for(let L of H)B(typeof L==="string"?L:null);if(z)B(d.resolve(z,"resources/views/components")),B(d.resolve(z,"resources/components")),B(d.resolve(z,"src/components")),B(d.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return n(d.resolve(d.dirname(J),`${Q}.stx`));for(let L of _){let F=d.isAbsolute(L)?L:d.resolve(U,L);for(let O of W)if(await n(d.join(F,O)))return!0}return!1}function hQ($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}async function I1($,Z,Y,J,X,Q,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (E5(),q4)),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let U=new Set(z);U.add($);let _=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=_&&_!=="load"&&hQ(_)?_:"";try{let j=(C)=>C.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=X.__importedComponents;if(O){let C=[L,L.toLowerCase(),j(L),H(L)];for(let x of C)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let C=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],x=[...new Set(C)],u=X.__originalFilePath,p=[];if(u){let H0=d.join(d.dirname(u),"components");p.push(H0)}if(J)p.push(J);let X0=d.join(d.dirname(Q),"components");if(!p.includes(X0))p.push(X0);if(G.componentsDir&&G.componentsDir!==J&&!p.includes(G.componentsDir))p.push(G.componentsDir);let W0=G._pluginComponentDirs;if(Array.isArray(W0)){for(let H0 of W0)if(typeof H0==="string"&&!p.includes(H0))p.push(H0)}let b0=typeof G.root==="string"?d.resolve(G.root):void 0,d1=b0??d.dirname(Q),g0=[];if(b0)g0.push(d.resolve(b0,"resources/views/components")),g0.push(d.resolve(b0,"resources/components")),g0.push(d.resolve(b0,"src/components")),g0.push(d.resolve(b0,"components"));g0.push(d.resolve(import.meta.dir,"components"));for(let H0 of g0)if(!p.includes(H0))p.push(H0);let X1=[...new Set(p.map((H0)=>{if(!H0)return H0;return d.isAbsolute(H0)?H0:d.resolve(d1,H0)}))];if(p.length=0,p.push(...X1),L.startsWith("./")||L.startsWith("../"))F=d.resolve(d.dirname(Q),`${L}.stx`),V.push(F);else for(let H0 of p){if(!H0)continue;for(let F1 of x){let a=d.join(H0,F1);if(V.push(a),await n(a)){F=a;break}}if(F)break;if(!F)try{let F1=await import("fs");if(!F1.statSync(H0,{throwIfNoEntry:!1})?.isDirectory())continue;let V1=8,o5=[{path:H0,depth:0}];while(o5.length>0&&!F){let s5=o5.pop();if(s5.depth>=V1)continue;let _6;try{_6=F1.readdirSync(s5.path,{withFileTypes:!0})}catch{continue}for(let r5 of _6){if(!r5.isDirectory())continue;if(r5.name==="node_modules"||r5.name.startsWith("."))continue;let B6=d.join(s5.path,r5.name);for(let eJ of x){let k$=d.join(B6,eJ);if(V.push(k$),await n(k$)){F=k$;break}}if(F)break;o5.push({path:B6,depth:s5.depth+1})}}}catch{}if(F)break}}if(!F||!await n(F)){let C=V.length>0?`
759
+ ${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function IQ($,Z,Y){let J=Y,X=Z+1;while(X<$.length){let Q=J.indexOf("{");if(Q!==-1){if(S0(J,"{","}",Q)!==-1)break}let G=$[X];J+=`
760
+ ${G}`,X++}return{functionCode:J,nextIndex:X}}function U9($,Z){let Y=Z0($,Z)??Z0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...D5.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 DQ($,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 q=K.trim().replace(/;$/,""),W=U9(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}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 q=K.trim().replace(/;$/,""),W=U9(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function O9($){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 L9($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var E5=S(()=>{I5();u1();R0()});var l$={};r(l$,{renderSlot:()=>V9,processSlots:()=>A9,parseSlots:()=>F9,parseSlotElement:()=>kQ,extractSlotContent:()=>yQ,applySlots:()=>CQ});function EQ($,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 F9($){let Z={default:"",named:new Map},Y=$,J=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,X=[],Q;while((Q=J.exec($))!==null){let[z,U,_,B,j]=Q,H=U||_||B,L=Q.index+z.length,F=EQ($,L);if(F!==-1){let O=$.slice(L,F-11).trim();X.push({start:Q.index,end:F,slotName:H,content:O,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:O,propsBinding:j||void 0})}}X.sort((z,U)=>U.start-z.start);for(let z of X)Y=Y.slice(0,z.start)+Y.slice(z.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Y))!==null){let[z,U,_,B,j,H]=q,L=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(L+F).trim(),V=`<${U}${O?" "+O:""}>${H}</${U}>`;G.push({start:q.index,end:q.index+z.length,slotName:B,element:V})}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=W.exec(Y))!==null){let[z,U,_,B,j]=q,H=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+L).trim(),O=`<${U}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+z.length,slotName:B,element:O})}G.sort((z,U)=>U.start-z.start);for(let z of G){let U=Z.named.get(z.slotName);if(U)U.content+=z.element;else Z.named.set(z.slotName,{name:z.slotName,content:z.element});Y=Y.slice(0,z.start)+Y.slice(z.end)}return Z.default=Y.trim(),Z}function kQ($){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 V9($,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((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,z]=q.split(":").map((_)=>_.trim()),U=z||W;if(Z[W]!==void 0)G[U]=Z[W]}}else G[Q]=Z;X=bQ(X,G)}return X}function bQ($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=w9(X,Z);return u0(String(Q??""))}catch{return`{{ ${J} }}`}})}function w9($,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(!Q0($))return;return G0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function A9($,Z,Y){let J=$;J=await SQ(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let z=Z.named.get(K),U=W?.trim()||"",_=q||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(_))!==null){let L=H[1],F=H[2];B[L]=w9(F,Y)}return await V9(z,B,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),J}async function SQ($,Z,Y){let J=[],X=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return X.push({match:K,index:W}),J.push(Y(K,...q.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:q,index:W}=X[K];G=G.slice(0,W)+Q[K]+G.slice(W+q.length)}return G}function yQ($){let Z=F9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function CQ($,Z,Y,J){return await A9($,{default:Z,named:Y},J)}var i$=S(()=>{r0();R0()});import PQ from"fs";import d from"path";function N9($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xQ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!xQ($)}function N1($){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:o0()}).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 fQ($){let Z=[],Y=new Set,J=0,X=0,Q=$.length,G=(z)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===z){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let z=1;while(X<Q&&z>0)if($[X]==="{")z++,X++;else if($[X]==="}")z--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},q=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
761
+ `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},W=()=>{if(J!==0)return;let z=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(X<Q){if(q())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])))W();X++}return Z}function gQ($){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 hQ($){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 dQ($,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 q=$[J];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let q of gQ(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let z=hQ(W);if(z===-1)continue;let U=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let _=W.slice(z+1).trim();if(!_)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${_});`);Z[U]=j(...B.map((H)=>Z[H]))}catch{}}}catch{}}async function z4($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[Q,Q.toLowerCase(),G(Q),K(Q)])if(q.has(L))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],z=typeof X.root==="string"?d.resolve(X.root):void 0,U=z??d.dirname(J),_=[],B=(L)=>{if(L&&!_.includes(L))_.push(L)},j=Y.__originalFilePath;if(j)B(d.join(d.dirname(j),"components"));B(Z),B(d.join(d.dirname(J),"components")),B(X.componentsDir);let H=X._pluginComponentDirs;if(Array.isArray(H))for(let L of H)B(typeof L==="string"?L:null);if(z)B(d.resolve(z,"resources/views/components")),B(d.resolve(z,"resources/components")),B(d.resolve(z,"src/components")),B(d.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return n(d.resolve(d.dirname(J),`${Q}.stx`));for(let L of _){let F=d.isAbsolute(L)?L:d.resolve(U,L);for(let O of W)if(await n(d.join(F,O)))return!0}return!1}function mQ($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}async function I1($,Z,Y,J,X,Q,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (E5(),q4)),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let U=new Set(z);U.add($);let _=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=_&&_!=="load"&&mQ(_)?_:"";try{let j=(C)=>C.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=X.__importedComponents;if(O){let C=[L,L.toLowerCase(),j(L),H(L)];for(let x of C)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let C=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],x=[...new Set(C)],u=X.__originalFilePath,p=[];if(u){let H0=d.join(d.dirname(u),"components");p.push(H0)}if(J)p.push(J);let X0=d.join(d.dirname(Q),"components");if(!p.includes(X0))p.push(X0);if(G.componentsDir&&G.componentsDir!==J&&!p.includes(G.componentsDir))p.push(G.componentsDir);let W0=G._pluginComponentDirs;if(Array.isArray(W0)){for(let H0 of W0)if(typeof H0==="string"&&!p.includes(H0))p.push(H0)}let b0=typeof G.root==="string"?d.resolve(G.root):void 0,d1=b0??d.dirname(Q),g0=[];if(b0)g0.push(d.resolve(b0,"resources/views/components")),g0.push(d.resolve(b0,"resources/components")),g0.push(d.resolve(b0,"src/components")),g0.push(d.resolve(b0,"components"));g0.push(d.resolve(import.meta.dir,"components"));for(let H0 of g0)if(!p.includes(H0))p.push(H0);let X1=[...new Set(p.map((H0)=>{if(!H0)return H0;return d.isAbsolute(H0)?H0:d.resolve(d1,H0)}))];if(p.length=0,p.push(...X1),L.startsWith("./")||L.startsWith("../"))F=d.resolve(d.dirname(Q),`${L}.stx`),V.push(F);else for(let H0 of p){if(!H0)continue;for(let F1 of x){let a=d.join(H0,F1);if(V.push(a),await n(a)){F=a;break}}if(F)break;if(!F)try{let F1=await import("fs");if(!F1.statSync(H0,{throwIfNoEntry:!1})?.isDirectory())continue;let V1=8,o5=[{path:H0,depth:0}];while(o5.length>0&&!F){let s5=o5.pop();if(s5.depth>=V1)continue;let B6;try{B6=F1.readdirSync(s5.path,{withFileTypes:!0})}catch{continue}for(let r5 of B6){if(!r5.isDirectory())continue;if(r5.name==="node_modules"||r5.name.startsWith("."))continue;let j6=d.join(s5.path,r5.name);for(let ZX of x){let k$=d.join(j6,ZX);if(V.push(k$),await n(k$)){F=k$;break}}if(F)break;o5.push({path:j6,depth:s5.depth+1})}}}catch{}if(F)break}}if(!F||!await n(F)){let C=V.length>0?`
762
762
  Searched paths:
763
763
  ${V.map((x)=>` - ${x}`).join(`
764
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(F);let w;if(n$.has(F))w=n$.get(F);else try{w=await Bun.file(F).text(),n$.set(F,w)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[C,x]of Object.entries(X))if(!C.startsWith("__")||A.has(C))N[C]=x;let{extractSlotContent:R}=await Promise.resolve().then(() => (i$(),l$)),T=R(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[C,x]of T.namedSlots)M[C]=x.content;let I={...N,...Z,props:Z,slot:Y,$slots:M,__processedComponents:U,__sections:{}};gQ(w,I);let D=w,E=D.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(E)D=E[1].trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...w.matchAll(P)],k=[];for(let C of b){let x=C[1]||"",u=C[2]||"",p=x.includes("server");if(A1(x)&&u.trim())u=N1(u);if(p&&u)try{await W(u,I,F)}catch(W0){}if(!p){let W0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,"");if(W0.includes("{{")&&W0.includes("}}"))W0=s0(W0,I,F);let b0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${b0}>${W0}</script>`)}}let y=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),g=y?y[1]:"",h=y?y[2]:"",m="",i=g&&/\bscoped\b/i.test(g);if(y)m=`<style${g}>${h}</style>`;let c=D;if(c=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y)c=c.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let C=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(c=c.replace(C,(u,p)=>{let X0=p.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(X0)x.push(`<style${X0[1]}>${X0[2]}</style>`);return""}),c=c.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)m=`${m}${x.join(`
765
- `)}`}if(Y&&c.includes("{{ text || slot }}"))c=c.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:q0}=await Promise.resolve().then(() => (i$(),l$)),{defaultSlot:F0,namedSlots:_0}=T;c=await q0(c,F0||Y,_0,I);for(let[C,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let u=g$(x);I[C]=u}}let $0=k.some((C)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(C)),k0={...G,componentsDir:d.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:$0,defaultLayout:void 0};I.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let f0=await j0(c,I,F,k0,q),v=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++CQ}_${Math.random().toString(36).slice(2,8)}`,f=f0;if($0){let C="";if(Object.keys(Z).length>0)try{C=` data-stx-props="${A9(JSON.stringify(Z))}"`}catch{}let x=B?` stx-hydrate="${A9(B)}"`:"";if(f=`<div data-stx-scope="${v}"${C}${x}>${f0}</div>`,f=k.map((p)=>{let X0=p.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!X0)return p;let[,W0,b0]=X0,d1=$1(b0),g0=`
764
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(F);let w;if(n$.has(F))w=n$.get(F);else try{w=await Bun.file(F).text(),n$.set(F,w)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[C,x]of Object.entries(X))if(!C.startsWith("__")||A.has(C))N[C]=x;let{extractSlotContent:R}=await Promise.resolve().then(() => (i$(),l$)),T=R(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[C,x]of T.namedSlots)M[C]=x.content;let I={...N,...Z,props:Z,slot:Y,$slots:M,__processedComponents:U,__sections:{}};dQ(w,I);let D=w,E=D.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(E)D=E[1].trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...w.matchAll(P)],k=[];for(let C of b){let x=C[1]||"",u=C[2]||"",p=x.includes("server");if(A1(x)&&u.trim())u=N1(u);if(p&&u)try{await W(u,I,F)}catch(W0){}if(!p){let W0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,"");if(W0.includes("{{")&&W0.includes("}}"))W0=s0(W0,I,F);let b0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${b0}>${W0}</script>`)}}let y=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),g=y?y[1]:"",h=y?y[2]:"",m="",i=g&&/\bscoped\b/i.test(g);if(y)m=`<style${g}>${h}</style>`;let c=D;if(c=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y)c=c.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let C=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(c=c.replace(C,(u,p)=>{let X0=p.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(X0)x.push(`<style${X0[1]}>${X0[2]}</style>`);return""}),c=c.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)m=`${m}${x.join(`
765
+ `)}`}if(Y&&c.includes("{{ text || slot }}"))c=c.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:q0}=await Promise.resolve().then(() => (i$(),l$)),{defaultSlot:F0,namedSlots:_0}=T;c=await q0(c,F0||Y,_0,I);for(let[C,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let u=g$(x);I[C]=u}}let $0=k.some((C)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(C)),k0={...G,componentsDir:d.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:$0,defaultLayout:void 0};I.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let f0=await j0(c,I,F,k0,q),v=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++vQ}_${Math.random().toString(36).slice(2,8)}`,f=f0;if($0){let C="";if(Object.keys(Z).length>0)try{C=` data-stx-props="${N9(JSON.stringify(Z))}"`}catch{}let x=B?` stx-hydrate="${N9(B)}"`:"";if(f=`<div data-stx-scope="${v}"${C}${x}>${f0}</div>`,f=k.map((p)=>{let X0=p.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!X0)return p;let[,W0,b0]=X0,d1=$1(b0),g0=`
766
766
  (function() {
767
767
  const { state, derived, effect, batch, defineEmits, defineExpose, defineSlots, defineProps, withDefaults, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, inject, ref, reactive, computed, watch, watchEffect, nextTick } = window.stx;
768
768
  const __scope = window.stx._scopes = window.stx._scopes || {};
@@ -779,7 +779,7 @@ ${d1}
779
779
  // Register all defined signals and functions in this scope
780
780
  const __localVars = {};
781
781
  try {
782
- ${vQ(d1).map((X1)=>`if (typeof ${X1} !== 'undefined') __localVars['${X1}'] = ${X1};`).join(`
782
+ ${fQ(d1).map((X1)=>`if (typeof ${X1} !== 'undefined') __localVars['${X1}'] = ${X1};`).join(`
783
783
  `)}
784
784
  }
785
785
  catch (e) {}
@@ -790,9 +790,9 @@ catch (e) {}
790
790
  `+m}else{if(m)f+=`
791
791
  `+m;if(k.length>0){let C=I.__stx_event_bindings||[],x=F5(I),u=await Promise.all(k.map(async(p)=>{let X0=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!X0)return p;return await V5(X0[1],{eventBindings:C,templateContent:f,filePath:F,projectRoot:process.cwd(),serverData:x})}));f+=`
792
792
  `+u.join(`
793
- `),I.__stx_event_bindings=[]}}if(i){let C=Q4(f,F);if(C.hasScoped)f=C.html}return f}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{z.delete($)}}async function n($){return Bun.file($).exists()}function o$($,Z){let Y=d.resolve(Z),J=d.resolve($),X=Y.endsWith(d.sep)?Y:Y+d.sep;if(J===Y||J.startsWith(X))return J;return null}async function s$($,Z,Y,J){let X=await dQ($,Z,Y,J);if(X===null)return null;let Q=o$(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 q=d.isAbsolute(K)?K:d.resolve(process.cwd(),K);if(o$(X,q))return d.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function dQ($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=d.dirname(Z),Q=process.cwd();if($.startsWith("/")){let _=d.join(Q,$),B=o$(_,Q);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${B}`);if(await n(B)&&J)J.add(B);return B}let G=d.join(X,$);if(await n(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 _ of[".stx",".tsx",".jsx"]){let B=`${G}${_}`;if(await n(B)){if(Y.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let K="",q=d.resolve(X),W=process.cwd();for(let _=0;_<10;_++){let B=d.join(q,"layouts"),j=!1;try{j=yQ.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=B;break}let H=d.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let _=$.startsWith("layouts/")?$.slice(8):$,B=d.join(K,_);if(await n(B)){if(Y.debug)console.log(`Found in current layouts dir: ${B}`);if(J)J.add(B);return B}if(!_.endsWith(".stx")){let j=`${B}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.layoutsDir){let _=d.isAbsolute(Y.layoutsDir)?Y.layoutsDir:d.resolve(process.cwd(),Y.layoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=d.join(_,B);if(await n(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await n(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(J)J.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let _=$.split("layouts/"),B=d.join(Y.partialsDir||X,"layouts",_[1]);if(await n(B)){if(Y.debug)console.log(`Found in layouts path: ${B}`);if(J)J.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.partialsDir){if(K=d.join(Y.partialsDir,"layouts"),await n(K)){let _=d.join(K,$);if(await n(_)){if(Y.debug)console.log(`Found in partials layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let B=`${_}.stx`;if(await n(B)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}}let z=Y.partialsDir||d.join(process.cwd(),"views"),U=d.join(z,$);if(await n(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let _=`${U}.stx`;if(await n(_)){if(Y.debug)console.log(`Found in views path with extension: ${_}`);if(J)J.add(_);return _}}if(X.includes("temp")){let _=d.join(d.dirname(X),"layouts",$);if(await n(_)){if(Y.debug)console.log(`Found in temp layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let B=`${_}.stx`;if(await n(B)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}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 N9($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
793
+ `),I.__stx_event_bindings=[]}}if(i){let C=Q4(f,F);if(C.hasScoped)f=C.html}return f}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{z.delete($)}}async function n($){return Bun.file($).exists()}function o$($,Z){let Y=d.resolve(Z),J=d.resolve($),X=Y.endsWith(d.sep)?Y:Y+d.sep;if(J===Y||J.startsWith(X))return J;return null}async function s$($,Z,Y,J){let X=await uQ($,Z,Y,J);if(X===null)return null;let Q=o$(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 q=d.isAbsolute(K)?K:d.resolve(process.cwd(),K);if(o$(X,q))return d.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function uQ($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=d.dirname(Z),Q=process.cwd();if($.startsWith("/")){let _=d.join(Q,$),B=o$(_,Q);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${B}`);if(await n(B)&&J)J.add(B);return B}let G=d.join(X,$);if(await n(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 _ of[".stx",".tsx",".jsx"]){let B=`${G}${_}`;if(await n(B)){if(Y.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let K="",q=d.resolve(X),W=process.cwd();for(let _=0;_<10;_++){let B=d.join(q,"layouts"),j=!1;try{j=PQ.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=B;break}let H=d.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let _=$.startsWith("layouts/")?$.slice(8):$,B=d.join(K,_);if(await n(B)){if(Y.debug)console.log(`Found in current layouts dir: ${B}`);if(J)J.add(B);return B}if(!_.endsWith(".stx")){let j=`${B}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.layoutsDir){let _=d.isAbsolute(Y.layoutsDir)?Y.layoutsDir:d.resolve(process.cwd(),Y.layoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=d.join(_,B);if(await n(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await n(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(J)J.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let _=$.split("layouts/"),B=d.join(Y.partialsDir||X,"layouts",_[1]);if(await n(B)){if(Y.debug)console.log(`Found in layouts path: ${B}`);if(J)J.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.partialsDir){if(K=d.join(Y.partialsDir,"layouts"),await n(K)){let _=d.join(K,$);if(await n(_)){if(Y.debug)console.log(`Found in partials layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let B=`${_}.stx`;if(await n(B)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}}let z=Y.partialsDir||d.join(process.cwd(),"views"),U=d.join(z,$);if(await n(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let _=`${U}.stx`;if(await n(_)){if(Y.debug)console.log(`Found in views path with extension: ${_}`);if(J)J.add(_);return _}}if(X.includes("temp")){let _=d.join(d.dirname(X),"layouts",$);if(await n(_)){if(Y.debug)console.log(`Found in temp layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let B=`${_}.stx`;if(await n(B)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}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 R9($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
794
794
  `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){J=q+1,X=G[q].trim();let W=Math.max(0,q-2),z=Math.min(G.length,q+3);Q=G.slice(W,z).map((U,_)=>{let B=W+_+1;return`${B===J?"> ":" "}${B}: ${U}`}).join(`
795
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return N9($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function K0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=N9(J,X,Q),q=Y.split("/").pop(),W=0;if(typeof X==="number"&&X>=0&&J){let U=J.lastIndexOf(`
795
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return R9($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function K0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=R9(J,X,Q),q=Y.split("/").pop(),W=0;if(typeof X==="number"&&X>=0&&J){let U=J.lastIndexOf(`
796
796
  `,Math.max(0,X-1));W=X-(U+1)+1}let z="";if(G>0)z+=`
797
797
  ${Y}:${G}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${Z}
798
798
  `;if(z+=`
@@ -805,8 +805,8 @@ ${t.yellow}${t.bold}Message:${t.reset} ${Z}
805
805
  `,K)z+=`
806
806
  ${t.blue}${t.bold}Context:${t.reset}
807
807
  ${t.dim}${K}${t.reset}
808
- `;return z}var n$,CQ=0,t;var A0=S(()=>{w5();r0();i1();W4();u1();m$();G9();E5();n$=new T5(500);t={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function R9($,Z,Y=""){let J=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",z=K+G[0].length,U=1,_=z,B=-1;while(U>0&&_<$.length){let L=$.indexOf("@markdown",_),F=$.indexOf("@endmarkdown",_);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
809
- `||O==="\r"||O===" "||O===void 0)U++;_=L+9}else{if(U--,U===0){B=F;break}_=F+12}}if(B===-1)continue;let j=$.slice(z,B),H=$.slice(K,B+12);X.push({fullMatch:H,options:W,content:j,index:K}),Q.lastIndex=B+12}for(let{fullMatch:K,options:q,content:W,index:z}of X)try{let U={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)U[H]=!0});let _={gfm:U.gfm??!0,breaks:U.breaks??!1},B=O5(W.trim(),_);J=J.split(K).join(B)}catch(U){let _=U instanceof Error?U.message:String(U),B=K0("Markdown Directive",`Error processing markdown: ${_}`,Y,$,z,K);J=J.split(K).join(B)}return J}async function T9($,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}),O5($.trim(),X)}var r$=S(()=>{A0()});function pQ($){if(mQ.set($.name,$),$.client)uQ.set($.name,$.client)}function U4($){return pQ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=cQ(J,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,G,X,Q);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function cQ($,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(),q=J.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var mQ,uQ;var a$=S(()=>{mQ=new Map,uQ=new Map});function t$($,Z=o1,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${b5($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function M9($,Z,Y=lQ,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${b5($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function e$($,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 b5($,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 $7($){return iQ[$]||"application/octet-stream"}var o1,lQ,k5,iQ;var Z7=S(()=>{o1=[320,480,640,768,1024,1280,1536,1920,2560],lQ=[1,1.5,2,3],k5=["avif","webp","jpeg"],iQ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function oQ(){try{return await import("ts-images")}catch{return null}}async function sQ($,Z={}){let Y={...nQ,...Z},J=await oQ();if(J)try{return await rQ($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return aQ($,Y)}async function rQ($,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 aQ($,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 I9($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
808
+ `;return z}var n$,vQ=0,t;var A0=S(()=>{w5();r0();i1();W4();u1();m$();K9();E5();n$=new T5(500);t={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function T9($,Z,Y=""){let J=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",z=K+G[0].length,U=1,_=z,B=-1;while(U>0&&_<$.length){let L=$.indexOf("@markdown",_),F=$.indexOf("@endmarkdown",_);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
809
+ `||O==="\r"||O===" "||O===void 0)U++;_=L+9}else{if(U--,U===0){B=F;break}_=F+12}}if(B===-1)continue;let j=$.slice(z,B),H=$.slice(K,B+12);X.push({fullMatch:H,options:W,content:j,index:K}),Q.lastIndex=B+12}for(let{fullMatch:K,options:q,content:W,index:z}of X)try{let U={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)U[H]=!0});let _={gfm:U.gfm??!0,breaks:U.breaks??!1},B=O5(W.trim(),_);J=J.split(K).join(B)}catch(U){let _=U instanceof Error?U.message:String(U),B=K0("Markdown Directive",`Error processing markdown: ${_}`,Y,$,z,K);J=J.split(K).join(B)}return J}async function M9($,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}),O5($.trim(),X)}var r$=S(()=>{A0()});function lQ($){if(pQ.set($.name,$),$.client)cQ.set($.name,$.client)}function U4($){return lQ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=iQ(J,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,G,X,Q);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function iQ($,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(),q=J.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var pQ,cQ;var a$=S(()=>{pQ=new Map,cQ=new Map});function t$($,Z=o1,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${b5($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function I9($,Z,Y=nQ,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${b5($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function e$($,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 b5($,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 $7($){return oQ[$]||"application/octet-stream"}var o1,nQ,k5,oQ;var Z7=S(()=>{o1=[320,480,640,768,1024,1280,1536,1920,2560],nQ=[1,1.5,2,3],k5=["avif","webp","jpeg"],oQ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function rQ(){try{return await import("ts-images")}catch{return null}}async function aQ($,Z={}){let Y={...sQ,...Z},J=await rQ();if(J)try{return await tQ($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return eQ($,Y)}async function tQ($,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 eQ($,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 D9($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
810
810
  #${$} {
811
811
  --stx-img-transition-duration: ${J}ms;
812
812
  --stx-img-transition-easing: ${X};
@@ -823,7 +823,7 @@ ${t.dim}${K}${t.reset}
823
823
  #${$}.stx-img-loaded img {
824
824
  opacity: 1;
825
825
  }
826
- `.trim()}async function D9($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(Y7.has(Y))return Y7.get(Y);let J=await sQ($,Z);return Y7.set(Y,J),J}var nQ,J7,Y7;var E9=S(()=>{nQ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},J7=`
826
+ `.trim()}async function E9($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(Y7.has(Y))return Y7.get(Y);let J=await aQ($,Z);return Y7.set(Y,J),J}var sQ,J7,Y7;var k9=S(()=>{sQ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},J7=`
827
827
  .stx-img-placeholder {
828
828
  position: relative;
829
829
  overflow: hidden;
@@ -852,8 +852,8 @@ ${t.dim}${K}${t.reset}
852
852
  filter: blur(0);
853
853
  transform: scale(1);
854
854
  }
855
- `.trim();Y7=new Map});import{createHash as b9}from"crypto";import{readFile as tQ,stat as S9}from"fs/promises";async function I0($){try{let Z=await tQ($);return b9("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function k9($){return b9("sha256").update($).digest("hex").slice(0,16)}function _4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${k9($)}-${k9(Y)}`}async function X7($){try{return(await S9($)).mtimeMs}catch{return 0}}async function M0($){try{return await S9($),!0}catch{return!1}}var D1=()=>{};import{mkdir as eQ,readFile as $G,writeFile as ZG,readdir as Uj,rm as YG,stat as _j}from"fs/promises";import{join as C9,dirname as JG}from"path";async function XG($){try{await eQ($,{recursive:!0})}catch{}}function P9($,Z,Y){return C9($,Y,`${Z}.json`)}async function y9($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await X7(Z)!==$.srcMtime)return!1;return!0}async function B4($,Z,Y,J=Q7){if(!J.enabled)return null;let X=_4($,Z),Q=s1.get(X);if(Q){if(await y9(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;s1.delete(X)}let G=P9(J.directory,X,Y);if(await M0(G))try{let K=await $G(G,"utf-8"),q=JSON.parse(K);if(await y9(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),s1.set(X,q),q.data}catch{}return null}async function j4($,Z,Y,J,X=Q7){if(!X.enabled)return;let Q=_4($,Z),G=await I0($),K=await X7($),q={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:_4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};s1.set(Q,q);let W=P9(X.directory,Q,J);try{await XG(JG(W)),await ZG(W,JSON.stringify(q,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function H4($,Z=Q7){if($==="all")s1.clear();else s1.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=C9(Z.directory,J);try{await YG(X,{recursive:!0,force:!0})}catch{}}}var s1,Q7;var G7=S(()=>{D1();s1=new Map,Q7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class L4{config;constructor($={}){this.config={...QG,...$}}async get($,Z){return B4($,Z,"image",this.config)}async set($,Z,Y){return j4($,Z,Y,"image",this.config)}async clear(){return H4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function K7($){if(!O4)O4=new L4($);else if($)O4.updateConfig($);return O4}async function F4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return K7(J).get($,Z)}async function V4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return K7(X).set($,Z,Y)}async function v9(){return K7().clear()}var QG,O4=null;var q7=S(()=>{G7();QG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as GG,basename as KG,extname as qG,join as zG}from"path";import{mkdir as WG}from"fs/promises";async function z7(){try{return await import("ts-images")}catch{return null}}function x9($){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 UG($,Z){let Y=Z?x9(Z):x9("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 f9($,Z,Y){let J=await z7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await F4($,Z,Y);if(X)return X;try{let Q=GG($);if(!await M0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=UG(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await WG(K,{recursive:!0});let W=await I0(Q),z=KG($,qG($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],_={src:$,processed:!0,variants:[],hash:W},B=null;if(Z.transformations&&Z.transformations.length>0)B=await W7(Q,Z.transformations,J);for(let j of U){let H=G[j]||{},L=`${z}-${W}.${j}`,F=zG(K,L);try{let O=await J.optimizeImage({input:B||Q,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(_.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!_.originalWidth&&O.width)_.originalWidth=O.width,_.originalHeight=O.height}}catch(O){_.errors=_.errors||[],_.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await J.generateThumbHash(Q);_.placeholder=j.dataUrl}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await J.generatePlaceholder(Q,{strategy:"dominant-color"});_.dominantColor=j.dominantColor}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to extract dominant color: ${j}`)}return await V4($,Z,_,Y),_}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function g9($,Z,Y,J){let X=await z7();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 W7($,Z,Y){let J=Y||await z7();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 h9=S(()=>{D1();q7()});import{resolve as _G,basename as BG,extname as jG,join as HG}from"path";import{mkdir as OG}from"fs/promises";async function LG(){try{return await import("ts-images")}catch{return null}}async function d9($,Z,Y){let J=await LG();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=_G($);if(!await M0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||FG,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await OG(K,{recursive:!0});let W=await I0(X),z=BG($,jG($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},_={src:$,byFormat:{},srcsets:{}};for(let j of G){_.byFormat[j]=[];let H=[];for(let L of Q){let F=`${z}-${L}w-${W}.${j}`,O=HG(K,F),V=`${q}/${F}`;try{let w=U[j]?.quality||80;if(await M0(O)){_.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await J.processImage({input:X,output:O,format:j,quality:w,resize:{width:L}});if(A)_.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${w}`)}}_.srcsets[j]=H.join(", ")}let B=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await J.generateThumbHash(X);_.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await J.generatePlaceholder(X,{strategy:B,width:20});_.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return _.sizes=Z.sizes||VG(Q),_}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function VG($){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 m9($,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 FG;var u9=S(()=>{D1();FG=[320,480,640,768,1024,1280,1536,1920]});var p9={};r(p9,{setCachedImageResult:()=>V4,processImage:()=>f9,optimizeImage:()=>g9,getCachedImageResult:()=>F4,generateSrcset:()=>m9,generateResponsiveVariants:()=>d9,clearImageCache:()=>v9,applyTransformations:()=>W7,ImageProcessorCache:()=>L4});var c9=S(()=>{h9();u9();q7()});async function wG(){try{return await Promise.resolve().then(() => (c9(),p9))}catch($){if(!l9)console.warn("[stx-media] Image processor not available, some features disabled:",$),l9=!0;return null}}async function w4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return TG(J,Y)}if(Y.processedResult?.processed)return j7($,Y.processedResult,Z);if(Y.responsiveVariants)return s9($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:q,widths:W=o1,dpr:z,formats:U=k5,quality:_=U7,params:B={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":N4,decoding:V=A4,fetchpriority:w,objectFit:A,objectPosition:N,crossorigin:R,referrerpolicy:T}=$,M=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:P=!1,baseUrl:b=""}=Z;if(P&&!Z.optimize)return RG($);let k,y,g=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{k=await D9(X,{strategy:j,...H}),y=I9(g,k,H)}catch{}let h=z!==void 0&&G!==void 0,m;if(h)m=NG($,g,k,Z);else m=await AG($,g,k,Z);let i;if(F){let F0=U.includes("webp")?"webp":U[0],_0=t$(X,W,{...B,q:_},F0),$0=typeof q==="object"?e$(q):q||"100vw";i=`<link rel="preload" as="image" imagesrcset="${_0}" imagesizes="${$0}" />`}let c=[];if(!i9&&j!=="none")c.push(J7),i9=!0;if(y)c.push(y);let q0=L?o9(g):void 0;return{html:m,preloadLink:i,css:c.length>0?c.join(`
856
- `):void 0,script:q0}}async function AG($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,sizes:q,widths:W=o1,formats:z=k5,quality:U=U7,params:_={},lazy:B=!0,priority:j=!1,loading:H=j?"eager":N4,decoding:L=A4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A}=$,N=$.class,R=$.style,T=$.data||{},M=typeof q==="object"?e$(q):q||"100vw",I=[];for(let P of z){let b=t$(X,W,{..._,q:U},P),k=$7(P);if(B&&!j)I.push(` <source type="${k}" data-srcset="${b}" data-sizes="${M}" />`);else I.push(` <source type="${k}" srcset="${b}" sizes="${M}" />`)}let D=_7({src:b5(X,{..._,q:U}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A,className:n9(N,Y),style:B7(R,O,V,Y),lazy:B&&!j,data:T}),E;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
855
+ `.trim();Y7=new Map});import{createHash as S9}from"crypto";import{readFile as $G,stat as y9}from"fs/promises";async function I0($){try{let Z=await $G($);return S9("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function b9($){return S9("sha256").update($).digest("hex").slice(0,16)}function _4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${b9($)}-${b9(Y)}`}async function X7($){try{return(await y9($)).mtimeMs}catch{return 0}}async function M0($){try{return await y9($),!0}catch{return!1}}var D1=()=>{};import{mkdir as ZG,readFile as YG,writeFile as JG,readdir as Bj,rm as XG,stat as jj}from"fs/promises";import{join as P9,dirname as QG}from"path";async function GG($){try{await ZG($,{recursive:!0})}catch{}}function v9($,Z,Y){return P9($,Y,`${Z}.json`)}async function C9($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await X7(Z)!==$.srcMtime)return!1;return!0}async function B4($,Z,Y,J=Q7){if(!J.enabled)return null;let X=_4($,Z),Q=s1.get(X);if(Q){if(await C9(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;s1.delete(X)}let G=v9(J.directory,X,Y);if(await M0(G))try{let K=await YG(G,"utf-8"),q=JSON.parse(K);if(await C9(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),s1.set(X,q),q.data}catch{}return null}async function j4($,Z,Y,J,X=Q7){if(!X.enabled)return;let Q=_4($,Z),G=await I0($),K=await X7($),q={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:_4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};s1.set(Q,q);let W=v9(X.directory,Q,J);try{await GG(QG(W)),await JG(W,JSON.stringify(q,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function H4($,Z=Q7){if($==="all")s1.clear();else s1.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=P9(Z.directory,J);try{await XG(X,{recursive:!0,force:!0})}catch{}}}var s1,Q7;var G7=S(()=>{D1();s1=new Map,Q7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class L4{config;constructor($={}){this.config={...KG,...$}}async get($,Z){return B4($,Z,"image",this.config)}async set($,Z,Y){return j4($,Z,Y,"image",this.config)}async clear(){return H4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function K7($){if(!O4)O4=new L4($);else if($)O4.updateConfig($);return O4}async function F4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return K7(J).get($,Z)}async function V4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return K7(X).set($,Z,Y)}async function x9(){return K7().clear()}var KG,O4=null;var q7=S(()=>{G7();KG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as qG,basename as zG,extname as WG,join as UG}from"path";import{mkdir as _G}from"fs/promises";async function z7(){try{return await import("ts-images")}catch{return null}}function f9($){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 BG($,Z){let Y=Z?f9(Z):f9("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 g9($,Z,Y){let J=await z7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await F4($,Z,Y);if(X)return X;try{let Q=qG($);if(!await M0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=BG(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await _G(K,{recursive:!0});let W=await I0(Q),z=zG($,WG($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],_={src:$,processed:!0,variants:[],hash:W},B=null;if(Z.transformations&&Z.transformations.length>0)B=await W7(Q,Z.transformations,J);for(let j of U){let H=G[j]||{},L=`${z}-${W}.${j}`,F=UG(K,L);try{let O=await J.optimizeImage({input:B||Q,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(_.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!_.originalWidth&&O.width)_.originalWidth=O.width,_.originalHeight=O.height}}catch(O){_.errors=_.errors||[],_.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await J.generateThumbHash(Q);_.placeholder=j.dataUrl}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await J.generatePlaceholder(Q,{strategy:"dominant-color"});_.dominantColor=j.dominantColor}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to extract dominant color: ${j}`)}return await V4($,Z,_,Y),_}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function h9($,Z,Y,J){let X=await z7();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 W7($,Z,Y){let J=Y||await z7();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 d9=S(()=>{D1();q7()});import{resolve as jG,basename as HG,extname as OG,join as LG}from"path";import{mkdir as FG}from"fs/promises";async function VG(){try{return await import("ts-images")}catch{return null}}async function m9($,Z,Y){let J=await VG();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=jG($);if(!await M0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||wG,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await FG(K,{recursive:!0});let W=await I0(X),z=HG($,OG($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},_={src:$,byFormat:{},srcsets:{}};for(let j of G){_.byFormat[j]=[];let H=[];for(let L of Q){let F=`${z}-${L}w-${W}.${j}`,O=LG(K,F),V=`${q}/${F}`;try{let w=U[j]?.quality||80;if(await M0(O)){_.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await J.processImage({input:X,output:O,format:j,quality:w,resize:{width:L}});if(A)_.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${w}`)}}_.srcsets[j]=H.join(", ")}let B=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await J.generateThumbHash(X);_.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await J.generatePlaceholder(X,{strategy:B,width:20});_.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return _.sizes=Z.sizes||AG(Q),_}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function AG($){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 u9($,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 wG;var p9=S(()=>{D1();wG=[320,480,640,768,1024,1280,1536,1920]});var c9={};r(c9,{setCachedImageResult:()=>V4,processImage:()=>g9,optimizeImage:()=>h9,getCachedImageResult:()=>F4,generateSrcset:()=>u9,generateResponsiveVariants:()=>m9,clearImageCache:()=>x9,applyTransformations:()=>W7,ImageProcessorCache:()=>L4});var l9=S(()=>{d9();p9();q7()});async function NG(){try{return await Promise.resolve().then(() => (l9(),c9))}catch($){if(!i9)console.warn("[stx-media] Image processor not available, some features disabled:",$),i9=!0;return null}}async function w4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return IG(J,Y)}if(Y.processedResult?.processed)return j7($,Y.processedResult,Z);if(Y.responsiveVariants)return r9($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:q,widths:W=o1,dpr:z,formats:U=k5,quality:_=U7,params:B={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":N4,decoding:V=A4,fetchpriority:w,objectFit:A,objectPosition:N,crossorigin:R,referrerpolicy:T}=$,M=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:P=!1,baseUrl:b=""}=Z;if(P&&!Z.optimize)return MG($);let k,y,g=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{k=await E9(X,{strategy:j,...H}),y=D9(g,k,H)}catch{}let h=z!==void 0&&G!==void 0,m;if(h)m=TG($,g,k,Z);else m=await RG($,g,k,Z);let i;if(F){let F0=U.includes("webp")?"webp":U[0],_0=t$(X,W,{...B,q:_},F0),$0=typeof q==="object"?e$(q):q||"100vw";i=`<link rel="preload" as="image" imagesrcset="${_0}" imagesizes="${$0}" />`}let c=[];if(!n9&&j!=="none")c.push(J7),n9=!0;if(y)c.push(y);let q0=L?s9(g):void 0;return{html:m,preloadLink:i,css:c.length>0?c.join(`
856
+ `):void 0,script:q0}}async function RG($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,sizes:q,widths:W=o1,formats:z=k5,quality:U=U7,params:_={},lazy:B=!0,priority:j=!1,loading:H=j?"eager":N4,decoding:L=A4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A}=$,N=$.class,R=$.style,T=$.data||{},M=typeof q==="object"?e$(q):q||"100vw",I=[];for(let P of z){let b=t$(X,W,{..._,q:U},P),k=$7(P);if(B&&!j)I.push(` <source type="${k}" data-srcset="${b}" data-sizes="${M}" />`);else I.push(` <source type="${k}" srcset="${b}" sizes="${M}" />`)}let D=_7({src:b5(X,{..._,q:U}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A,className:o9(N,Y),style:B7(R,O,V,Y),lazy:B&&!j,data:T}),E;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
857
857
  <picture>
858
858
  ${I.join(`
859
859
  `)}
@@ -863,9 +863,9 @@ ${I.join(`
863
863
  ${I.join(`
864
864
  `)}
865
865
  <img ${D} />
866
- </picture>`;return E}function NG($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,dpr:q=[1,2,3],quality:W=U7,params:z={},lazy:U=!0,priority:_=!1,loading:B=_?"eager":N4,decoding:j=A4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,A=$.style,N=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),T=M9(X,R,q,{...z,q:W}),M=_7({src:b5(X,{...z,w:R,q:W}),alt:Q,width:G,height:K,loading:_?void 0:B,decoding:j,fetchpriority:_?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:n9(w,Y),style:B7(A,L,F,Y),lazy:U&&!_,data:N}),I=U&&!_?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let D=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${D}">
866
+ </picture>`;return E}function TG($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,dpr:q=[1,2,3],quality:W=U7,params:z={},lazy:U=!0,priority:_=!1,loading:B=_?"eager":N4,decoding:j=A4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,A=$.style,N=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),T=I9(X,R,q,{...z,q:W}),M=_7({src:b5(X,{...z,w:R,q:W}),alt:Q,width:G,height:K,loading:_?void 0:B,decoding:j,fetchpriority:_?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:o9(w,Y),style:B7(A,L,F,Y),lazy:U&&!_,data:N}),I=U&&!_?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let D=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${D}">
867
867
  <img ${M} ${I} />
868
- </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function RG($){let{src:Z,alt:Y,width:J,height:X,loading:Q=N4,decoding:G=A4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,priority:_=!1}=$,B=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${_7({src:Z,alt:Y,width:J,height:X,loading:_?"eager":Q,decoding:G,fetchpriority:_?"high":K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,className:B,style:B7(j,q,W),id:H,data:L})} />`}}function _7($){let Z=[];if($.lazy)Z.push(`data-src="${p0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${p0($.src)}"`);if(Z.push(`alt="${p0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${p0($.className)}"`);if($.style)Z.push(`style="${p0($.style)}"`);if($.id)Z.push(`id="${p0($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${p0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function n9($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function B7($,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 p0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function o9($){return`
868
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function MG($){let{src:Z,alt:Y,width:J,height:X,loading:Q=N4,decoding:G=A4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,priority:_=!1}=$,B=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${_7({src:Z,alt:Y,width:J,height:X,loading:_?"eager":Q,decoding:G,fetchpriority:_?"high":K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,className:B,style:B7(j,q,W),id:H,data:L})} />`}}function _7($){let Z=[];if($.lazy)Z.push(`data-src="${p0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${p0($.src)}"`);if(Z.push(`alt="${p0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${p0($.className)}"`);if($.style)Z.push(`style="${p0($.style)}"`);if($.id)Z.push(`id="${p0($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${p0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function o9($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function B7($,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 p0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s9($){return`
869
869
  (function() {
870
870
  const container = document.getElementById('${$}');
871
871
  if (!container) return;
@@ -902,7 +902,7 @@ ${I.join(`
902
902
 
903
903
  observer.observe(container);
904
904
  })();
905
- `.trim()}async function TG($,Z){let Y=await wG();if(!Y)return w4({...$,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 s9($,Q,Z)}else{let Q=await Y.processImage($.src,$,J);if(Q.processed)return j7($,Q,Z)}return w4({...$,process:!1},Z)}async function j7($,Z,Y){let{alt:J,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U}=$,_=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((y)=>y.format==="jpeg")||L.find((y)=>y.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((y)=>y.format===(F?.format||"jpeg")).map((y)=>`${y.url} ${y.width}w`).join(", "),w=new Map;for(let y of L){if(!w.has(y.format))w.set(y.format,[]);w.get(y.format).push(y)}let A=[],N=["avif","webp","jpeg","png"];for(let y of N){let g=w.get(y);if(g&&g.length>0){let h=g.map((i)=>`${i.url} ${i.width}w`).join(", "),m=$7(y);if(G&&!K)A.push(` <source type="${m}" data-srcset="${h}" />`);else A.push(` <source type="${m}" srcset="${h}" />`)}}let R=[];if(G&&!K){if(R.push(`data-src="${p0(O)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${p0(O)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${p0(J)}"`);let T=X||Z.originalWidth,M=Q||Z.originalHeight;if(T)R.push(`width="${T}"`);if(M)R.push(`height="${M}"`);if(!K)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(z)R.push(`crossorigin="${z}"`);if(U)R.push(`referrerpolicy="${U}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(B)I.push(B);if(I.length>0)R.push(`style="${I.join("; ")}"`);let D=[];if(_)D.push(_);if(Z.placeholder)D.push("stx-img-blur");if(D.length>0)R.push(`class="${D.join(" ")}"`);if(G&&!K)R.push("data-stx-lazy");for(let[y,g]of Object.entries(H))R.push(`data-${y}="${p0(g)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let y=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${y}">
905
+ `.trim()}async function IG($,Z){let Y=await NG();if(!Y)return w4({...$,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 r9($,Q,Z)}else{let Q=await Y.processImage($.src,$,J);if(Q.processed)return j7($,Q,Z)}return w4({...$,process:!1},Z)}async function j7($,Z,Y){let{alt:J,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U}=$,_=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((y)=>y.format==="jpeg")||L.find((y)=>y.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((y)=>y.format===(F?.format||"jpeg")).map((y)=>`${y.url} ${y.width}w`).join(", "),w=new Map;for(let y of L){if(!w.has(y.format))w.set(y.format,[]);w.get(y.format).push(y)}let A=[],N=["avif","webp","jpeg","png"];for(let y of N){let g=w.get(y);if(g&&g.length>0){let h=g.map((i)=>`${i.url} ${i.width}w`).join(", "),m=$7(y);if(G&&!K)A.push(` <source type="${m}" data-srcset="${h}" />`);else A.push(` <source type="${m}" srcset="${h}" />`)}}let R=[];if(G&&!K){if(R.push(`data-src="${p0(O)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${p0(O)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${p0(J)}"`);let T=X||Z.originalWidth,M=Q||Z.originalHeight;if(T)R.push(`width="${T}"`);if(M)R.push(`height="${M}"`);if(!K)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(z)R.push(`crossorigin="${z}"`);if(U)R.push(`referrerpolicy="${U}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(B)I.push(B);if(I.length>0)R.push(`style="${I.join("; ")}"`);let D=[];if(_)D.push(_);if(Z.placeholder)D.push("stx-img-blur");if(D.length>0)R.push(`class="${D.join(" ")}"`);if(G&&!K)R.push("data-stx-lazy");for(let[y,g]of Object.entries(H))R.push(`data-${y}="${p0(g)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let y=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${y}">
906
906
  <picture>
907
907
  ${A.join(`
908
908
  `)}
@@ -912,12 +912,12 @@ ${A.join(`
912
912
  ${A.join(`
913
913
  `)}
914
914
  <img ${R.join(" ")} />
915
- </picture>`;let P=[];if(Z.placeholder)P.push(J7);let b=G?o9(j):void 0,k;if(K&&V)k=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:k,css:P.length>0?P.join(`
916
- `):void 0,script:b}}async function s9($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[X,Q]of Object.entries(Z.byFormat))if(Q)J.variants.push(...Q);return j7($,J,Y)}var l9=!1,U7=80,A4="async",N4="lazy",i9=!1;var r9=S(()=>{Z7();E9()});function MG(){return U4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:X,alt:Q,options:G}=IG($,Z,Y);if(!X)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:X,alt:Q||"",widths:G.widths||o1,formats:G.formats||k5,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await w4(K,{isDev:q}),z=W.html;if(W.preloadLink)z=W.preloadLink+`
915
+ </picture>`;let P=[];if(Z.placeholder)P.push(J7);let b=G?s9(j):void 0,k;if(K&&V)k=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:k,css:P.length>0?P.join(`
916
+ `):void 0,script:b}}async function r9($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[X,Q]of Object.entries(Z.byFormat))if(Q)J.variants.push(...Q);return j7($,J,Y)}var i9=!1,U7=80,A4="async",N4="lazy",n9=!1;var a9=S(()=>{Z7();k9()});function DG(){return U4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:X,alt:Q,options:G}=EG($,Z,Y);if(!X)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:X,alt:Q||"",widths:G.widths||o1,formats:G.formats||k5,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await w4(K,{isDev:q}),z=W.html;if(W.preloadLink)z=W.preloadLink+`
917
917
  `+z;if(W.css)z+=`
918
918
  <style>${W.css}</style>`;if(W.script)z+=`
919
- <script>${W.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function IG($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=DG(J),Q=H7(X[0],Y)||"",G=H7(X[1],Y)||"",K={};if(X[2]){let q=H7(X[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof X[2]==="string")try{K=JSON.parse(X[2])}catch{}}return{src:Q,alt:G,options:K}}function DG($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!J)J=!0,X=q;else if(q===X)J=!1,X="";else Y+=q;continue}if(!J){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function H7($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var a9;var t9=S(()=>{a$();r9();Z7();a9=MG()});class T4{config;constructor($={}){this.config={...EG,...$}}async get($,Z){return B4($,Z,"video",this.config)}async set($,Z,Y){return j4($,Z,Y,"video",this.config)}async clear(){return H4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function O7($){if(!R4)R4=new T4($);else if($)R4.updateConfig($);return R4}async function M4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return O7(J).get($,Z)}async function I4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return O7(X).set($,Z,Y)}async function e9(){return O7().clear()}var EG,R4=null;var L7=S(()=>{G7();EG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as F7,basename as V7,extname as w7,join as D4}from"path";import{mkdir as A7}from"fs/promises";async function N7(){try{return await import("ts-videos")}catch{return null}}async function E4($,Z,Y,J){let X=await N7();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=F7($);if(!await M0(Q))return null;await A7(Y,{recursive:!0});let G=await I0(Q),K=V7($,w7($)),q=Z.format||"webp",W=Z.timestamp||0,z=`${K}-poster-${G}.${q}`,U=D4(Y,z),_=await X.extractThumbnails(Q,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:z.replace(`.${q}`,"")});if(_&&_.length>0){let B=_[0];return{path:U,url:`${J}/${z}`,width:B.width||Z.width||1280,height:B.height||720,timestamp:W,size:B.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function k4($,Z,Y,J){let X=await N7();if(!X)return[];try{let Q=F7($);if(!await M0(Q))return[];await A7(Y,{recursive:!0});let G=await I0(Q),K=V7($,w7($)),q=Z.format||"webp",U=(await new X.Input(Q).getInfo()).duration||60,_=Z.count||10,B=Z.interval||U/_,j=[];for(let L=0;L<_&&L*B<U;L++)j.push(L*B);let H=await X.extractThumbnails(Q,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||D4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${J}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function $8($,Z,Y,J){let X=await N7();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=F7($);if(!await M0(Q))return null;await A7(Y,{recursive:!0});let G=await I0(Q),K=V7($,w7($)),z=(await new X.Input(Q).getInfo()).duration||60,U=Z.columns||10,_=Z.interval||5,B=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(z/_),F=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,V=D4(Y,O),w=[];for(let N=0;N<L;N++)w.push(N*_);let A=await X.extractThumbnails(Q,{timestamps:w,width:B,height:j,format:H,quality:Z.quality||70,outputDir:D4(Y,".temp")});if(!A||A.length===0)return null;try{let N=await import("ts-images"),R=U*B,T=F*j,M=await N.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:V,columns:U,rows:F,thumbnailWidth:B,thumbnailHeight:j,interval:_,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var R7=S(()=>{D1()});import{resolve as Y8,basename as J8,extname as X8,join as E1}from"path";import{mkdir as b4,writeFile as Q8}from"fs/promises";async function G8(){try{return await import("ts-videos")}catch{return null}}async function S4($,Z,Y,J,X){let Q=await G8();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=Y8($);if(!await M0(G))return null;let K=await I0(G),q=J8($,X8($)),W=E1(Y,`${q}-${K}-hls`);await b4(W,{recursive:!0});let z=Z.length>0?Z:K8,U=X?.segmentDuration||6,j=(await new Q.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of z){let w=E1(W,V.label);await b4(w,{recursive:!0});let A=`${V.label}.m3u8`,N=E1(w,A);try{let R=await Q.generateHLS(G,{outputDir:w,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)H.push({quality:V,url:`${J}/${q}-${K}-hls/${V.label}/${A}`,path:N}),L+=R.segmentCount||Math.ceil(j/U)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(H.length===0)return null;let F=E1(W,"master.m3u8"),O=kG(H,J,q,K);return await Q8(F,O),{manifestUrl:`${J}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function kG($,Z,Y,J){let X=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;X.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return X.join(`
920
- `)}async function y4($,Z,Y,J,X){let Q=await G8();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=Y8($);if(!await M0(G))return null;let K=await I0(G),q=J8($,X8($)),W=E1(Y,`${q}-${K}-dash`);await b4(W,{recursive:!0});let z=Z.length>0?Z:K8,U=X?.segmentDuration||4,_=X?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of z){let N=E1(W,A.label);await b4(N,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:N,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${q}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${J}/${q}-${K}-dash/${A.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${R}`)}}if(L.length===0)return null;let O=E1(W,"manifest.mpd"),V=bG(L,F,H,U,_);await Q8(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${J}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function bG($,Z,Y,J,X){let Q=Z8(Y),G=Z8(X),K=`<?xml version="1.0" encoding="UTF-8"?>
919
+ <script>${W.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function EG($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=kG(J),Q=H7(X[0],Y)||"",G=H7(X[1],Y)||"",K={};if(X[2]){let q=H7(X[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof X[2]==="string")try{K=JSON.parse(X[2])}catch{}}return{src:Q,alt:G,options:K}}function kG($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!J)J=!0,X=q;else if(q===X)J=!1,X="";else Y+=q;continue}if(!J){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function H7($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var t9;var e9=S(()=>{a$();a9();Z7();t9=DG()});class T4{config;constructor($={}){this.config={...bG,...$}}async get($,Z){return B4($,Z,"video",this.config)}async set($,Z,Y){return j4($,Z,Y,"video",this.config)}async clear(){return H4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function O7($){if(!R4)R4=new T4($);else if($)R4.updateConfig($);return R4}async function M4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return O7(J).get($,Z)}async function I4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return O7(X).set($,Z,Y)}async function $8(){return O7().clear()}var bG,R4=null;var L7=S(()=>{G7();bG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as F7,basename as V7,extname as w7,join as D4}from"path";import{mkdir as A7}from"fs/promises";async function N7(){try{return await import("ts-videos")}catch{return null}}async function E4($,Z,Y,J){let X=await N7();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=F7($);if(!await M0(Q))return null;await A7(Y,{recursive:!0});let G=await I0(Q),K=V7($,w7($)),q=Z.format||"webp",W=Z.timestamp||0,z=`${K}-poster-${G}.${q}`,U=D4(Y,z),_=await X.extractThumbnails(Q,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:z.replace(`.${q}`,"")});if(_&&_.length>0){let B=_[0];return{path:U,url:`${J}/${z}`,width:B.width||Z.width||1280,height:B.height||720,timestamp:W,size:B.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function k4($,Z,Y,J){let X=await N7();if(!X)return[];try{let Q=F7($);if(!await M0(Q))return[];await A7(Y,{recursive:!0});let G=await I0(Q),K=V7($,w7($)),q=Z.format||"webp",U=(await new X.Input(Q).getInfo()).duration||60,_=Z.count||10,B=Z.interval||U/_,j=[];for(let L=0;L<_&&L*B<U;L++)j.push(L*B);let H=await X.extractThumbnails(Q,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||D4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${J}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function Z8($,Z,Y,J){let X=await N7();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=F7($);if(!await M0(Q))return null;await A7(Y,{recursive:!0});let G=await I0(Q),K=V7($,w7($)),z=(await new X.Input(Q).getInfo()).duration||60,U=Z.columns||10,_=Z.interval||5,B=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(z/_),F=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,V=D4(Y,O),w=[];for(let N=0;N<L;N++)w.push(N*_);let A=await X.extractThumbnails(Q,{timestamps:w,width:B,height:j,format:H,quality:Z.quality||70,outputDir:D4(Y,".temp")});if(!A||A.length===0)return null;try{let N=await import("ts-images"),R=U*B,T=F*j,M=await N.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:V,columns:U,rows:F,thumbnailWidth:B,thumbnailHeight:j,interval:_,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var R7=S(()=>{D1()});import{resolve as J8,basename as X8,extname as Q8,join as E1}from"path";import{mkdir as b4,writeFile as G8}from"fs/promises";async function K8(){try{return await import("ts-videos")}catch{return null}}async function S4($,Z,Y,J,X){let Q=await K8();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=J8($);if(!await M0(G))return null;let K=await I0(G),q=X8($,Q8($)),W=E1(Y,`${q}-${K}-hls`);await b4(W,{recursive:!0});let z=Z.length>0?Z:q8,U=X?.segmentDuration||6,j=(await new Q.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of z){let w=E1(W,V.label);await b4(w,{recursive:!0});let A=`${V.label}.m3u8`,N=E1(w,A);try{let R=await Q.generateHLS(G,{outputDir:w,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)H.push({quality:V,url:`${J}/${q}-${K}-hls/${V.label}/${A}`,path:N}),L+=R.segmentCount||Math.ceil(j/U)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(H.length===0)return null;let F=E1(W,"master.m3u8"),O=SG(H,J,q,K);return await G8(F,O),{manifestUrl:`${J}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function SG($,Z,Y,J){let X=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;X.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return X.join(`
920
+ `)}async function y4($,Z,Y,J,X){let Q=await K8();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=J8($);if(!await M0(G))return null;let K=await I0(G),q=X8($,Q8($)),W=E1(Y,`${q}-${K}-dash`);await b4(W,{recursive:!0});let z=Z.length>0?Z:q8,U=X?.segmentDuration||4,_=X?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of z){let N=E1(W,A.label);await b4(N,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:N,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${q}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${J}/${q}-${K}-dash/${A.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${R}`)}}if(L.length===0)return null;let O=E1(W,"manifest.mpd"),V=yG(L,F,H,U,_);await G8(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${J}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function yG($,Z,Y,J,X){let Q=Y8(Y),G=Y8(X),K=`<?xml version="1.0" encoding="UTF-8"?>
921
921
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
922
922
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
923
923
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -943,7 +943,7 @@ ${A.join(`
943
943
  </Representation>
944
944
  `}K+=` </AdaptationSet>
945
945
  `}return K+=` </Period>
946
- </MPD>`,K}function Z8($){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 K8;var T7=S(()=>{D1();K8=[{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 q8,basename as SG,extname as yG,join as CG}from"path";import{mkdir as PG}from"fs/promises";async function z8(){try{return await import("ts-videos")}catch{return null}}function vG($){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 xG($){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 M7($){let Z=await z8();if(!Z)return null;try{let Y=q8($),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 W8($,Z,Y,J){let X=await z8();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await M4($,Z,Y);if(Q)return Q;try{let G=q8($);if(!await M0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await PG(K,{recursive:!0});let W=await I0(G),z=SG($,yG($)),U={src:$,processed:!0,hash:W};J?.({percentage:5,stage:"analyzing"}),U.metadata=await M7(G)||void 0;let _={};if(Z.quality)_.bitrate=vG(Z.quality);if(Z.platform)Object.assign(_,xG(Z.platform));if(Z.transcode)Object.assign(_,Z.transcode);if(Object.keys(_).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let B=`${z}-${W}.mp4`,j=CG(K,B);try{let H=await fG(G,j,_,X,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:j,url:`${q}/${B}`,duration:H.duration,size:H.size,video:{codec:_.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:_.audioCodec||"aac",bitrate:_.audioBitrate||128000,sampleRate:_.sampleRate||48000,channels:_.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let B=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await E4(G,B,K,q);if(j)U.poster=j}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let B=await k4(G,Y.thumbnails,K,q);if(B.length>0)U.thumbnails=B}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let B=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let j=await S4(G,B.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,hls:j}}if(B.format==="dash"){let j=await y4(G,B.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,dash:j}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await I4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function fG($,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 U8=S(()=>{D1();L7();R7();T7()});var _8={};r(_8,{setCachedVideoResult:()=>I4,processVideo:()=>W8,getCachedVideoResult:()=>M4,generateThumbnails:()=>k4,generateSpriteSheet:()=>$8,generatePoster:()=>E4,generateHLSManifest:()=>S4,generateDASHManifest:()=>y4,clearVideoCache:()=>e9,analyzeVideo:()=>M7,VideoProcessorCache:()=>T4});var B8=S(()=>{U8();R7();T7();L7()});async function H8(){try{return await Promise.resolve().then(() => (B8(),_8))}catch($){if(!j8)console.warn("[stx-media] Video processor not available, some features disabled:",$),j8=!0;return null}}async function C4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return pG(J,Y)}if(Y.processedResult?.processed)return V8($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await cG(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:q,controls:W=O8,autoplay:z=!1,muted:U=!1,loop:_=!1,preload:B=L8,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:N=!1}=$,R=X||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return dG($,Z);if(F&&F!=="video")return hG(Q||"",F,$);let D=G.length>0?G:Q?[{src:Q,type:F8(Q)}]:[],E=[`id="${I}"`];if(W)E.push("controls");if(z)E.push("autoplay");if(U)E.push("muted");if(_)E.push("loop");if(j)E.push("playsinline");if(A)E.push("disablepictureinpicture");if(N)E.push("disableremoteplayback");if(w)E.push(`crossorigin="${w}"`);if(H){if(E.push(`data-preload="${B}"`),E.push('preload="none"'),R)E.push(`data-poster="${V0(R)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${B}"`),R)E.push(`poster="${V0(R)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(T)E.push(`class="${V0(T)}"`);if(M)E.push(`style="${V0(M)}"`);let P=D.map((y)=>{return` <source ${H?`data-src="${V0(y.src)}"`:`src="${V0(y.src)}"`} type="${y.type}"${y.media?` media="${y.media}"`:""} />`}).join(`
946
+ </MPD>`,K}function Y8($){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 q8;var T7=S(()=>{D1();q8=[{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 z8,basename as CG,extname as PG,join as vG}from"path";import{mkdir as xG}from"fs/promises";async function W8(){try{return await import("ts-videos")}catch{return null}}function fG($){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 gG($){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 M7($){let Z=await W8();if(!Z)return null;try{let Y=z8($),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 U8($,Z,Y,J){let X=await W8();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await M4($,Z,Y);if(Q)return Q;try{let G=z8($);if(!await M0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await xG(K,{recursive:!0});let W=await I0(G),z=CG($,PG($)),U={src:$,processed:!0,hash:W};J?.({percentage:5,stage:"analyzing"}),U.metadata=await M7(G)||void 0;let _={};if(Z.quality)_.bitrate=fG(Z.quality);if(Z.platform)Object.assign(_,gG(Z.platform));if(Z.transcode)Object.assign(_,Z.transcode);if(Object.keys(_).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let B=`${z}-${W}.mp4`,j=vG(K,B);try{let H=await hG(G,j,_,X,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:j,url:`${q}/${B}`,duration:H.duration,size:H.size,video:{codec:_.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:_.audioCodec||"aac",bitrate:_.audioBitrate||128000,sampleRate:_.sampleRate||48000,channels:_.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let B=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await E4(G,B,K,q);if(j)U.poster=j}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let B=await k4(G,Y.thumbnails,K,q);if(B.length>0)U.thumbnails=B}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let B=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let j=await S4(G,B.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,hls:j}}if(B.format==="dash"){let j=await y4(G,B.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,dash:j}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await I4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function hG($,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 _8=S(()=>{D1();L7();R7();T7()});var B8={};r(B8,{setCachedVideoResult:()=>I4,processVideo:()=>U8,getCachedVideoResult:()=>M4,generateThumbnails:()=>k4,generateSpriteSheet:()=>Z8,generatePoster:()=>E4,generateHLSManifest:()=>S4,generateDASHManifest:()=>y4,clearVideoCache:()=>$8,analyzeVideo:()=>M7,VideoProcessorCache:()=>T4});var j8=S(()=>{_8();R7();T7();L7()});async function O8(){try{return await Promise.resolve().then(() => (j8(),B8))}catch($){if(!H8)console.warn("[stx-media] Video processor not available, some features disabled:",$),H8=!0;return null}}async function C4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return lG(J,Y)}if(Y.processedResult?.processed)return w8($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await iG(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:q,controls:W=L8,autoplay:z=!1,muted:U=!1,loop:_=!1,preload:B=F8,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:N=!1}=$,R=X||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return uG($,Z);if(F&&F!=="video")return mG(Q||"",F,$);let D=G.length>0?G:Q?[{src:Q,type:V8(Q)}]:[],E=[`id="${I}"`];if(W)E.push("controls");if(z)E.push("autoplay");if(U)E.push("muted");if(_)E.push("loop");if(j)E.push("playsinline");if(A)E.push("disablepictureinpicture");if(N)E.push("disableremoteplayback");if(w)E.push(`crossorigin="${w}"`);if(H){if(E.push(`data-preload="${B}"`),E.push('preload="none"'),R)E.push(`data-poster="${V0(R)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${B}"`),R)E.push(`poster="${V0(R)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(T)E.push(`class="${V0(T)}"`);if(M)E.push(`style="${V0(M)}"`);let P=D.map((y)=>{return` <source ${H?`data-src="${V0(y.src)}"`:`src="${V0(y.src)}"`} type="${y.type}"${y.media?` media="${y.media}"`:""} />`}).join(`
947
947
  `),b=`<video ${E.join(" ")}>
948
948
  ${P}
949
949
  Your browser does not support the video tag.
@@ -982,9 +982,9 @@ ${P}
982
982
 
983
983
  observer.observe(video);
984
984
  })();
985
- `.trim();return{html:b,script:k}}function hG($,Z,Y){let{width:J=640,height:X=360}=Y,Q=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=mG($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=uG($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let z=[`id="${K}"`,`src="${V0(q)}"`,`width="${J}"`,`height="${X}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)z.push(`class="${V0(Q)}"`);if(G)z.push(`style="${V0(G)}"`);if(Y.lazy)z.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
985
+ `.trim();return{html:b,script:k}}function mG($,Z,Y){let{width:J=640,height:X=360}=Y,Q=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=pG($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=cG($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let z=[`id="${K}"`,`src="${V0(q)}"`,`width="${J}"`,`height="${X}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)z.push(`class="${V0(Q)}"`);if(G)z.push(`style="${V0(G)}"`);if(Y.lazy)z.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
986
986
  <iframe ${z.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
987
- </div>`}}function dG($,Z={}){let{src:Y,sources:J=[],poster:X,controls:Q=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:z=!0,lazy:U=!0,width:_,height:B}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:J.length>0?J:Y,autoplay:G,loop:q,muted:K,playsinline:z,preload:W,poster:X,controls:Q,title:$.title},O=["position: relative",_?`width: ${typeof _==="number"?_+"px":_}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",H||""].filter(Boolean).join("; "),V=`
987
+ </div>`}}function uG($,Z={}){let{src:Y,sources:J=[],poster:X,controls:Q=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:z=!0,lazy:U=!0,width:_,height:B}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:J.length>0?J:Y,autoplay:G,loop:q,muted:K,playsinline:z,preload:W,poster:X,controls:Q,title:$.title},O=["position: relative",_?`width: ${typeof _==="number"?_+"px":_}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",H||""].filter(Boolean).join("; "),V=`
988
988
  <div
989
989
  id="${L}"
990
990
  class="ts-video-player${j?" "+V0(j):""}"
@@ -1021,7 +1021,7 @@ ${P}
1021
1021
 
1022
1022
  // Load ts-video-player from CDN
1023
1023
  var script = document.createElement('script');
1024
- script.src = '${gG}';
1024
+ script.src = '${dG}';
1025
1025
  script.onload = initPlayer;
1026
1026
  script.onerror = function() {
1027
1027
  console.error('[stx] Failed to load ts-video-player');
@@ -1151,7 +1151,7 @@ else {
1151
1151
  .ts-video-player__play-button svg {
1152
1152
  margin-left: 4px;
1153
1153
  }
1154
- `.trim();return{html:V,script:w,css:A}}function F8($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function mG($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let J=$.match(Y);if(J)return J[1]}return null}function uG($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function V0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function pG($,Z){let Y=await H8();if(!Y)return C4({...$,process:!1},Z);let J=Z.tsVideosConfig,X=await Y.processVideo($.src,$,J,$.onProcessProgress);if(X.processed)return V8($,X,Z);return C4({...$,process:!1},Z)}async function cG($,Z){let Y=await H8();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},X=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,X.outputDir,X.baseUrl||"/videos"))?.url}function V8($,Z,Y){let{controls:J=O8,autoplay:X=!1,muted:Q=!1,loop:G=!1,preload:K=L8,playsinline:q=!0,lazy:W=!0,width:z,height:U,crossorigin:_,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=F8(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,N=[`id="${F}"`];if(J)N.push("controls");if(X)N.push("autoplay");if(Q)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(B)N.push("disablepictureinpicture");if(j)N.push("disableremoteplayback");if(_)N.push(`crossorigin="${_}"`);if(W){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),A)N.push(`data-poster="${V0(A)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),A)N.push(`poster="${V0(A)}"`);let R=z||Z.metadata?.width,T=U||Z.metadata?.height;if(R)N.push(`width="${R}"`);if(T)N.push(`height="${T}"`);if(H)N.push(`class="${V0(H)}"`);if(L)N.push(`style="${V0(L)}"`);let I=` <source ${W?`data-src="${V0(O)}"`:`src="${V0(O)}"`} type="${V}" />`,D=`<video ${N.join(" ")}>
1154
+ `.trim();return{html:V,script:w,css:A}}function V8($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function pG($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let J=$.match(Y);if(J)return J[1]}return null}function cG($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function V0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function lG($,Z){let Y=await O8();if(!Y)return C4({...$,process:!1},Z);let J=Z.tsVideosConfig,X=await Y.processVideo($.src,$,J,$.onProcessProgress);if(X.processed)return w8($,X,Z);return C4({...$,process:!1},Z)}async function iG($,Z){let Y=await O8();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},X=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,X.outputDir,X.baseUrl||"/videos"))?.url}function w8($,Z,Y){let{controls:J=L8,autoplay:X=!1,muted:Q=!1,loop:G=!1,preload:K=F8,playsinline:q=!0,lazy:W=!0,width:z,height:U,crossorigin:_,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=V8(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,N=[`id="${F}"`];if(J)N.push("controls");if(X)N.push("autoplay");if(Q)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(B)N.push("disablepictureinpicture");if(j)N.push("disableremoteplayback");if(_)N.push(`crossorigin="${_}"`);if(W){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),A)N.push(`data-poster="${V0(A)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),A)N.push(`poster="${V0(A)}"`);let R=z||Z.metadata?.width,T=U||Z.metadata?.height;if(R)N.push(`width="${R}"`);if(T)N.push(`height="${T}"`);if(H)N.push(`class="${V0(H)}"`);if(L)N.push(`style="${V0(L)}"`);let I=` <source ${W?`data-src="${V0(O)}"`:`src="${V0(O)}"`} type="${V}" />`,D=`<video ${N.join(" ")}>
1155
1155
  ${I}
1156
1156
  Your browser does not support the video tag.
1157
1157
  </video>`;if(Z.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${V0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -1200,9 +1200,9 @@ ${D}
1200
1200
  width: 100%;
1201
1201
  height: auto;
1202
1202
  }
1203
- `.trim();return{html:D,script:E,css:P}}var j8=!1,O8=!0,L8="metadata",gG="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var w8=S(()=>{D7()});function A8(){return U4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:X,options:Q}=lG($,Z,Y);if(!X)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:X,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await C4(G,q),z=W.html;if(W.css)z+=`
1203
+ `.trim();return{html:D,script:E,css:P}}var H8=!1,L8=!0,F8="metadata",dG="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var A8=S(()=>{D7()});function N8(){return U4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:X,options:Q}=nG($,Z,Y);if(!X)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:X,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await C4(G,q),z=W.html;if(W.css)z+=`
1204
1204
  <style>${W.css}</style>`;if(W.script)z+=`
1205
- <script>${W.script}</script>`;return z},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function lG($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=iG(J),Q=N8(X[0],Y)||"",G={};if(X[1]){let K=N8(X[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof X[1]==="string")try{G=JSON.parse(X[1])}catch{}}return{src:Q,options:G}}function iG($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!J)J=!0,X=q;else if(q===X)J=!1,X="";else Y+=q;continue}if(!J){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function N8($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var I7;var D7=S(()=>{a$();w8();I7=A8()});function nG($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1205
+ <script>${W.script}</script>`;return z},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function nG($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=oG(J),Q=R8(X[0],Y)||"",G={};if(X[1]){let K=R8(X[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof X[1]==="string")try{G=JSON.parse(X[1])}catch{}}return{src:Q,options:G}}function oG($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!J)J=!0,X=q;else if(q===X)J=!1,X="";else Y+=q;continue}if(!J){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function R8($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var I7;var D7=S(()=>{a$();A8();I7=N8()});function sG($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1206
1206
  ${$}
1207
1207
  </div>
1208
1208
  <script>
@@ -1247,7 +1247,7 @@ ${D}
1247
1247
  }
1248
1248
  }
1249
1249
  })();
1250
- </script>`}function oG($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",X=Y?.autoReload||!1,Q=$.trim().length>0,G=`
1250
+ </script>`}function rG($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",X=Y?.autoReload||!1,Q=$.trim().length>0,G=`
1251
1251
  <div class="stx-pwa-update-banner" style="
1252
1252
  position: fixed;
1253
1253
  bottom: 0;
@@ -1358,7 +1358,7 @@ else {
1358
1358
  // Also listen for custom event
1359
1359
  window.addEventListener('pwa-update-available', showUpdate);
1360
1360
  })();
1361
- </script>`}function sG($,Z){let Y=$.trim().length>0,J=`
1361
+ </script>`}function aG($,Z){let Y=$.trim().length>0,J=`
1362
1362
  <div class="stx-offline-indicator" style="
1363
1363
  position: fixed;
1364
1364
  top: 16px;
@@ -1419,7 +1419,7 @@ else {
1419
1419
  window.addEventListener('offline', updateStatus);
1420
1420
  updateStatus();
1421
1421
  })();
1422
- </script>`}function rG($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",X=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
1422
+ </script>`}function tG($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",X=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
1423
1423
  ${$}
1424
1424
  </div>
1425
1425
  <script>
@@ -1501,33 +1501,33 @@ catch (error) {
1501
1501
  init();
1502
1502
  }
1503
1503
  })();
1504
- </script>`}var aG,tG,eG,$K,R8;var T8=S(()=>{aG={name:"pwa.installButton",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return nG($,X)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},tG={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return oG($,X)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},eG={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return sG($,X)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},$K={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return rG($,X)},hasEndTag:!0,description:"Renders a push notification subscription button"},R8=[aG,tG,eG,$K]});function E7($){for(let[Z,Y]of Object.entries(s))if(Y===$)return Z;return}var s;var P4=S(()=>{s={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 S5(){return!1}function y5(){return!S5()||process.env.STX_DEBUG==="true"}function v4(){return!1}import ZK from"path";function x4(){return{...k7}}function f4($){if(!k7.showRelativePaths||!$)return $;let Z=k7.baseDir||process.cwd();try{let Y=ZK.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var YK,k7,g4,k1,h4;var d4=S(()=>{P4();YK={showRelativePaths:!1,enableAutoRecovery:y5(),logRecoveryWarnings:!0},k7={...YK};g4=class g4 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||s.EVALUATION_ERROR,this.filePath)this.filePath=f4(this.filePath)}};k1=class k1 extends g4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};h4=class h4 extends g4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function I8($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:q,snippet:W,suggestion:z,format:U="text"}=$,_=Q,B=G;if(!_&&K&&q!==void 0){let O=qK(K,q);_=O.line,B=O.column}let j=X?f4(X):void 0,H=J?E7(J):void 0,L={type:Z,code:J,codeName:H,message:Y,filePath:j,line:_,column:B,snippet:W,suggestion:z,timestamp:new Date().toISOString()},F;switch(U){case"html":F=XK(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=QK(L,K,q);break;case"text":default:F=JK(L,K,q);break}return{formatted:F,data:L}}function JK($,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(`
1505
- ${$.message}`),Z&&$.line){let Q=GK(Z,$.line,2);if(Q)J.push(`
1504
+ </script>`}var eG,$K,ZK,YK,T8;var M8=S(()=>{eG={name:"pwa.installButton",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return sG($,X)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},$K={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return rG($,X)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},ZK={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return aG($,X)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},YK={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return tG($,X)},hasEndTag:!0,description:"Renders a push notification subscription button"},T8=[eG,$K,ZK,YK]});function E7($){for(let[Z,Y]of Object.entries(s))if(Y===$)return Z;return}var s;var P4=S(()=>{s={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 S5(){return!1}function y5(){return!S5()||process.env.STX_DEBUG==="true"}function v4(){return!1}import JK from"path";function x4(){return{...k7}}function f4($){if(!k7.showRelativePaths||!$)return $;let Z=k7.baseDir||process.cwd();try{let Y=JK.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var XK,k7,g4,k1,h4;var d4=S(()=>{P4();XK={showRelativePaths:!1,enableAutoRecovery:y5(),logRecoveryWarnings:!0},k7={...XK};g4=class g4 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||s.EVALUATION_ERROR,this.filePath)this.filePath=f4(this.filePath)}};k1=class k1 extends g4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};h4=class h4 extends g4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function D8($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:q,snippet:W,suggestion:z,format:U="text"}=$,_=Q,B=G;if(!_&&K&&q!==void 0){let O=WK(K,q);_=O.line,B=O.column}let j=X?f4(X):void 0,H=J?E7(J):void 0,L={type:Z,code:J,codeName:H,message:Y,filePath:j,line:_,column:B,snippet:W,suggestion:z,timestamp:new Date().toISOString()},F;switch(U){case"html":F=GK(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=KK(L,K,q);break;case"text":default:F=QK(L,K,q);break}return{formatted:F,data:L}}function QK($,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(`
1505
+ ${$.message}`),Z&&$.line){let Q=qK(Z,$.line,2);if(Q)J.push(`
1506
1506
  ${Q}`)}if($.snippet)J.push(`
1507
1507
  Snippet: ${$.snippet}`);if($.suggestion)J.push(`
1508
- Suggestion: ${$.suggestion}`);return J.join(" ")}function XK($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${M8($.message)}`;if($.suggestion)J+=` | Suggestion: ${M8($.suggestion)}`;return J+=" -->",J}function QK($,Z,Y){let W=[],z=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${z} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let U=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(U+=`\x1B[90m:${$.line}\x1B[0m`,$.column)U+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
1508
+ Suggestion: ${$.suggestion}`);return J.join(" ")}function GK($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${I8($.message)}`;if($.suggestion)J+=` | Suggestion: ${I8($.suggestion)}`;return J+=" -->",J}function KK($,Z,Y){let W=[],z=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${z} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let U=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(U+=`\x1B[90m:${$.line}\x1B[0m`,$.column)U+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
1509
1509
  \x1B[90mat\x1B[0m ${U}`)}if(W.push(`
1510
1510
 
1511
- ${$.message}`),Z&&$.line){let U=KK(Z,$.line,2);if(U)W.push(`
1511
+ ${$.message}`),Z&&$.line){let U=zK(Z,$.line,2);if(U)W.push(`
1512
1512
 
1513
1513
  \x1B[90mContext:\x1B[0m
1514
1514
  ${U}`)}if($.suggestion)W.push(`
1515
1515
 
1516
1516
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
1517
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function GK($,Z,Y){let J=$.split(`
1517
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function qK($,Z,Y){let J=$.split(`
1518
1518
  `),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G=[];for(let K=X;K<=Q;K++){let q=(K+1).toString().padStart(4),W=K===Z-1?">":" ";G.push(`${W}${q} | ${J[K]}`)}return G.join(`
1519
- `)}function KK($,Z,Y){let J=$.split(`
1519
+ `)}function zK($,Z,Y){let J=$.split(`
1520
1520
  `),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",W=[];for(let z=X;z<=Q;z++){let U=(z+1).toString().padStart(4),_=z===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${J[z]}\x1B[0m`:`\x1B[90m${J[z]}\x1B[0m`;W.push(`${B}\x1B[90m${U}\x1B[0m | ${j}`)}return W.join(`
1521
- `)}function M8($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function qK($,Z){let J=$.substring(0,Z).split(`
1522
- `);return{line:J.length,column:J[J.length-1].length}}function e($,Z,Y){return I8({type:$,message:Z,code:Y,format:"html"}).formatted}async function r1($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var D8=S(()=>{P4();d4()});class S7{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let J={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
1521
+ `)}function I8($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function WK($,Z){let J=$.substring(0,Z).split(`
1522
+ `);return{line:J.length,column:J[J.length-1].length}}function e($,Z,Y){return D8({type:$,message:Z,code:Y,format:"html"}).formatted}async function r1($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var E8=S(()=>{P4();d4()});class S7{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let J={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
1523
1523
  `).slice(1).join(`
1524
1524
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
1525
1525
  `)}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($)}
1526
1526
  `;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(`
1527
1527
 
1528
- `),"utf-8")}}async flush(){await this.writeQueue}}var b7,c0,y7;var E8=S(()=>{d4();b7={isEnabled(){return x4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=x4();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 q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let z=q-W;for(let U=0;U<z;U++)Y+=`
1528
+ `),"utf-8")}}async flush(){await this.writeQueue}}var b7,c0,y7;var k8=S(()=>{d4();b7={isEnabled(){return x4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=x4();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 q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let z=q-W;for(let U=0;U<z;U++)Y+=`
1529
1529
  @end${K}`;J.push(`Added ${z} 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(y5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};c0=new S7,y7={isDevelopment(){return y5()},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(`
1530
- `)}}});var k8=()=>{};var b8=S(()=>{P4();D8();E8();k8();d4()});var Z1=S(()=>{b8()});function S8($,Z,Y,J){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let z=q.split(":"),U=q,_=z.length>1?z[1]:"";if(_&&Z[_])W=Z[_];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])W=Z.openGraph[z[1]];else W="";return W?`<meta property="${l(U)}" content="${l(W)}">`:""}return W?`<meta name="${l(q)}" content="${l(W)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,q=K+G[0].length-1,W=1,z=q+1;while(z<X.length&&W>0){if(X[z]==="(")W++;else if(X[z]===")"){if(W--,W===0)break}z++}if(W!==0)break;let U=X.substring(q+1,z).trim(),_=z+1,B=(()=>{try{let j=N0(U,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${l(String(j.name))}"`;if(j.property)H+=` property="${l(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${l(String(j.httpEquiv))}"`;if(j.content)H+=` content="${l(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return e("MetaTag",H,s.EVALUATION_ERROR)}})();X=X.substring(0,K)+B+X.substring(_),Q.lastIndex=0}return X}function y8($,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,q=1,W=K+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let z=J.substring(K+1,W).trim(),U=W+1,_=(()=>{try{let B=N0(z,Z);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return e("StructuredData",j,s.EVALUATION_ERROR)}})();J=J.substring(0,G)+_+J.substring(U),X.lastIndex=0}return J}function C8($,Z,Y,J){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),q=1,W=K+1,z=null,U=!1;while(W<X.length&&q>0){let F=X[W];if(U){U=!1,W++;continue}if(F==="\\"&&z){U=!0,W++;continue}if(z){if(F===z)z=null;W++;continue}if(F==='"'||F==="'"||F==="`"){z=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let _=X.substring(W).match(/^\s*\)/);if(!_)break;let B=W+_[0].length,j=X.substring(K,W),H=X.substring(G.index,B),L=((F)=>{try{let O=N0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${l(O.title)}</title>
1530
+ `)}}});var b8=()=>{};var S8=S(()=>{P4();E8();k8();b8();d4()});var Z1=S(()=>{S8()});function y8($,Z,Y,J){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let z=q.split(":"),U=q,_=z.length>1?z[1]:"";if(_&&Z[_])W=Z[_];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])W=Z.openGraph[z[1]];else W="";return W?`<meta property="${l(U)}" content="${l(W)}">`:""}return W?`<meta name="${l(q)}" content="${l(W)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,q=K+G[0].length-1,W=1,z=q+1;while(z<X.length&&W>0){if(X[z]==="(")W++;else if(X[z]===")"){if(W--,W===0)break}z++}if(W!==0)break;let U=X.substring(q+1,z).trim(),_=z+1,B=(()=>{try{let j=N0(U,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${l(String(j.name))}"`;if(j.property)H+=` property="${l(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${l(String(j.httpEquiv))}"`;if(j.content)H+=` content="${l(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return e("MetaTag",H,s.EVALUATION_ERROR)}})();X=X.substring(0,K)+B+X.substring(_),Q.lastIndex=0}return X}function C8($,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,q=1,W=K+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let z=J.substring(K+1,W).trim(),U=W+1,_=(()=>{try{let B=N0(z,Z);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return e("StructuredData",j,s.EVALUATION_ERROR)}})();J=J.substring(0,G)+_+J.substring(U),X.lastIndex=0}return J}function P8($,Z,Y,J){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),q=1,W=K+1,z=null,U=!1;while(W<X.length&&q>0){let F=X[W];if(U){U=!1,W++;continue}if(F==="\\"&&z){U=!0,W++;continue}if(z){if(F===z)z=null;W++;continue}if(F==='"'||F==="'"||F==="`"){z=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let _=X.substring(W).match(/^\s*\)/);if(!_)break;let B=W+_[0].length,j=X.substring(K,W),H=X.substring(G.index,B),L=((F)=>{try{let O=N0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${l(O.title)}</title>
1531
1531
  `,V+=`<meta name="title" content="${l(O.title)}">
1532
1532
  `;if(O.description)V+=`<meta name="description" content="${l(O.description)}">
1533
1533
  `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${l(w)}">
@@ -1549,7 +1549,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
1549
1549
  `}if(w.site)V+=`<meta name="twitter:site" content="${l(w.site)}">
1550
1550
  `;if(w.creator)V+=`<meta name="twitter:creator" content="${l(w.creator)}">
1551
1551
  `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
1552
- `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return e("SEO",`Error processing @seo directive: ${V}`,s.EVALUATION_ERROR)}})(j);X=X.substring(0,G.index)+L+X.substring(B),Q.lastIndex=G.index+L.length}return X}function P8($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
1552
+ `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return e("SEO",`Error processing @seo directive: ${V}`,s.EVALUATION_ERROR)}})(j);X=X.substring(0,G.index)+L+X.substring(B),Q.lastIndex=G.index+L.length}return X}function v8($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
1553
1553
  <!-- stx SEO Tags -->
1554
1554
  <meta name="title" content="${l(G)}">
1555
1555
  <meta name="description" content="${l(K)}">
@@ -1565,7 +1565,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
1565
1565
  `;let z=$;if(!Q)z=z.replace(/<head[^>]*>/,`$&
1566
1566
  <title>${l(G)}</title>`);return z.replace(/<head[^>]*>/,`$&
1567
1567
  ${W}
1568
- `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var v8,x8;var C7=S(()=>{Z1();R0();v8={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return e("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(X)}" content="${l(Q)}">`},hasEndTag:!1},x8={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return e("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let X=JSON.parse($);if(!X["@context"])X["@context"]="https://schema.org";if(!X["@type"])return e("StructuredData","structuredData requires @type property",s.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 e("StructuredData",Q,s.EVALUATION_ERROR)}},hasEndTag:!0}});import C5 from"path";function zK($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",X=Z,Q=[],G=!0;if(J){let U=J.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let _=U[1],B=_.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)X=B[1];let j=_.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)Q=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=_.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),z=W?W[1].trim():"";return{tag:X,props:Q,template:q,styles:z,script:J,shadowDOM:G}}function WK($){let{tag:Z,props:Y,template:J,styles:X,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((U)=>`'${U}'`).join(", "),z=Y.map((U)=>`
1568
+ `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var x8,f8;var C7=S(()=>{Z1();R0();x8={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return e("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(X)}" content="${l(Q)}">`},hasEndTag:!1},f8={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return e("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let X=JSON.parse($);if(!X["@context"])X["@context"]="https://schema.org";if(!X["@type"])return e("StructuredData","structuredData requires @type property",s.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 e("StructuredData",Q,s.EVALUATION_ERROR)}},hasEndTag:!0}});import C5 from"path";function UK($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",X=Z,Q=[],G=!0;if(J){let U=J.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let _=U[1],B=_.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)X=B[1];let j=_.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)Q=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=_.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),z=W?W[1].trim():"";return{tag:X,props:Q,template:q,styles:z,script:J,shadowDOM:G}}function _K($){let{tag:Z,props:Y,template:J,styles:X,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((U)=>`'${U}'`).join(", "),z=Y.map((U)=>`
1569
1569
  get ${U}() {
1570
1570
  return this.getAttribute('${U}') || '';
1571
1571
  }
@@ -1616,16 +1616,16 @@ ${z}
1616
1616
  }
1617
1617
 
1618
1618
  customElements.define('${Z}', ${G});
1619
- `}async function f8($,Z,Y,J){if(Z.length<1)return e("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[C5.join(C5.dirname(J),G,`${X}.stx`),C5.join(process.cwd(),G,`${X}.stx`),C5.join(C5.dirname(J),`${X}.stx`)],q=null;for(let U of K)if(await n(U)){q=await Bun.file(U).text();break}if(!q)return e("WebComponent",`Component file not found: ${X}.stx`,s.FILE_NOT_FOUND);let W=zK(q,X);return`<script type="module">
1620
- ${WK(W)}
1621
- </script>`}var g8=S(()=>{Z1();A0()});var h8={};r(h8,{timingPlugin:()=>HK,pluginManager:()=>UK,definePlugin:()=>m4,debugPlugin:()=>jK,createVariablesPlugin:()=>OK,createFilterPlugin:()=>BK,createDirectivePlugin:()=>_K,PluginManager:()=>P7});function m4($){return $}class P7{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 _K($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function BK($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function OK($){return m4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var UK,jK,HK;var d8=S(()=>{UK=new P7;jK=m4({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)}}),HK=m4({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 u8={};r(u8,{validateConfig:()=>AK,loadStxConfig:()=>S1,defineStxConfig:()=>wK,defaultConfig:()=>b1,config:()=>x7});import v7 from"fs";import D0 from"path";import{loadConfigWithResult as LK}from"bunfig";function FK($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=D0.join(process.cwd(),"resources","views"),X=D0.join(process.cwd(),"resources","layouts");if(v7.existsSync(J)&&v7.existsSync(X))return{root:"resources",pagesDir:"views"};let Q=D0.join(process.cwd(),"resources","views","pages");if(v7.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function VK($){if(H6($.stateDir),$.stateDir=B5(),$.cachePath=j5($.cachePath),$.build)$.build.cacheDir=j5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=j5($.media.cache.directory);if($.story)$.story.outDir=j5($.story.outDir)}async function S1($){if(!$){if(a1)return a1;if(u4)return u4}let Z=$?D0.resolve($):process.cwd(),Y=m8.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await LK({name:"stx",alias:"ui",cwd:Z,defaultConfig:b1,verbose:!1})).config;VK(Q);let G=FK(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!D0.isAbsolute(Q.partialsDir))Q.partialsDir=D0.join(K,Q.partialsDir);if(Q.componentsDir&&!D0.isAbsolute(Q.componentsDir))Q.componentsDir=D0.join(K,Q.componentsDir);if(Q.layoutsDir&&!D0.isAbsolute(Q.layoutsDir))Q.layoutsDir=D0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (d8(),h8)),q=[],W=[];for(let z of Q.plugins){let U=typeof z==="string"?z:z[0],_=typeof z==="string"?{}:z[1]||{};try{let B,j;try{B=await import(U),j=D0.dirname(z0.resolve(U))}catch{let L=D0.resolve(process.cwd(),U);B=await import(L),j=D0.dirname(L)}let H=B.default||B;if(K.register(H,Q),H.components){let L=D0.resolve(j,H.components);q.push(L)}if(H.pages){let L=D0.resolve(j,H.pages),F=_.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(F)},addRoute:(F,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[F]=O},addMiddleware:(F)=>{Q.middleware=Q.middleware||[],Q.middleware.push(F)},pluginDir:j,config:Q};await H.setup(_,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(B){console.warn(`[stx] Failed to load plugin ${U}:`,B.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=W}return Q})();if(m8.set(Z,J),!$)u4=J,J.then((X)=>{a1=X}).catch(()=>{});return J}function wK($){return $}function AK($){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 b1,a1=null,m8,u4=null,x7;var t1=S(()=>{S$();y$();C$();P$();r$();t9();D7();T8();C7();H5();g8();b1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:m1,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:T9,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:f8,hasEndTag:!1,description:"Include a web component in the template"},F6,V6,v8,x8,w6,N6,R6,A6,D6,b6,a9,I7,...R8],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:"#app-content",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}};m8=new Map;x7=new Proxy(b1,{get($,Z){if(a1&&Z in a1)return a1[Z];if(!u4)S1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var n8={};r(n8,{resetCssCache:()=>DK,resetCrosswindCache:()=>EK,rebuildCrosswindCSS:()=>kK,loadCrosswindConfig:()=>m7,loadCrosswind:()=>d7,injectCrosswindCSS:()=>v5,getCachedCSS:()=>bK,generateCrosswindCSS:()=>i8,extractClassNames:()=>l8,buildCrosswindCSS:()=>c8});import Y0 from"path";import{hasLocalConfig as NK}from"bunfig/discovery";function h7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function f7($,Z){if(Y1.has($))Y1.delete($);else if(Y1.size>=RK)Y1.delete(Y1.keys().next().value);Y1.set($,Z)}async function TK($){if(!q1)return null;try{let Z=Bun.file(Y0.join(q1,`cw-${h7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function MK($,Z){if(!q1)return;try{if(!fs.existsSync(q1))fs.mkdirSync(q1,{recursive:!0});await Bun.write(Y0.join(q1,`cw-${h7($)}.css`),Z)}catch{}}async function p8($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function IK(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==Y0.dirname(Y))$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Y0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=Y0.dirname(Y);if(Z){let J=[Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...J)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function d7(){if(g7)return $5;g7=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let J=await p8(Y);if(J){if($5=J,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded`);return $5}}let Z=IK();for(let Y of Z)if(await Bun.file(Y).exists()){let J=await p8(Y);if(J){if($5=J,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(Y))}`);return $5}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${B0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${B0.reset}`),console.warn(`${B0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${B0.reset}`),null}}function DK(){Y1.clear()}function EK(){$5=null,g7=!1,l0=null,P5="",Y1.clear(),p4=null}async function m7($){try{if(!NK({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=Y0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${B0.yellow}[Crosswind]${B0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function c8($){if(e1)return P5;e1=!0;try{let Z=await d7();if(!Z||!Z.build)return e1=!1,"";if(!l0)l0=await m7($);if(!l0)return e1=!1,"";let Y=Z.defaultConfig?.theme||{},J=l0.theme||{},X={...Z.defaultConfig,...l0,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(P5=G.css,console.log(`${B0.cyan}[Crosswind]${B0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let q=Y0.isAbsolute(X.output)?X.output:Y0.join($,X.output),W=Y0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,G.css)}return e1=!1,G.css}catch(Z){return console.error(`${B0.red}[Crosswind]${B0.reset} Build error:`,Z),e1=!1,P5}}async function kK($){l0=null,await c8($)}function bK(){return P5}function l8($){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 q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}Q=X.exec($)}return Z}async function i8($,Z){try{let Y=await d7();if(!Y)return"";let J=l8($);if(J.size===0)return"";let X=Z?Y0.resolve(Z):process.cwd();if(!q1)q1=Q1(X,"cache");let Q=[...J].sort().join(" "),G=`${p4||"default"}::${Q}`,K=Y1.get(G);if(K!==void 0)return f7(G,K),K;let q=await TK(G);if(q!==null)return f7(G,q),q;if(!l0){let A=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (t1(),u8)),R=await N(X);if(R.css)if(typeof R.css==="string"){let T=Y0.isAbsolute(R.css)?R.css:Y0.resolve(X,R.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Y0.isAbsolute(R.css.config)?R.css.config:Y0.resolve(X,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${B0.green}[Crosswind]${B0.reset} Using inline CSS config from stx.config.ts`)}}catch{}l0=A||await m7(X);try{p4=h7(JSON.stringify(l0??{}))}catch{p4="unhashable"}}let W=Y.defaultConfig||Y.config,z=l0||{},U=W.theme||{},B=(z.theme||{}).extend||{},j={...U};if(Object.keys(B).length>0)j.extend=B;let H=[...W.safelist||[],...z.safelist||[]],L={...W,...z,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of J)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||z.shortcuts||{};for(let[A,N]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean);for(let T of R)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
1619
+ `}async function g8($,Z,Y,J){if(Z.length<1)return e("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[C5.join(C5.dirname(J),G,`${X}.stx`),C5.join(process.cwd(),G,`${X}.stx`),C5.join(C5.dirname(J),`${X}.stx`)],q=null;for(let U of K)if(await n(U)){q=await Bun.file(U).text();break}if(!q)return e("WebComponent",`Component file not found: ${X}.stx`,s.FILE_NOT_FOUND);let W=UK(q,X);return`<script type="module">
1620
+ ${_K(W)}
1621
+ </script>`}var h8=S(()=>{Z1();A0()});var d8={};r(d8,{timingPlugin:()=>LK,pluginManager:()=>BK,definePlugin:()=>m4,debugPlugin:()=>OK,createVariablesPlugin:()=>FK,createFilterPlugin:()=>HK,createDirectivePlugin:()=>jK,PluginManager:()=>P7});function m4($){return $}class P7{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 jK($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function HK($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function FK($){return m4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var BK,OK,LK;var m8=S(()=>{BK=new P7;OK=m4({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)}}),LK=m4({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 p8={};r(p8,{validateConfig:()=>RK,loadStxConfig:()=>S1,defineStxConfig:()=>NK,defaultConfig:()=>b1,config:()=>x7});import v7 from"fs";import D0 from"path";import{loadConfigWithResult as VK}from"bunfig";function wK($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=D0.join(process.cwd(),"resources","views"),X=D0.join(process.cwd(),"resources","layouts");if(v7.existsSync(J)&&v7.existsSync(X))return{root:"resources",pagesDir:"views"};let Q=D0.join(process.cwd(),"resources","views","pages");if(v7.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function AK($){if(O6($.stateDir),$.stateDir=B5(),$.cachePath=j5($.cachePath),$.build)$.build.cacheDir=j5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=j5($.media.cache.directory);if($.story)$.story.outDir=j5($.story.outDir)}async function S1($){if(!$){if(a1)return a1;if(u4)return u4}let Z=$?D0.resolve($):process.cwd(),Y=u8.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await VK({name:"stx",alias:"ui",cwd:Z,defaultConfig:b1,verbose:!1})).config;AK(Q);let G=wK(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!D0.isAbsolute(Q.partialsDir))Q.partialsDir=D0.join(K,Q.partialsDir);if(Q.componentsDir&&!D0.isAbsolute(Q.componentsDir))Q.componentsDir=D0.join(K,Q.componentsDir);if(Q.layoutsDir&&!D0.isAbsolute(Q.layoutsDir))Q.layoutsDir=D0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (m8(),d8)),q=[],W=[];for(let z of Q.plugins){let U=typeof z==="string"?z:z[0],_=typeof z==="string"?{}:z[1]||{};try{let B,j;try{B=await import(U),j=D0.dirname(z0.resolve(U))}catch{let L=D0.resolve(process.cwd(),U);B=await import(L),j=D0.dirname(L)}let H=B.default||B;if(K.register(H,Q),H.components){let L=D0.resolve(j,H.components);q.push(L)}if(H.pages){let L=D0.resolve(j,H.pages),F=_.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(F)},addRoute:(F,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[F]=O},addMiddleware:(F)=>{Q.middleware=Q.middleware||[],Q.middleware.push(F)},pluginDir:j,config:Q};await H.setup(_,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(B){console.warn(`[stx] Failed to load plugin ${U}:`,B.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=W}return Q})();if(u8.set(Z,J),!$)u4=J,J.then((X)=>{a1=X}).catch(()=>{});return J}function NK($){return $}function RK($){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 b1,a1=null,u8,u4=null,x7;var t1=S(()=>{S$();y$();C$();P$();r$();e9();D7();M8();C7();H5();h8();b1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:m1,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:M9,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:g8,hasEndTag:!1,description:"Include a web component in the template"},V6,w6,x8,f8,A6,R6,T6,N6,E6,S6,t9,I7,...T8],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:"#app-content",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}};u8=new Map;x7=new Proxy(b1,{get($,Z){if(a1&&Z in a1)return a1[Z];if(!u4)S1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var o8={};r(o8,{resetCssCache:()=>kK,resetCrosswindCache:()=>bK,rebuildCrosswindCSS:()=>SK,loadCrosswindConfig:()=>m7,loadCrosswind:()=>d7,injectCrosswindCSS:()=>v5,getCachedCSS:()=>yK,generateCrosswindCSS:()=>n8,extractClassNames:()=>i8,buildCrosswindCSS:()=>l8});import Y0 from"path";import{hasLocalConfig as TK}from"bunfig/discovery";function h7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function f7($,Z){if(Y1.has($))Y1.delete($);else if(Y1.size>=MK)Y1.delete(Y1.keys().next().value);Y1.set($,Z)}async function IK($){if(!q1)return null;try{let Z=Bun.file(Y0.join(q1,`cw-${h7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function DK($,Z){if(!q1)return;try{if(!fs.existsSync(q1))fs.mkdirSync(q1,{recursive:!0});await Bun.write(Y0.join(q1,`cw-${h7($)}.css`),Z)}catch{}}async function c8($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function EK(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==Y0.dirname(Y))$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Y0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=Y0.dirname(Y);if(Z){let J=[Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...J)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function d7(){if(g7)return $5;g7=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let J=await c8(Y);if(J){if($5=J,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded`);return $5}}let Z=EK();for(let Y of Z)if(await Bun.file(Y).exists()){let J=await c8(Y);if(J){if($5=J,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(Y))}`);return $5}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${B0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${B0.reset}`),console.warn(`${B0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${B0.reset}`),null}}function kK(){Y1.clear()}function bK(){$5=null,g7=!1,l0=null,P5="",Y1.clear(),p4=null}async function m7($){try{if(!TK({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=Y0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${B0.yellow}[Crosswind]${B0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function l8($){if(e1)return P5;e1=!0;try{let Z=await d7();if(!Z||!Z.build)return e1=!1,"";if(!l0)l0=await m7($);if(!l0)return e1=!1,"";let Y=Z.defaultConfig?.theme||{},J=l0.theme||{},X={...Z.defaultConfig,...l0,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(P5=G.css,console.log(`${B0.cyan}[Crosswind]${B0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let q=Y0.isAbsolute(X.output)?X.output:Y0.join($,X.output),W=Y0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,G.css)}return e1=!1,G.css}catch(Z){return console.error(`${B0.red}[Crosswind]${B0.reset} Build error:`,Z),e1=!1,P5}}async function SK($){l0=null,await l8($)}function yK(){return P5}function i8($){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 q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}Q=X.exec($)}return Z}async function n8($,Z){try{let Y=await d7();if(!Y)return"";let J=i8($);if(J.size===0)return"";let X=Z?Y0.resolve(Z):process.cwd();if(!q1)q1=Q1(X,"cache");let Q=[...J].sort().join(" "),G=`${p4||"default"}::${Q}`,K=Y1.get(G);if(K!==void 0)return f7(G,K),K;let q=await IK(G);if(q!==null)return f7(G,q),q;if(!l0){let A=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (t1(),p8)),R=await N(X);if(R.css)if(typeof R.css==="string"){let T=Y0.isAbsolute(R.css)?R.css:Y0.resolve(X,R.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Y0.isAbsolute(R.css.config)?R.css.config:Y0.resolve(X,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${B0.green}[Crosswind]${B0.reset} Using inline CSS config from stx.config.ts`)}}catch{}l0=A||await m7(X);try{p4=h7(JSON.stringify(l0??{}))}catch{p4="unhashable"}}let W=Y.defaultConfig||Y.config,z=l0||{},U=W.theme||{},B=(z.theme||{}).extend||{},j={...U};if(Object.keys(B).length>0)j.extend=B;let H=[...W.safelist||[],...z.safelist||[]],L={...W,...z,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of J)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||z.shortcuts||{};for(let[A,N]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean);for(let T of R)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
1622
1622
  `);for(let[A,N]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of R){let D=I.startsWith("dark:"),b=`.${(D?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<w.length;k++){let y=w[k].trim();if(y===`${b} {`||y.startsWith(`${b} {`)){let g=k,h="";while(g<w.length){if(h+=w[g],w[g].includes("}"))break;g++}let m=h.match(/\{([^}]+)\}/);if(m)if(D)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
1623
1623
  .${A} { ${T.join(" ")} }`;if(M.length)O+=`
1624
- @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return f7(G,O),MK(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function v5($,Z){let Y=await i8($,Z);if(!Y)return $;let J=`<style data-crosswind="generated">
1624
+ @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return f7(G,O),DK(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function v5($,Z){let Y=await n8($,Z);if(!Y)return $;let J=`<style data-crosswind="generated">
1625
1625
  ${Y}
1626
1626
  </style>`,X=/<style data-crosswind="generated">[\s\S]*?<\/style>/g;if(X.test($)){let Q=!1;return $.replace(X,()=>{if(Q)return"";return Q=!0,J})}if($.includes("</head>"))return $.replace("</head>",`${J}
1627
1627
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
1628
- ${J}`);return J+$}var $5=null,g7=!1,l0=null,P5="",e1=!1,RK=256,Y1,q1=null,p4=null;var c4=S(()=>{H5();O6();Y1=new Map});function o8(){return`
1628
+ ${J}`);return J+$}var $5=null,g7=!1,l0=null,P5="",e1=!1,MK=256,Y1,q1=null,p4=null;var c4=S(()=>{H5();L6();Y1=new Map});function s8(){return`
1629
1629
  // STX Lifecycle Runtime
1630
1630
  (function() {
1631
1631
  if (typeof window === 'undefined') return;
@@ -1970,7 +1970,7 @@ else {
1970
1970
 
1971
1971
  console.log('[stx] Lifecycle runtime initialized');
1972
1972
  })();
1973
- `}function u7($){return Symbol($)}var MO,IO,DO;var s8=S(()=>{MO=u7("theme"),IO=u7("router"),DO=u7("i18n")});import*as a8 from"crypto";function r8($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function SK(){return`stx-${a8.randomBytes(4).toString("hex")}`}function yK($){return/\$\w+\./.test($)}function CK($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,X=$;return X=X.replace(J,(Q,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let W=[],z=!1,U=K,_=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...K.matchAll(_)];for(let L of B){let F=L[0],O=L[1],V=L[2];if(yK(V)){z=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),r8(A).forEach((R)=>Y.add(R)),O==="text")U=U.replace(F,"");else if(O==="class")U=U.replace(F,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(F,"");else U=U.replace(F,`${O}=""`)}}}if(!z)return Q;let j=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=SK(),U=` id="${H}"${U}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:r8(L.expr)});return`<${G}${U}${q}`}),{html:X,bindings:Z,stores:Y}}function PK($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
1973
+ `}function u7($){return Symbol($)}var DO,EO,kO;var r8=S(()=>{DO=u7("theme"),EO=u7("router"),kO=u7("i18n")});import*as t8 from"crypto";function a8($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function CK(){return`stx-${t8.randomBytes(4).toString("hex")}`}function PK($){return/\$\w+\./.test($)}function vK($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,X=$;return X=X.replace(J,(Q,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let W=[],z=!1,U=K,_=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...K.matchAll(_)];for(let L of B){let F=L[0],O=L[1],V=L[2];if(PK(V)){z=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),a8(A).forEach((R)=>Y.add(R)),O==="text")U=U.replace(F,"");else if(O==="class")U=U.replace(F,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(F,"");else U=U.replace(F,`${O}=""`)}}}if(!z)return Q;let j=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=CK(),U=` id="${H}"${U}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:a8(L.expr)});return`<${G}${U}${q}`}),{html:X,bindings:Z,stores:Y}}function xK($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
1974
1974
  <script>
1975
1975
  (function() {
1976
1976
  'use strict';
@@ -2128,10 +2128,10 @@ else {
2128
2128
  }
2129
2129
  })();
2130
2130
  </script>
2131
- `,J}function t8($){let{html:Z,bindings:Y,stores:J}=CK($);if(Y.length===0)return $;let X=PK(Y,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var e8=()=>{};function vK($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return xK(Z);case"google-analytics":return fK(Z);case"plausible":return gK(Z);case"self-hosted":return hK(Z);case"custom":return dK(Z);default:return""}}function xK($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",X=[`data-site="${P0(Z.siteId)}"`];if(Z.honorDnt)X.push('data-honor-dnt="true"');if(Z.spa)X.push('data-spa="auto"');if(Z.canonical)X.push(`data-canonical="${P0(Z.canonical)}"`);if(Z.auto===!1)X.push('data-auto="false"');return`
2131
+ `,J}function e8($){let{html:Z,bindings:Y,stores:J}=vK($);if(Y.length===0)return $;let X=xK(Y,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var $Z=()=>{};function fK($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return gK(Z);case"google-analytics":return hK(Z);case"plausible":return dK(Z);case"self-hosted":return mK(Z);case"custom":return uK(Z);default:return""}}function gK($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",X=[`data-site="${P0(Z.siteId)}"`];if(Z.honorDnt)X.push('data-honor-dnt="true"');if(Z.spa)X.push('data-spa="auto"');if(Z.canonical)X.push(`data-canonical="${P0(Z.canonical)}"`);if(Z.auto===!1)X.push('data-auto="false"');return`
2132
2132
  <!-- Fathom Analytics -->
2133
2133
  <script src="${P0(Y)}" ${X.join(" ")}${J}></script>
2134
- `}function fK($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=P0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
2134
+ `}function hK($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=P0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
2135
2135
  <!-- Google Analytics -->
2136
2136
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
2137
2137
  <script>
@@ -2141,10 +2141,10 @@ else {
2141
2141
  gtag('config', '${Y}');
2142
2142
  ${J}
2143
2143
  </script>
2144
- `}function gK($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${P0(Z.domain)}"`],X=Y,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&Y==="https://plausible.io/js/script.js")X=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
2144
+ `}function dK($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${P0(Z.domain)}"`],X=Y,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&Y==="https://plausible.io/js/script.js")X=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
2145
2145
  <!-- Plausible Analytics -->
2146
2146
  <script defer data-domain="${P0(Z.domain)}" src="${P0(X)}"></script>
2147
- `}function hK($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=P0(Z.siteId),J=P0(Z.apiEndpoint),X=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
2147
+ `}function mK($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=P0(Z.siteId),J=P0(Z.apiEndpoint),X=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
2148
2148
  d.addEventListener('click',function(e){
2149
2149
  var a=e.target.closest('a');
2150
2150
  if(a&&a.hostname!==location.hostname){
@@ -2177,7 +2177,7 @@ else {
2177
2177
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
2178
2178
  })();
2179
2179
  </script>
2180
- `}function dK($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
2180
+ `}function uK($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
2181
2181
  <!-- Custom Analytics -->
2182
2182
  <script>
2183
2183
  ${Z.inlineScript}
@@ -2185,7 +2185,7 @@ ${Z.inlineScript}
2185
2185
  `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${P0(Z.scriptId)}"`);if(Z.attributes)for(let[X,Q]of Object.entries(Z.attributes))Y.push(`${P0(X)}="${P0(Q)}"`);return`
2186
2186
  <!-- Custom Analytics -->
2187
2187
  <script${Y.length>0?` ${Y.join(" ")}`:""} src="${P0(Z.scriptUrl)}" defer></script>
2188
- `}function $Z($,Z){let Y=vK(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function P0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var ZZ=()=>{};function XZ($){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(mK.has(J))Z.systemKeys.push(J);else if(J in QZ)Z.mouse=J;else if(J in JZ||/^[a-z]$/.test(J))Z.keys.push(JZ[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 GZ($){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,q=X.index,W=q+Q.length,z=`__stx_evt_${Y++}`,U=[],_=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=_.exec(K))!==null){let[,H,L]=B,F=H.split("."),O=F[0];if(!YZ.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:XZ(F.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(K))!==null){let[,H,L]=B,F=H.split("."),O=F[0];if(!YZ.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:XZ(F.slice(1)),elementId:z})}if(U.length>0)Z.push({originalTag:Q,elementId:z,events:U,startIndex:q,endIndex:W})}return Z}function uK($){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=QZ[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 pK($,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 cK($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=uK($),X=pK($.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`
2188
+ `}function ZZ($,Z){let Y=fK(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function P0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var YZ=()=>{};function QZ($){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(pK.has(J))Z.systemKeys.push(J);else if(J in GZ)Z.mouse=J;else if(J in XZ||/^[a-z]$/.test(J))Z.keys.push(XZ[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 KZ($){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,q=X.index,W=q+Q.length,z=`__stx_evt_${Y++}`,U=[],_=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=_.exec(K))!==null){let[,H,L]=B,F=H.split("."),O=F[0];if(!JZ.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:QZ(F.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(K))!==null){let[,H,L]=B,F=H.split("."),O=F[0];if(!JZ.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:QZ(F.slice(1)),elementId:z})}if(U.length>0)Z.push({originalTag:Q,elementId:z,events:U,startIndex:q,endIndex:W})}return Z}function cK($){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=GZ[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 lK($,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 iK($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=cK($),X=lK($.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`
2189
2189
  (function() {
2190
2190
  var $el = document.getElementById('${Y}');
2191
2191
  if (!$el) return;
@@ -2239,7 +2239,7 @@ else {
2239
2239
  __stx_runHandler('${K}', $event, $el);
2240
2240
  }
2241
2241
  }${G});
2242
- })();`}function lK($){if($.length===0)return"";return`
2242
+ })();`}function nK($){if($.length===0)return"";return`
2243
2243
  <script data-stx-events>
2244
2244
  (function() {
2245
2245
  'use strict';
@@ -2287,11 +2287,11 @@ else {
2287
2287
  }
2288
2288
 
2289
2289
  // Event listeners
2290
- ${$.flatMap((Y)=>Y.events).map(cK).join(`
2290
+ ${$.flatMap((Y)=>Y.events).map(iK).join(`
2291
2291
  `)}
2292
2292
  })();
2293
- </script>`}function iK($){let Z=GZ($);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 q of Q.events)q.elementId=K[1]}for(let K of Q.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(z,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),J.push(...Q.events)}return{template:Y,bindings:J}}function KZ($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=iK($),z=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...z,...W],q}let X=GZ($);if(X.length===0)return $;let Q=$;for(let q=X.length-1;q>=0;q--){let W=X[q],z=W.originalTag;if(!z.includes(" id="))z=z.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let U=z.match(/id=["']([^"']+)["']/);if(U)for(let _ of W.events)_.elementId=U[1]}for(let U of W.events){let _=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`\\s*${_}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${_}\\s*=\\s*'[^']*'`,"g");z=z.replace(B,""),z=z.replace(j,"")}Q=Q.slice(0,W.startIndex)+z+Q.slice(W.endIndex)}let G=lK(X),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+G+`
2294
- `+Q.slice(K);else Q+=G;return Q}var YZ,JZ,mK,QZ;var qZ=S(()=>{YZ=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"]),JZ={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"},mK=new Set(["ctrl","alt","shift","meta"]),QZ={left:0,middle:1,right:2}});function l4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zZ($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function oK($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[X,Q,G]=J,K=J.index,q=zZ(G,"x-data");if(!q)continue;let W=`__stx_scope_${UZ++}`,z=zZ(G,"x-init"),U=sK($,Q,K+X.length),_=$.slice(K,U.endIndex),B=rK(_);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:z,bindings:[],refs:B})}return Z}function sK($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X,K.lastIndex=X;let q=Q.exec($),W=G.exec($),z=K.exec($);if(z&&z.index<(q?.index??1/0)){X=z.index+z[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)J++,X=q.index+q[0].length;else{if(J--,J===0)return{endIndex:W.index+W[0].length};X=W.index+W[0].length}}return{endIndex:$.length}}function rK($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,X;while((X=J.exec(Y))!==null){let[,Q,G]=X,K=aK(Q);Z.set(G,K)}return Z}function aK($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${nK++}`}function tK(){return`
2293
+ </script>`}function oK($){let Z=KZ($);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 q of Q.events)q.elementId=K[1]}for(let K of Q.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(z,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),J.push(...Q.events)}return{template:Y,bindings:J}}function qZ($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=oK($),z=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...z,...W],q}let X=KZ($);if(X.length===0)return $;let Q=$;for(let q=X.length-1;q>=0;q--){let W=X[q],z=W.originalTag;if(!z.includes(" id="))z=z.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let U=z.match(/id=["']([^"']+)["']/);if(U)for(let _ of W.events)_.elementId=U[1]}for(let U of W.events){let _=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`\\s*${_}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${_}\\s*=\\s*'[^']*'`,"g");z=z.replace(B,""),z=z.replace(j,"")}Q=Q.slice(0,W.startIndex)+z+Q.slice(W.endIndex)}let G=nK(X),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+G+`
2294
+ `+Q.slice(K);else Q+=G;return Q}var JZ,XZ,pK,GZ;var zZ=S(()=>{JZ=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"]),XZ={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"},pK=new Set(["ctrl","alt","shift","meta"]),GZ={left:0,middle:1,right:2}});function l4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function WZ($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function rK($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[X,Q,G]=J,K=J.index,q=WZ(G,"x-data");if(!q)continue;let W=`__stx_scope_${_Z++}`,z=WZ(G,"x-init"),U=aK($,Q,K+X.length),_=$.slice(K,U.endIndex),B=tK(_);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:z,bindings:[],refs:B})}return Z}function aK($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X,K.lastIndex=X;let q=Q.exec($),W=G.exec($),z=K.exec($);if(z&&z.index<(q?.index??1/0)){X=z.index+z[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)J++,X=q.index+q[0].length;else{if(J--,J===0)return{endIndex:W.index+W[0].length};X=W.index+W[0].length}}return{endIndex:$.length}}function tK($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,X;while((X=J.exec(Y))!==null){let[,Q,G]=X,K=eK(Q);Z.set(G,K)}return Z}function eK($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${sK++}`}function $q(){return`
2295
2295
  // STX Reactive Runtime - x-cloak and transition CSS
2296
2296
  (function() {
2297
2297
  var style = document.createElement('style');
@@ -2498,7 +2498,7 @@ window.__stx_reactive = (function() {
2498
2498
 
2499
2499
  return { initScope: initScope, reactive: reactive };
2500
2500
  })();
2501
- `}function WZ($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=d0(X,Z,!0);if(Q===void 0)return J;return String(Q)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{try{let Q=d0(X,Z,!0);if(Q===void 0)return J;if(typeof Q==="string"){let G=Q.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(Q)}catch{return J}}),Y}function eK($,Z){if($.length===0)return"";let Y=$.map((J)=>{let X=JSON.stringify(Object.fromEntries(J.refs)),Q=WZ(J.stateExpr,Z),G=J.initExpr?WZ(J.initExpr,Z):null,K=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
2501
+ `}function UZ($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=d0(X,Z,!0);if(Q===void 0)return J;return String(Q)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{try{let Q=d0(X,Z,!0);if(Q===void 0)return J;if(typeof Q==="string"){let G=Q.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(Q)}catch{return J}}),Y}function Zq($,Z){if($.length===0)return"";let Y=$.map((J)=>{let X=JSON.stringify(Object.fromEntries(J.refs)),Q=UZ(J.stateExpr,Z),G=J.initExpr?UZ(J.initExpr,Z):null,K=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
2502
2502
  (function() {
2503
2503
  var scopeEl = document.querySelector('${J.selector}');
2504
2504
  if (!scopeEl) return;
@@ -2507,14 +2507,14 @@ window.__stx_reactive = (function() {
2507
2507
  })();`}).join(`
2508
2508
  `);return`
2509
2509
  <script data-stx-scoped data-stx-reactive>
2510
- ${tK()}
2510
+ ${$q()}
2511
2511
  ${Y}
2512
- </script>`}function _Z($,Z,Y){if(UZ=0,!Zq($))return $;let J=oK($);if(J.length===0)return $;let X=$q($,J),Q=eK(J,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
2513
- `+X.slice(G);else X+=Q;return X}function $q($,Z){let Y=$;for(let J of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${l4(J.stateExpr)}["']`,"gi").exec(Y);if(Q)J.id=Q[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${l4(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)J.id=K[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${l4(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${l4(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Zq($){return/x-data\s*=\s*["']/.test($)}var UZ=0,nK=0;var BZ=S(()=>{r0()});import Yq from"fs";import p7 from"path";import{createHighlighter as Jq}from"ts-syntax-highlighter";async function Xq($,Z={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let J=(await Yq.promises.stat($)).mtime.getTime();if(Z.cache&&c7.has($)){let U=c7.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=y6(X),K=Z.markdown||x7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=O5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await Qq(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:W,data:Q||{}};if(Z.cache)c7.set($,{...z,updatedAt:J});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:K0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function Qq($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!i4)try{i4=await Jq({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,q,W,z)=>{let U=z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),_=W||(Y?"text":"");if(!_)return K;try{if(!i4.getSupportedLanguages().includes(_))return K;return(await i4.highlight(U,_,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[q,W,z,U]=K,_=await X(q,W,z,U);Q=Q.replace(q,_)}return Q}async function jZ($,Z,Y="",J={}){return await Gq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let z=K;if(!p7.isAbsolute(K))z=p7.resolve(p7.dirname(Y),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),N=V.substring(w+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(R||T)N=N.substring(1,N.length-1);U[A]=N}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:_,data:B}=await Xq(z,J),j={...Z,...B,...U},H=_,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(z){let U=z instanceof Error?z.message:String(z);return K0("Markdown File",`Error including markdown file: ${U}`,Y,$,W,G)}})}async function Gq($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],q=X.index,W=X;J.push(Y(...W).then((z)=>({match:K,replacement:z,index:q})))}let Q=await Promise.all(J);Q.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of Q)G=G.replace(K,()=>q);return G}var c7,i4=null;var HZ=S(()=>{t1();A0();c7=new Map});function z1($,Z){try{let Y=$.trim();if(Q0(Y))return G0(Y,Object.keys(Z))(...Object.values(Z));else return Z0(Y,Z)}catch{return!1}}var OZ=S(()=>{R0()});function W1($,Z){let Y=Kq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function Kq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=S0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function y1($,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 q=G.exec($),W=K.exec($),z=q?q.index:1/0,U=W?W.index:1/0;if(z<U)X++,Q=z+q[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+W[0].length}else break}return-1}function LZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=W1($,J);if(!X)return null;let Q=X.endPos,G=y1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],W=0,z="if",U=X.expression,_=0,B=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if(/^@if\s*\(/.test(H)){B++,W++;continue}if(/^@endif(?![a-z])/.test(H)){B--,W+=6;continue}if(B===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:z,condition:U,content:K.substring(_,W),start:Q+_,end:Q+W});let F=W+L[0].length,O=W1(K,F);if(!O){W++;continue}z="elseif",U=O.expression,W=O.endPos,_=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:z,condition:U,content:K.substring(_,W),start:Q+_,end:Q+W}),z="else",U=void 0,W+=5,_=W;continue}}W++}return q.push({type:z,condition:U,content:K.slice(_),start:Q+_,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function x5($){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=LZ($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function n4($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=X.exec($);continue}let K=Q.index,q=K+Q[0].length-1,W=S0($,"(",")",q);if(W===-1){Q=X.exec($);continue}let z=$.slice(q+1,W),U=W+1,_=y1($,Z,Y,U);if(_===-1){Q=X.exec($);continue}let B=$.slice(U,_),j=_+`@${Y}`.length;J.push({fullMatch:$.slice(K,j),name:Z,params:z,content:B,start:K,end:j}),X.lastIndex=j,Q=X.exec($)}return J}function l7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=W1($,J);if(!X)return null;let Q=X.endPos,G=y1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],W=0,z=null,U=0;while(W<K.length){let _=K.slice(W),B=_.match(/^@switch\s*\(/),j=_.match(/^@endswitch(?![a-z])/);if(B){if(U++,z)z.content+=B[0];W+=B[0].length;continue}if(j){if(U--,z)z.content+=j[0];W+=j[0].length;continue}if(U>0){if(z)z.content+=K[W];W++;continue}let H=_.match(/^@case\s*/),L=_.match(/^@default(?![a-z])/),F=_.match(/^@break(?![a-z])/);if(H&&_.startsWith("@case")){if(z)q.push(z);let O=W+H[0].length,V=W1(K,O);if(!V){W++;continue}z={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&_.startsWith("@default")){if(z)q.push(z);z={type:"default",content:""},W+=L[0].length}else if(F&&_.startsWith("@break"))W+=F[0].length;else{if(z)z.content+=K[W];W++}}if(z)q.push(z);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:q,start:Z,end:G+10}}var FZ=()=>{};var VZ=()=>{};var o4=S(()=>{FZ();VZ()});function Uq($,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=l7(J,G);if(!K)break;try{let q;if(Q0(K.expression))q=G0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Z0(K.expression,Z);let W="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)W=U.content.trim()}else try{let _;if(U.value&&Q0(U.value))_=G0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)_=Z0(U.value,Z);if(q===_){W=U.content.trim(),z=!0;break}}catch{continue}J=J.substring(0,G)+W+J.substring(K.end),X=!0}catch(q){let W=q instanceof Error?q.message:String(q),z=e("Switch",`Error evaluating @switch expression: ${W}`,s.EVALUATION_ERROR);J=J.substring(0,G)+z+J.substring(K.end);break}}return J}function C1($,Z,Y){let J=$;J=Uq(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,q=W1(J,K+7);if(!q)break;let W=q.endPos,z=y1(J,"unless","endunless",W);if(z===-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 U=J.slice(W,z),_=q.expression,B=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((A,N)=>A.pos-N.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){B=A.pos;break}}let j;if(B!==-1){let H=U.slice(0,B),L=U.slice(B+5);j=`@if (${_})${L}@else ${H}@endif`}else j=`@if (!(${_}))${U}@endif`;J=J.substring(0,K)+j+J.substring(z+10),Q=!0}}J=n7(J,Z,Y),J=o7(J,Z,Y),J=i7(J,Z);let X=()=>{let Q=x5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let q="",W=!1;for(let z of K.branches){if(W)break;if(z.type==="else")q=z.content,W=!0;else try{let U;if(z.condition&&Q0(z.condition))U=G0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Z0(z.condition,Z);if(U)q=z.content,W=!0}catch(U){q=e(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),W=!0}}J=J.substring(0,K.start)+q+J.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),z=e("If",`Error processing @if block: ${W}`,s.EVALUATION_ERROR);J=J.substring(0,K.start)+z+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function wZ($){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 i7($,Z){let Y=$;function J(K,q,W,z){let U=1,_=z,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(_<K.length&&U>0){B.lastIndex=_,j.lastIndex=_;let H=B.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)U++,_=F+H[0].length;else if(O<1/0){if(U--,U===0)return O;_=O+L[0].length}else break}return-1}function X(K,q,W){let z=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],H;while((H=U.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")z++;else if(L.type==="close")z--;else if(L.type==="else"&&z===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,_=Y.slice(W+5),B=wZ(_);if(B)z=B.value,U=W+5+B.consumed;else U=W+5;let j=J(Y,"auth","endauth",U);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=X(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=z?z1(`auth?.check && auth?.user?.[${z}]`,Z):z1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,_=Y.slice(W+6),B=wZ(_);if(B)z=B.value,U=W+6+B.consumed;else U=W+6;let j=J(Y,"guest","endguest",U);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=X(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=z?z1(`!auth?.check || !auth?.user?.[${z}]`,Z):z1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function Q(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(q)z.push(q);if(W){let U=z1(W,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let _=U.index,B=Y.slice(_+`@${K}`.length),j=G(B);if(!j)break;let H=_+`@${K}`.length+j.paramsEnd,L=J(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${_} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((k,y)=>k.pos-y.pos);for(let k of T){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)O.push(k)}let I=[],D=0;for(let k=0;k<O.length;k++){let y=O[k];if(I.push({content:F.slice(D,y.pos),ability:void 0}),y.type==="elseDirective"){let g=F.slice(y.pos+`@${W}`.length),h=G(g);if(h){I[I.length-1]={content:F.slice(D,y.pos)},D=y.pos+`@${W}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let m=O[k+1],i=m?m.pos:F.length;I.push({content:F.slice(D,i),ability:h.ability,type:h.type,id:h.id}),D=i}}else D=y.pos+5}if(D<F.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=Q(j.ability,j.type,j.id),P=K==="can"?E:!E,b="";if(P)b=I[0]?.content||"";else{let k=!1;for(let y=1;y<I.length;y++){let g=I[y];if(g.isFinalElse){b=g.content,k=!0;break}if(g.ability){let h=Q(g.ability,g.type,g.id);if(K==="can"?h:!h){b=g.content,k=!0;break}}}if(!k&&I.length>0){let y=I[I.length-1];if(y.isFinalElse)b=y.content}}Y=Y.substring(0,_)+b+Y.substring(L+`@${q}`.length),z=!0}}return Y}function n7($,Z,Y){let J=$;function X(Q,G,K,q,W){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),_=Q.match(U);if(!_||_.index===void 0)break;let B=_.index,j=W1(Q,B+`@${G}`.length);if(!j)break;let H=j.endPos,L=y1(Q,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(H,L),O=j.expression,V=-1,w=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let R=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){V=N;break}A=N+1}try{let N=q(O.trim()),R;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);R=N?T:M}else R=N?F:"";Q=Q.substring(0,B)+R+Q.substring(L+`@${K}`.length),z=!0}catch(N){let R=N instanceof Error?N.message:String(N),T=e(W,`Error processing @${G} directive: ${R}`,s.EVALUATION_ERROR);Q=Q.substring(0,B)+T+Q.substring(L+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function o7($,Z,Y){let J=$,X="development";function Q(G,K,q,W){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),_=new RegExp(`^@${K}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,z.lastIndex=0;let L=z.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=X===E[2]}let V=1,w=O,A=-1;while(V>0&&w<j.length){z.lastIndex=w,U.lastIndex=w;let E=z.exec(j),P=U.exec(j),b=E?E.index:1/0,k=P?P.index:1/0;if(b<k)V++,w=b+E[0].length;else if(k<1/0){if(V--,V===0){A=k;break}w=k+P[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=j.substring(O,A),R=-1,T=0,M=0;while(M<N.length){let E=N.indexOf("@",M);if(E===-1)break;let P=N.substring(E);if(_.test(P)){T++,M=E+1;continue}if(B.test(P)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){R=E;break}M=E+1}let I;if(R!==-1){let E=N.slice(0,R),P=N.slice(R+5);I=W?E:P}else I=W?N:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+D),H=!0}return j}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 s4=S(()=>{OZ();Z1();o4();R0()});function NZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function r4($,Z){if(!$)return Z?.nonceGenerator?.()??NZ();let Y=AZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??NZ(),AZ.set($,Y);return Y}function _q($,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 RZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${_q($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function TZ($,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?r4(Y,Z):void 0,X=RZ(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
2514
- ${X}`)}function MZ($,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?r4(Z,Q):void 0;return RZ(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return r4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=r4(Z,Q);return X}var AZ;var IZ=S(()=>{AZ=new WeakMap});import Bq from"crypto";function Hq($=jq){let Z=Bq.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return s7=Z,Z}function Oq(){if(!s7)Hq();return s7}function Lq($=DZ){let Z=Oq();return`<input type="hidden" name="${$}" value="${Z}">`}function EZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return Lq(J||DZ)})}var jq=40,DZ="_token",s7=null;var kZ=()=>{};async function bZ($,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 Fq(X,Q,Z,Y,J);else X=await Vq(X,Q,Z,Y,J)}return X}async function Fq($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,q=`@end${Q}`,W=$,z=l1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],_=z.exec(W);while(_!==null){let[B,j="",H=""]=_,L=_.index||0;try{let F=j?SZ(j):[],O=H.trim(),V=await G(O,F,Y,J);U.push({original:B,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(X.debug)console.error(`Error processing custom directive @${Q}:`,F);U.push({original:B,processed:e("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:L})}_=z.exec(W)}for(let B=U.length-1;B>=0;B--){let{original:j,processed:H}=U[B];W=W.replace(j,H)}return W}async function Vq($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,q=l1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],z=q.exec(K);while(z!==null){let[B,j=""]=z,H=z.index||0;try{let L=SZ(j),F=await G("",L,Y,J);W.push({original:B,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(X.debug)console.error(`Error processing custom directive @${Q}:`,L);W.push({original:B,processed:e("CustomDirective",`Error in @${Q}(${j}): ${F}`,s.EVALUATION_ERROR),startIndex:H})}z=q.exec(K)}let U=l1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),_=U.exec(K);while(_!==null){let[B]=_,j=_.index||0;try{let H=await G("",[],Y,J);W.push({original:B,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(X.debug)console.error(`Error processing custom directive @${Q}:`,H);W.push({original:B,processed:e("CustomDirective",`Error in @${Q}: ${L}`,s.EVALUATION_ERROR),startIndex:j})}_=U.exec(K)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:H}=W[B];K=K.replace(j,H)}return K}function SZ($){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 yZ=S(()=>{Z1();i1()});import wq from"crypto";function T0($){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 Aq(){return wq.randomUUID()}function t4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=Aq();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${T0(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="${T0(Q)}">`;return J}),Y}function vZ($,Z,Y=PZ){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,q,W="")=>{let z=Q||G||"POST",U=K||q||"",_=U1(W),B=z.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",H=`<form method="${T0(j)}" action="${T0(U)}"${_?` ${_}`:""}>`;if(H+=`
2512
+ </script>`}function BZ($,Z,Y){if(_Z=0,!Jq($))return $;let J=rK($);if(J.length===0)return $;let X=Yq($,J),Q=Zq(J,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
2513
+ `+X.slice(G);else X+=Q;return X}function Yq($,Z){let Y=$;for(let J of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${l4(J.stateExpr)}["']`,"gi").exec(Y);if(Q)J.id=Q[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${l4(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)J.id=K[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${l4(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${l4(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Jq($){return/x-data\s*=\s*["']/.test($)}var _Z=0,sK=0;var jZ=S(()=>{r0()});import Xq from"fs";import p7 from"path";import{createHighlighter as Qq}from"ts-syntax-highlighter";async function Gq($,Z={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let J=(await Xq.promises.stat($)).mtime.getTime();if(Z.cache&&c7.has($)){let U=c7.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=C6(X),K=Z.markdown||x7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=O5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await Kq(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:W,data:Q||{}};if(Z.cache)c7.set($,{...z,updatedAt:J});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:K0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function Kq($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!i4)try{i4=await Qq({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,q,W,z)=>{let U=z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),_=W||(Y?"text":"");if(!_)return K;try{if(!i4.getSupportedLanguages().includes(_))return K;return(await i4.highlight(U,_,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[q,W,z,U]=K,_=await X(q,W,z,U);Q=Q.replace(q,_)}return Q}async function HZ($,Z,Y="",J={}){return await qq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let z=K;if(!p7.isAbsolute(K))z=p7.resolve(p7.dirname(Y),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),N=V.substring(w+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(R||T)N=N.substring(1,N.length-1);U[A]=N}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:_,data:B}=await Gq(z,J),j={...Z,...B,...U},H=_,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(z){let U=z instanceof Error?z.message:String(z);return K0("Markdown File",`Error including markdown file: ${U}`,Y,$,W,G)}})}async function qq($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],q=X.index,W=X;J.push(Y(...W).then((z)=>({match:K,replacement:z,index:q})))}let Q=await Promise.all(J);Q.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of Q)G=G.replace(K,()=>q);return G}var c7,i4=null;var OZ=S(()=>{t1();A0();c7=new Map});function z1($,Z){try{let Y=$.trim();if(Q0(Y))return G0(Y,Object.keys(Z))(...Object.values(Z));else return Z0(Y,Z)}catch{return!1}}var LZ=S(()=>{R0()});function W1($,Z){let Y=zq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function zq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=S0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function y1($,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 q=G.exec($),W=K.exec($),z=q?q.index:1/0,U=W?W.index:1/0;if(z<U)X++,Q=z+q[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+W[0].length}else break}return-1}function FZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=W1($,J);if(!X)return null;let Q=X.endPos,G=y1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],W=0,z="if",U=X.expression,_=0,B=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if(/^@if\s*\(/.test(H)){B++,W++;continue}if(/^@endif(?![a-z])/.test(H)){B--,W+=6;continue}if(B===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:z,condition:U,content:K.substring(_,W),start:Q+_,end:Q+W});let F=W+L[0].length,O=W1(K,F);if(!O){W++;continue}z="elseif",U=O.expression,W=O.endPos,_=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:z,condition:U,content:K.substring(_,W),start:Q+_,end:Q+W}),z="else",U=void 0,W+=5,_=W;continue}}W++}return q.push({type:z,condition:U,content:K.slice(_),start:Q+_,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function x5($){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=FZ($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function n4($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=X.exec($);continue}let K=Q.index,q=K+Q[0].length-1,W=S0($,"(",")",q);if(W===-1){Q=X.exec($);continue}let z=$.slice(q+1,W),U=W+1,_=y1($,Z,Y,U);if(_===-1){Q=X.exec($);continue}let B=$.slice(U,_),j=_+`@${Y}`.length;J.push({fullMatch:$.slice(K,j),name:Z,params:z,content:B,start:K,end:j}),X.lastIndex=j,Q=X.exec($)}return J}function l7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=W1($,J);if(!X)return null;let Q=X.endPos,G=y1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],W=0,z=null,U=0;while(W<K.length){let _=K.slice(W),B=_.match(/^@switch\s*\(/),j=_.match(/^@endswitch(?![a-z])/);if(B){if(U++,z)z.content+=B[0];W+=B[0].length;continue}if(j){if(U--,z)z.content+=j[0];W+=j[0].length;continue}if(U>0){if(z)z.content+=K[W];W++;continue}let H=_.match(/^@case\s*/),L=_.match(/^@default(?![a-z])/),F=_.match(/^@break(?![a-z])/);if(H&&_.startsWith("@case")){if(z)q.push(z);let O=W+H[0].length,V=W1(K,O);if(!V){W++;continue}z={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&_.startsWith("@default")){if(z)q.push(z);z={type:"default",content:""},W+=L[0].length}else if(F&&_.startsWith("@break"))W+=F[0].length;else{if(z)z.content+=K[W];W++}}if(z)q.push(z);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:q,start:Z,end:G+10}}var VZ=()=>{};var wZ=()=>{};var o4=S(()=>{VZ();wZ()});function Bq($,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=l7(J,G);if(!K)break;try{let q;if(Q0(K.expression))q=G0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Z0(K.expression,Z);let W="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)W=U.content.trim()}else try{let _;if(U.value&&Q0(U.value))_=G0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)_=Z0(U.value,Z);if(q===_){W=U.content.trim(),z=!0;break}}catch{continue}J=J.substring(0,G)+W+J.substring(K.end),X=!0}catch(q){let W=q instanceof Error?q.message:String(q),z=e("Switch",`Error evaluating @switch expression: ${W}`,s.EVALUATION_ERROR);J=J.substring(0,G)+z+J.substring(K.end);break}}return J}function C1($,Z,Y){let J=$;J=Bq(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,q=W1(J,K+7);if(!q)break;let W=q.endPos,z=y1(J,"unless","endunless",W);if(z===-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 U=J.slice(W,z),_=q.expression,B=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((A,N)=>A.pos-N.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){B=A.pos;break}}let j;if(B!==-1){let H=U.slice(0,B),L=U.slice(B+5);j=`@if (${_})${L}@else ${H}@endif`}else j=`@if (!(${_}))${U}@endif`;J=J.substring(0,K)+j+J.substring(z+10),Q=!0}}J=n7(J,Z,Y),J=o7(J,Z,Y),J=i7(J,Z);let X=()=>{let Q=x5(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let q="",W=!1;for(let z of K.branches){if(W)break;if(z.type==="else")q=z.content,W=!0;else try{let U;if(z.condition&&Q0(z.condition))U=G0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Z0(z.condition,Z);if(U)q=z.content,W=!0}catch(U){q=e(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),W=!0}}J=J.substring(0,K.start)+q+J.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),z=e("If",`Error processing @if block: ${W}`,s.EVALUATION_ERROR);J=J.substring(0,K.start)+z+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function AZ($){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 i7($,Z){let Y=$;function J(K,q,W,z){let U=1,_=z,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(_<K.length&&U>0){B.lastIndex=_,j.lastIndex=_;let H=B.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)U++,_=F+H[0].length;else if(O<1/0){if(U--,U===0)return O;_=O+L[0].length}else break}return-1}function X(K,q,W){let z=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],H;while((H=U.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")z++;else if(L.type==="close")z--;else if(L.type==="else"&&z===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,_=Y.slice(W+5),B=AZ(_);if(B)z=B.value,U=W+5+B.consumed;else U=W+5;let j=J(Y,"auth","endauth",U);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=X(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=z?z1(`auth?.check && auth?.user?.[${z}]`,Z):z1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,_=Y.slice(W+6),B=AZ(_);if(B)z=B.value,U=W+6+B.consumed;else U=W+6;let j=J(Y,"guest","endguest",U);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=X(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=z?z1(`!auth?.check || !auth?.user?.[${z}]`,Z):z1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function Q(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(q)z.push(q);if(W){let U=z1(W,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let _=U.index,B=Y.slice(_+`@${K}`.length),j=G(B);if(!j)break;let H=_+`@${K}`.length+j.paramsEnd,L=J(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${_} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((k,y)=>k.pos-y.pos);for(let k of T){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)O.push(k)}let I=[],D=0;for(let k=0;k<O.length;k++){let y=O[k];if(I.push({content:F.slice(D,y.pos),ability:void 0}),y.type==="elseDirective"){let g=F.slice(y.pos+`@${W}`.length),h=G(g);if(h){I[I.length-1]={content:F.slice(D,y.pos)},D=y.pos+`@${W}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let m=O[k+1],i=m?m.pos:F.length;I.push({content:F.slice(D,i),ability:h.ability,type:h.type,id:h.id}),D=i}}else D=y.pos+5}if(D<F.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=Q(j.ability,j.type,j.id),P=K==="can"?E:!E,b="";if(P)b=I[0]?.content||"";else{let k=!1;for(let y=1;y<I.length;y++){let g=I[y];if(g.isFinalElse){b=g.content,k=!0;break}if(g.ability){let h=Q(g.ability,g.type,g.id);if(K==="can"?h:!h){b=g.content,k=!0;break}}}if(!k&&I.length>0){let y=I[I.length-1];if(y.isFinalElse)b=y.content}}Y=Y.substring(0,_)+b+Y.substring(L+`@${q}`.length),z=!0}}return Y}function n7($,Z,Y){let J=$;function X(Q,G,K,q,W){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),_=Q.match(U);if(!_||_.index===void 0)break;let B=_.index,j=W1(Q,B+`@${G}`.length);if(!j)break;let H=j.endPos,L=y1(Q,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(H,L),O=j.expression,V=-1,w=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let R=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){V=N;break}A=N+1}try{let N=q(O.trim()),R;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);R=N?T:M}else R=N?F:"";Q=Q.substring(0,B)+R+Q.substring(L+`@${K}`.length),z=!0}catch(N){let R=N instanceof Error?N.message:String(N),T=e(W,`Error processing @${G} directive: ${R}`,s.EVALUATION_ERROR);Q=Q.substring(0,B)+T+Q.substring(L+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function o7($,Z,Y){let J=$,X="development";function Q(G,K,q,W){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),_=new RegExp(`^@${K}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,z.lastIndex=0;let L=z.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=X===E[2]}let V=1,w=O,A=-1;while(V>0&&w<j.length){z.lastIndex=w,U.lastIndex=w;let E=z.exec(j),P=U.exec(j),b=E?E.index:1/0,k=P?P.index:1/0;if(b<k)V++,w=b+E[0].length;else if(k<1/0){if(V--,V===0){A=k;break}w=k+P[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=j.substring(O,A),R=-1,T=0,M=0;while(M<N.length){let E=N.indexOf("@",M);if(E===-1)break;let P=N.substring(E);if(_.test(P)){T++,M=E+1;continue}if(B.test(P)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){R=E;break}M=E+1}let I;if(R!==-1){let E=N.slice(0,R),P=N.slice(R+5);I=W?E:P}else I=W?N:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+D),H=!0}return j}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 s4=S(()=>{LZ();Z1();o4();R0()});function RZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function r4($,Z){if(!$)return Z?.nonceGenerator?.()??RZ();let Y=NZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??RZ(),NZ.set($,Y);return Y}function jq($,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 TZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${jq($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function MZ($,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?r4(Y,Z):void 0,X=TZ(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
2514
+ ${X}`)}function IZ($,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?r4(Z,Q):void 0;return TZ(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return r4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=r4(Z,Q);return X}var NZ;var DZ=S(()=>{NZ=new WeakMap});import Hq from"crypto";function Lq($=Oq){let Z=Hq.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return s7=Z,Z}function Fq(){if(!s7)Lq();return s7}function Vq($=EZ){let Z=Fq();return`<input type="hidden" name="${$}" value="${Z}">`}function kZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return Vq(J||EZ)})}var Oq=40,EZ="_token",s7=null;var bZ=()=>{};async function SZ($,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 wq(X,Q,Z,Y,J);else X=await Aq(X,Q,Z,Y,J)}return X}async function wq($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,q=`@end${Q}`,W=$,z=l1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],_=z.exec(W);while(_!==null){let[B,j="",H=""]=_,L=_.index||0;try{let F=j?yZ(j):[],O=H.trim(),V=await G(O,F,Y,J);U.push({original:B,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(X.debug)console.error(`Error processing custom directive @${Q}:`,F);U.push({original:B,processed:e("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:L})}_=z.exec(W)}for(let B=U.length-1;B>=0;B--){let{original:j,processed:H}=U[B];W=W.replace(j,H)}return W}async function Aq($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,q=l1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],z=q.exec(K);while(z!==null){let[B,j=""]=z,H=z.index||0;try{let L=yZ(j),F=await G("",L,Y,J);W.push({original:B,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(X.debug)console.error(`Error processing custom directive @${Q}:`,L);W.push({original:B,processed:e("CustomDirective",`Error in @${Q}(${j}): ${F}`,s.EVALUATION_ERROR),startIndex:H})}z=q.exec(K)}let U=l1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),_=U.exec(K);while(_!==null){let[B]=_,j=_.index||0;try{let H=await G("",[],Y,J);W.push({original:B,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(X.debug)console.error(`Error processing custom directive @${Q}:`,H);W.push({original:B,processed:e("CustomDirective",`Error in @${Q}: ${L}`,s.EVALUATION_ERROR),startIndex:j})}_=U.exec(K)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:H}=W[B];K=K.replace(j,H)}return K}function yZ($){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 CZ=S(()=>{Z1();i1()});import Nq from"crypto";function T0($){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 Rq(){return Nq.randomUUID()}function t4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=Rq();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${T0(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="${T0(Q)}">`;return J}),Y}function xZ($,Z,Y=vZ){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,q,W="")=>{let z=Q||G||"POST",U=K||q||"",_=U1(W),B=z.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",H=`<form method="${T0(j)}" action="${T0(U)}"${_?` ${_}`:""}>`;if(H+=`
2515
2515
  ${t4("@csrf",Z)}`,!["GET","POST"].includes(B))H+=`
2516
- ${t4(`@method('${B}')`,Z)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,q,W="")=>{let z=Q||G||"",U=K||q||"",_=U1(W),B=f5(z,Z),j=B!==void 0&&B!==null?B:U||"",H=_.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=g5(z,Z),O=_.match(/class=['"]([^'"]+)['"]/i),V=a4(O?O[1]:"",Y.input,F,Y.inputError),w=_.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${T0(L)}" name="${T0(z)}" value="${T0(j)}" class="${V}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let q=U1(G),W=f5(Q,Z)||K.trim(),z=g5(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),_=a4(U?U[1]:"",Y.input,z,Y.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${T0(Q)}" class="${_}"${B?` ${B}`:""}>${T0(W)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let q=U1(G),W=f5(Q,Z),z=g5(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),_=a4(U?U[1]:"",Y.input,z,Y.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${T0(Q)}" class="${_}"${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="1",K="")=>{let q=U1(K),W=f5(Q,Z),z=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),U=q.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:Y.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${T0(Q)}" value="${T0(G)}" class="${_}"${z?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let q=U1(K),W=f5(Q,Z),z=W!==void 0&&W===G,U=q.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:Y.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${T0(Q)}" value="${T0(G)}" class="${_}"${z?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=U1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",z=K.includes("multiple"),U=g5(Q,Z),_=K.match(/class=['"]([^'"]+)['"]/i),B=a4(_?_[1]:"",Y.input,U,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${T0(Q)}"`,`class="${B}"`];if(W)H.push(`accept="${T0(W)}"`);if(z)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let q=U1(G),W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:Y.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${T0(Q)}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),J}function xZ($,Z,Y=PZ){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(g5(X,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return CZ(X,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return CZ(X,Z)}let q=K.trim();if(Q0(q)){let W=Z0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function g5($,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 CZ($,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 f5($,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 U1($){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 PZ;var fZ=S(()=>{R0();PZ={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import t7 from"path";async function Nq(){if(h5!==void 0)return h5;try{h5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{h5=null}return h5}function Rq($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function Tq($,Z){if({...Z3,...Z.i18n}.cache&&e7[$]){let X=e7[$],Q=Z.i18n?.cacheMaxAge??0;if(!Rq(X,Q))return X.translations}if(d5[$]?.state==="loading")return d5[$].promise;r7[$]="loading";let J=$3($,Z).then((X)=>{return r7[$]="loaded",delete d5[$],X}).catch((X)=>{throw r7[$]="error",d5[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return d5[$]={promise:J,state:"loading"},J}async function $3($,Z){let Y={...Z3,...Z.i18n},J=t7.isAbsolute(Y.translationsDir)?Y.translationsDir:t7.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await Nq(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:kq(Y.format)}):await Mq($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return $3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)e7[$]={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 $3(Y.defaultLocale,Z);return{}}}async function Mq($,Z,Y){let J=t7.join(Y,`${$}${Iq(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 Dq(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function Iq($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function Dq($){let Z={},Y=$.split(`
2517
- `),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,q=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,z]=q,U=W.trim(),_=z.trim();if(_==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=Eq(_)}}return Z}function Eq($){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 kq($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function bq($,Z){return Tq($,Z)}function Sq($,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 yq($,Z={}){return dZ($,Z)}function dZ($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=Cq($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=Pq(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 Cq($,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 Pq($,Z){let Y=vq($);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 xq(X,Y.slice(2).join(","),Z);case"select":return gq(X,Y.slice(2).join(","));case"selectordinal":return hq(X,Y.slice(2).join(","));case"number":return mq(X,Y[2]?.trim());case"date":return uq(X,Y[2]?.trim());case"time":return pq(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function vq($){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 xq($,Z,Y){let J=Number($)||0,X=Y3(Z),Q=`=${J}`;if(X[Q])return a7(X[Q],J,Y);let G=fq(J);if(X[G])return a7(X[G],J,Y);if(X.other)return a7(X.other,J,Y);return String(J)}function a7($,Z,Y){let J=$.replace(/#/g,String(Z));return dZ(J,Y)}function fq($){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 gq($,Z){let Y=String($||""),J=Y3(Z);if(J[Y])return J[Y];return J.other||String($)}function hq($,Z){let Y=Number($)||0,J=Y3(Z),X=dq(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 dq($){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 Y3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function mq($,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 uq($,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 pq($,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 cq($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function gZ($,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(cq(G))return yq(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),q=G.split("|");G=Sq(q,K)}for(let[K,q]of Object.entries(J)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function mZ($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...Z3,...J.i18n},K=await bq(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await hZ(X,Q,async(z,U,_,B,j)=>{try{let H={};if(_)try{let F=[()=>JSON.parse(_),()=>{let O=`{"data":${_}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return N0(_,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(J.debug)console.error("Error parsing parameters for @translate directive:",F)}return gZ(U,K,G.fallbackToKey,H)||B.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return e("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let q=/@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 z=[...X.matchAll(q)];console.warn(`Found ${z.length} @translate matches`),z.forEach((U,_)=>console.warn(`Match ${_}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return X=await hZ(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,U,_,B)=>{try{let j={};if(_)try{let H=[()=>JSON.parse(_),()=>{let L=`{"data":${_}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return N0(_,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return gZ(U,K,G.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return e("Translate",`Error in @translate('${U}'): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR)}}),X}async function hZ($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((q)=>({match:Q,replacement:q}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var h5,Z3,e7,d5,r7;var uZ=S(()=>{Z1();R0();Z3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},e7={},d5={},r7={}});var Q3={};r(Q3,{streamingSuspenseDirective:()=>lZ,streamToResponse:()=>Yz,streamTemplateSimple:()=>tq,streamTemplate:()=>iq,renderStreamingPage:()=>oq,registerStreamingDirectives:()=>$z,processStreamDirectives:()=>rq,processSectionDirectives:()=>Zz,islandDirective:()=>iZ,generateHydrationRuntime:()=>Jz,extractStreamBoundaries:()=>aq,createStreamRenderer:()=>eq,buildSuspenseResolveScript:()=>X3,SUSPENSE_RESOLVER_RUNTIME:()=>cZ});import e4 from"path";function lq($){let Z=[],Y=0,J;pZ.lastIndex=0;while((J=pZ.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 iq($,Z={},Y={}){let J={...b1,...Y,streaming:{...J3,...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),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:e4.dirname($)};if(q.trim())await M1(q,z,$);let U=lq(W),_=new Set;if(!U.some((j)=>j.type==="suspense")){let j=J.streaming?.strategy||"auto",H=new RegExp(P1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await j0(W,z,$,J,_);for(let O=0;O<F.length;O+=X)Q.enqueue(F.slice(O,O+X)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(P1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let A of F){if(A.start>w){let R=W.slice(w,A.start);if(R.trim()){let T=await j0(R,z,$,J,_);Q.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let N=await j0(A.content,z,$,J,_);Q.enqueue(N),await new Promise((R)=>setTimeout(R,0)),w=A.end}if(w<W.length){let A=W.slice(w);if(A.trim()){let N=await j0(A,z,$,J,_);Q.enqueue(N)}}}}else{let j=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let F=await j0(L.content,z,$,J,_);Q.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;Q.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
2516
+ ${t4(`@method('${B}')`,Z)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,q,W="")=>{let z=Q||G||"",U=K||q||"",_=U1(W),B=f5(z,Z),j=B!==void 0&&B!==null?B:U||"",H=_.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=g5(z,Z),O=_.match(/class=['"]([^'"]+)['"]/i),V=a4(O?O[1]:"",Y.input,F,Y.inputError),w=_.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${T0(L)}" name="${T0(z)}" value="${T0(j)}" class="${V}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let q=U1(G),W=f5(Q,Z)||K.trim(),z=g5(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),_=a4(U?U[1]:"",Y.input,z,Y.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${T0(Q)}" class="${_}"${B?` ${B}`:""}>${T0(W)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let q=U1(G),W=f5(Q,Z),z=g5(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),_=a4(U?U[1]:"",Y.input,z,Y.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${T0(Q)}" class="${_}"${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="1",K="")=>{let q=U1(K),W=f5(Q,Z),z=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),U=q.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:Y.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${T0(Q)}" value="${T0(G)}" class="${_}"${z?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let q=U1(K),W=f5(Q,Z),z=W!==void 0&&W===G,U=q.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:Y.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${T0(Q)}" value="${T0(G)}" class="${_}"${z?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=U1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",z=K.includes("multiple"),U=g5(Q,Z),_=K.match(/class=['"]([^'"]+)['"]/i),B=a4(_?_[1]:"",Y.input,U,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${T0(Q)}"`,`class="${B}"`];if(W)H.push(`accept="${T0(W)}"`);if(z)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let q=U1(G),W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:Y.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${T0(Q)}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),J}function fZ($,Z,Y=vZ){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(g5(X,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return PZ(X,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return PZ(X,Z)}let q=K.trim();if(Q0(q)){let W=Z0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function g5($,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 PZ($,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 f5($,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 U1($){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 vZ;var gZ=S(()=>{R0();vZ={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import t7 from"path";async function Tq(){if(h5!==void 0)return h5;try{h5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{h5=null}return h5}function Mq($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function Iq($,Z){if({...Z3,...Z.i18n}.cache&&e7[$]){let X=e7[$],Q=Z.i18n?.cacheMaxAge??0;if(!Mq(X,Q))return X.translations}if(d5[$]?.state==="loading")return d5[$].promise;r7[$]="loading";let J=$3($,Z).then((X)=>{return r7[$]="loaded",delete d5[$],X}).catch((X)=>{throw r7[$]="error",d5[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return d5[$]={promise:J,state:"loading"},J}async function $3($,Z){let Y={...Z3,...Z.i18n},J=t7.isAbsolute(Y.translationsDir)?Y.translationsDir:t7.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await Tq(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:Sq(Y.format)}):await Dq($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return $3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)e7[$]={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 $3(Y.defaultLocale,Z);return{}}}async function Dq($,Z,Y){let J=t7.join(Y,`${$}${Eq(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 kq(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function Eq($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function kq($){let Z={},Y=$.split(`
2517
+ `),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,q=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,z]=q,U=W.trim(),_=z.trim();if(_==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=bq(_)}}return Z}function bq($){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 Sq($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function yq($,Z){return Iq($,Z)}function Cq($,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 Pq($,Z={}){return mZ($,Z)}function mZ($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=vq($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=xq(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 vq($,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 xq($,Z){let Y=fq($);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 gq(X,Y.slice(2).join(","),Z);case"select":return dq(X,Y.slice(2).join(","));case"selectordinal":return mq(X,Y.slice(2).join(","));case"number":return pq(X,Y[2]?.trim());case"date":return cq(X,Y[2]?.trim());case"time":return lq(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function fq($){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 gq($,Z,Y){let J=Number($)||0,X=Y3(Z),Q=`=${J}`;if(X[Q])return a7(X[Q],J,Y);let G=hq(J);if(X[G])return a7(X[G],J,Y);if(X.other)return a7(X.other,J,Y);return String(J)}function a7($,Z,Y){let J=$.replace(/#/g,String(Z));return mZ(J,Y)}function hq($){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 dq($,Z){let Y=String($||""),J=Y3(Z);if(J[Y])return J[Y];return J.other||String($)}function mq($,Z){let Y=Number($)||0,J=Y3(Z),X=uq(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 uq($){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 Y3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function pq($,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 cq($,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 lq($,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 iq($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function hZ($,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(iq(G))return Pq(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),q=G.split("|");G=Cq(q,K)}for(let[K,q]of Object.entries(J)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function uZ($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...Z3,...J.i18n},K=await yq(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await dZ(X,Q,async(z,U,_,B,j)=>{try{let H={};if(_)try{let F=[()=>JSON.parse(_),()=>{let O=`{"data":${_}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return N0(_,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(J.debug)console.error("Error parsing parameters for @translate directive:",F)}return hZ(U,K,G.fallbackToKey,H)||B.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return e("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let q=/@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 z=[...X.matchAll(q)];console.warn(`Found ${z.length} @translate matches`),z.forEach((U,_)=>console.warn(`Match ${_}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return X=await dZ(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,U,_,B)=>{try{let j={};if(_)try{let H=[()=>JSON.parse(_),()=>{let L=`{"data":${_}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return N0(_,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return hZ(U,K,G.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return e("Translate",`Error in @translate('${U}'): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR)}}),X}async function dZ($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((q)=>({match:Q,replacement:q}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var h5,Z3,e7,d5,r7;var pZ=S(()=>{Z1();R0();Z3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},e7={},d5={},r7={}});var Q3={};r(Q3,{streamingSuspenseDirective:()=>iZ,streamToResponse:()=>Xz,streamTemplateSimple:()=>$z,streamTemplate:()=>oq,renderStreamingPage:()=>rq,registerStreamingDirectives:()=>Yz,processStreamDirectives:()=>tq,processSectionDirectives:()=>Jz,islandDirective:()=>nZ,generateHydrationRuntime:()=>Qz,extractStreamBoundaries:()=>eq,createStreamRenderer:()=>Zz,buildSuspenseResolveScript:()=>X3,SUSPENSE_RESOLVER_RUNTIME:()=>lZ});import e4 from"path";function nq($){let Z=[],Y=0,J;cZ.lastIndex=0;while((J=cZ.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 oq($,Z={},Y={}){let J={...b1,...Y,streaming:{...J3,...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),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:e4.dirname($)};if(q.trim())await M1(q,z,$);let U=nq(W),_=new Set;if(!U.some((j)=>j.type==="suspense")){let j=J.streaming?.strategy||"auto",H=new RegExp(P1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await j0(W,z,$,J,_);for(let O=0;O<F.length;O+=X)Q.enqueue(F.slice(O,O+X)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(P1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let A of F){if(A.start>w){let R=W.slice(w,A.start);if(R.trim()){let T=await j0(R,z,$,J,_);Q.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let N=await j0(A.content,z,$,J,_);Q.enqueue(N),await new Promise((R)=>setTimeout(R,0)),w=A.end}if(w<W.length){let A=W.slice(w);if(A.trim()){let N=await j0(A,z,$,J,_);Q.enqueue(N)}}}}else{let j=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let F=await j0(L.content,z,$,J,_);Q.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;Q.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
2518
2518
  <template data-suspense-fallback>Loading...</template>
2519
2519
  </div>`),j.set(L.name,j0(L.content,z,$,J,_))}Q.enqueue(`
2520
2520
  <script>
@@ -2538,7 +2538,7 @@ window.__stxSuspense.resolve('${$}', \`${J}\`);
2538
2538
  </script>`}catch(Y){let J=Y instanceof Error?Y.message:String(Y);return`
2539
2539
  <script>
2540
2540
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${u0(J)}</div>');
2541
- </script>`}}function nq($,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 oq($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(cZ),await Promise.all(Z.map(async(Q)=>{let G=nq(Q.render(),J,Q.id);X.enqueue(await X3(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function rq($,Z){return $.replace(sq,(Y,J,X)=>{let Q=J.trim(),G=X.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${q}</div>`})}function aq($){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 tq($,Z={},Y={}){let J={...b1,...Y,streaming:{...J3,...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),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:e4.dirname($)};if(q.trim())await M1(q,z,$);let U=new Set,_=J.streaming?.strategy||"auto",B=new RegExp(P1.source,"g");if(!(_!=="manual"&&B.test(W))){let H=await j0(W,z,$,J,U);for(let L=0;L<H.length;L+=X)Q.enqueue(H.slice(L,L+X))}else{let H=[],L=new RegExp(P1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let N=await j0(A,z,$,J,U);Q.enqueue(N)}}let w=await j0(V.content,z,$,J,U);Q.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await j0(V,z,$,J,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function eq($,Z={}){let Y={...b1,...Z,streaming:{...J3,...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,q={},W;P1.lastIndex=0;while((W=P1.exec(G))!==null){let _=W[1],B=W[2];q[_]=B}let z=G.replace(P1,"");return{renderShell:async(_={})=>{let B={..._,__filename:$,__dirname:e4.dirname($)};return await M1(Q,B,$),j0(z,B,$,Y,new Set)},renderSection:async(_,B={})=>{try{if(!q[_])return`<div class="error-message">Section "${u0(_)}" not found in template "${u0($)}"</div>`;let j={...B,__filename:$,__dirname:e4.dirname($)};await M1(Q,j,$);let H=new Set;return await j0(q[_],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return K0("Expression",H,$,q[_]||"",0,q[_]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function $z($={}){let Z=[];if($.streaming?.enabled)Z.push(lZ);if($.hydration?.enabled)Z.push(iZ);return Z}async function Zz($,Z,Y,J={}){return $}function Yz($,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 Jz($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
2541
+ </script>`}}function sq($,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 rq($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(lZ),await Promise.all(Z.map(async(Q)=>{let G=sq(Q.render(),J,Q.id);X.enqueue(await X3(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function tq($,Z){return $.replace(aq,(Y,J,X)=>{let Q=J.trim(),G=X.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${q}</div>`})}function eq($){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 $z($,Z={},Y={}){let J={...b1,...Y,streaming:{...J3,...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),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:e4.dirname($)};if(q.trim())await M1(q,z,$);let U=new Set,_=J.streaming?.strategy||"auto",B=new RegExp(P1.source,"g");if(!(_!=="manual"&&B.test(W))){let H=await j0(W,z,$,J,U);for(let L=0;L<H.length;L+=X)Q.enqueue(H.slice(L,L+X))}else{let H=[],L=new RegExp(P1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let N=await j0(A,z,$,J,U);Q.enqueue(N)}}let w=await j0(V.content,z,$,J,U);Q.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await j0(V,z,$,J,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function Zz($,Z={}){let Y={...b1,...Z,streaming:{...J3,...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,q={},W;P1.lastIndex=0;while((W=P1.exec(G))!==null){let _=W[1],B=W[2];q[_]=B}let z=G.replace(P1,"");return{renderShell:async(_={})=>{let B={..._,__filename:$,__dirname:e4.dirname($)};return await M1(Q,B,$),j0(z,B,$,Y,new Set)},renderSection:async(_,B={})=>{try{if(!q[_])return`<div class="error-message">Section "${u0(_)}" not found in template "${u0($)}"</div>`;let j={...B,__filename:$,__dirname:e4.dirname($)};await M1(Q,j,$);let H=new Set;return await j0(q[_],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return K0("Expression",H,$,q[_]||"",0,q[_]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function Yz($={}){let Z=[];if($.streaming?.enabled)Z.push(iZ);if($.hydration?.enabled)Z.push(nZ);return Z}async function Jz($,Z,Y,J={}){return $}function Xz($,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 Qz($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
2542
2542
  `);if(Z==="loader")return`
2543
2543
  (function() {
2544
2544
  window.__stx = window.__stx || {};
@@ -2680,7 +2680,7 @@ else {
2680
2680
  else {
2681
2681
  stx.hydrate();
2682
2682
  }
2683
- })();`}var J3,P1,pZ,cZ=`
2683
+ })();`}var J3,P1,cZ,lZ=`
2684
2684
  <script>
2685
2685
  (function(){
2686
2686
  window.__stxSuspense = window.__stxSuspense || {
@@ -2700,25 +2700,25 @@ else {
2700
2700
  }
2701
2701
  };
2702
2702
  })();
2703
- </script>`,sq,lZ,iZ;var G3=S(()=>{t1();r0();W4();A0();J3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},P1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,pZ=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;sq=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;lZ={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} -->`}},iZ={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),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
2703
+ </script>`,aq,iZ,nZ;var G3=S(()=>{t1();r0();W4();A0();J3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},P1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,cZ=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;aq=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;iZ={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} -->`}},nZ={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),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
2704
2704
  ${W}
2705
2705
  <script type="application/json" data-island-props="${G}">
2706
2706
  ${q?`{${q}}`:"{}"}
2707
2707
  </script>
2708
- </div>`}}});var sZ={};r(sZ,{warnUnbalancedTags:()=>K3,findUnbalancedTags:()=>oZ});function Z5($){return $.replace(/[^\n]/g," ")}function oZ($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,Z5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,Z5).replace(/<!--[\s\S]*?-->/g,Z5).replace(/\{\{\{[\s\S]*?\}\}\}/g,Z5).replace(/\{\{[\s\S]*?\}\}/g,Z5).replace(/\{!![\s\S]*?!!\}/g,Z5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",q=Q[2],W=Q[3]==="/";if(Xz.has(q.toLowerCase()))continue;if(W)continue;if(K)J.set(q,(J.get(q)??0)+1);else{let z=Y.get(q);if(z)z.count++;else{let U=Z.slice(0,Q.index).split(`
2709
- `).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(Qz.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=J.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function K3($,Z){let Y;try{Y=oZ($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(nZ.has(J))return;nZ.add(J);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var Xz,Qz,nZ;var q3=S(()=>{Xz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Qz=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);nZ=new Set});import m0 from"path";import z3 from"fs";function rZ($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function aZ($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class tZ{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 B=[X,X.toLowerCase(),rZ(X),aZ(X)];for(let j of B)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${X}.stx`,`${rZ(X)}.stx`,`${aZ(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let B=m0.resolve(m0.dirname(Z),`${X}.stx`);if(await n(B))return B;return null}let K=[],q=Y.componentsDir||"",W=J?.__originalFilePath;if(W)K.push(m0.join(m0.dirname(W),"components"));if(q)K.push(q);let z=m0.join(m0.dirname(Z),"components");if(!K.includes(z))K.push(z);let U=process.cwd(),_=[m0.resolve(U,"src/components"),m0.resolve(U,"components"),m0.resolve(import.meta.dir,"components")];for(let B of _)if(!K.includes(B))K.push(B);for(let B of K){if(!B)continue;for(let j of G){let H=m0.join(B,j);if(await n(H))return H}try{if(!z3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let H=z3.readdirSync(B,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=m0.join(B,L.name);for(let O of G){let V=m0.join(F,O);if(await n(V))return V}}}catch{}}return null}}var y0;var W3=S(()=>{A0();y0=new tZ});function _1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Gz($){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 U3;var _3=S(()=>{U3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=Gz($),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,q=[];if(J.reactive)q.push(`:href="${_1(J.value)}"`);else q.push(`href="${_1(J.value)}"`);if(X)q.push(`class="${_1(X)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${_1(Q)}"`),q.push(`data-stx-exact-active-class="${_1(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[z,U]of Object.entries($.static)){if(W.has(z))continue;if(typeof U==="boolean"){if(U)q.push(_1(z))}else q.push(`${_1(z)}="${_1(U)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function O0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function j3($,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 eZ($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[X,Q]=J.split(":"),G=Kz[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 H3($,Z,Y,J){return Z.map((X)=>`${m5($,X,void 0,Y,J)} ${X}w`).join(", ")}function qz($,Z,Y,J,X){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${m5($,G,void 0,J,X)} ${Q}x`}).join(", ")}function m5($,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 zz($,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 Kz,B3,O3;var L3=S(()=>{Kz={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},B3=[320,640,768,1024,1280,1536,1920];O3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=E0($,"src")||"",X=E0($,"alt")||"",Q=E0($,"width"),G=E0($,"height"),K=E0($,"sizes"),q=E0($,"srcset"),W=E0($,"densities"),z=E0($,"format"),U=E0($,"placeholder"),_=E0($,"placeholderColor")||"#e5e7eb",B=E0($,"provider"),j=E0($,"class")||E0($,"className")||"",H=E0($,"style")||"",L=E0($,"quality"),F=j3($,"lazy",!0),O=j3($,"preload",!1),V=j3($,"picture",!1)||!!z,w=Q?Number.parseInt(Q):void 0,A=G?Number.parseInt(G):void 0,N=q||"",R="";if(!N&&K)N=H3(J,B3,B,z),R=eZ(K);else if(!N&&W){let b=W.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));N=qz(J,b,w,B,z)}else if(K)R=eZ(K);let T=[];if(H)T.push(H);if(w&&A)T.push(`aspect-ratio:${w}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let b=zz(w||16,A||9,_);T.push(`background-image:url(${b})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${O0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=m5(J,w,A,B,z),I=[];if(I.push(`src="${O0(M)}"`),I.push(`alt="${O0(X)}"`),Q)I.push(`width="${O0(Q)}"`);if(G)I.push(`height="${O0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${O0(j)}"`);if(T.length>0)I.push(`style="${O0(T.join(";"))}"`);if(N)I.push(`srcset="${O0(N)}"`);if(R)I.push(`sizes="${O0(R)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[b,k]of Object.entries($.static)){if(D.has(b))continue;if(typeof k==="boolean"){if(k)I.push(O0(b))}else I.push(`${O0(b)}="${O0(k)}"`)}let E=`<img ${I.join(" ")} />`,P="";if(O){let k=z==="webp"?"image/webp":z==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${O0(M)}"${k?` type="${k}"`:""}${N?` imagesrcset="${O0(N)}"`:""}${R?` imagesizes="${O0(R)}"`:""} />
2708
+ </div>`}}});var rZ={};r(rZ,{warnUnbalancedTags:()=>K3,findUnbalancedTags:()=>sZ});function Z5($){return $.replace(/[^\n]/g," ")}function sZ($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,Z5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,Z5).replace(/<!--[\s\S]*?-->/g,Z5).replace(/\{\{\{[\s\S]*?\}\}\}/g,Z5).replace(/\{\{[\s\S]*?\}\}/g,Z5).replace(/\{!![\s\S]*?!!\}/g,Z5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",q=Q[2],W=Q[3]==="/";if(Gz.has(q.toLowerCase()))continue;if(W)continue;if(K)J.set(q,(J.get(q)??0)+1);else{let z=Y.get(q);if(z)z.count++;else{let U=Z.slice(0,Q.index).split(`
2709
+ `).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(Kz.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=J.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function K3($,Z){let Y;try{Y=sZ($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(oZ.has(J))return;oZ.add(J);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var Gz,Kz,oZ;var q3=S(()=>{Gz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Kz=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);oZ=new Set});import m0 from"path";import z3 from"fs";function aZ($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function tZ($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class eZ{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 B=[X,X.toLowerCase(),aZ(X),tZ(X)];for(let j of B)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${X}.stx`,`${aZ(X)}.stx`,`${tZ(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let B=m0.resolve(m0.dirname(Z),`${X}.stx`);if(await n(B))return B;return null}let K=[],q=Y.componentsDir||"",W=J?.__originalFilePath;if(W)K.push(m0.join(m0.dirname(W),"components"));if(q)K.push(q);let z=m0.join(m0.dirname(Z),"components");if(!K.includes(z))K.push(z);let U=process.cwd(),_=[m0.resolve(U,"src/components"),m0.resolve(U,"components"),m0.resolve(import.meta.dir,"components")];for(let B of _)if(!K.includes(B))K.push(B);for(let B of K){if(!B)continue;for(let j of G){let H=m0.join(B,j);if(await n(H))return H}try{if(!z3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let H=z3.readdirSync(B,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=m0.join(B,L.name);for(let O of G){let V=m0.join(F,O);if(await n(V))return V}}}catch{}}return null}}var y0;var W3=S(()=>{A0();y0=new eZ});function _1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qz($){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 U3;var _3=S(()=>{U3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=qz($),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,q=[];if(J.reactive)q.push(`:href="${_1(J.value)}"`);else q.push(`href="${_1(J.value)}"`);if(X)q.push(`class="${_1(X)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${_1(Q)}"`),q.push(`data-stx-exact-active-class="${_1(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[z,U]of Object.entries($.static)){if(W.has(z))continue;if(typeof U==="boolean"){if(U)q.push(_1(z))}else q.push(`${_1(z)}="${_1(U)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function O0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function j3($,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 $Y($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[X,Q]=J.split(":"),G=zz[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 H3($,Z,Y,J){return Z.map((X)=>`${m5($,X,void 0,Y,J)} ${X}w`).join(", ")}function Wz($,Z,Y,J,X){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${m5($,G,void 0,J,X)} ${Q}x`}).join(", ")}function m5($,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 Uz($,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 zz,B3,O3;var L3=S(()=>{zz={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},B3=[320,640,768,1024,1280,1536,1920];O3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=E0($,"src")||"",X=E0($,"alt")||"",Q=E0($,"width"),G=E0($,"height"),K=E0($,"sizes"),q=E0($,"srcset"),W=E0($,"densities"),z=E0($,"format"),U=E0($,"placeholder"),_=E0($,"placeholderColor")||"#e5e7eb",B=E0($,"provider"),j=E0($,"class")||E0($,"className")||"",H=E0($,"style")||"",L=E0($,"quality"),F=j3($,"lazy",!0),O=j3($,"preload",!1),V=j3($,"picture",!1)||!!z,w=Q?Number.parseInt(Q):void 0,A=G?Number.parseInt(G):void 0,N=q||"",R="";if(!N&&K)N=H3(J,B3,B,z),R=$Y(K);else if(!N&&W){let b=W.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));N=Wz(J,b,w,B,z)}else if(K)R=$Y(K);let T=[];if(H)T.push(H);if(w&&A)T.push(`aspect-ratio:${w}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let b=Uz(w||16,A||9,_);T.push(`background-image:url(${b})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${O0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=m5(J,w,A,B,z),I=[];if(I.push(`src="${O0(M)}"`),I.push(`alt="${O0(X)}"`),Q)I.push(`width="${O0(Q)}"`);if(G)I.push(`height="${O0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${O0(j)}"`);if(T.length>0)I.push(`style="${O0(T.join(";"))}"`);if(N)I.push(`srcset="${O0(N)}"`);if(R)I.push(`sizes="${O0(R)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[b,k]of Object.entries($.static)){if(D.has(b))continue;if(typeof k==="boolean"){if(k)I.push(O0(b))}else I.push(`${O0(b)}="${O0(k)}"`)}let E=`<img ${I.join(" ")} />`,P="";if(O){let k=z==="webp"?"image/webp":z==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${O0(M)}"${k?` type="${k}"`:""}${N?` imagesrcset="${O0(N)}"`:""}${R?` imagesizes="${O0(R)}"`:""} />
2710
2710
  `}if(V){let b=[];if(z==="avif"||z==="auto"){let k=m5(J,w,A,B,"avif"),y=N?H3(J,B3,B,"avif"):`${k}`;b.push(`<source type="image/avif" srcset="${O0(y)}"${R?` sizes="${O0(R)}"`:""} />`)}if(z==="webp"||z==="auto"){let k=m5(J,w,A,B,"webp"),y=N?H3(J,B3,B,"webp"):`${k}`;b.push(`<source type="image/webp" srcset="${O0(y)}"${R?` sizes="${O0(R)}"`:""} />`)}return`${P}<picture>
2711
2711
  ${b.join(`
2712
2712
  `)}
2713
2713
  ${E}
2714
- </picture>`}return`${P}${E}`}}});function B1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Y5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var Wz="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",F3;var V3=S(()=>{F3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=Y5($,"src")||"",X=Y5($,"alt")||"",Q=Y5($,"fallback")||"/images/safe-image-default.svg",G=Y5($,"class")||Y5($,"className")||"",K=Y5($,"fallbackClassName")||"",q=[];if(q.push(`src="${B1(J)}"`),q.push(`alt="${B1(X)}"`),G)q.push(`class="${B1(G)}"`);if(q.push(`data-fallback="${B1(Q)}"`),K)q.push(`data-fallback-class="${B1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[_,B]of Object.entries($.static)){if(W.has(_))continue;if(typeof B==="boolean"){if(B)q.push(B1(_))}else q.push(`${B1(_)}="${B1(B)}"`)}let z=`<img ${q.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${Wz}${z}`;return z}}});function w3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function u5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function $$($,Z,Y){let J=u5($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var A3;var N3=S(()=>{A3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=w3(u5($,"color")||"#6366f1"),X=w3(u5($,"initialColor")||u5($,"initial-color")||""),Q=w3(u5($,"height")||"3px"),G=$$($,"duration",2000),K=$$($,"throttle",200),q=$$($,"zIndex",999999)||$$($,"z-index",999999),W=X?`linear-gradient(to right, ${X}, ${J})`:J;return`
2714
+ </picture>`}return`${P}${E}`}}});function B1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Y5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var _z="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",F3;var V3=S(()=>{F3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=Y5($,"src")||"",X=Y5($,"alt")||"",Q=Y5($,"fallback")||"/images/safe-image-default.svg",G=Y5($,"class")||Y5($,"className")||"",K=Y5($,"fallbackClassName")||"",q=[];if(q.push(`src="${B1(J)}"`),q.push(`alt="${B1(X)}"`),G)q.push(`class="${B1(G)}"`);if(q.push(`data-fallback="${B1(Q)}"`),K)q.push(`data-fallback-class="${B1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[_,B]of Object.entries($.static)){if(W.has(_))continue;if(typeof B==="boolean"){if(B)q.push(B1(_))}else q.push(`${B1(_)}="${B1(B)}"`)}let z=`<img ${q.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${_z}${z}`;return z}}});function w3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function u5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function $$($,Z,Y){let J=u5($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var A3;var N3=S(()=>{A3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=w3(u5($,"color")||"#6366f1"),X=w3(u5($,"initialColor")||u5($,"initial-color")||""),Q=w3(u5($,"height")||"3px"),G=$$($,"duration",2000),K=$$($,"throttle",200),q=$$($,"zIndex",999999)||$$($,"z-index",999999),W=X?`linear-gradient(to right, ${X}, ${J})`:J;return`
2715
2715
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${W};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
2716
2716
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
2717
2717
  </div>
2718
2718
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
2719
2719
  <script>
2720
2720
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${K})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
2721
- </script>`}}});function i0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ZY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Uz($,Z,Y){let J=ZY($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var $Y,R3;var T3=S(()=>{$Y={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},R3={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=i0(ZY($,"position")||"top-right"),X=Uz($,"max",5),Q=$Y[J]||$Y["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${X}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
2721
+ </script>`}}});function i0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function YY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Bz($,Z,Y){let J=YY($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var ZY,R3;var T3=S(()=>{ZY={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},R3={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=i0(YY($,"position")||"top-right"),X=Bz($,"max",5),Q=ZY[J]||ZY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${X}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
2722
2722
  <style>
2723
2723
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
2724
2724
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -2726,7 +2726,7 @@ ${E}
2726
2726
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
2727
2727
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
2728
2728
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
2729
- </style>`}}});function Z$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var YY,M3;var I3=S(()=>{YY={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},M3={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=Z$($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let X=i0(J),Q=Z$($,"size")||"md",G=Z$($,"closeOnBackdrop")!=="false",K=Z$($,"closeOnEscape")!=="false",q=YY[Q]||YY.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
2729
+ </style>`}}});function Z$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var JY,M3;var I3=S(()=>{JY={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},M3={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=Z$($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let X=i0(J),Q=Z$($,"size")||"md",G=Z$($,"closeOnBackdrop")!=="false",K=Z$($,"closeOnEscape")!=="false",q=JY[Q]||JY.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
2730
2730
  <div class="stx-modal-panel" style="${q};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
2731
2731
  <div style="padding:1.5rem">${Z}</div>
2732
2732
  </div>
@@ -2735,7 +2735,7 @@ ${E}
2735
2735
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
2736
2736
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
2737
2737
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
2738
- </style>`}}});function J5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var JY,D3;var E3=S(()=>{JY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},D3={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=J5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let X=i0(J),Q=J5($,"side")||"right",G=J5($,"size")||"md",K=J5($,"closeOnBackdrop")!=="false",q=J5($,"closeOnEscape")!=="false",W=J5($,"overlay")!=="false",z=JY[G]||JY.md,U=Q==="left",_=U?"left:0":"right:0",B=U?"translateX(-100%)":"translateX(100%)",j=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
2738
+ </style>`}}});function J5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var XY,D3;var E3=S(()=>{XY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},D3={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=J5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let X=i0(J),Q=J5($,"side")||"right",G=J5($,"size")||"md",K=J5($,"closeOnBackdrop")!=="false",q=J5($,"closeOnEscape")!=="false",W=J5($,"overlay")!=="false",z=XY[G]||XY.md,U=Q==="left",_=U?"left:0":"right:0",B=U?"translateX(-100%)":"translateX(100%)",j=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
2739
2739
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${_};width:${z};max-width:100vw;transform:${B};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
2740
2740
  <div style="padding:1.5rem">${Z}</div>
2741
2741
  </div>
@@ -2744,18 +2744,18 @@ ${E}
2744
2744
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
2745
2745
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
2746
2746
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
2747
- </style>`}}});var GY={};r(GY,{preloadIconCollection:()=>QY,IconBuiltin:()=>Y$});import{existsSync as _z,readFileSync as Bz}from"fs";function XY($){try{return z0.resolve(`@iconify/json/json/${$}.json`)}catch{}let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(_z(Y))return Y;return null}function jz($){if(v1.has($))return v1.get($);let Z=XY($);if(!Z)return null;try{let Y=JSON.parse(Bz(Z,"utf8"));return v1.set($,Y.icons),Y.icons}catch{return null}}async function Hz($){if(v1.has($))return v1.get($);let Z=XY($);if(!Z)return null;try{let Y=await Bun.file(Z).json();return v1.set($,Y.icons),Y.icons}catch{return null}}function X5($,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}async function QY($="lucide"){await Hz($)}var v1,Y$;var J$=S(()=>{v1=new Map;Y$={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=X5($,"name")??X5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=J;if(J.includes(":")){let O=J.split(":");X=O[0],Q=O[1]}let G=i0(X5($,"size")||"24"),K=i0(X5($,"color")||"currentColor"),q=i0(X5($,"class")||""),W=i0(X5($,"style")||""),z=v1.get(X)??jz(X);if(!z)return`<!-- Icon: collection "${X}" not loaded -->`;let U=z[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${X} -->`;let _=U.width||24,B=U.height||24,j=`0 0 ${_} ${B}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function KY($,...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 qY($,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 k3;var b3=S(()=>{k3={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=qY(Z,"fallback"),X=J.rest,Q=qY(X,"error"),G=Q.rest,K=J.region??KY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??KY($,"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>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function X$($,...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 S3;var y3=S(()=>{S3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(X$($,"name")||"v").replace(/["'<>]/g,""),X=(X$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=X$($,"class"),G=X$($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function zY(){y0.registerBuiltin(U3),y0.registerBuiltin(O3),y0.registerBuiltin(F3),y0.registerBuiltin(A3),y0.registerBuiltin(R3),y0.registerBuiltin(M3),y0.registerBuiltin(D3),y0.registerBuiltin(Y$),y0.registerBuiltin(k3),y0.registerBuiltin(S3)}var WY=S(()=>{_3();L3();V3();N3();T3();I3();E3();J$();b3();y3();W3();_3();L3();V3();N3();T3();I3();E3();J$();b3();y3()});function UY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function _Y($,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})`));if(!K){X=Q+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=Q+1+q.length;while(H<$.length&&$[H]!==">")H++;X=H+1;continue}let W=Q+1+q.length,z=null,U=W,_=-1,B=!1;while(W<$.length){let H=$[W];if(z){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===z)z=null;W++;continue}if(H==='"'||H==="'"){z=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){_=W+2,B=!0;break}if(H===">"){_=W+1;break}W++}if(_===-1){X=Q+1;continue}let j=$.slice(U,B?_-2:_-1).trim();if(B)J.push({fullMatch:$.slice(Q,_),tagName:q,attributes:j,content:"",startIndex:Q,endIndex:_,isSelfClosing:!0}),X=_;else{let H=`<${q}`,L=`</${q}>`,F=1,O=_,V=-1;while(F>0&&O<$.length){let N=$.indexOf(H,O),R=$.indexOf(L,O);if(R===-1)break;if(N!==-1&&N<R){let T=$[N+H.length];if(T===" "||T===">"||T==="/"||T===`
2748
- `||T==="\t")F++;O=N+H.length}else{if(F--,F===0){V=R;break}O=R+L.length}}if(V===-1){X=_;continue}let w=$.slice(_,V),A=V+L.length;J.push({fullMatch:$.slice(Q,A),tagName:q,attributes:j,content:w,startIndex:Q,endIndex:A,isSelfClosing:!1}),X=A}}return J}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 jY=S(()=>{R0();A0();X4()});var wY={};r(wY,{processESImports:()=>VY,processComponents:()=>G$});import Q$ from"fs";import v0 from"path";function Lz($,Z,Y){let J={static:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),Q=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!X.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){J.events[q]=K;continue}if(q.startsWith("__stx_")){let W=Q(q.slice(6));J.serverDynamic[W]=BY(K,Y);continue}if(q.startsWith(":")){let W=Q(q.slice(1)),z=K==="true"?W:K;try{if(!Q0(z)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${z}`);J.clientReactive[W]=z;continue}let U=Object.keys(Z),B=G0(z,U)(...Object.values(Z));if(B===void 0){let j=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!U.includes(F))){J.clientReactive[W]=z;continue}}J.serverDynamic[W]=B}catch{J.clientReactive[W]=z}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let z=W[1];if(Q0(z)){let _=G0(z,Object.keys(Z))(...Object.values(Z));J.static[q]=_!=null?String(_):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${z}`);J.static[q]=K}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,z);J.static[q]=K}else{let z=K,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=U.exec(K))!==null)try{let B=_[1];if(!Q0(B)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let H=G0(B,Object.keys(Z))(...Object.values(Z));z=z.replace(_[0],String(H??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,B)}J.static[q]=z}continue}J.static[q]=K}return J}function Fz($){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]="true"}return Z}function OY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Vz($){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(y0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function wz($){let Z=LY.get($);if(Z)return Z;let Y=new Map,J=[v0.join($,"src"),v0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=Q$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of K){let W=v0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;X(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let z=q.name.slice(0,-4);if(!Y.has(z))Y.set(z,W);let U=z.toLowerCase();if(!Y.has(U))Y.set(U,W);let _=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(_))Y.set(_,W)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return LY.set($,Y),Y}function Az($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=v0.join(Y,"node_modules",$);try{if(Q$.statSync(J).isDirectory())return J}catch{}let X=v0.dirname(Y);if(X===Y)return null;Y=X}}async function VY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=v0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,z,U)=>{let _=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=U,j,H=[];while((j=_.exec(U))!==null){let[L,F,O,V]=j,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=v0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(Q$.statSync(M).isFile())A=M}catch{try{if(Q$.statSync(T).isDirectory())w=T}catch{}}}}else w=Az(V,G);if(!w&&!A)continue;let N=!1,R=(T,M)=>{Q.set(T,M),Q.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,M),X.add(M)};if(O&&A)R(O,A),N=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),M=w?wz(w):null;for(let{source:I,local:D}of T){let E=null;if(A)E=A;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)R(D,E),N=!0}}if(N)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)B=B.slice(0,H[L].start)+B.slice(H[L].end);return`<script${z}>${B}</script>`}),K}async function Nz($,Z,Y,J,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(Q))!==null){let[W,z]=q,U=z.split(",").map((_)=>_.trim().replace(/^['"]|['"]$/g,"")).filter((_)=>_.length>0);for(let _ of U){let B=_.split("/"),H=B[B.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[v0.resolve(v0.dirname(Y),`${_}.stx`),v0.resolve(v0.dirname(Y),_),v0.resolve(J.componentsDir||"components",`${_}.stx`),v0.resolve(J.componentsDir||"components",_),_.endsWith(".stx")?_:`${_}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),X.add(F),J.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${_}`)}Q=Q.replace(W,""),K.lastIndex=0}return Q}async function Rz($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(Q))!==null){let z=W.index,U=z+W[0].length-1,_=1,B=U+1;while(B<Q.length&&_>0){if(Q[B]==="(")_++;else if(Q[B]===")"){if(_--,_===0)break}B++}if(_!==0)break;let j=Q.substring(U+1,B),H=B+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=N0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);Q=Q.replace(Q.substring(z,H),`[Error parsing component props: ${E}]`);continue}let N="",R=H,M=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),R=H+M[0].length;let I=await I1(F,A,N,G,Z,Y,J,K,X);Q=Q.substring(0,z)+I+Q.substring(R),q.lastIndex=0}return Q}async function Tz($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=x$(Q);return Q=q.output,Q=await _(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await _(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await _(Q,/[a-z][a-z0-9]*/,!1,Oz),Q=f$(Q,q.scripts),Q;async function _(B,j,H,L){if(!B)return B;let F=B,O=_Y(F,j,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?UY(w.tagName):w.tagName,N=Fz(w.attributes),R=Lz(N,Z,J),T=y0.getBuiltin(w.tagName),M=T?await z4(A,G,Z,Y,J):!1;if(T&&!M){let P={context:Z,filePath:Y,options:J,dependencies:X},b=T.render(R,w.content,P);if(Object.keys(R.clientReactive).length>0)b=FY(b,R.clientReactive);if(Object.keys(R.events).length>0){let k=Object.entries(R.events).map(([y,g])=>`${y}="${OY(g)}"`).join(" ");b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}F=F.substring(0,w.startIndex)+b+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await z4(A,G,Z,Y,J))continue;let I={};for(let[P,b]of Object.entries(R.static))I[P]=b;for(let[P,b]of Object.entries(R.serverDynamic))I[P]=b;let E=await I1(A,I,w.content,G,Z,Y,J,K,X);if(Object.keys(R.clientReactive).length>0)E=FY(E,R.clientReactive);if(Object.keys(R.events).length>0){let P=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(P){let b=Object.entries(R.events).map(([y,g])=>`${y}="${OY(g)}"`).join(" "),k=P[1].length+P[2].length;E=E.substring(0,k)+" "+b+E.substring(k)}}F=F.substring(0,w.startIndex)+E+F.substring(w.endIndex)}return F}}function FY($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let J=Object.entries(Z).map(([Q,G])=>`:${Q}="${G.replace(/"/g,"&quot;")}"`).join(" "),X=Y[1].length+Y[2].length;return $.substring(0,X)+" "+J+$.substring(X)}async function G$($,Z,Y,J,X){if(!HY)zY(),HY=!0;let Q=await VY($,Z,Y,J,X);Q=await Nz(Q,Z,Y,J,X),Q=await Rz(Q,Z,Y,J,X);for(let G=0;G<3;G++){let K=Q;if(Q=await Tz(Q,Z,Y,J,X),Q===K)break}if(J.debug){let G=Vz(Q);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var HY=!1,Oz,LY;var C3=S(()=>{W3();WY();jY();A0();R0();Oz=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","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"]);LY=new Map});var DY={};r(DY,{processLoops:()=>P3});function Dz($,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,q=1,W=K+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let z=J.substring(K+1,W),U=W+1,_=z.match(/^\s*['"]([^'"]+)['"]/);if(!_)continue;let B=_[1],j=z.slice(_[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=N0(L,Z),O=JSON.stringify(F),V=`@component('${B}', ${O})`;Q.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];J=J.substring(0,K)+W+J.substring(q)}return J}function K$($,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,q=1,W=K+1,z=null,U=!1;while(W<J.length&&q>0){let j=J[W];if(U){U=!1,W++;continue}if(j==="\\"&&z){U=!0,W++;continue}if(z){if(j===z)z=null;W++;continue}if(j==='"'||j==="'"||j==="`"){z=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let _=J.substring(K+1,W),B=Y(_);J=J.substring(0,G)+B+J.substring(W+1)}return J}function Ez($,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);$4(Q);let W=G0(Q,G)(...K),z=JSON.stringify(W),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return J}}),Y}function kz($,Z){let Y=$;return Y=K$(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(Q0(Q)){let K=G0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?q$:""}catch{return""}}),Y=K$(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(Q0(Q)){let K=G0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?z$:""}catch{return""}}),Y}function bz($){let Z=$;return Z=Z.replace(/@break(?!\()/g,q$),Z=Z.replace(/@continue(?!\()/g,z$),Z}function AY($){let Z=$.includes(q$),Y=Z?$.substring(0,$.indexOf(q$)):$;return{hasBreak:Z,content:Y}}function NY($){let Z=$.includes(z$),Y=Z?$.substring(0,$.indexOf(z$)):$;return{hasContinue:Z,content:Y}}function TY($){let Z=$;return Z=K$(Z,"@break",(Y)=>{let J=Y.trim();if(!Z4(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=K$(Z,"@continue",(Y)=>{let J=Y.trim();if(!Z4(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function Sz($){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((z,U)=>z.pos-U.pos);let K=[],q=0;for(let z of J)q+=z.delta,K.push({pos:z.pos,depth:q});function W(z){let U=0,_=K.length-1,B=0;while(U<=_){let j=U+_>>1;if(K[j].pos<=z)B=K[j].depth,U=j+1;else _=j-1}return B}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,_=1,B=U+1,j=-1;while(B<$.length&&_>0){if($[B]==="(")_++;else if($[B]===")"){if(_--,_===0){j=B;break}}B++}if(j===-1)continue;let H=$.substring(U+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,w=1,A=V,N=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(w>0&&A<$.length){N.lastIndex=A,R.lastIndex=A;let b=N.exec($),k=R.exec($);if(!k)break;if(b&&b.index<k.index)w++,A=b.index+b[0].length;else{if(w--,w===0){T=k.index;break}A=k.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,D=-1,E=0,P=0;while(P<M.length){let b=M.indexOf("@",P);if(b===-1)break;let k=M.substring(b);if(/^@forelse\s*\(/.test(k))E++,P=b+1;else if(k.startsWith("@endforelse"))E--,P=b+11;else if(E===0&&k.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){D=b;break}P=b+1}else P=b+1}if(D===-1)continue;return{start:z,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function RY($,Z){let Y=$;while(!0){let J=Sz(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=J;try{let z;if(Q0(G))z=G0(G,Object.keys(Z))(...Object.values(Z));else z=Z0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=W;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,X)+U+Y.substring(Q)}catch(z){let U=z instanceof Error?z.message:String(z),_=e("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,X)+_+Y.substring(Q)}}return Y}function P3($,Z,Y,J){let X=$;X=RY(X,Z);function Q(q){let W=/@foreach\s*\(/g,z;while((z=W.exec(q))!==null){let U=z.index,_=z.index+z[0].length-1,B=1,j=_+1,H=-1;while(j<q.length&&B>0){if(q[j]==="(")B++;else if(q[j]===")"){if(B--,B===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(_+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=U,V=L.substring(0,F),w=L.substring(F+4),A=H+1,N=1,R=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&R<q.length){T.lastIndex=R,M.lastIndex=R;let I=T.exec(q),D=M.exec(q);if(!D)break;if(I&&I.index<D.index)N++,R=I.index+I[0].length;else{if(N--,N===0){let E=q.substring(A,D.index),P=D.index+11;return{start:O,end:P,arrayExpr:V,itemVar:w,content:E}}R=D.index+11}}}return null}function G(q,W){let z=q;while(!0){let U=Q(z);if(!U)break;let{start:_,end:B,arrayExpr:j,itemVar:H,content:L}=U;try{let F=j.trim(),O;if(Q0(F))O=G0(F,Object.keys(W))(...Object.values(W));else O=Z0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=e("Foreach",`Error in @foreach: ${F} is not iterable`,s.TYPE_ERROR);z=z.substring(0,_)+D+z.substring(B);continue}let w=J?.loops?.useAltLoopVariable??Iz,A=H.trim(),N=null,R,T=!1;if(A.includes("=>")){let D=A.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])N=D[0],R=D[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])R=D[0],N=D[1],T=!0;else R=A}else R=A;let M="",I=O;for(let D=0;D<I.length;D++){let E=I[D],P={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},b={...W,loop:P,$loop:P};if(R.startsWith("[")&&R.endsWith("]")){let h=R.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))h.forEach((m,i)=>{if(m)b[m]=E[i]});else b[R]=E}else b[R]=E;if(N)if(!T&&V&&Array.isArray(E)&&E.length===2)b[N]=E[0],b[R]=E[1];else b[N]=D;let k=kz(L,b),y=NY(k);if(y.hasContinue){M+=y.content;continue}let g=AY(k);if(g.hasBreak){M+=g.content;break}if(k=RY(k,b),k=G(k,b),k=C1(k,b,Y),k=bz(k),g=AY(k),g.hasBreak){M+=g.content;break}if(y=NY(k),y.hasContinue){M+=y.content;continue}k=s0(k,b,Y),k=Ez(k,b),k=Dz(k,b),M+=k}z=z.substring(0,_)+M+z.substring(B)}catch(F){let O=e("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,s.EVALUATION_ERROR);z=z.substring(0,_)+O+z.substring(B)}}return z}X=G(X,Z),X=IY(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??Mz;return X=Pz(X,Z,K),X}function MY($){return Z4($)}function IY($,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,q=K+G[0].length-1,W=S0(X,"(",")",q);if(W===-1)break;let z=X.slice(q+1,W),U=W+1,_=n4(X.slice(K),"for","endfor");if(_.length===0)break;let B=_[0].content,j=K+_[0].end;if(!MY(z)){let H=e("For",`Unsafe expression in @for: ${z}`,s.UNSAFE_EXPRESSION);X=X.substring(0,K)+H+X.substring(j),Q=!0;continue}try{let H=yz(z),L=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(H.length>0&&L){let N=Cz({forExpr:z,content:B,iterVarNames:H,context:Z,filePath:Y,options:J});X=X.substring(0,K)+N+X.substring(j),Q=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});V=TY(V);let A=Function(...F,`
2747
+ </style>`}}});var qY={};r(qY,{resolveCollectionPath:()=>k3,preloadIconCollection:()=>KY,IconBuiltin:()=>Y$});import{existsSync as jz,readFileSync as Hz}from"fs";function GY($){if(QY.has($))return;QY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function k3($){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(jz(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return z0.resolve(Y)}catch{}return null}function Oz($){if(v1.has($))return v1.get($);let Z=k3($);if(!Z)return GY($),null;try{let Y=JSON.parse(Hz(Z,"utf8"));return v1.set($,Y.icons),Y.icons}catch{return null}}async function Lz($){if(v1.has($))return v1.get($);let Z=k3($);if(!Z)return GY($),null;try{let Y=await Bun.file(Z).json();return v1.set($,Y.icons),Y.icons}catch{return null}}function X5($,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}async function KY($="lucide"){await Lz($)}var v1,QY,Y$;var J$=S(()=>{v1=new Map,QY=new Set;Y$={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=X5($,"name")??X5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=J;if(J.includes(":")){let O=J.split(":");X=O[0],Q=O[1]}let G=i0(X5($,"size")||"24"),K=i0(X5($,"color")||"currentColor"),q=i0(X5($,"class")||""),W=i0(X5($,"style")||""),z=v1.get(X)??Oz(X);if(!z)return`<!-- Icon: collection "${X}" not loaded -->`;let U=z[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${X} -->`;let _=U.width||24,B=U.height||24,j=`0 0 ${_} ${B}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function zY($,...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 WY($,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 b3;var S3=S(()=>{b3={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=WY(Z,"fallback"),X=J.rest,Q=WY(X,"error"),G=Q.rest,K=J.region??zY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??zY($,"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>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function X$($,...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 y3;var C3=S(()=>{y3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(X$($,"name")||"v").replace(/["'<>]/g,""),X=(X$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=X$($,"class"),G=X$($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function UY(){y0.registerBuiltin(U3),y0.registerBuiltin(O3),y0.registerBuiltin(F3),y0.registerBuiltin(A3),y0.registerBuiltin(R3),y0.registerBuiltin(M3),y0.registerBuiltin(D3),y0.registerBuiltin(Y$),y0.registerBuiltin(b3),y0.registerBuiltin(y3)}var _Y=S(()=>{_3();L3();V3();N3();T3();I3();E3();J$();S3();C3();W3();_3();L3();V3();N3();T3();I3();E3();J$();S3();C3()});function BY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function jY($,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})`));if(!K){X=Q+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=Q+1+q.length;while(H<$.length&&$[H]!==">")H++;X=H+1;continue}let W=Q+1+q.length,z=null,U=W,_=-1,B=!1;while(W<$.length){let H=$[W];if(z){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===z)z=null;W++;continue}if(H==='"'||H==="'"){z=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){_=W+2,B=!0;break}if(H===">"){_=W+1;break}W++}if(_===-1){X=Q+1;continue}let j=$.slice(U,B?_-2:_-1).trim();if(B)J.push({fullMatch:$.slice(Q,_),tagName:q,attributes:j,content:"",startIndex:Q,endIndex:_,isSelfClosing:!0}),X=_;else{let H=`<${q}`,L=`</${q}>`,F=1,O=_,V=-1;while(F>0&&O<$.length){let N=$.indexOf(H,O),R=$.indexOf(L,O);if(R===-1)break;if(N!==-1&&N<R){let T=$[N+H.length];if(T===" "||T===">"||T==="/"||T===`
2748
+ `||T==="\t")F++;O=N+H.length}else{if(F--,F===0){V=R;break}O=R+L.length}}if(V===-1){X=_;continue}let w=$.slice(_,V),A=V+L.length;J.push({fullMatch:$.slice(Q,A),tagName:q,attributes:j,content:w,startIndex:Q,endIndex:A,isSelfClosing:!1}),X=A}}return J}function HY($,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 OY=S(()=>{R0();A0();X4()});var NY={};r(NY,{processESImports:()=>AY,processComponents:()=>G$});import Q$ from"fs";import v0 from"path";function Vz($,Z,Y){let J={static:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),Q=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!X.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){J.events[q]=K;continue}if(q.startsWith("__stx_")){let W=Q(q.slice(6));J.serverDynamic[W]=HY(K,Y);continue}if(q.startsWith(":")){let W=Q(q.slice(1)),z=K==="true"?W:K;try{if(!Q0(z)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${z}`);J.clientReactive[W]=z;continue}let U=Object.keys(Z),B=G0(z,U)(...Object.values(Z));if(B===void 0){let j=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!U.includes(F))){J.clientReactive[W]=z;continue}}J.serverDynamic[W]=B}catch{J.clientReactive[W]=z}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let z=W[1];if(Q0(z)){let _=G0(z,Object.keys(Z))(...Object.values(Z));J.static[q]=_!=null?String(_):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${z}`);J.static[q]=K}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,z);J.static[q]=K}else{let z=K,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=U.exec(K))!==null)try{let B=_[1];if(!Q0(B)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let H=G0(B,Object.keys(Z))(...Object.values(Z));z=z.replace(_[0],String(H??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,B)}J.static[q]=z}continue}J.static[q]=K}return J}function wz($){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]="true"}return Z}function FY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Az($){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(y0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function Nz($){let Z=VY.get($);if(Z)return Z;let Y=new Map,J=[v0.join($,"src"),v0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=Q$.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of K){let W=v0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;X(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let z=q.name.slice(0,-4);if(!Y.has(z))Y.set(z,W);let U=z.toLowerCase();if(!Y.has(U))Y.set(U,W);let _=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(_))Y.set(_,W)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return VY.set($,Y),Y}function Rz($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=v0.join(Y,"node_modules",$);try{if(Q$.statSync(J).isDirectory())return J}catch{}let X=v0.dirname(Y);if(X===Y)return null;Y=X}}async function AY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=v0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,z,U)=>{let _=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=U,j,H=[];while((j=_.exec(U))!==null){let[L,F,O,V]=j,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=v0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(Q$.statSync(M).isFile())A=M}catch{try{if(Q$.statSync(T).isDirectory())w=T}catch{}}}}else w=Rz(V,G);if(!w&&!A)continue;let N=!1,R=(T,M)=>{Q.set(T,M),Q.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,M),X.add(M)};if(O&&A)R(O,A),N=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),M=w?Nz(w):null;for(let{source:I,local:D}of T){let E=null;if(A)E=A;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)R(D,E),N=!0}}if(N)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)B=B.slice(0,H[L].start)+B.slice(H[L].end);return`<script${z}>${B}</script>`}),K}async function Tz($,Z,Y,J,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(Q))!==null){let[W,z]=q,U=z.split(",").map((_)=>_.trim().replace(/^['"]|['"]$/g,"")).filter((_)=>_.length>0);for(let _ of U){let B=_.split("/"),H=B[B.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[v0.resolve(v0.dirname(Y),`${_}.stx`),v0.resolve(v0.dirname(Y),_),v0.resolve(J.componentsDir||"components",`${_}.stx`),v0.resolve(J.componentsDir||"components",_),_.endsWith(".stx")?_:`${_}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),X.add(F),J.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${_}`)}Q=Q.replace(W,""),K.lastIndex=0}return Q}async function Mz($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(Q))!==null){let z=W.index,U=z+W[0].length-1,_=1,B=U+1;while(B<Q.length&&_>0){if(Q[B]==="(")_++;else if(Q[B]===")"){if(_--,_===0)break}B++}if(_!==0)break;let j=Q.substring(U+1,B),H=B+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=N0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);Q=Q.replace(Q.substring(z,H),`[Error parsing component props: ${E}]`);continue}let N="",R=H,M=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),R=H+M[0].length;let I=await I1(F,A,N,G,Z,Y,J,K,X);Q=Q.substring(0,z)+I+Q.substring(R),q.lastIndex=0}return Q}async function Iz($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=x$(Q);return Q=q.output,Q=await _(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await _(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await _(Q,/[a-z][a-z0-9]*/,!1,Fz),Q=f$(Q,q.scripts),Q;async function _(B,j,H,L){if(!B)return B;let F=B,O=jY(F,j,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?BY(w.tagName):w.tagName,N=wz(w.attributes),R=Vz(N,Z,J),T=y0.getBuiltin(w.tagName),M=T?await z4(A,G,Z,Y,J):!1;if(T&&!M){let P={context:Z,filePath:Y,options:J,dependencies:X},b=T.render(R,w.content,P);if(Object.keys(R.clientReactive).length>0)b=wY(b,R.clientReactive);if(Object.keys(R.events).length>0){let k=Object.entries(R.events).map(([y,g])=>`${y}="${FY(g)}"`).join(" ");b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}F=F.substring(0,w.startIndex)+b+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await z4(A,G,Z,Y,J))continue;let I={};for(let[P,b]of Object.entries(R.static))I[P]=b;for(let[P,b]of Object.entries(R.serverDynamic))I[P]=b;let E=await I1(A,I,w.content,G,Z,Y,J,K,X);if(Object.keys(R.clientReactive).length>0)E=wY(E,R.clientReactive);if(Object.keys(R.events).length>0){let P=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(P){let b=Object.entries(R.events).map(([y,g])=>`${y}="${FY(g)}"`).join(" "),k=P[1].length+P[2].length;E=E.substring(0,k)+" "+b+E.substring(k)}}F=F.substring(0,w.startIndex)+E+F.substring(w.endIndex)}return F}}function wY($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let J=Object.entries(Z).map(([Q,G])=>`:${Q}="${G.replace(/"/g,"&quot;")}"`).join(" "),X=Y[1].length+Y[2].length;return $.substring(0,X)+" "+J+$.substring(X)}async function G$($,Z,Y,J,X){if(!LY)UY(),LY=!0;let Q=await AY($,Z,Y,J,X);Q=await Tz(Q,Z,Y,J,X),Q=await Mz(Q,Z,Y,J,X);for(let G=0;G<3;G++){let K=Q;if(Q=await Iz(Q,Z,Y,J,X),Q===K)break}if(J.debug){let G=Az(Q);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var LY=!1,Fz,VY;var P3=S(()=>{W3();_Y();OY();A0();R0();Fz=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","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"]);VY=new Map});var kY={};r(kY,{processLoops:()=>v3});function kz($,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,q=1,W=K+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let z=J.substring(K+1,W),U=W+1,_=z.match(/^\s*['"]([^'"]+)['"]/);if(!_)continue;let B=_[1],j=z.slice(_[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=N0(L,Z),O=JSON.stringify(F),V=`@component('${B}', ${O})`;Q.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];J=J.substring(0,K)+W+J.substring(q)}return J}function K$($,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,q=1,W=K+1,z=null,U=!1;while(W<J.length&&q>0){let j=J[W];if(U){U=!1,W++;continue}if(j==="\\"&&z){U=!0,W++;continue}if(z){if(j===z)z=null;W++;continue}if(j==='"'||j==="'"||j==="`"){z=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let _=J.substring(K+1,W),B=Y(_);J=J.substring(0,G)+B+J.substring(W+1)}return J}function bz($,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);$4(Q);let W=G0(Q,G)(...K),z=JSON.stringify(W),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return J}}),Y}function Sz($,Z){let Y=$;return Y=K$(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(Q0(Q)){let K=G0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?q$:""}catch{return""}}),Y=K$(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(Q0(Q)){let K=G0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?z$:""}catch{return""}}),Y}function yz($){let Z=$;return Z=Z.replace(/@break(?!\()/g,q$),Z=Z.replace(/@continue(?!\()/g,z$),Z}function RY($){let Z=$.includes(q$),Y=Z?$.substring(0,$.indexOf(q$)):$;return{hasBreak:Z,content:Y}}function TY($){let Z=$.includes(z$),Y=Z?$.substring(0,$.indexOf(z$)):$;return{hasContinue:Z,content:Y}}function IY($){let Z=$;return Z=K$(Z,"@break",(Y)=>{let J=Y.trim();if(!Z4(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=K$(Z,"@continue",(Y)=>{let J=Y.trim();if(!Z4(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function Cz($){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((z,U)=>z.pos-U.pos);let K=[],q=0;for(let z of J)q+=z.delta,K.push({pos:z.pos,depth:q});function W(z){let U=0,_=K.length-1,B=0;while(U<=_){let j=U+_>>1;if(K[j].pos<=z)B=K[j].depth,U=j+1;else _=j-1}return B}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,_=1,B=U+1,j=-1;while(B<$.length&&_>0){if($[B]==="(")_++;else if($[B]===")"){if(_--,_===0){j=B;break}}B++}if(j===-1)continue;let H=$.substring(U+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,w=1,A=V,N=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(w>0&&A<$.length){N.lastIndex=A,R.lastIndex=A;let b=N.exec($),k=R.exec($);if(!k)break;if(b&&b.index<k.index)w++,A=b.index+b[0].length;else{if(w--,w===0){T=k.index;break}A=k.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,D=-1,E=0,P=0;while(P<M.length){let b=M.indexOf("@",P);if(b===-1)break;let k=M.substring(b);if(/^@forelse\s*\(/.test(k))E++,P=b+1;else if(k.startsWith("@endforelse"))E--,P=b+11;else if(E===0&&k.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){D=b;break}P=b+1}else P=b+1}if(D===-1)continue;return{start:z,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function MY($,Z){let Y=$;while(!0){let J=Cz(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=J;try{let z;if(Q0(G))z=G0(G,Object.keys(Z))(...Object.values(Z));else z=Z0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=W;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,X)+U+Y.substring(Q)}catch(z){let U=z instanceof Error?z.message:String(z),_=e("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,X)+_+Y.substring(Q)}}return Y}function v3($,Z,Y,J){let X=$;X=MY(X,Z);function Q(q){let W=/@foreach\s*\(/g,z;while((z=W.exec(q))!==null){let U=z.index,_=z.index+z[0].length-1,B=1,j=_+1,H=-1;while(j<q.length&&B>0){if(q[j]==="(")B++;else if(q[j]===")"){if(B--,B===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(_+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=U,V=L.substring(0,F),w=L.substring(F+4),A=H+1,N=1,R=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&R<q.length){T.lastIndex=R,M.lastIndex=R;let I=T.exec(q),D=M.exec(q);if(!D)break;if(I&&I.index<D.index)N++,R=I.index+I[0].length;else{if(N--,N===0){let E=q.substring(A,D.index),P=D.index+11;return{start:O,end:P,arrayExpr:V,itemVar:w,content:E}}R=D.index+11}}}return null}function G(q,W){let z=q;while(!0){let U=Q(z);if(!U)break;let{start:_,end:B,arrayExpr:j,itemVar:H,content:L}=U;try{let F=j.trim(),O;if(Q0(F))O=G0(F,Object.keys(W))(...Object.values(W));else O=Z0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=e("Foreach",`Error in @foreach: ${F} is not iterable`,s.TYPE_ERROR);z=z.substring(0,_)+D+z.substring(B);continue}let w=J?.loops?.useAltLoopVariable??Ez,A=H.trim(),N=null,R,T=!1;if(A.includes("=>")){let D=A.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])N=D[0],R=D[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])R=D[0],N=D[1],T=!0;else R=A}else R=A;let M="",I=O;for(let D=0;D<I.length;D++){let E=I[D],P={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},b={...W,loop:P,$loop:P};if(R.startsWith("[")&&R.endsWith("]")){let h=R.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))h.forEach((m,i)=>{if(m)b[m]=E[i]});else b[R]=E}else b[R]=E;if(N)if(!T&&V&&Array.isArray(E)&&E.length===2)b[N]=E[0],b[R]=E[1];else b[N]=D;let k=Sz(L,b),y=TY(k);if(y.hasContinue){M+=y.content;continue}let g=RY(k);if(g.hasBreak){M+=g.content;break}if(k=MY(k,b),k=G(k,b),k=C1(k,b,Y),k=yz(k),g=RY(k),g.hasBreak){M+=g.content;break}if(y=TY(k),y.hasContinue){M+=y.content;continue}k=s0(k,b,Y),k=bz(k,b),k=kz(k,b),M+=k}z=z.substring(0,_)+M+z.substring(B)}catch(F){let O=e("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,s.EVALUATION_ERROR);z=z.substring(0,_)+O+z.substring(B)}}return z}X=G(X,Z),X=EY(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??Dz;return X=xz(X,Z,K),X}function DY($){return Z4($)}function EY($,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,q=K+G[0].length-1,W=S0(X,"(",")",q);if(W===-1)break;let z=X.slice(q+1,W),U=W+1,_=n4(X.slice(K),"for","endfor");if(_.length===0)break;let B=_[0].content,j=K+_[0].end;if(!DY(z)){let H=e("For",`Unsafe expression in @for: ${z}`,s.UNSAFE_EXPRESSION);X=X.substring(0,K)+H+X.substring(j),Q=!0;continue}try{let H=Pz(z),L=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(H.length>0&&L){let N=vz({forExpr:z,content:B,iterVarNames:H,context:Z,filePath:Y,options:J});X=X.substring(0,K)+N+X.substring(j),Q=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});V=IY(V);let A=Function(...F,`
2749
2749
  let result = '';
2750
2750
  for (${z}) {
2751
2751
  result += \`${V}\`;
2752
2752
  }
2753
2753
  return result;
2754
- `)(...O);X=X.substring(0,K)+A+X.substring(j),Q=!0}catch(H){let L=e("For",`Error in @for(${z}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);X=X.substring(0,K)+L+X.substring(j),Q=!0}}return X}function yz($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let Q=Y[1];return Q.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&Q.startsWith("{")){let _=q.slice(W+1).trim(),B=_.indexOf("=");return(B>=0?_.slice(0,B):_).trim()}let z=q.indexOf("="),U=(z>=0?q.slice(0,z):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(X)return[X[1]];return[]}function Cz($){let{forExpr:Z,content:Y,iterVarNames:J,context:X,filePath:Q,options:G}=$,K=Object.keys(X),q=Object.values(X),W=Function(...K,"__pushIter",`
2754
+ `)(...O);X=X.substring(0,K)+A+X.substring(j),Q=!0}catch(H){let L=e("For",`Error in @for(${z}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);X=X.substring(0,K)+L+X.substring(j),Q=!0}}return X}function Pz($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let Q=Y[1];return Q.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&Q.startsWith("{")){let _=q.slice(W+1).trim(),B=_.indexOf("=");return(B>=0?_.slice(0,B):_).trim()}let z=q.indexOf("="),U=(z>=0?q.slice(0,z):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(X)return[X[1]];return[]}function vz($){let{forExpr:Z,content:Y,iterVarNames:J,context:X,filePath:Q,options:G}=$,K=Object.keys(X),q=Object.values(X),W=Function(...K,"__pushIter",`
2755
2755
  for (${Z}) {
2756
2756
  __pushIter([${J.join(", ")}])
2757
2757
  }
2758
- `),z=[];W(...q,(B)=>{z.push(B)});let U=Q??"inline.stx",_="";for(let B of z){let j={...X};J.forEach((L,F)=>{j[L]=B[F]});let H=IY(Y,j,Q,G);H=C1(H,j,U),H=s0(H,j,U),_+=H}return _}function Pz($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,q=S0(J,"(",")",K);if(q===-1)break;let W=J.slice(K+1,q),z=n4(J.slice(G),"while","endwhile");if(z.length===0)break;let U=z[0].content,_=G+z[0].end;if(!MY(W)){let B=e("While",`Unsafe expression in @while: ${W}`,s.UNSAFE_EXPRESSION);J=J.substring(0,G)+B+J.substring(_),X=!0;continue}try{let B=Object.keys(Z),j=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=TY(H);let F=Function(...B,`
2758
+ `),z=[];W(...q,(B)=>{z.push(B)});let U=Q??"inline.stx",_="";for(let B of z){let j={...X};J.forEach((L,F)=>{j[L]=B[F]});let H=EY(Y,j,Q,G);H=C1(H,j,U),H=s0(H,j,U),_+=H}return _}function xz($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,q=S0(J,"(",")",K);if(q===-1)break;let W=J.slice(K+1,q),z=n4(J.slice(G),"while","endwhile");if(z.length===0)break;let U=z[0].content,_=G+z[0].end;if(!DY(W)){let B=e("While",`Unsafe expression in @while: ${W}`,s.UNSAFE_EXPRESSION);J=J.substring(0,G)+B+J.substring(_),X=!0;continue}try{let B=Object.keys(Z),j=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=IY(H);let F=Function(...B,`
2759
2759
  let result = '';
2760
2760
  let maxIterations = ${Y}; // Configurable safety limit
2761
2761
  let counter = 0;
@@ -2767,8 +2767,8 @@ ${E}
2767
2767
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
2768
2768
  }
2769
2769
  return result;
2770
- `)(...j);J=J.substring(0,G)+F+J.substring(_),X=!0}catch(B){let j=e("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR);J=J.substring(0,G)+j+J.substring(_),X=!0}}return J}var Mz=1000,Iz=!1,q$="<!--__STX_BREAK__-->",z$="<!--__STX_CONTINUE__-->";var v3=S(()=>{s4();Z1();r0();o4();R0()});import U0 from"path";function x3($,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 vz($,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,q=1,W=K+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")")q--;W++}if(q!==0)break;let z=J.substring(K+1,W-1),U=`${Y}(${z})`;J=J.substring(0,G)+U+J.substring(W),X.lastIndex=G+U.length,Q=X.exec(J)}return J}function xz($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function fz($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},q=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},W=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
2771
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(X!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!J.has(j))Y.push(j),J.add(j);return}let _=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!J.has(j))Y.push(j),J.add(j);return}let B=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!J.has(j))Y.push(j),J.add(j)}};while(Q<G){if(W())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){q();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])))z();Q++}return Y.join(", ")}function kY($,Z=""){return`
2770
+ `)(...j);J=J.substring(0,G)+F+J.substring(_),X=!0}catch(B){let j=e("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR);J=J.substring(0,G)+j+J.substring(_),X=!0}}return J}var Dz=1000,Ez=!1,q$="<!--__STX_BREAK__-->",z$="<!--__STX_CONTINUE__-->";var x3=S(()=>{s4();Z1();r0();o4();R0()});import U0 from"path";function f3($,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 fz($,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,q=1,W=K+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")")q--;W++}if(q!==0)break;let z=J.substring(K+1,W-1),U=`${Y}(${z})`;J=J.substring(0,G)+U+J.substring(W),X.lastIndex=G+U.length,Q=X.exec(J)}return J}function gz($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function hz($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},q=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},W=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
2771
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(X!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!J.has(j))Y.push(j),J.add(j);return}let _=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!J.has(j))Y.push(j),J.add(j);return}let B=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!J.has(j))Y.push(j),J.add(j)}};while(Q<G){if(W())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){q();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])))z();Q++}return Y.join(", ")}function SY($,Z=""){return`
2772
2772
  (function() {
2773
2773
  var { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect, defineProps, withDefaults, defineEmits, defineExpose, defineSlots } = window.stx;
2774
2774
  var __destroyHooks = [];
@@ -2777,11 +2777,11 @@ ${E}
2777
2777
 
2778
2778
  ${$}
2779
2779
  ${Z}})();
2780
- `}function gz($,Z){let Q=`
2780
+ `}function dz($,Z){let Q=`
2781
2781
  // Register scope variables for STX runtime
2782
2782
  if (!window.stx._scopes) window.stx._scopes = {};
2783
2783
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
2784
- ${fz($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeRegistration[${JSON.stringify(q)}] = ${q}; } catch (e) { /* not actually top-level */ }`).join(`
2784
+ ${hz($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeRegistration[${JSON.stringify(q)}] = ${q}; } catch (e) { /* not actually top-level */ }`).join(`
2785
2785
  `)}
2786
2786
  // #1767: when the bundler renamed a component const that collided with an
2787
2787
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -2798,33 +2798,33 @@ ${fz($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeR
2798
2798
  } finally {
2799
2799
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2800
2800
  }
2801
- })();`;return G+kY($,Q)+`
2801
+ })();`;return G+SY($,Q)+`
2802
2802
  } finally {
2803
2803
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2804
2804
  }
2805
- })();`}function hz($,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 mz($){if($.__onceStore instanceof Set)return $.__onceStore;return dz}async function f3($,Z,Y,J,X,Q=new Set){let G=J.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=vz($,"@partial","@include"),q=mz(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let N=A[1],R=W(N,G,Y),T="";if(R&&await Bun.file(R).exists())X.add(R),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,A=V+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let N=K.substring(V+1,A-1),R=x3(N,0);if(R===-1){L.lastIndex=A;continue}let T=N.substring(0,R).trim(),M=N.substring(R+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let D=I[1],E=M.substring(I[0].length),P,b=x3(E,0);if(b!==-1)P=E.substring(b+1).trim();try{let k=`Boolean(${T})`,y;if(Q0(k)){let m=G0(k,Object.keys(Z));y=Boolean(m(...Object.values(Z)))}else y=Boolean(Z0(k,Z));let g=H?!y:y,h="";if(g){let m=W(D,G,Y);if(m&&await Bun.file(m).exists())X.add(m);h=`@include('${D}'${P?`, ${P}`:""})`}K=K.substring(0,O)+h+K.substring(A),L.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k),g=K0("Include",`Error evaluating ${j} condition: ${y}`,Y,$,O);K=K.substring(0,O)+g+K.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let[,R,T,M,I]=N;try{let D,E=T.trim();if(Q0(E))D=G0(E,Object.keys(Z))(...Object.values(Z));else D=Z0(E,Z);let P="";if(Array.isArray(D)&&D.length>0)for(let b of D){let k={...Z,[M]:b},y=await U(R,k,$,L);P+=y}else if(I)P=await U(I,{},$,L);K=K.substring(0,L)+P+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+K0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let R=N[1],T=w.slice(N[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let P=1,b=1;while(b<T.length&&P>0){if(T[b]==="{")P++;else if(T[b]==="}"){if(P--,P===0)break}b++}M=T.substring(0,b+1),T=T.slice(b+1)}let D,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let P=JSON.parse(R.replace(/'/g,'"')),b={};if(M)try{b=N0(M,Z)}catch(y){let g=y instanceof Error?y.message:String(y);if(J.debug){let h=K0("Include",`Error parsing includeFirst variables: ${g}`,Y,$,L,A);K=K.replace(A,()=>h)}else K=K.replace(A,()=>D||"");continue}let k=!1;for(let y of P){let g=W(y,G,Y);if(!g)continue;if(await n(g)){let h=await U(y,b,$,L);K=K.replace(A,()=>h),k=!0;break}}if(!k)if(D!==void 0)K=K.replace(A,()=>D);else if(J.debug){let y=K0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,L,A);K=K.replace(A,()=>y)}else K=K.replace(A,"")}catch(P){let b=P instanceof Error?P.message:String(P),k=K0("Include",`Error processing @includeFirst: ${b}`,Y,$,L,A);K=K.replace(A,()=>k)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=U0.resolve(H,F);else w=U0.resolve(V,F);let A=U0.normalize(w),N=A.startsWith(O+U0.sep)||A===O,R=A.startsWith(V+U0.sep)||A===V,T=!1,M=U0.dirname(V);if(A.startsWith(M+U0.sep)){if(!U0.relative(M,A).split(U0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))T=!0}if(!N&&!R&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let z=U0.resolve(Y);Q.add(z);async function U(j,H={},L,F){let O=W(j,G,Y);if(!O)return K0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=U0.resolve(O);if(Q.has(V)){let w=[...Q,V].map((A)=>U0.basename(A)).join(" -> ");return K0("Include",`Circular include detected: ${w}`,Y,L,F)}try{X.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(h){let m=h instanceof Error?h.message:String(h);return K0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:h}=await Promise.resolve().then(() => (G3(),Q3));w=h(w,Z)}if(w&&(J.debug||!S5()&&!v4()))try{let{warnUnbalancedTags:h}=await Promise.resolve().then(() => (q3(),sZ));h(w,O)}catch{}let A=w;try{let{processESImports:h}=await Promise.resolve().then(() => (C3(),wY));await h(w,Z,O,J,X)}catch(h){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,h instanceof Error?h.message:h)}let N=A.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(N)A=N[1].trim();let T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[h,m]of Object.entries(H))I[h]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...w.matchAll(D)],P="",b=null;for(let h of E){let m=h[1]||"",i=h[2]||"",c=m.includes("server"),q0=A1(m),F0="";try{let{extractAndStripCssImports:$0,renderVendorStyleTags:k0}=await Promise.resolve().then(() => (w5(),f6)),f0=$0(i,{filePath:O,projectRoot:process.cwd()});i=f0.code,F0=k0(f0.styles)}catch($0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,$0 instanceof Error?$0.message:$0)}if(q0&&i.trim())i=N1(i);if(!c)try{let{hasUserImports:$0,bundleClientScript:k0}=await Promise.resolve().then(() => (t5(),a5));if($0(i))i=await k0(i,O,{projectRoot:process.cwd()})}catch($0){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,$0 instanceof Error?$0.message:$0)}let _0=xz(i);if(_0&&!c){b=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++EY}`;let $0=$1(i),k0=gz($0,b);P+=`${F0}<script data-stx-scoped>${k0}</script>
2806
- `;continue}if(c)try{let{extractVariables:$0}=await Promise.resolve().then(() => (E5(),q4));await $0(i,I,O)}catch($0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,$0)}if(!c&&!_0){let $0=m.replace(/\bclient\b/i,"").trim();b=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++EY}`;let k0=$1(i),f0=`
2805
+ })();`}function mz($,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 pz($){if($.__onceStore instanceof Set)return $.__onceStore;return uz}async function g3($,Z,Y,J,X,Q=new Set){let G=J.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=fz($,"@partial","@include"),q=pz(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let N=A[1],R=W(N,G,Y),T="";if(R&&await Bun.file(R).exists())X.add(R),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,A=V+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let N=K.substring(V+1,A-1),R=f3(N,0);if(R===-1){L.lastIndex=A;continue}let T=N.substring(0,R).trim(),M=N.substring(R+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let D=I[1],E=M.substring(I[0].length),P,b=f3(E,0);if(b!==-1)P=E.substring(b+1).trim();try{let k=`Boolean(${T})`,y;if(Q0(k)){let m=G0(k,Object.keys(Z));y=Boolean(m(...Object.values(Z)))}else y=Boolean(Z0(k,Z));let g=H?!y:y,h="";if(g){let m=W(D,G,Y);if(m&&await Bun.file(m).exists())X.add(m);h=`@include('${D}'${P?`, ${P}`:""})`}K=K.substring(0,O)+h+K.substring(A),L.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k),g=K0("Include",`Error evaluating ${j} condition: ${y}`,Y,$,O);K=K.substring(0,O)+g+K.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let[,R,T,M,I]=N;try{let D,E=T.trim();if(Q0(E))D=G0(E,Object.keys(Z))(...Object.values(Z));else D=Z0(E,Z);let P="";if(Array.isArray(D)&&D.length>0)for(let b of D){let k={...Z,[M]:b},y=await U(R,k,$,L);P+=y}else if(I)P=await U(I,{},$,L);K=K.substring(0,L)+P+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+K0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let R=N[1],T=w.slice(N[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let P=1,b=1;while(b<T.length&&P>0){if(T[b]==="{")P++;else if(T[b]==="}"){if(P--,P===0)break}b++}M=T.substring(0,b+1),T=T.slice(b+1)}let D,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let P=JSON.parse(R.replace(/'/g,'"')),b={};if(M)try{b=N0(M,Z)}catch(y){let g=y instanceof Error?y.message:String(y);if(J.debug){let h=K0("Include",`Error parsing includeFirst variables: ${g}`,Y,$,L,A);K=K.replace(A,()=>h)}else K=K.replace(A,()=>D||"");continue}let k=!1;for(let y of P){let g=W(y,G,Y);if(!g)continue;if(await n(g)){let h=await U(y,b,$,L);K=K.replace(A,()=>h),k=!0;break}}if(!k)if(D!==void 0)K=K.replace(A,()=>D);else if(J.debug){let y=K0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,L,A);K=K.replace(A,()=>y)}else K=K.replace(A,"")}catch(P){let b=P instanceof Error?P.message:String(P),k=K0("Include",`Error processing @includeFirst: ${b}`,Y,$,L,A);K=K.replace(A,()=>k)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=U0.resolve(H,F);else w=U0.resolve(V,F);let A=U0.normalize(w),N=A.startsWith(O+U0.sep)||A===O,R=A.startsWith(V+U0.sep)||A===V,T=!1,M=U0.dirname(V);if(A.startsWith(M+U0.sep)){if(!U0.relative(M,A).split(U0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))T=!0}if(!N&&!R&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let z=U0.resolve(Y);Q.add(z);async function U(j,H={},L,F){let O=W(j,G,Y);if(!O)return K0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=U0.resolve(O);if(Q.has(V)){let w=[...Q,V].map((A)=>U0.basename(A)).join(" -> ");return K0("Include",`Circular include detected: ${w}`,Y,L,F)}try{X.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(h){let m=h instanceof Error?h.message:String(h);return K0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:h}=await Promise.resolve().then(() => (G3(),Q3));w=h(w,Z)}if(w&&(J.debug||!S5()&&!v4()))try{let{warnUnbalancedTags:h}=await Promise.resolve().then(() => (q3(),rZ));h(w,O)}catch{}let A=w;try{let{processESImports:h}=await Promise.resolve().then(() => (P3(),NY));await h(w,Z,O,J,X)}catch(h){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,h instanceof Error?h.message:h)}let N=A.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(N)A=N[1].trim();let T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[h,m]of Object.entries(H))I[h]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...w.matchAll(D)],P="",b=null;for(let h of E){let m=h[1]||"",i=h[2]||"",c=m.includes("server"),q0=A1(m),F0="";try{let{extractAndStripCssImports:$0,renderVendorStyleTags:k0}=await Promise.resolve().then(() => (w5(),g6)),f0=$0(i,{filePath:O,projectRoot:process.cwd()});i=f0.code,F0=k0(f0.styles)}catch($0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,$0 instanceof Error?$0.message:$0)}if(q0&&i.trim())i=N1(i);if(!c)try{let{hasUserImports:$0,bundleClientScript:k0}=await Promise.resolve().then(() => (t5(),a5));if($0(i))i=await k0(i,O,{projectRoot:process.cwd()})}catch($0){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,$0 instanceof Error?$0.message:$0)}let _0=gz(i);if(_0&&!c){b=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++bY}`;let $0=$1(i),k0=dz($0,b);P+=`${F0}<script data-stx-scoped>${k0}</script>
2806
+ `;continue}if(c)try{let{extractVariables:$0}=await Promise.resolve().then(() => (E5(),q4));await $0(i,I,O)}catch($0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,$0)}if(!c&&!_0){let $0=m.replace(/\bclient\b/i,"").trim();b=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++bY}`;let k0=$1(i),f0=`
2807
2807
  if (!window.stx._scopes) window.stx._scopes = {};
2808
2808
  window.stx._scopes['${b}'] = { __destroyCallbacks: __destroyHooks };
2809
- `,v=kY(k0,f0);P+=`${F0}<script data-stx-scoped${$0?` ${$0}`:""}>${v}</script>
2810
- `}}if(b){let h=hz(A,b);if(A=h.html,h.mergedIntoExisting)P=P.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${h.mergedIntoExisting}']`),b=h.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await f3(A,I,O,J,X,Q);let{processLoops:k}=await Promise.resolve().then(() => (v3(),DY)),y=k(A,I,O);y=C1(y,I,O);let g=p1(w);if(y=s0(y,I,O,{forceSignals:g}),M)y+=`
2809
+ `,v=SY(k0,f0);P+=`${F0}<script data-stx-scoped${$0?` ${$0}`:""}>${v}</script>
2810
+ `}}if(b){let h=mz(A,b);if(A=h.html,h.mergedIntoExisting)P=P.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${h.mergedIntoExisting}']`),b=h.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await g3(A,I,O,J,X,Q);let{processLoops:k}=await Promise.resolve().then(() => (x3(),kY)),y=k(A,I,O);y=C1(y,I,O);let g=p1(w);if(y=s0(y,I,O,{forceSignals:g}),M)y+=`
2811
2811
  `+M;if(P)y+=`
2812
- `+P;return y}catch(w){let A=w instanceof Error?w.message:String(w);return K0("Include",`Error processing include ${j}: ${A}`,Y,L,F)}}let _=/@include\s*\(/g,B;while((B=_.exec(K))!==null){let j=B.index,H=j+B[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){_.lastIndex=F;continue}let A=w[1],N,R=V.substring(w[0].length),T=x3(R,0);if(T!==-1)N=R.substring(T+1).trim();let M={};if(N)try{M=N0(N,Z)}catch(D){let E=D instanceof Error?D.message:String(D);K=K.replace(O,K0("Include",`Error parsing include variables for ${A}: ${E}`,Y,$,j)),_.lastIndex=0;continue}let I=await U(A,M,$,j);K=K.substring(0,j)+I+K.substring(F),_.lastIndex=0}return K}function g3($,Z){let Y=$;function J(X,Q,G,K){let q=X,W=!0;while(W){W=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=q.match(z);if(!U||U.index===void 0)break;let _=U.index,B=U[1],j=_+U[0].length,H=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let A=q.slice(O),N=A.match(H),R=A.match(L),T=N?O+N.index:1/0,M=R?O+R.index:1/0;if(T<M)F++,O=T+(N[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let w=q.slice(j,V);if(!Z[B])Z[B]=[];if(K)Z[B].unshift(w);else Z[B].push(w);q=q.substring(0,_)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function h3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
2813
- `)})}var EY=0,uF,dz;var bY=S(()=>{s4();r0();i1();R0();A0();uF=new T5(500),dz=new Set});import*as d3 from"path";async function SY($,Z,Y=""){if(d3.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 CY($,Z,Y,"@js","@endjs")}async function yY($,Z,Y=""){if(d3.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 CY($,Z,Y,"@ts","@endts")}async function CY($,Z,Y,J,X){let Q=$,G=l1(`${J}([\\s\\S]*?)${X}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:z,index:U}of K)try{let _=Object.keys(Z),B=Object.values(Z),j=z.trim();if(J==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
2812
+ `+P;return y}catch(w){let A=w instanceof Error?w.message:String(w);return K0("Include",`Error processing include ${j}: ${A}`,Y,L,F)}}let _=/@include\s*\(/g,B;while((B=_.exec(K))!==null){let j=B.index,H=j+B[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){_.lastIndex=F;continue}let A=w[1],N,R=V.substring(w[0].length),T=f3(R,0);if(T!==-1)N=R.substring(T+1).trim();let M={};if(N)try{M=N0(N,Z)}catch(D){let E=D instanceof Error?D.message:String(D);K=K.replace(O,K0("Include",`Error parsing include variables for ${A}: ${E}`,Y,$,j)),_.lastIndex=0;continue}let I=await U(A,M,$,j);K=K.substring(0,j)+I+K.substring(F),_.lastIndex=0}return K}function h3($,Z){let Y=$;function J(X,Q,G,K){let q=X,W=!0;while(W){W=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=q.match(z);if(!U||U.index===void 0)break;let _=U.index,B=U[1],j=_+U[0].length,H=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let A=q.slice(O),N=A.match(H),R=A.match(L),T=N?O+N.index:1/0,M=R?O+R.index:1/0;if(T<M)F++,O=T+(N[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let w=q.slice(j,V);if(!Z[B])Z[B]=[];if(K)Z[B].unshift(w);else Z[B].push(w);q=q.substring(0,_)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function d3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
2813
+ `)})}var bY=0,cF,uz;var yY=S(()=>{s4();r0();i1();R0();A0();cF=new T5(500),uz=new Set});import*as m3 from"path";async function CY($,Z,Y=""){if(m3.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 vY($,Z,Y,"@js","@endjs")}async function PY($,Z,Y=""){if(m3.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 vY($,Z,Y,"@ts","@endts")}async function vY($,Z,Y,J,X){let Q=$,G=l1(`${J}([\\s\\S]*?)${X}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:z,index:U}of K)try{let _=Object.keys(Z),B=Object.values(Z),j=z.trim();if(J==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
2814
2814
  ${j}
2815
2815
  ${F}
2816
- `,w=Function(..._,O)(...B);if(w&&typeof w==="object")Object.assign(Z,w);Q=Q.replace(W,"")}catch(_){console.error(`Error executing ${J} code block in ${Y}:`,_);let B=_ instanceof Error?_.message:String(_),j=K0(`${J} Directive`,`Error executing code: ${B}`,Y,$,U,W);console.error(j),Q=Q.replace(W,"")}return Q}var PY=S(()=>{i1();A0()});function uz($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function vY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return uz(J,Q||"_method")})}async function xY($,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 q=await K.handler(Q,Z,Y,J);if(typeof q==="string")Q=q;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(J.debug)console.error(`Error in middleware ${K.name}:`,q);if(J.debug){let W=K0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
2816
+ `,w=Function(..._,O)(...B);if(w&&typeof w==="object")Object.assign(Z,w);Q=Q.replace(W,"")}catch(_){console.error(`Error executing ${J} code block in ${Y}:`,_);let B=_ instanceof Error?_.message:String(_),j=K0(`${J} Directive`,`Error executing code: ${B}`,Y,$,U,W);console.error(j),Q=Q.replace(W,"")}return Q}var xY=S(()=>{i1();A0()});function cz($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function fY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return cz(J,Q||"_method")})}async function gY($,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 q=await K.handler(Q,Z,Y,J);if(typeof q==="string")Q=q;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(J.debug)console.error(`Error in middleware ${K.name}:`,q);if(J.debug){let W=K0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
2817
2817
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${u0(W)}</div>
2818
- `)}}}return Q}async function fY($,Z,Y,J){return xY($,Z,Y,J,"before")}async function gY($,Z,Y,J){return xY($,Z,Y,J,"after")}var hY=S(()=>{r0();A0()});import{defineRoute as ZV,defineRoutes as YV,resetRoutes as JV,route as XV,setAppUrl as QV}from"stx-router";import{route as pz}from"stx-router";function dY($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?N0(X,{}):{};return pz(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var mY=S(()=>{R0()});async function uY($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(p5.exact[$])for(let J of p5.exact[$])await Promise.resolve(J(Z,$));if(p5.exact[Y])for(let J of p5.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of p5.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var p5;var pY=S(()=>{p5={patterns:[],exact:{}}});function cY($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>cY(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function lY($,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(W){return X.some(([z,U])=>W>=z&&W<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let W=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,_,B=z,j=!1;while((_=U.exec(z))!==null){let H=_[1],L=_[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.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 A=Function(...F,`return (${L})`)(...O);if(H==="class"){let N=cY(A);if(N){let R=B.match(/\sclass="([^"]*)"/);if(R)B=B.replace(R[0],` class="${R[1]} ${N}"`);else B=B.replace(_[0],` class="${N}"`)}else B=B.replace(_[0],"");j=!0;continue}if(cz.has(H)){if(A)B=B.replace(_[0],` ${H}`);else B=B.replace(_[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(_[0],"");else{let N=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(_[0],` ${H}="${N}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${Q[1]}${B}${H}>`;q.push({start:Q.index,end:Q.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:_}=q[W];Y=Y.slice(0,z)+_+Y.slice(U)}return Y}var cz;var iY=S(()=>{cz=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function x1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;return{full:J[0],tag:J[1],attrs:J[2],selfClosing:J[3].includes("/")||lz.has(J[1].toLowerCase()),start:J.index,end:J.index+J[0].length}}function nz($,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($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)J++,X=K.index+K[0].length;else{if(J--,J===0)return q.index+q[0].length;X=q.index+q[0].length}}return-1}function a0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=nz($,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 nY($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function Q5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function j1($,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 oz($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function sz($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let X=Q5(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(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=j1(J.attrs,"v-for"),z=j1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=a0(Z,J),_=Z.slice(U.outerStart,U.outerEnd),B=H1(_,{...J,start:0,end:J.end-J.start},z),j=`@foreach(${q})
2818
+ `)}}}return Q}async function hY($,Z,Y,J){return gY($,Z,Y,J,"before")}async function dY($,Z,Y,J){return gY($,Z,Y,J,"after")}var mY=S(()=>{r0();A0()});import{defineRoute as JV,defineRoutes as XV,resetRoutes as QV,route as GV,setAppUrl as KV}from"stx-router";import{route as lz}from"stx-router";function uY($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?N0(X,{}):{};return lz(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var pY=S(()=>{R0()});async function cY($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(p5.exact[$])for(let J of p5.exact[$])await Promise.resolve(J(Z,$));if(p5.exact[Y])for(let J of p5.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of p5.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var p5;var lY=S(()=>{p5={patterns:[],exact:{}}});function iY($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>iY(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function nY($,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(W){return X.some(([z,U])=>W>=z&&W<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let W=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,_,B=z,j=!1;while((_=U.exec(z))!==null){let H=_[1],L=_[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.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 A=Function(...F,`return (${L})`)(...O);if(H==="class"){let N=iY(A);if(N){let R=B.match(/\sclass="([^"]*)"/);if(R)B=B.replace(R[0],` class="${R[1]} ${N}"`);else B=B.replace(_[0],` class="${N}"`)}else B=B.replace(_[0],"");j=!0;continue}if(iz.has(H)){if(A)B=B.replace(_[0],` ${H}`);else B=B.replace(_[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(_[0],"");else{let N=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(_[0],` ${H}="${N}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${Q[1]}${B}${H}>`;q.push({start:Q.index,end:Q.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:_}=q[W];Y=Y.slice(0,z)+_+Y.slice(U)}return Y}var iz;var oY=S(()=>{iz=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function x1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;return{full:J[0],tag:J[1],attrs:J[2],selfClosing:J[3].includes("/")||nz.has(J[1].toLowerCase()),start:J.index,end:J.index+J[0].length}}function sz($,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($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)J++,X=K.index+K[0].length;else{if(J--,J===0)return q.index+q[0].length;X=q.index+q[0].length}}return-1}function a0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=sz($,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 sY($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function Q5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function j1($,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 rz($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function az($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let X=Q5(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(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=j1(J.attrs,"v-for"),z=j1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=a0(Z,J),_=Z.slice(U.outerStart,U.outerEnd),B=H1(_,{...J,start:0,end:J.end-J.start},z),j=`@foreach(${q})
2819
2819
  `,H=`${j}${B}
2820
- @endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+j.length}return Z}function rz($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let X=Q5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=a0(Z,J),K=j1(J.attrs,"v-if"),q=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:q,parsedTag:J});let W=G.outerEnd,z=!0;while(z){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=x1(Z,W+L);if(!F){z=!1;break}let O=Q5(F.attrs,"v-else-if"),V=nY(F.attrs,"v-else");if(O!==null){let w=a0(Z,F),A=j1(F.attrs,"v-else-if"),N=H1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);Q.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=w.outerEnd}else if(V){let w=a0(Z,F),A=j1(F.attrs,"v-else"),N=H1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);Q.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),z=!1}else z=!1}let U=[];for(let H of Q)if(H.type==="if")U.push(`@if(${H.expr})
2820
+ @endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+j.length}return Z}function tz($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let X=Q5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=a0(Z,J),K=j1(J.attrs,"v-if"),q=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:q,parsedTag:J});let W=G.outerEnd,z=!0;while(z){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=x1(Z,W+L);if(!F){z=!1;break}let O=Q5(F.attrs,"v-else-if"),V=sY(F.attrs,"v-else");if(O!==null){let w=a0(Z,F),A=j1(F.attrs,"v-else-if"),N=H1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);Q.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=w.outerEnd}else if(V){let w=a0(Z,F),A=j1(F.attrs,"v-else"),N=H1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);Q.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),z=!1}else z=!1}let U=[];for(let H of Q)if(H.type==="if")U.push(`@if(${H.expr})
2821
2821
  ${H.element}`);else if(H.type==="else-if")U.push(`@elseif(${H.expr})
2822
2822
  ${H.element}`);else U.push(`@else
2823
2823
  ${H.element}`);U.push("@endif");let _=U.join(`
2824
- `),B=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,B)+_+Z.slice(j),Y=B+_.length}return Z}function az($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function tz($){let Z=$,Y=0;while(Y<Z.length){let J=x1(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 z=K[1],U=K[2],_=K[3];X=X.replace(K[0],""),X+=` :${z}="${_}" @update:${z}="${_} = $event"`,K=X.match(G)}if(Q){let z=a0(Z,J),U=Z.slice(z.outerStart,z.outerEnd),_=H1(U,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length;continue}let q=Q5(J.attrs,"v-model");if(q===null){Y=J.end;continue}if(iz.has(J.tag.toLowerCase())){let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=a0(Z,J),_=Z.slice(U.outerStart,U.outerEnd),B=H1(_,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length}else{let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=a0(Z,J),_=Z.slice(U.outerStart,U.outerEnd),B=H1(_,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length}}return Z}function ez($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function $W($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function ZW($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let X=Q5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=a0(Z,J),G=j1(J.attrs,"v-html"),K=J.selfClosing?" /":"",q=`<${J.tag}${G}${K}>{!! ${X} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function YW($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let X=Q5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=a0(Z,J),G=j1(J.attrs,"v-text"),K=J.selfClosing?" /":"",q=`<${J.tag}${G}${K}>{{ ${X} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function JW($){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 XW($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;if(!nY(J.attrs,"v-once")){Y=J.end;continue}let X=j1(J.attrs,"v-once"),Q=a0(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
2824
+ `),B=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,B)+_+Z.slice(j),Y=B+_.length}return Z}function ez($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function $W($){let Z=$,Y=0;while(Y<Z.length){let J=x1(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 z=K[1],U=K[2],_=K[3];X=X.replace(K[0],""),X+=` :${z}="${_}" @update:${z}="${_} = $event"`,K=X.match(G)}if(Q){let z=a0(Z,J),U=Z.slice(z.outerStart,z.outerEnd),_=H1(U,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length;continue}let q=Q5(J.attrs,"v-model");if(q===null){Y=J.end;continue}if(oz.has(J.tag.toLowerCase())){let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=a0(Z,J),_=Z.slice(U.outerStart,U.outerEnd),B=H1(_,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length}else{let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=a0(Z,J),_=Z.slice(U.outerStart,U.outerEnd),B=H1(_,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length}}return Z}function ZW($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function YW($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function JW($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let X=Q5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=a0(Z,J),G=j1(J.attrs,"v-html"),K=J.selfClosing?" /":"",q=`<${J.tag}${G}${K}>{!! ${X} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function XW($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let X=Q5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=a0(Z,J),G=j1(J.attrs,"v-text"),K=J.selfClosing?" /":"",q=`<${J.tag}${G}${K}>{{ ${X} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function QW($){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 GW($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;if(!sY(J.attrs,"v-once")){Y=J.end;continue}let X=j1(J.attrs,"v-once"),Q=a0(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
2825
2825
  ${H1(G,{...J,start:0,end:J.end-J.start},X)}
2826
- @endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function QW($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function GW($){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 oY($){if(!oz($))return $;let Z=$;return Z=sz(Z),Z=rz(Z),Z=XW(Z),Z=ez(Z),Z=$W(Z),Z=tz(Z),Z=az(Z),Z=GW(Z),Z=ZW(Z),Z=YW(Z),Z=JW(Z),Z=QW(Z),Z}var lz,iz;var sY=S(()=>{lz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),iz=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 W$($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function rY($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=Z0(z.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${W$(z.expr)}" -->`;Q=Q.slice(0,z.index)+O+Q.slice(z.index+z.full.length);continue}let _=z.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(_))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{B[O]=Z0(V,Z)}catch{B[O]=V}else B[O]=V}let L=J.componentsDir||"components",F=await I1(U,B,z.slotContent,L,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,z.index)+F+Q.slice(z.index+z.full.length)}catch(U){let _=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${W$(_)} -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}}return Q=await KW(Q,Z,Y,J,X),Q}async function KW($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=Z0(z.expr,Z);if(!U||typeof U!=="string"){let j=`<!-- dynamic component: could not resolve "${W$(z.expr)}" -->`;Q=Q.slice(0,z.index)+j+Q.slice(z.index+z.full.length);continue}let _=J.componentsDir||"components",B=await I1(U,{},"",_,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}catch(U){let _=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${W$(_)} -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}}return Q}var aY=S(()=>{A0();R0()});function tY($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
2827
- ${$.slice(Z)}`}function qW($,Z={},Y={}){let{title:J="stx App",lang:X="en",meta:Q=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:z={}}=Z,U=Y.title||J,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...Q].map((A)=>{return` <meta ${Object.entries(A).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
2826
+ @endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function KW($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function qW($){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 rY($){if(!rz($))return $;let Z=$;return Z=az(Z),Z=tz(Z),Z=GW(Z),Z=ZW(Z),Z=YW(Z),Z=$W(Z),Z=ez(Z),Z=qW(Z),Z=JW(Z),Z=XW(Z),Z=QW(Z),Z=KW(Z),Z}var nz,oz;var aY=S(()=>{nz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),oz=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 W$($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function tY($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=Z0(z.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${W$(z.expr)}" -->`;Q=Q.slice(0,z.index)+O+Q.slice(z.index+z.full.length);continue}let _=z.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(_))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{B[O]=Z0(V,Z)}catch{B[O]=V}else B[O]=V}let L=J.componentsDir||"components",F=await I1(U,B,z.slotContent,L,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,z.index)+F+Q.slice(z.index+z.full.length)}catch(U){let _=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${W$(_)} -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}}return Q=await zW(Q,Z,Y,J,X),Q}async function zW($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=Z0(z.expr,Z);if(!U||typeof U!=="string"){let j=`<!-- dynamic component: could not resolve "${W$(z.expr)}" -->`;Q=Q.slice(0,z.index)+j+Q.slice(z.index+z.full.length);continue}let _=J.componentsDir||"components",B=await I1(U,{},"",_,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}catch(U){let _=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${W$(_)} -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}}return Q}var eY=S(()=>{A0();R0()});function $2($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
2827
+ ${$.slice(Z)}`}function WW($,Z={},Y={}){let{title:J="stx App",lang:X="en",meta:Q=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:z={}}=Z,U=Y.title||J,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...Q].map((A)=>{return` <meta ${Object.entries(A).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
2828
2828
  `),H=G.map((A)=>{return` <link ${Object.entries(A).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
2829
2829
  `),L=K.map((A)=>{if(A.src)return` <script ${Object.entries(A).filter(([R])=>R!=="content").map(([R,T])=>`${R}="${T}"`).join(" ")}></script>`;if(A.content)return` <script>${A.content}</script>`;return""}).filter(Boolean).join(`
2830
2830
  `),F=Object.entries(z).map(([A,N])=>` ${A}="${N}"`).join(""),O=W?` class="${W}"`:"",V=[j,` <title>${U}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((A)=>` ${A}`),...(Y.headScripts||[]).map((A)=>` ${A}`),Y.headStack||""].filter(Boolean),w=[$,...(Y.bodyScripts||[]).map((A)=>A),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
@@ -2837,9 +2837,9 @@ ${V.join(`
2837
2837
  ${w.join(`
2838
2838
  `)}
2839
2839
  </body>
2840
- </html>`}function m3($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function eY($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:X=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of J){let z=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(z&&K.includes(z))continue;q.push(` <meta ${Object.entries(W).map(([U,_])=>`${U}="${_}"`).join(" ")}>`)}for(let W of X){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([z,U])=>`${z}="${U}"`).join(" ")}>`)}for(let W of Q)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([z])=>z!=="content").map(([z,U])=>`${z}="${U}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
2840
+ </html>`}function u3($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function Z2($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:X=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of J){let z=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(z&&K.includes(z))continue;q.push(` <meta ${Object.entries(W).map(([U,_])=>`${U}="${_}"`).join(" ")}>`)}for(let W of X){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([z,U])=>`${z}="${U}"`).join(" ")}>`)}for(let W of Q)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([z])=>z!=="content").map(([z,U])=>`${z}="${U}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
2841
2841
  `)}
2842
- ${$.slice(Y)}`}function $2($,Z={},Y={}){if(m3($))return $;return qW($,Z,Y)}function B$($){let Z=$,Y=new Set,J=new Set,X=()=>{if(x0)J.add(x0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),c5)J.forEach((K)=>_$.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}),X}function j$($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,c5)J.forEach((G)=>_$.add(G));else J.forEach((G)=>G())},Q=()=>{if(x0)J.add(x0);if(Y){let G=x0;x0=X,U$.push(X);try{Z=$()}finally{U$.pop(),x0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Q}function H$($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=x0;x0=X,U$.push(X);try{Y=$()}finally{U$.pop(),x0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function u3($){if(c5){$();return}c5=!0;try{$()}finally{c5=!1,_$.forEach((Z)=>Z()),_$.clear()}}function p3($){zW.push($)}function c3($){WW.push($)}function O$($){return typeof $==="function"&&$._isSignal===!0}function L$($){return typeof $==="function"&&$._isDerived===!0}function l3($){if(O$($)||L$($))return $();return $}function F$($){let Z=x0;x0=null;try{return $()}finally{x0=Z}}function UW($,Z){let Y=typeof $==="function"?$:()=>$,J=B$([]),X=j$(()=>J().reduce((K,q)=>Z(K,q.action),Y())),Q=!1;return H$(()=>{if(Y(),!Q){Q=!0;return}if(F$(()=>J().length))J.set([])}),[X,(K,q)=>{let W={action:K};J.set([...J(),W]);let z=()=>{let U=J().filter((_)=>_!==W);if(U.length!==J().length)J.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(z,z);return z}]}var x0=null,U$,c5=!1,_$,zW,WW;var i3=S(()=>{U$=[],_$=new Set,zW=[],WW=[]});var Y2={};r(Y2,{useOptimistic:()=>UW,untrack:()=>l3,state:()=>B$,peek:()=>F$,onMount:()=>p3,onDestroy:()=>c3,isSignal:()=>O$,isDerived:()=>L$,generateSignalsRuntimeDev:()=>V$,generateSignalsRuntime:()=>Z2,effect:()=>H$,derived:()=>j$,default:()=>BW,batch:()=>u3});function Z2(){try{let $=_W(V$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return V$()}}function _W($){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 q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function V$(){return`
2842
+ ${$.slice(Y)}`}function Y2($,Z={},Y={}){if(u3($))return $;return WW($,Z,Y)}function B$($){let Z=$,Y=new Set,J=new Set,X=()=>{if(x0)J.add(x0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),c5)J.forEach((K)=>_$.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}),X}function j$($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,c5)J.forEach((G)=>_$.add(G));else J.forEach((G)=>G())},Q=()=>{if(x0)J.add(x0);if(Y){let G=x0;x0=X,U$.push(X);try{Z=$()}finally{U$.pop(),x0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Q}function H$($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=x0;x0=X,U$.push(X);try{Y=$()}finally{U$.pop(),x0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function p3($){if(c5){$();return}c5=!0;try{$()}finally{c5=!1,_$.forEach((Z)=>Z()),_$.clear()}}function c3($){UW.push($)}function l3($){_W.push($)}function O$($){return typeof $==="function"&&$._isSignal===!0}function L$($){return typeof $==="function"&&$._isDerived===!0}function i3($){if(O$($)||L$($))return $();return $}function F$($){let Z=x0;x0=null;try{return $()}finally{x0=Z}}function BW($,Z){let Y=typeof $==="function"?$:()=>$,J=B$([]),X=j$(()=>J().reduce((K,q)=>Z(K,q.action),Y())),Q=!1;return H$(()=>{if(Y(),!Q){Q=!0;return}if(F$(()=>J().length))J.set([])}),[X,(K,q)=>{let W={action:K};J.set([...J(),W]);let z=()=>{let U=J().filter((_)=>_!==W);if(U.length!==J().length)J.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(z,z);return z}]}var x0=null,U$,c5=!1,_$,UW,_W;var n3=S(()=>{U$=[],_$=new Set,UW=[],_W=[]});var X2={};r(X2,{useOptimistic:()=>BW,untrack:()=>i3,state:()=>B$,peek:()=>F$,onMount:()=>c3,onDestroy:()=>l3,isSignal:()=>O$,isDerived:()=>L$,generateSignalsRuntimeDev:()=>V$,generateSignalsRuntime:()=>J2,effect:()=>H$,derived:()=>j$,default:()=>HW,batch:()=>p3});function J2(){try{let $=jW(V$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return V$()}}function jW($){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 q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function V$(){return`
2843
2843
  // STX Signals Runtime (Development Build)
2844
2844
  console.log('[stx] signals runtime loading');
2845
2845
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -8060,7 +8060,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
8060
8060
  }
8061
8061
  }
8062
8062
  })();
8063
- `}var BW;var J2=S(()=>{i3();i3();BW={state:B$,derived:j$,effect:H$,batch:u3,onMount:p3,onDestroy:c3,isSignal:O$,isDerived:L$,untrack:l3,peek:F$,generateSignalsRuntime:Z2,generateSignalsRuntimeDev:V$}});var n3={};r(n3,{templateCache:()=>X2,readFileCached:()=>jW,invalidateFileCacheByDir:()=>OW,invalidateFileCache:()=>HW,hashFilePath:()=>l5,getCachedSignalsRuntime:()=>VW,getCachedRouterScript:()=>wW,clearDevCaches:()=>AW,checkCache:()=>NW,cacheTemplate:()=>RW,__setSignalsGeneratorsForTest:()=>FW});import O1 from"fs";import G5 from"path";async function jW($){let Y;for(let J=0;J<3;J++)try{let Q=(await O1.promises.stat($)).mtime.getTime(),G=f1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),W=(await O1.promises.stat($)).mtime.getTime();if(W!==Q)continue;return f1.set($,{content:K,mtime:W}),K}catch(X){Y=X;break}throw f1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function HW($){f1.delete($)}function OW($){for(let Z of f1.keys())if(Z.startsWith($))f1.delete(Z)}function FW($){Q2=$}async function VW($=!1){let Z=Q2??await Promise.resolve().then(() => (J2(),Y2));if($)return Z.generateSignalsRuntimeDev();if(w$===null)w$=Z.generateSignalsRuntime();return w$}async function wW(){if(A$===null){let{getRouterScript:$}=await import("stx-router");A$=$()}return A$}function AW(){f1.clear(),w$=null,LW=null,A$=null}function G2($){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 NW($,Z){try{if(!Z.cachePath)return null;let Y=G5.resolve(Z.cachePath),J=G5.join(Y,`${l5($)}.html`),X=G5.join(Y,`${l5($)}.meta.json`);if(!await n(J)||!await n(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==G2(Z))return null;if((await O1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await n(q)){if((await O1.promises.stat(q)).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 RW($,Z,Y,J){try{if(!J.cachePath)return;let X=G5.resolve(J.cachePath);await O1.promises.mkdir(X,{recursive:!0});let Q=G5.join(X,`${l5($)}.html`),G=G5.join(X,`${l5($)}.meta.json`),K=await O1.promises.stat($);await Bun.write(Q,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:G2(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),X2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function l5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,TW)}var X2,f1,w$=null,LW=null,Q2=null,A$=null,TW=16;var o3=S(()=>{A0();X2=new Map,f1=new Map});function K2($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",J;while((J=Z.exec($))!==null)Y+=J[1]+`
8063
+ `}var HW;var Q2=S(()=>{n3();n3();HW={state:B$,derived:j$,effect:H$,batch:p3,onMount:c3,onDestroy:l3,isSignal:O$,isDerived:L$,untrack:i3,peek:F$,generateSignalsRuntime:J2,generateSignalsRuntimeDev:V$}});var o3={};r(o3,{templateCache:()=>G2,readFileCached:()=>OW,invalidateFileCacheByDir:()=>FW,invalidateFileCache:()=>LW,hashFilePath:()=>l5,getCachedSignalsRuntime:()=>AW,getCachedRouterScript:()=>NW,clearDevCaches:()=>RW,checkCache:()=>TW,cacheTemplate:()=>MW,__setSignalsGeneratorsForTest:()=>wW});import O1 from"fs";import G5 from"path";async function OW($){let Y;for(let J=0;J<3;J++)try{let Q=(await O1.promises.stat($)).mtime.getTime(),G=f1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),W=(await O1.promises.stat($)).mtime.getTime();if(W!==Q)continue;return f1.set($,{content:K,mtime:W}),K}catch(X){Y=X;break}throw f1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function LW($){f1.delete($)}function FW($){for(let Z of f1.keys())if(Z.startsWith($))f1.delete(Z)}function wW($){K2=$}async function AW($=!1){let Z=K2??await Promise.resolve().then(() => (Q2(),X2));if($)return Z.generateSignalsRuntimeDev();if(w$===null)w$=Z.generateSignalsRuntime();return w$}async function NW(){if(A$===null){let{getRouterScript:$}=await import("stx-router");A$=$()}return A$}function RW(){f1.clear(),w$=null,VW=null,A$=null}function q2($){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 TW($,Z){try{if(!Z.cachePath)return null;let Y=G5.resolve(Z.cachePath),J=G5.join(Y,`${l5($)}.html`),X=G5.join(Y,`${l5($)}.meta.json`);if(!await n(J)||!await n(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==q2(Z))return null;if((await O1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await n(q)){if((await O1.promises.stat(q)).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 MW($,Z,Y,J){try{if(!J.cachePath)return;let X=G5.resolve(J.cachePath);await O1.promises.mkdir(X,{recursive:!0});let Q=G5.join(X,`${l5($)}.html`),G=G5.join(X,`${l5($)}.meta.json`),K=await O1.promises.stat($);await Bun.write(Q,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:q2(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),G2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function l5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,IW)}var G2,f1,w$=null,VW=null,K2=null,A$=null,IW=16;var s3=S(()=>{A0();G2=new Map,f1=new Map});function z2($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",J;while((J=Z.exec($))!==null)Y+=J[1]+`
8064
8064
  `;let X=/\{\{([\s\S]*?)\}\}/g;while((J=X.exec($))!==null)Y+=J[1]+`
8065
8065
  `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((_)=>{return new RegExp(`\\b${_}\\b`).test(Y)}),K=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"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,W,z=!1;while((W=q.exec(Y))!==null)if(!K.has(W[1])){z=!0;break}if(!G&&!z)return $;let U=`<script type="module">
8066
8066
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -8069,22 +8069,22 @@ import '@stacksjs/browser'
8069
8069
  `+$.slice(j);return $.replace("</head>",`${U}
8070
8070
  </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
8071
8071
  ${U}`);return U+`
8072
- `+$}async function q2($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8072
+ `+$}async function W2($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8073
8073
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8074
8074
  `+$.slice(q)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8075
- `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (o3(),n3)),X=`<script data-stx-scoped>${await Y(Z.debug)}</script>`,Q=$.indexOf("<script");if(Q!==-1)return $.slice(0,Q)+X+`
8075
+ `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (s3(),o3)),X=`<script data-stx-scoped>${await Y(Z.debug)}</script>`,Q=$.indexOf("<script");if(Q!==-1)return $.slice(0,Q)+X+`
8076
8076
  `+$.slice(Q);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+X+`
8077
8077
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
8078
8078
  `+X+$.slice(K+1)}return X+`
8079
- `+$}async function s3($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";if(Y){let K={};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;if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
8080
- `}let{getCachedRouterScript:X}=await Promise.resolve().then(() => (o3(),n3)),Q=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await X()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
8081
- </body>`+$.slice(G+7)}var V2={};r(V2,{scanScriptTags:()=>j2,rewriteStxImportSpecifiers:()=>F2,processSignals:()=>$6,processScriptSetup:()=>O2,preEvalLiteralReactiveIfs:()=>t3,parseLoopExpression:()=>H2,hasSignalsSyntax:()=>M$,findMarkupIndexOutsideScripts:()=>T$,extractExports:()=>L2,convertSignalLoopsToAttributes:()=>e3,convertSignalDirectivesToAttributes:()=>a3});function j2($,Z={}){let Y=[];N$.lastIndex=0;let J;while((J=N$.exec($))!==null){let X=J[1],Q=J.index+J[0].length,G=$.toLowerCase().indexOf("</script>",Q);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(X)){N$.lastIndex=K;continue}Y.push({fullMatch:$.slice(J.index,K),attrs:X,body:$.slice(Q,G),start:J.index,end:K}),N$.lastIndex=K}return Y}function H2($){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}=z2(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}=z2(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function z2($){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 M$($){return[/@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*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function IW($){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 DW($){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 EW($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function U2($,Z,Y){if(!$)return!1;let J=EW($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(J))!==null){let _=q[1];if(J.slice(0,q.index).trimEnd().endsWith("."))continue;if(W2.has(_))continue;if(Z.has(_))X=!0;else if(Y&&_ in Y)Q=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=W.exec(J))!==null){let _=z[1];if(J.slice(0,z.index).trimEnd().endsWith("."))continue;if(W2.has(_)||Y&&_ in Y)continue;G=!0}return(X||G)&&!Q}function R$($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,X=$.trim(),Q=X.match(B2);if(Q&&kW(Q[3],Q[1])){let[,G,K,q]=Q;return`<${G}${K}${J}>${q}</${G}>`}return`<template${J}>${X}</template>`}function kW($,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 a3($,Z){let Y=$,J=DW($),X=/@if\s*\(/g,Q,G=[];while((Q=X.exec(Y))!==null){let K=Q.index,q=K+Q[0].length,W=1,z=q;while(z<Y.length&&W>0){if(Y[z]==="(")W++;else if(Y[z]===")")W--;z++}if(W!==0)continue;let U=Y.substring(q,z-1).trim(),_=z,B=1,j=_,H=/@(if\s*\(|endif)/g;H.lastIndex=_;let L;while((L=H.exec(Y))!==null)if(L[1].startsWith("if"))B++;else if(L[1]==="endif"){if(B--,B===0){j=L.index+L[0].length;break}}if(B!==0)continue;let F=Y.substring(_,j-6).trim(),O;if(IW(F)){let V=x5(Y.substring(K,j));if(V.length===0)continue;let w=V[0].branches.filter((R)=>R.type!=="else");if(!(w.length>0&&w.every((R)=>U2(R.condition,J,Z))))continue;O=V[0].branches.map((R)=>{if(R.type==="elseif")return R$(R.content,"@else-if",R.condition??"");if(R.type==="else")return R$(R.content,"@else");return R$(R.content,"@if",R.condition??"")}).join(`
8082
- `)}else{if(!U2(U,J,Z))continue;O=R$(F,"@if",U)}G.push({start:K,end:j,replacement:O})}for(let K=G.length-1;K>=0;K--){let{start:q,end:W,replacement:z}=G[K];Y=Y.substring(0,q)+z+Y.substring(W)}return Y}function bW($){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 SW($,Z,Y,J){if(r3.has(Y.toLowerCase()))return J;let X=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,q=J;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let B=$.indexOf("-->",q+4);if(B===-1)return-1;q=B+3;continue}let z=/^<(script|style)\b/i.exec($.slice(q,q+8));if(z){let B=$.indexOf(">",q);if(B===-1)return-1;if($[B-1]==="/"){q=B+1;continue}let j=Q.indexOf(`</${z[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!B){q++;continue}if(B[1].toLowerCase()===X){if(K--,q+=B[0].length,K===0)return q;continue}q+=B[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!U){q++;continue}let _=$.indexOf(">",q);if(_===-1)return-1;if(U[1].toLowerCase()===X){let B=$.slice(q,_+1);if(!(/\/\s*>$/.test(B)||r3.has(X)))K++}q=_+1}return-1}function CW($,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 yW.test(Q)}function t3($){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=(U)=>Z.some(([_,B])=>U>=_&&U<B),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(X(K.index))continue;let[U,_,B,j,H,L,F]=K,O=bW(H);if(O===void 0)continue;let V=K.index,w=V+U.length,R=!!F||/\/\s*>$/.test(U)||r3.has(_.toLowerCase())?w:SW($,V,_,w);if(R===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&CW($,R)){Q.lastIndex=w;continue}if(O===!0){let M=`<${_}${B}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:R,replacement:""}),Q.lastIndex=R}if(G.length===0)return $;G.sort((U,_)=>U.start-_.start);let q=[],W=-1;for(let U of G){if(U.start<W)continue;q.push(U),W=U.end}let z=$;for(let U=q.length-1;U>=0;U--){let{start:_,end:B,replacement:j}=q[U];z=z.substring(0,_)+j+z.substring(B)}return z}function e3($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,X,Q=[];while((X=J.exec(Y))!==null){let G=X[1],K=X.index,q=K+X[0].length,W=1,z=q;while(z<Y.length&&W>0){if(Y[z]==="(")W++;else if(Y[z]===")")W--;z++}if(W!==0)continue;let U=Y.substring(q,z-1).trim(),_=z,B=H2(U);if(B.iterable){let N=B.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N))continue;if(Z){let R=N.split(/[.[(]/)[0].trim();if(R&&R in Z)continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=_,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=_;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(_,L-j.length).trim(),w=V.match(B2),A;if(w){let[,N,R,T]=w;A=`<${N}${R} @for="${U}">${T}</${N}>`}else A=`<template @for="${U}">${V}</template>`;Q.push({start:K,end:L,replacement:A})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function PW($){let Z=new Set,Y=[],J=0,X=0,Q=$.length,G=(z)=>{let U=J+1;while(U<Q){let _=$[U];if(_==="\\"){U+=2;continue}if(_===z)return U+1;U++}return Q},K=()=>{let z=J+2;while(z<Q&&$[z]!==`
8079
+ `+$}async function r3($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";if(Y){let K={};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;if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
8080
+ `}let{getCachedRouterScript:X}=await Promise.resolve().then(() => (s3(),o3)),Q=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await X()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
8081
+ </body>`+$.slice(G+7)}var A2={};r(A2,{scanScriptTags:()=>O2,rewriteStxImportSpecifiers:()=>w2,processSignals:()=>Z6,processScriptSetup:()=>F2,preEvalLiteralReactiveIfs:()=>e3,parseLoopExpression:()=>L2,hasSignalsSyntax:()=>M$,findMarkupIndexOutsideScripts:()=>T$,extractExports:()=>V2,convertSignalLoopsToAttributes:()=>$6,convertSignalDirectivesToAttributes:()=>t3});function O2($,Z={}){let Y=[];N$.lastIndex=0;let J;while((J=N$.exec($))!==null){let X=J[1],Q=J.index+J[0].length,G=$.toLowerCase().indexOf("</script>",Q);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(X)){N$.lastIndex=K;continue}Y.push({fullMatch:$.slice(J.index,K),attrs:X,body:$.slice(Q,G),start:J.index,end:K}),N$.lastIndex=K}return Y}function L2($){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}=U2(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}=U2(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function U2($){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 M$($){return[/@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*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function EW($){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 kW($){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 bW($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function B2($,Z,Y){if(!$)return!1;let J=bW($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(J))!==null){let _=q[1];if(J.slice(0,q.index).trimEnd().endsWith("."))continue;if(_2.has(_))continue;if(Z.has(_))X=!0;else if(Y&&_ in Y)Q=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=W.exec(J))!==null){let _=z[1];if(J.slice(0,z.index).trimEnd().endsWith("."))continue;if(_2.has(_)||Y&&_ in Y)continue;G=!0}return(X||G)&&!Q}function R$($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,X=$.trim(),Q=X.match(H2);if(Q&&SW(Q[3],Q[1])){let[,G,K,q]=Q;return`<${G}${K}${J}>${q}</${G}>`}return`<template${J}>${X}</template>`}function SW($,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 t3($,Z){let Y=$,J=kW($),X=/@if\s*\(/g,Q,G=[];while((Q=X.exec(Y))!==null){let K=Q.index,q=K+Q[0].length,W=1,z=q;while(z<Y.length&&W>0){if(Y[z]==="(")W++;else if(Y[z]===")")W--;z++}if(W!==0)continue;let U=Y.substring(q,z-1).trim(),_=z,B=1,j=_,H=/@(if\s*\(|endif)/g;H.lastIndex=_;let L;while((L=H.exec(Y))!==null)if(L[1].startsWith("if"))B++;else if(L[1]==="endif"){if(B--,B===0){j=L.index+L[0].length;break}}if(B!==0)continue;let F=Y.substring(_,j-6).trim(),O;if(EW(F)){let V=x5(Y.substring(K,j));if(V.length===0)continue;let w=V[0].branches.filter((R)=>R.type!=="else");if(!(w.length>0&&w.every((R)=>B2(R.condition,J,Z))))continue;O=V[0].branches.map((R)=>{if(R.type==="elseif")return R$(R.content,"@else-if",R.condition??"");if(R.type==="else")return R$(R.content,"@else");return R$(R.content,"@if",R.condition??"")}).join(`
8082
+ `)}else{if(!B2(U,J,Z))continue;O=R$(F,"@if",U)}G.push({start:K,end:j,replacement:O})}for(let K=G.length-1;K>=0;K--){let{start:q,end:W,replacement:z}=G[K];Y=Y.substring(0,q)+z+Y.substring(W)}return Y}function yW($){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 CW($,Z,Y,J){if(a3.has(Y.toLowerCase()))return J;let X=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,q=J;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let B=$.indexOf("-->",q+4);if(B===-1)return-1;q=B+3;continue}let z=/^<(script|style)\b/i.exec($.slice(q,q+8));if(z){let B=$.indexOf(">",q);if(B===-1)return-1;if($[B-1]==="/"){q=B+1;continue}let j=Q.indexOf(`</${z[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!B){q++;continue}if(B[1].toLowerCase()===X){if(K--,q+=B[0].length,K===0)return q;continue}q+=B[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!U){q++;continue}let _=$.indexOf(">",q);if(_===-1)return-1;if(U[1].toLowerCase()===X){let B=$.slice(q,_+1);if(!(/\/\s*>$/.test(B)||a3.has(X)))K++}q=_+1}return-1}function vW($,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 PW.test(Q)}function e3($){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=(U)=>Z.some(([_,B])=>U>=_&&U<B),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(X(K.index))continue;let[U,_,B,j,H,L,F]=K,O=yW(H);if(O===void 0)continue;let V=K.index,w=V+U.length,R=!!F||/\/\s*>$/.test(U)||a3.has(_.toLowerCase())?w:CW($,V,_,w);if(R===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&vW($,R)){Q.lastIndex=w;continue}if(O===!0){let M=`<${_}${B}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:R,replacement:""}),Q.lastIndex=R}if(G.length===0)return $;G.sort((U,_)=>U.start-_.start);let q=[],W=-1;for(let U of G){if(U.start<W)continue;q.push(U),W=U.end}let z=$;for(let U=q.length-1;U>=0;U--){let{start:_,end:B,replacement:j}=q[U];z=z.substring(0,_)+j+z.substring(B)}return z}function $6($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,X,Q=[];while((X=J.exec(Y))!==null){let G=X[1],K=X.index,q=K+X[0].length,W=1,z=q;while(z<Y.length&&W>0){if(Y[z]==="(")W++;else if(Y[z]===")")W--;z++}if(W!==0)continue;let U=Y.substring(q,z-1).trim(),_=z,B=L2(U);if(B.iterable){let N=B.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N))continue;if(Z){let R=N.split(/[.[(]/)[0].trim();if(R&&R in Z)continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=_,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=_;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(_,L-j.length).trim(),w=V.match(H2),A;if(w){let[,N,R,T]=w;A=`<${N}${R} @for="${U}">${T}</${N}>`}else A=`<template @for="${U}">${V}</template>`;Q.push({start:K,end:L,replacement:A})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function xW($){let Z=new Set,Y=[],J=0,X=0,Q=$.length,G=(z)=>{let U=J+1;while(U<Q){let _=$[U];if(_==="\\"){U+=2;continue}if(_===z)return U+1;U++}return Q},K=()=>{let z=J+2;while(z<Q&&$[z]!==`
8083
8083
  `)z++;return z},q=()=>{let z=J+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},W=(z)=>{let U=z,_=0;while(U<Q){let B=$[U];if(B==="/"&&$[U+1]==="/"){let j=U+2;while(j<Q&&$[j]!==`
8084
- `)j++;U=j;continue}if(B==="/"&&$[U+1]==="*"){let j=U+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;U=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=U+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}U=j;continue}if(B==="("||B==="["||B==="{"){_++,U++;continue}if(B===")"||B==="]"||B==="}"){_--,U++;continue}if(B===";"&&_===0)return U+1;U++}return Q};while(J<Q){let z=$[J];if(z==="/"&&$[J+1]==="/"){let U=K();Y.push($.slice(J,U)),J=U;continue}if(z==="/"&&$[J+1]==="*"){let U=q();Y.push($.slice(J,U)),J=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);Y.push($.slice(J,U)),J=U;continue}if(z==="{"){X++,Y.push(z),J++;continue}if(z==="}"){X--,Y.push(z),J++;continue}if(X===0){let U=J>0?$[J-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],H=W(J+B[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),J=H;continue}Z.add(j),Y.push($.slice(J,H)),J=H;continue}}}Y.push(z),J++}return Y.join("")}async function O2($,Z,Y){let J=j2($,{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|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let H of J){let L=H.body;if(A1(H.attrs))L=N1(L);if(X.test(L))Q.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${MW++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (t5(),a5)),W=[];for(let H=0;H<Q.length;H++){let L=Q[H].content;if(K(L))console.log("[stx:bundler] bundling signal script imports"),L=await q(L,Z||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(O,V)=>F2(V));let F=$1(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
8084
+ `)j++;U=j;continue}if(B==="/"&&$[U+1]==="*"){let j=U+2;while(j<Q-1&&!($[j]==="*"&&$[j+1]==="/"))j++;U=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=U+1;while(j<Q){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}U=j;continue}if(B==="("||B==="["||B==="{"){_++,U++;continue}if(B===")"||B==="]"||B==="}"){_--,U++;continue}if(B===";"&&_===0)return U+1;U++}return Q};while(J<Q){let z=$[J];if(z==="/"&&$[J+1]==="/"){let U=K();Y.push($.slice(J,U)),J=U;continue}if(z==="/"&&$[J+1]==="*"){let U=q();Y.push($.slice(J,U)),J=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);Y.push($.slice(J,U)),J=U;continue}if(z==="{"){X++,Y.push(z),J++;continue}if(z==="}"){X--,Y.push(z),J++;continue}if(X===0){let U=J>0?$[J-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],H=W(J+B[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),J=H;continue}Z.add(j),Y.push($.slice(J,H)),J=H;continue}}}Y.push(z),J++}return Y.join("")}async function F2($,Z,Y){let J=O2($,{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|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let H of J){let L=H.body;if(A1(H.attrs))L=N1(L);if(X.test(L))Q.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${DW++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (t5(),a5)),W=[];for(let H=0;H<Q.length;H++){let L=Q[H].content;if(K(L))console.log("[stx:bundler] bundling signal script imports"),L=await q(L,Z||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(O,V)=>w2(V));let F=$1(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
8085
8085
  ${F}`)}let z=W.join(`
8086
8086
 
8087
- `);z=PW(z);let U=L2(z),_=e5(z,Y),B=`
8087
+ `);z=xW(z);let U=V2(z),_=e5(z,Y),B=`
8088
8088
  <script data-stx-scoped>
8089
8089
  function ${G}() {
8090
8090
  const { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect, defineProps, withDefaults, defineEmits, defineExpose, defineSlots } = window.stx;
@@ -8092,28 +8092,28 @@ ${_}${z}
8092
8092
  return { ${U} };
8093
8093
  }
8094
8094
  if(window.stx)window.stx._latestSetup=${G};
8095
- </script>`,j=$;for(let H of Q)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:B}}function L2($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K="",q=()=>{Q++;let j=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!j){j=!0,Q++;continue}if(H==="]"&&j){j=!1,Q++;continue}if(H==="/"&&!j){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
8095
+ </script>`,j=$;for(let H of Q)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:B}}function V2($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K="",q=()=>{Q++;let j=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!j){j=!0,Q++;continue}if(H==="]"&&j){j=!1,Q++;continue}if(H==="/"&&!j){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
8096
8096
  `)return;Q++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},z=(j)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===j){Q++;return}Q++}},U=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let j=1;while(Q<G&&j>0)if(Z[Q]==="{")j++,Q++;else if(Z[Q]==="}")j--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")U();else Q++;continue}Q++}},_=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
8097
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},B=()=>{if(X!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!J.has(V))Y.push(V),J.add(V);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!J.has(R))Y.push(R),J.add(R)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!J.has(A))Y.push(A),J.add(A)});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 O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!J.has(V))Y.push(V),J.add(V)}};while(Q<G){if(_())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){U(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&W()){q(),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])))B();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function $6($,Z,Y,J){if(!M$($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await O2(X,Y,J);if(X=Q,X=await q2(X,Z),X=K2(X),G){let z=T$(X,/<\/head>/i),U=z===-1?T$(X,/<body[^>]*>/i):-1;if(z!==-1)X=`${X.slice(0,z)}${G}
8097
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},B=()=>{if(X!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!J.has(V))Y.push(V),J.add(V);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!J.has(R))Y.push(R),J.add(R)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!J.has(A))Y.push(A),J.add(A)});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 O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!J.has(V))Y.push(V),J.add(V)}};while(Q<G){if(_())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){U(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&W()){q(),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])))B();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function Z6($,Z,Y,J){if(!M$($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await F2(X,Y,J);if(X=Q,X=await W2(X,Z),X=z2(X),G){let z=T$(X,/<\/head>/i),U=z===-1?T$(X,/<body[^>]*>/i):-1;if(z!==-1)X=`${X.slice(0,z)}${G}
8098
8098
  ${X.slice(z)}`;else if(U!==-1){let _=/<body[^>]*>/i.exec(X.slice(U))[0],B=U+_.length;X=`${X.slice(0,B)}
8099
8099
  ${G}${X.slice(B)}`}else X=`${X}
8100
- ${G}`}let q=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let z=/<body[^>]*>/i,U=T$(X,z);if(U!==-1){let _=X.slice(0,U),B=X.slice(U).replace(z,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=_+B}}return X}function T$($,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 q=G+K.index;if(!J.some(([z,U])=>q>=z&&q<U))return q;G=q+Math.max(K[0].length,1)}return-1}function F2($){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 _2;return`const ${Z.join(", ")}; ${_2}`}var MW=0,N$,B2,W2,r3,yW,_2="// [stx import stripped \u2014 resolved via window.stx in __stx_setup]";var Z6=S(()=>{w5();o4();A0();N$=/<script\b([^>]*)>/gi,B2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;W2=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"]);r3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);yW=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import K5 from"path";function w2($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function A2($,Z,Y){try{let J;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=K5.join(X,$);if(await Bun.file(G).exists())return G;X=K5.dirname(X)}J=K5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=K5.resolve(Z,$);else J=K5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function N2($,Z,Y){let J=$,X=K5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[W,z,U,_]=G;if(w2(U))continue;let B=await A2(U,X,Z);if(B)try{let j=await Bun.file(B).text();if(Y.add(B),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:o0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
8100
+ ${G}`}let q=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let z=/<body[^>]*>/i,U=T$(X,z);if(U!==-1){let _=X.slice(0,U),B=X.slice(U).replace(z,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=_+B}}return X}function T$($,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 q=G+K.index;if(!J.some(([z,U])=>q>=z&&q<U))return q;G=q+Math.max(K[0].length,1)}return-1}function w2($){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 j2;return`const ${Z.join(", ")}; ${j2}`}var DW=0,N$,H2,_2,a3,PW,j2="// [stx import stripped \u2014 resolved via window.stx in __stx_setup]";var Y6=S(()=>{w5();o4();A0();N$=/<script\b([^>]*)>/gi,H2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;_2=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"]);a3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);PW=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import K5 from"path";function N2($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function R2($,Z,Y){try{let J;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=K5.join(X,$);if(await Bun.file(G).exists())return G;X=K5.dirname(X)}J=K5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=K5.resolve(Z,$);else J=K5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function T2($,Z,Y){let J=$,X=K5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[W,z,U,_]=G;if(N2(U))continue;let B=await R2(U,X,Z);if(B)try{let j=await Bun.file(B).text();if(Y.add(B),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:o0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
8101
8101
  // Source: ${U}
8102
8102
  ${j}
8103
- </script>`;J=J.replace(W,H),Q.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(J))!==null){let[W,z,U,_]=q,B=z+_;if(w2(U))continue;if(/rel=["']stylesheet["']/.test(B)||U.endsWith(".css")){let H=await A2(U,X,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
8103
+ </script>`;J=J.replace(W,H),Q.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(J))!==null){let[W,z,U,_]=q,B=z+_;if(N2(U))continue;if(/rel=["']stylesheet["']/.test(B)||U.endsWith(".css")){let H=await R2(U,X,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
8104
8104
  /* Source: ${U} */
8105
8105
  ${L}
8106
- </style>`;J=J.replace(W,F),K.lastIndex=0}catch(L){}}}return J}var R2=S(()=>{u1()});function Y6($,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,q=G+1,W=null,z=!1;while(q<Y.length&&K>0){let V=Y[q];if(z){z=!1,q++;continue}if(V==="\\"&&W){z=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=Y.substring(G+1,q).trim(),_=Y.substring(Q,q+1),B=-1,j=0,H=null,L=!1;for(let V=0;V<U.length;V++){let w=U[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){B=V;break}}let F=B>=0?U.substring(0,B).trim():U,O=B>=0?U.substring(B+1).trim():void 0;try{let V=F.trim(),w;if(Q0(V))w=G0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let N=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+N+Y.substring(q+1),J.lastIndex=Q+N.length}catch(V){c0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),J.lastIndex=Q+_.length}}return Y}function J6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function T2($){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,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),z=q,U=Z.slice(z),_=U.indexOf("@endmemo");if(_===-1)continue;let B=U.slice(0,_),j=z+_+8,H=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=B.slice(L),O=B.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(A){let[R,T,M="",I]=A,D=`<${T}${M} data-stx-memo="${W}"${I}>`;N=B.slice(0,L)+D+w.slice(R.length)+B.slice(L+w.length)}else N=`${B.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${B.slice(L+w.length)}`;X.push({start:Q,end:j,replacement:N}),Y.lastIndex=j}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 X6($){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 M2($){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,q=!1,W=!1,z=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){z=K;break}K++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let _=$.slice(z+1),B=_.indexOf("</"),j=B>=0?_.slice(0,B):_.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(X,z)+" x-cloak>",X=z+1}return J+=$.slice(X),J}function I2($){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 j=`</${G}>`,H=$.toLowerCase().indexOf(j,Q);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=Q+X[0].length,q=!1,W=!1,z=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(Q+X[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!vW.test(U))continue;let _=$[z-1]==="/",B=_?z-1:z;Y+=`${$.slice(J,B)} x-cloak${_?" ":""}`,J=B}return Y+=$.slice(J),Y}var vW;var Q6=S(()=>{Z1();R0();vW=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function G6($,Z,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},X=J.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:q}of xW){if(X.some((z)=>K.includes(z)||G.source.includes(z)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let z=$.split(`
8106
+ </style>`;J=J.replace(W,F),K.lastIndex=0}catch(L){}}}return J}var M2=S(()=>{u1()});function J6($,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,q=G+1,W=null,z=!1;while(q<Y.length&&K>0){let V=Y[q];if(z){z=!1,q++;continue}if(V==="\\"&&W){z=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=Y.substring(G+1,q).trim(),_=Y.substring(Q,q+1),B=-1,j=0,H=null,L=!1;for(let V=0;V<U.length;V++){let w=U[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){B=V;break}}let F=B>=0?U.substring(0,B).trim():U,O=B>=0?U.substring(B+1).trim():void 0;try{let V=F.trim(),w;if(Q0(V))w=G0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let N=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+N+Y.substring(q+1),J.lastIndex=Q+N.length}catch(V){c0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),J.lastIndex=Q+_.length}}return Y}function X6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function I2($){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,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),z=q,U=Z.slice(z),_=U.indexOf("@endmemo");if(_===-1)continue;let B=U.slice(0,_),j=z+_+8,H=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=B.slice(L),O=B.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(A){let[R,T,M="",I]=A,D=`<${T}${M} data-stx-memo="${W}"${I}>`;N=B.slice(0,L)+D+w.slice(R.length)+B.slice(L+w.length)}else N=`${B.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${B.slice(L+w.length)}`;X.push({start:Q,end:j,replacement:N}),Y.lastIndex=j}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 Q6($){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 D2($){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,q=!1,W=!1,z=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){z=K;break}K++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let _=$.slice(z+1),B=_.indexOf("</"),j=B>=0?_.slice(0,B):_.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(X,z)+" x-cloak>",X=z+1}return J+=$.slice(X),J}function E2($){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 j=`</${G}>`,H=$.toLowerCase().indexOf(j,Q);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=Q+X[0].length,q=!1,W=!1,z=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(Q+X[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!fW.test(U))continue;let _=$[z-1]==="/",B=_?z-1:z;Y+=`${$.slice(J,B)} x-cloak${_?" ":""}`,J=B}return Y+=$.slice(J),Y}var fW;var G6=S(()=>{Z1();R0();fW=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function K6($,Z,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},X=J.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:q}of gW){if(X.some((z)=>K.includes(z)||G.source.includes(z)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let z=$.split(`
8107
8107
  `),U=[];z.forEach((B,j)=>{if(G.lastIndex=0,G.test(B))U.push(j+1)});let _=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";Q.push(` \u2717 ${K}${_}
8108
8108
  \u2192 ${q}`)}}if(Q.length>0&&J.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
8109
8109
  ${Q.join(`
8110
8110
  `)}
8111
- Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var xW;var K6=S(()=>{xW=[{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:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{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"}]});var D2={};r(D2,{getStoreScript:()=>fW,clearStoreCache:()=>gW});import I$ from"path";async function fW($){let Z;if($)Z=I$.resolve($);else{let z=await S1();Z=I$.resolve(z.root||process.cwd(),z.storesDir||"stores")}let Y=q5.get(Z);if(Y!==void 0)return Y||null;let J=new Bun.Glob("*.ts"),X=[];try{for await(let z of J.scan({cwd:Z,absolute:!0})){let U=I$.basename(z,".ts");if(["index","types"].includes(U))continue;if(z.includes(".d.ts"))continue;X.push(z)}}catch{return q5.set(Z,""),null}if(X.length===0)return q5.set(Z,""),null;let Q=[];for(let z of X){let U=await Bun.file(z).text();Q.push({file:z,hasUseStore:/useStore\s*\(/.test(U)})}Q.sort((z,U)=>{if(z.hasUseStore===U.hasUseStore)return 0;return z.hasUseStore?1:-1});let G=Q.map((z)=>z.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()});for(let z of G)try{let U=await Bun.file(z).text(),_=I$.basename(z,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=q.transformSync(U),K.push(`// Store: ${_}
8111
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var gW;var q6=S(()=>{gW=[{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:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{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"}]});var k2={};r(k2,{getStoreScript:()=>hW,clearStoreCache:()=>dW});import I$ from"path";async function hW($){let Z;if($)Z=I$.resolve($);else{let z=await S1();Z=I$.resolve(z.root||process.cwd(),z.storesDir||"stores")}let Y=q5.get(Z);if(Y!==void 0)return Y||null;let J=new Bun.Glob("*.ts"),X=[];try{for await(let z of J.scan({cwd:Z,absolute:!0})){let U=I$.basename(z,".ts");if(["index","types"].includes(U))continue;if(z.includes(".d.ts"))continue;X.push(z)}}catch{return q5.set(Z,""),null}if(X.length===0)return q5.set(Z,""),null;let Q=[];for(let z of X){let U=await Bun.file(z).text();Q.push({file:z,hasUseStore:/useStore\s*\(/.test(U)})}Q.sort((z,U)=>{if(z.hasUseStore===U.hasUseStore)return 0;return z.hasUseStore?1:-1});let G=Q.map((z)=>z.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()});for(let z of G)try{let U=await Bun.file(z).text(),_=I$.basename(z,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=q.transformSync(U),K.push(`// Store: ${_}
8112
8112
  ${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${z}:`,U)}if(K.length===0)return q5.set(Z,""),null;let W=`;(function(){
8113
8113
  ${K.join(`
8114
8114
 
8115
8115
  `)}
8116
- })();`;return q5.set(Z,W),W}function gW(){q5.clear()}var q5;var E2=S(()=>{t1();u1();q5=new Map});var b2={};r(b2,{processDeferDirectives:()=>pW});function hW(){return`stx-defer-${++k2}`}function dW($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function mW($,Z,Y){let{trigger:J,value:X}=dW(Z),Q=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[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:q}}function uW($,Z){let{trigger:Y,triggerValue:J}=Z,X;switch(Y){case"visible":X=`
8116
+ })();`;return q5.set(Z,W),W}function dW(){q5.clear()}var q5;var b2=S(()=>{t1();u1();q5=new Map});var y2={};r(y2,{processDeferDirectives:()=>lW});function mW(){return`stx-defer-${++S2}`}function uW($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function pW($,Z,Y){let{trigger:J,value:X}=uW(Z),Q=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[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:q}}function cW($,Z){let{trigger:Y,triggerValue:J}=Z,X;switch(Y){case"visible":X=`
8117
8117
  const observer = new IntersectionObserver((entries) => {
8118
8118
  if (entries[0].isIntersecting) {
8119
8119
  observer.disconnect();
@@ -8186,7 +8186,7 @@ else {
8186
8186
  ${X}
8187
8187
  })();
8188
8188
  </script>
8189
- `}function pW($,Z,Y){k2=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(X,Q,G)=>{let K=hW(),q=mW(X,Q,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",z=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',U=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",_=`<div data-defer-content style="display: none;">${q.content}</div>`,B=uW(K,q);return`
8189
+ `}function lW($,Z,Y){S2=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(X,Q,G)=>{let K=mW(),q=pW(X,Q,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",z=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',U=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",_=`<div data-defer-content style="display: none;">${q.content}</div>`,B=cW(K,q);return`
8190
8190
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
8191
8191
  ${W}
8192
8192
  ${z}
@@ -8194,7 +8194,7 @@ else {
8194
8194
  ${U}
8195
8195
  </div>
8196
8196
  ${B}
8197
- `})}var k2=0;var y2={};r(y2,{processTeleportDirectives:()=>nW,ensureTeleportTargets:()=>oW});function cW(){return`stx-teleport-${++S2}`}function lW($){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 iW($,Z){return`
8197
+ `})}var S2=0;var P2={};r(P2,{processTeleportDirectives:()=>sW,ensureTeleportTargets:()=>rW});function iW(){return`stx-teleport-${++C2}`}function nW($){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 oW($,Z){return`
8198
8198
  <script>
8199
8199
  (function() {
8200
8200
  const source = document.getElementById('${$}');
@@ -8240,12 +8240,12 @@ else {
8240
8240
  });
8241
8241
  })();
8242
8242
  </script>
8243
- `}function nW($,Z,Y){S2=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(X,Q,G)=>{let K=cW(),{target:q,disabled:W}=lW(Q),z=G.trim();if(W)try{let _=!1;if(W==="true")_=!0;else if(W==="false")_=!1;else if(W in Z)_=Boolean(Z[W]);if(_)return`<div class="stx-teleport-inline" data-teleport-disabled>${z}</div>`}catch{}let U=iW(K,q);return`
8243
+ `}function sW($,Z,Y){C2=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(X,Q,G)=>{let K=iW(),{target:q,disabled:W}=nW(Q),z=G.trim();if(W)try{let _=!1;if(W==="true")_=!0;else if(W==="false")_=!1;else if(W in Z)_=Boolean(Z[W]);if(_)return`<div class="stx-teleport-inline" data-teleport-disabled>${z}</div>`}catch{}let U=oW(K,q);return`
8244
8244
  <div id="${K}" class="stx-teleport-source" style="display: none;">
8245
8245
  <template>${z}</template>
8246
8246
  </div>
8247
8247
  ${U}
8248
- `})}function oW(){return`
8248
+ `})}function rW(){return`
8249
8249
  <script>
8250
8250
  (function() {
8251
8251
  // Common teleport targets
@@ -8262,7 +8262,7 @@ else {
8262
8262
  });
8263
8263
  })();
8264
8264
  </script>
8265
- `}var S2=0;var x2={};r(x2,{processTransitionDirectives:()=>tW,processTransitionAttributes:()=>YU,performLeave:()=>aW,performEnter:()=>rW,generateTransitionRuntime:()=>ZU,generateTransitionCSS:()=>$U});function C2($,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 sW($){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 P2($,Z){return new Promise((Y)=>{let J=Z??sW($);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 v2($){$.offsetHeight}async function rW($,Z={}){let Y=Z.name||"stx",J=C2(Y,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),v2($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await P2($,X);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function aW($,Z={}){let Y=Z.name||"stx",J=C2(Y,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),v2($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await P2($,X);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function tW($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(X,Q,G)=>{let K=eW(Q),q=K.name||"stx",W=K.duration||300,z=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
8265
+ `}var C2=0;var g2={};r(g2,{processTransitionDirectives:()=>$U,processTransitionAttributes:()=>XU,performLeave:()=>eW,performEnter:()=>tW,generateTransitionRuntime:()=>JU,generateTransitionCSS:()=>YU});function v2($,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 aW($){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 x2($,Z){return new Promise((Y)=>{let J=Z??aW($);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 f2($){$.offsetHeight}async function tW($,Z={}){let Y=Z.name||"stx",J=v2(Y,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),f2($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await x2($,X);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function eW($,Z={}){let Y=Z.name||"stx",J=v2(Y,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),f2($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await x2($,X);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function $U($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(X,Q,G)=>{let K=ZU(Q),q=K.name||"stx",W=K.duration||300,z=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
8266
8266
  <div
8267
8267
  class="stx-transition-wrapper"
8268
8268
  data-transition="${q}"
@@ -8304,7 +8304,7 @@ else {
8304
8304
  });
8305
8305
  })();
8306
8306
  </script>
8307
- `})}function eW($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4]||J[5];switch(X){case"name":Z.name=Q;break;case"duration":Z.duration=parseInt(Q,10);break;case"mode":Z.mode=Q;break;case"easing":Z.easing=Q;break}}return Z}function $U(){return`
8307
+ `})}function ZU($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4]||J[5];switch(X){case"name":Z.name=Q;break;case"duration":Z.duration=parseInt(Q,10);break;case"mode":Z.mode=Q;break;case"easing":Z.easing=Q;break}}return Z}function YU(){return`
8308
8308
  /* STX Transition Presets */
8309
8309
 
8310
8310
  /* Fade */
@@ -8491,7 +8491,7 @@ else {
8491
8491
  opacity: 1;
8492
8492
  max-height: 1000px;
8493
8493
  }
8494
- `}function ZU(){return`
8494
+ `}function JU(){return`
8495
8495
  // STX Transition Runtime
8496
8496
  (function() {
8497
8497
  if (typeof window === 'undefined') return;
@@ -8580,7 +8580,7 @@ else {
8580
8580
 
8581
8581
  console.log('[stx] Transition runtime initialized');
8582
8582
  })();
8583
- `}function YU($){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 g2={};r(g2,{withErrorBoundary:()=>f2,processErrorBoundaryDirectives:()=>QU,generateErrorBoundaryRuntime:()=>WU,generateErrorBoundaryCSS:()=>zU,createErrorBoundary:()=>qU});function XU(){return`eb-${++JU}-${Date.now().toString(36)}`}function QU($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(X,Q,G,K)=>{let q=XU(),W=GU(Q||"");return KU(q,G.trim(),K.trim(),W)})}function GU($){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 KU($,Z,Y,J){let X=J.logErrors!==!1;return`
8583
+ `}function XU($){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 d2={};r(d2,{withErrorBoundary:()=>h2,processErrorBoundaryDirectives:()=>KU,generateErrorBoundaryRuntime:()=>_U,generateErrorBoundaryCSS:()=>UU,createErrorBoundary:()=>WU});function GU(){return`eb-${++QU}-${Date.now().toString(36)}`}function KU($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(X,Q,G,K)=>{let q=GU(),W=qU(Q||"");return zU(q,G.trim(),K.trim(),W)})}function qU($){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 zU($,Z,Y,J){let X=J.logErrors!==!1;return`
8584
8584
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
8585
8585
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
8586
8586
  ${Z}
@@ -8700,7 +8700,7 @@ else {
8700
8700
  };
8701
8701
  })();
8702
8702
  </script>
8703
- `}async function f2($,Z,Y){try{return await $()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return Z}}function qU($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>f2(J,$,Y)}function zU(){return`
8703
+ `}async function h2($,Z,Y){try{return await $()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return Z}}function WU($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>h2(J,$,Y)}function UU(){return`
8704
8704
  /* STX Error Boundary Styles */
8705
8705
  .stx-error-boundary {
8706
8706
  position: relative;
@@ -8744,7 +8744,7 @@ else {
8744
8744
  color: #fecaca;
8745
8745
  }
8746
8746
  }
8747
- `}function WU(){return`
8747
+ `}function _U(){return`
8748
8748
  // STX Error Boundary Runtime
8749
8749
  (function() {
8750
8750
  if (typeof window === 'undefined') return;
@@ -8809,7 +8809,7 @@ else {
8809
8809
 
8810
8810
  console.log('[stx] Error boundary runtime initialized');
8811
8811
  })();
8812
- `}var JU=0;var h2={};r(h2,{renderSSRSuspense:()=>LU,processSuspenseDirectives:()=>BU,generateSuspenseRuntime:()=>VU,generateSuspenseCSS:()=>FU,createSSRSuspense:()=>OU});function _U(){return`suspense-${++UU}-${Date.now().toString(36)}`}function BU($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let q=_U(),W=jU(Q||"");return HU(q,G.trim(),K.trim(),W)})}function jU($){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 HU($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
8812
+ `}var QU=0;var m2={};r(m2,{renderSSRSuspense:()=>VU,processSuspenseDirectives:()=>HU,generateSuspenseRuntime:()=>AU,generateSuspenseCSS:()=>wU,createSSRSuspense:()=>FU});function jU(){return`suspense-${++BU}-${Date.now().toString(36)}`}function HU($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let q=jU(),W=OU(Q||"");return LU(q,G.trim(),K.trim(),W)})}function OU($){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 LU($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
8813
8813
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${Q}" data-status="pending">
8814
8814
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
8815
8815
  ${Y}
@@ -8999,7 +8999,7 @@ else {
8999
8999
  }, 0);
9000
9000
  })();
9001
9001
  </script>
9002
- `}function OU($,Z,Y){return{id:$,fallback:Y,content:Z}}async function LU($){let Z=$.map((J)=>`
9002
+ `}function FU($,Z,Y){return{id:$,fallback:Y,content:Z}}async function VU($){let Z=$.map((J)=>`
9003
9003
  <div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
9004
9004
  ${J.fallback}
9005
9005
  </div>
@@ -9024,7 +9024,7 @@ else {
9024
9024
  }
9025
9025
  })();
9026
9026
  </script>
9027
- `}}return{initial:Z,streaming:Y()}}function FU(){return`
9027
+ `}}return{initial:Z,streaming:Y()}}function wU(){return`
9028
9028
  /* STX Suspense Styles */
9029
9029
  .stx-suspense {
9030
9030
  position: relative;
@@ -9080,7 +9080,7 @@ else {
9080
9080
  background-size: 200% 100%;
9081
9081
  }
9082
9082
  }
9083
- `}function VU(){return`
9083
+ `}function AU(){return`
9084
9084
  // STX Suspense Runtime
9085
9085
  (function() {
9086
9086
  if (typeof window === 'undefined') return;
@@ -9147,7 +9147,7 @@ else {
9147
9147
 
9148
9148
  console.log('[stx] Suspense runtime initialized');
9149
9149
  })();
9150
- `}var UU=0;var p2={};r(p2,{processAsyncDirectives:()=>AU,isAsyncComponent:()=>RU,generateAsyncComponentRuntime:()=>MU,generateAsyncComponentCSS:()=>TU,defineAsyncComponent:()=>NU});function d2(){return`async-${++wU}-${Date.now().toString(36)}`}function AU($,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,q,W)=>{let z=d2(),U=m2(K);return u2(z,U,q.trim(),W.trim())}),Q=Q.replace(X,(G,K,q)=>{let W=d2(),z=m2(K);return u2(W,z,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function m2($){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 u2($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:q}=Z;return`
9150
+ `}var BU=0;var l2={};r(l2,{processAsyncDirectives:()=>RU,isAsyncComponent:()=>MU,generateAsyncComponentRuntime:()=>DU,generateAsyncComponentCSS:()=>IU,defineAsyncComponent:()=>TU});function u2(){return`async-${++NU}-${Date.now().toString(36)}`}function RU($,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,q,W)=>{let z=u2(),U=p2(K);return c2(z,U,q.trim(),W.trim())}),Q=Q.replace(X,(G,K,q)=>{let W=u2(),z=p2(K);return c2(W,z,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function p2($){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 c2($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:q}=Z;return`
9151
9151
  <div class="stx-async-component" data-async-id="${$}" data-component="${X}" data-status="pending">
9152
9152
  <div class="stx-async-loading" data-async-loading="${$}">
9153
9153
  ${Y}
@@ -9374,7 +9374,7 @@ catch (error) {
9374
9374
  loadComponent();
9375
9375
  })();
9376
9376
  </script>
9377
- `}function NU($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function RU($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function TU(){return`
9377
+ `}function TU($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function MU($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function IU(){return`
9378
9378
  /* STX Async Component Styles */
9379
9379
  .stx-async-component {
9380
9380
  position: relative;
@@ -9448,7 +9448,7 @@ catch (error) {
9448
9448
  background-size: 200% 100%;
9449
9449
  }
9450
9450
  }
9451
- `}function MU(){return`
9451
+ `}function DU(){return`
9452
9452
  // STX Async Component Runtime
9453
9453
  (function() {
9454
9454
  if (typeof window === 'undefined') return;
@@ -9502,7 +9502,7 @@ catch (error) {
9502
9502
 
9503
9503
  console.log('[stx] Async component runtime initialized');
9504
9504
  })();
9505
- `}var wU=0;var l2={};r(l2,{shouldCacheComponent:()=>SU,processKeepAliveDirectives:()=>DU,onDeactivated:()=>vU,onActivated:()=>PU,generateKeepAliveRuntime:()=>CU,generateKeepAliveCSS:()=>yU,createKeepAliveCache:()=>bU});function c2(){return`keep-alive-${++IU}-${Date.now().toString(36)}`}function DU($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(X,Q,G)=>{let K=c2(),q=EU(Q||"");return kU(K,G.trim(),q)})}function EU($){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 kU($,Z,Y){let{max:J,include:X,exclude:Q}=Y,G=Y.id||$;return`
9505
+ `}var NU=0;var n2={};r(n2,{shouldCacheComponent:()=>CU,processKeepAliveDirectives:()=>kU,onDeactivated:()=>fU,onActivated:()=>xU,generateKeepAliveRuntime:()=>vU,generateKeepAliveCSS:()=>PU,createKeepAliveCache:()=>yU});function i2(){return`keep-alive-${++EU}-${Date.now().toString(36)}`}function kU($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(X,Q,G)=>{let K=i2(),q=bU(Q||"");return SU(K,G.trim(),q)})}function bU($){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 SU($,Z,Y){let{max:J,include:X,exclude:Q}=Y,G=Y.id||$;return`
9506
9506
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
9507
9507
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
9508
9508
  ${Z}
@@ -9789,7 +9789,7 @@ else {
9789
9789
  });
9790
9790
  })();
9791
9791
  </script>
9792
- `}function bU($={}){return{id:$.id||c2(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function SU($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function yU(){return`
9792
+ `}function yU($={}){return{id:$.id||i2(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function CU($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function PU(){return`
9793
9793
  /* STX Keep-Alive Styles */
9794
9794
  .stx-keep-alive {
9795
9795
  position: relative;
@@ -9814,7 +9814,7 @@ else {
9814
9814
  .stx-keep-alive-content > [data-activated] {
9815
9815
  opacity: 1;
9816
9816
  }
9817
- `}function CU(){return`
9817
+ `}function vU(){return`
9818
9818
  // STX Keep-Alive Runtime
9819
9819
  (function() {
9820
9820
  if (typeof window === 'undefined') return;
@@ -9850,7 +9850,7 @@ else {
9850
9850
 
9851
9851
  console.log('[stx] Keep-alive runtime initialized');
9852
9852
  })();
9853
- `}function PU($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function vU($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var IU=0;var r2={};r(r2,{useVirtualList:()=>n2,processVirtualListDirectives:()=>z6,processVirtualGridDirectives:()=>s2,processInfiniteListDirectives:()=>o2,generateVirtualListCSS:()=>i2,default:()=>xU,createVirtualList:()=>q6});function q6($,Z){let{itemHeight:Y,containerHeight:J,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],z=0,U=new Map;function _(){if(G)return B();let N=Math.max(0,Math.floor(z/Y)-X),R=Math.ceil(J/Y),T=Math.min(W.length-1,N+R+X*2);return{startIndex:N,endIndex:T}}function B(){let N=0,R=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=U.get(M)||K;if(N+I>z){R=Math.max(0,M-X);break}N+=I}N=0;for(let M=0;M<W.length;M++){let I=U.get(M)||K;if(N+=I,N>z+J){T=Math.min(W.length-1,M+X);break}}return{startIndex:R,endIndex:T}}function j(){if(G){let N=0;for(let R=0;R<W.length;R++)N+=U.get(R)||K;return N}return W.length*Y}function H(N){if(G){let R=0;for(let T=0;T<N;T++)R+=U.get(T)||K;return R}return N*Y}function L(){let{startIndex:N,endIndex:R}=_();return{startIndex:N,endIndex:R,scrollTop:z,totalHeight:j(),visibleItems:W.slice(N,R+1),itemHeights:new Map(U)}}function F(N,R="auto"){let T=H(N);O(T,R)}function O(N,R="auto"){z=Math.max(0,Math.min(N,j()-J))}function V(){_()}function w(N){W=[...N],U.clear(),V()}function A(){W=[],U.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:A}}function z6($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(X,Q,G,K)=>{let q=Q.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();z={...z,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(z.containerHeight/z.itemHeight),B=z.overscan||3,j=0,H=Math.min(W.length-1,_+B),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
9853
+ `}function xU($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function fU($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var EU=0;var t2={};r(t2,{useVirtualList:()=>s2,processVirtualListDirectives:()=>W6,processVirtualGridDirectives:()=>a2,processInfiniteListDirectives:()=>r2,generateVirtualListCSS:()=>o2,default:()=>gU,createVirtualList:()=>z6});function z6($,Z){let{itemHeight:Y,containerHeight:J,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],z=0,U=new Map;function _(){if(G)return B();let N=Math.max(0,Math.floor(z/Y)-X),R=Math.ceil(J/Y),T=Math.min(W.length-1,N+R+X*2);return{startIndex:N,endIndex:T}}function B(){let N=0,R=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=U.get(M)||K;if(N+I>z){R=Math.max(0,M-X);break}N+=I}N=0;for(let M=0;M<W.length;M++){let I=U.get(M)||K;if(N+=I,N>z+J){T=Math.min(W.length-1,M+X);break}}return{startIndex:R,endIndex:T}}function j(){if(G){let N=0;for(let R=0;R<W.length;R++)N+=U.get(R)||K;return N}return W.length*Y}function H(N){if(G){let R=0;for(let T=0;T<N;T++)R+=U.get(T)||K;return R}return N*Y}function L(){let{startIndex:N,endIndex:R}=_();return{startIndex:N,endIndex:R,scrollTop:z,totalHeight:j(),visibleItems:W.slice(N,R+1),itemHeights:new Map(U)}}function F(N,R="auto"){let T=H(N);O(T,R)}function O(N,R="auto"){z=Math.max(0,Math.min(N,j()-J))}function V(){_()}function w(N){W=[...N],U.clear(),V()}function A(){W=[],U.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:A}}function W6($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(X,Q,G,K)=>{let q=Q.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();z={...z,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(z.containerHeight/z.itemHeight),B=z.overscan||3,j=0,H=Math.min(W.length-1,_+B),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
9854
9854
  <div class="virtual-item ${z.itemClass||""}"
9855
9855
  style="position: absolute; top: ${O*z.itemHeight}px; height: ${z.itemHeight}px; width: 100%;"
9856
9856
  data-index="${O}">
@@ -9927,7 +9927,7 @@ else {
9927
9927
  };
9928
9928
  })();
9929
9929
  </script>
9930
- `})}function i2(){return`
9930
+ `})}function o2(){return`
9931
9931
  .virtual-list-container {
9932
9932
  position: relative;
9933
9933
  overflow-y: auto;
@@ -9975,7 +9975,7 @@ else {
9975
9975
  0% { background-position: 200% 0; }
9976
9976
  100% { background-position: -200% 0; }
9977
9977
  }
9978
- `}function n2($,Z){let Y=null,J=()=>{if(!Y)Y=q6($(),Z);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(X)=>{let Q=X.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(X)=>({style:{position:"absolute",top:`${X*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":X}),scrollToIndex:(X)=>{J().scrollToIndex(X)}}}function o2($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(X,Q,G,K,q)=>{let W=Q.trim(),z=Z[W];if(!z||!Array.isArray(z))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();U={...U,...j}}catch{}let _=`ilist-${Math.random().toString(36).substring(2,9)}`,B=z6(`@virtualList(${W}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return B=B.replace("</script>",`
9978
+ `}function s2($,Z){let Y=null,J=()=>{if(!Y)Y=z6($(),Z);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(X)=>{let Q=X.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(X)=>({style:{position:"absolute",top:`${X*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":X}),scrollToIndex:(X)=>{J().scrollToIndex(X)}}}function r2($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(X,Q,G,K,q)=>{let W=Q.trim(),z=Z[W];if(!z||!Array.isArray(z))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();U={...U,...j}}catch{}let _=`ilist-${Math.random().toString(36).substring(2,9)}`,B=W6(`@virtualList(${W}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return B=B.replace("</script>",`
9979
9979
  // Infinite scroll detection
9980
9980
  container.addEventListener('scroll', function() {
9981
9981
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -9993,7 +9993,7 @@ else {
9993
9993
  ${q}
9994
9994
  </div>
9995
9995
  </div>
9996
- `})}function s2($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(X,Q,G,K)=>{let q=Q.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let z={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();z={...z,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(W.length/z.columns),B=_*(z.rowHeight+(z.gap||0)),j=Math.ceil(z.containerHeight/(z.rowHeight+(z.gap||0))),H=z.overscan||2,L=0,F=Math.min(_-1,j+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<z.columns;w++){let A=V*z.columns+w;if(A>=W.length)break;let N=W[A],R=w*(100/z.columns),T=V*(z.rowHeight+(z.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,D)=>{if(typeof N==="object"&&N!==null)return String(N[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
9996
+ `})}function a2($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(X,Q,G,K)=>{let q=Q.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let z={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();z={...z,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(W.length/z.columns),B=_*(z.rowHeight+(z.gap||0)),j=Math.ceil(z.containerHeight/(z.rowHeight+(z.gap||0))),H=z.overscan||2,L=0,F=Math.min(_-1,j+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<z.columns;w++){let A=V*z.columns+w;if(A>=W.length)break;let N=W[A],R=w*(100/z.columns),T=V*(z.rowHeight+(z.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,D)=>{if(typeof N==="object"&&N!==null)return String(N[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
9997
9997
  <div class="virtual-grid-item"
9998
9998
  style="position: absolute; top: ${T}px; left: ${R}%; width: calc(${100/z.columns}% - ${z.gap||0}px); height: ${z.rowHeight}px;"
9999
9999
  data-index="${A}">
@@ -10063,7 +10063,7 @@ else {
10063
10063
  });
10064
10064
  })();
10065
10065
  </script>
10066
- `})}var xU;var a2=S(()=>{xU={createVirtualList:q6,processVirtualListDirectives:z6,processInfiniteListDirectives:o2,processVirtualGridDirectives:s2,generateVirtualListCSS:i2,useVirtualList:n2}});function t2(){return`<script data-stx-hydration-runtime>
10066
+ `})}var gU;var e2=S(()=>{gU={createVirtualList:z6,processVirtualListDirectives:W6,processInfiniteListDirectives:r2,processVirtualGridDirectives:a2,generateVirtualListCSS:o2,useVirtualList:s2}});function $J(){return`<script data-stx-hydration-runtime>
10067
10067
  (function() {
10068
10068
  'use strict';
10069
10069
 
@@ -10223,7 +10223,7 @@ else {
10223
10223
  stxIslands.initIslands();
10224
10224
  }
10225
10225
  })();
10226
- </script>`}function e2($){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 $J($,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 UJ={};r(UJ,{processStaticDirectives:()=>zJ,processPartialHydrationDirectives:()=>YJ,onHydrated:()=>qJ,isHydrated:()=>KJ,hydrateIsland:()=>XJ,hydrateByStrategy:()=>QJ,hydrateAll:()=>GJ,generatePartialHydrationCSS:()=>JJ,generateIslandManifest:()=>WJ,default:()=>cU,createIslandRegistry:()=>ZJ});function ZJ(){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 fU($){return`
10226
+ </script>`}function ZJ($){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 YJ($,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 BJ={};r(BJ,{processStaticDirectives:()=>UJ,processPartialHydrationDirectives:()=>XJ,onHydrated:()=>WJ,isHydrated:()=>zJ,hydrateIsland:()=>GJ,hydrateByStrategy:()=>KJ,hydrateAll:()=>qJ,generatePartialHydrationCSS:()=>QJ,generateIslandManifest:()=>_J,default:()=>iU,createIslandRegistry:()=>JJ});function JJ(){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 hU($){return`
10227
10227
  <script data-hydrate="${$}">
10228
10228
  (function() {
10229
10229
  const island = document.querySelector('[data-island="${$}"]');
@@ -10234,7 +10234,7 @@ else {
10234
10234
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
10235
10235
  })();
10236
10236
  </script>
10237
- `}function gU($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
10237
+ `}function dU($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
10238
10238
  <script data-hydrate="${$}">
10239
10239
  (function() {
10240
10240
  const island = document.querySelector('[data-island="${$}"]');
@@ -10270,7 +10270,7 @@ else {
10270
10270
  }
10271
10271
  })();
10272
10272
  </script>
10273
- `}function hU($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
10273
+ `}function mU($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
10274
10274
  <script data-hydrate="${$}">
10275
10275
  (function() {
10276
10276
  const island = document.querySelector('[data-island="${$}"]');
@@ -10303,7 +10303,7 @@ else {
10303
10303
  }
10304
10304
  })();
10305
10305
  </script>
10306
- `}function dU($,Z){let Y=Z.media||"(min-width: 768px)";return`
10306
+ `}function uU($,Z){let Y=Z.media||"(min-width: 768px)";return`
10307
10307
  <script data-hydrate="${$}">
10308
10308
  (function() {
10309
10309
  const island = document.querySelector('[data-island="${$}"]');
@@ -10332,7 +10332,7 @@ else {
10332
10332
  }
10333
10333
  })();
10334
10334
  </script>
10335
- `}function mU($){return`
10335
+ `}function pU($){return`
10336
10336
  <script data-hydrate="${$}">
10337
10337
  (function() {
10338
10338
  const island = document.querySelector('[data-island="${$}"]');
@@ -10354,7 +10354,7 @@ else {
10354
10354
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
10355
10355
  })();
10356
10356
  </script>
10357
- `}function uU($,Z){let Y=Z.event||"stx:activate";return`
10357
+ `}function cU($,Z){let Y=Z.event||"stx:activate";return`
10358
10358
  <script data-hydrate="${$}">
10359
10359
  (function() {
10360
10360
  const island = document.querySelector('[data-island="${$}"]');
@@ -10375,9 +10375,9 @@ else {
10375
10375
  });
10376
10376
  })();
10377
10377
  </script>
10378
- `}function YJ($,Z={},Y){let J=$,X=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=z5(J,"load",Z),J=z5(J,"idle",Z),J=z5(J,"visible",Z),J=z5(J,"media",Z),J=pU(J),J=z5(J,"hover",Z),J=z5(J,"event",Z),X=Q&&J!==$,X)J+=`
10379
- `+t2();return J}function z5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(X,Q,G)=>{let K={strategy:Z};if(Q)try{let H=Q.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=e2(G.trim()),z=$J(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(W)U.push(`data-component="${W}"`);let B=Object.keys(z).length>0?`
10380
- <script type="application/json" data-island-props="${q}">${JSON.stringify(z)}</script>`:"",j="";switch(Z){case"load":j=fU(q);break;case"idle":j=gU(q,K);break;case"visible":j=hU(q,K);break;case"media":j=dU(q,K);break;case"hover":j=mU(q);break;case"event":j=uU(q,K);break}return`
10378
+ `}function XJ($,Z={},Y){let J=$,X=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=z5(J,"load",Z),J=z5(J,"idle",Z),J=z5(J,"visible",Z),J=z5(J,"media",Z),J=lU(J),J=z5(J,"hover",Z),J=z5(J,"event",Z),X=Q&&J!==$,X)J+=`
10379
+ `+$J();return J}function z5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(X,Q,G)=>{let K={strategy:Z};if(Q)try{let H=Q.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=ZJ(G.trim()),z=YJ(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(W)U.push(`data-component="${W}"`);let B=Object.keys(z).length>0?`
10380
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(z)}</script>`:"",j="";switch(Z){case"load":j=hU(q);break;case"idle":j=dU(q,K);break;case"visible":j=mU(q,K);break;case"media":j=uU(q,K);break;case"hover":j=pU(q);break;case"event":j=cU(q,K);break}return`
10381
10381
  <div data-island="${q}"
10382
10382
  data-strategy="${Z}"
10383
10383
  ${U.join(`
@@ -10387,7 +10387,7 @@ else {
10387
10387
  ${G.trim()}${B}
10388
10388
  </div>
10389
10389
  ${j}
10390
- `})}function pU($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let X=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
10390
+ `})}function lU($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let X=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
10391
10391
  <div data-island="${X}"
10392
10392
  data-strategy="only"
10393
10393
  class="stx-island stx-client-only">
@@ -10406,7 +10406,7 @@ else {
10406
10406
  }
10407
10407
  })();
10408
10408
  </script>
10409
- `})}function JJ(){return`
10409
+ `})}function QJ(){return`
10410
10410
  /* Island base styles */
10411
10411
  .stx-island {
10412
10412
  display: contents;
@@ -10447,11 +10447,11 @@ else {
10447
10447
  .stx-island.hydrated {
10448
10448
  opacity: 1;
10449
10449
  }
10450
- `}function XJ($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function QJ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function GJ(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function KJ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function qJ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function zJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function WJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
10450
+ `}function GJ($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function KJ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function qJ(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function zJ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function WJ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function UJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function _J($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
10451
10451
  <script type="application/json" id="stx-island-manifest">
10452
10452
  ${JSON.stringify(Z)}
10453
10453
  </script>
10454
- `}var cU;var _J=S(()=>{cU={processPartialHydrationDirectives:YJ,processStaticDirectives:zJ,generatePartialHydrationCSS:JJ,generateIslandManifest:WJ,createIslandRegistry:ZJ,hydrateIsland:XJ,hydrateByStrategy:QJ,hydrateAll:GJ,isHydrated:KJ,onHydrated:qJ}});var RJ={};r(RJ,{watchMultiple:()=>LJ,watchEffect:()=>FJ,watch:()=>OJ,unref:()=>BJ,toRefs:()=>jJ,throttledComputed:()=>NJ,stxWatchMultiple:()=>LJ,stxWatchEffect:()=>FJ,stxWatch:()=>OJ,stxUnref:()=>BJ,stxToRefs:()=>jJ,stxThrottledComputed:()=>NJ,stxShallowRef:()=>HJ,stxRef:()=>W5,stxIsRef:()=>L1,stxDebouncedComputed:()=>AJ,stxComputed:()=>n5,shallowRef:()=>HJ,ref:()=>W5,processWatchDirectives:()=>wJ,processComputedDirectives:()=>VJ,isRef:()=>L1,default:()=>lU,debouncedComputed:()=>AJ,computed:()=>n5});function W5($){let Z=$,Y=new Set,J={get value(){if(t0){let X=i5.get(J);if(!X)X=new Set,i5.set(J,X);X.add(t0)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,Y.forEach((G)=>G(X));let Q=i5.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 BJ($){return L1($)?$.value:$}function jJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=W5($[Y]);return Z}function HJ($){return W5($)}function n5($){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,q=new Set,W=()=>{if(G=!0,q.size>0){let _=U.value;q.forEach((B)=>B(_))}};function z(){K.clear();let _=t0;t0=W,D$.push(W);try{return Y()}finally{D$.pop(),t0=_}}let U={get value(){if(t0){let _=i5.get(U);if(!_)_=new Set,i5.set(U,_);_.add(t0)}if(G){let _=z();if(!X(Q,_))Q=_;G=!1}return Q},set value(_){if(J)J(_);else console.warn("Computed property is readonly")},subscribe(_){return q.add(_),()=>q.delete(_)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function OJ($,Z,Y={}){let{immediate:J=!1,deep:X=!1,flush:Q="pre",once:G=!1}=Y,K,q=!0,W=!1,z=()=>{if(L1($))return X?g1($.value):$.value;return $()},U=()=>{if(!q||W)return;let j=z();if(K!==void 0&&Object.is(K,j)&&!X)return;let H=()=>{if(Z(j,K),K=X?g1(j):j,G)B()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},_=null;if(L1($))_=$.subscribe(()=>U());else _=n5($).subscribe(()=>U());if(J)K=void 0,U();else K=z();let B=()=>{if(q=!1,_)_(),_=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function LJ($,Z,Y={}){let{immediate:J=!1,once:X=!1}=Y,Q=$.map((U)=>L1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((_)=>L1(_)?_.value:void 0);if(Z(U,Q),Q=[...U],X)z()},W=$.map((U)=>{if(L1(U))return U.subscribe(()=>q());return()=>{}});if(J)q();let z=()=>{G=!1,W.forEach((U)=>U())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function FJ($,Z={}){let{flush:Y="pre"}=Z,J,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(J)J();let q=t0;t0=G,D$.push(G);try{J=$()}finally{D$.pop(),t0=q}};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 VJ($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(X,Q,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=q,`<!-- computed: ${Q} = ${q} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function wJ($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(X,Q,G)=>{return`
10454
+ `}var iU;var jJ=S(()=>{iU={processPartialHydrationDirectives:XJ,processStaticDirectives:UJ,generatePartialHydrationCSS:QJ,generateIslandManifest:_J,createIslandRegistry:JJ,hydrateIsland:GJ,hydrateByStrategy:KJ,hydrateAll:qJ,isHydrated:zJ,onHydrated:WJ}});var MJ={};r(MJ,{watchMultiple:()=>VJ,watchEffect:()=>wJ,watch:()=>FJ,unref:()=>HJ,toRefs:()=>OJ,throttledComputed:()=>TJ,stxWatchMultiple:()=>VJ,stxWatchEffect:()=>wJ,stxWatch:()=>FJ,stxUnref:()=>HJ,stxToRefs:()=>OJ,stxThrottledComputed:()=>TJ,stxShallowRef:()=>LJ,stxRef:()=>W5,stxIsRef:()=>L1,stxDebouncedComputed:()=>RJ,stxComputed:()=>n5,shallowRef:()=>LJ,ref:()=>W5,processWatchDirectives:()=>NJ,processComputedDirectives:()=>AJ,isRef:()=>L1,default:()=>nU,debouncedComputed:()=>RJ,computed:()=>n5});function W5($){let Z=$,Y=new Set,J={get value(){if(t0){let X=i5.get(J);if(!X)X=new Set,i5.set(J,X);X.add(t0)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,Y.forEach((G)=>G(X));let Q=i5.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 HJ($){return L1($)?$.value:$}function OJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=W5($[Y]);return Z}function LJ($){return W5($)}function n5($){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,q=new Set,W=()=>{if(G=!0,q.size>0){let _=U.value;q.forEach((B)=>B(_))}};function z(){K.clear();let _=t0;t0=W,D$.push(W);try{return Y()}finally{D$.pop(),t0=_}}let U={get value(){if(t0){let _=i5.get(U);if(!_)_=new Set,i5.set(U,_);_.add(t0)}if(G){let _=z();if(!X(Q,_))Q=_;G=!1}return Q},set value(_){if(J)J(_);else console.warn("Computed property is readonly")},subscribe(_){return q.add(_),()=>q.delete(_)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function FJ($,Z,Y={}){let{immediate:J=!1,deep:X=!1,flush:Q="pre",once:G=!1}=Y,K,q=!0,W=!1,z=()=>{if(L1($))return X?g1($.value):$.value;return $()},U=()=>{if(!q||W)return;let j=z();if(K!==void 0&&Object.is(K,j)&&!X)return;let H=()=>{if(Z(j,K),K=X?g1(j):j,G)B()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},_=null;if(L1($))_=$.subscribe(()=>U());else _=n5($).subscribe(()=>U());if(J)K=void 0,U();else K=z();let B=()=>{if(q=!1,_)_(),_=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function VJ($,Z,Y={}){let{immediate:J=!1,once:X=!1}=Y,Q=$.map((U)=>L1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((_)=>L1(_)?_.value:void 0);if(Z(U,Q),Q=[...U],X)z()},W=$.map((U)=>{if(L1(U))return U.subscribe(()=>q());return()=>{}});if(J)q();let z=()=>{G=!1,W.forEach((U)=>U())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function wJ($,Z={}){let{flush:Y="pre"}=Z,J,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(J)J();let q=t0;t0=G,D$.push(G);try{J=$()}finally{D$.pop(),t0=q}};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 AJ($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(X,Q,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=q,`<!-- computed: ${Q} = ${q} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function NJ($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(X,Q,G)=>{return`
10455
10455
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
10456
10456
  (function() {
10457
10457
  // Watch implementation for ${Q}
@@ -10463,9 +10463,9 @@ else {
10463
10463
  }
10464
10464
  })();
10465
10465
  </script>
10466
- `})}function g1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>g1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set(g1(X),g1(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(g1(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=g1($[Y]);return Z}function AJ($,Z=100){let Y=W5($()),J=null,X=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return n5($).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 NJ($,Z=100){let Y=W5($()),J=0,X=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return n5($).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 t0=null,D$,i5,lU;var TJ=S(()=>{D$=[],i5=new WeakMap;lU={ref:W5,computed:n5,watch:OJ,watchMultiple:LJ,watchEffect:FJ,isRef:L1,unref:BJ,toRefs:jJ,shallowRef:HJ,debouncedComputed:AJ,throttledComputed:NJ,processComputedDirectives:VJ,processWatchDirectives:wJ}});var EJ={};r(EJ,{v:()=>iU,processHasErrorsDirective:()=>DJ,processFormValidationDirectives:()=>oU,processErrorsDirective:()=>IJ,processErrorDirective:()=>MJ,defineForm:()=>nU,Validator:()=>U5});class U5{rules=[];defaultValue="";addRule($){let Z=new U5;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 U5;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 U5;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 nU($,Z){let Y=Object.keys($),J={},X={},Q={},G={},K={};for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(J[O],J);return X[O]=V,K[O]=!1,V.length===0}async function z(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function U(){for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1}function _(O){for(let V of Y)if(V in O)J[V]=O[V],G[V]=!0}function B(O,V){J[O]=V,G[O]=!0}function j(O,V=!0){if(Q[O]=V,V)W(O)}function H(O){return{value:J[O],errors:X[O],touched:Q[O],dirty:G[O],valid:X[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)Q[A]=!0;if(await z())await O(J)}}return{values:J,errors:X,touched:Q,dirty:G,get isValid(){return Y.every((O)=>X[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:z,validateField:W,reset:U,setValues:_,setFieldValue:B,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function MJ($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
10467
- `)}catch{return""}})}function IJ($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>G.replace(/\{\{\s*message\s*\}\}/g,z)).join(`
10468
- `)}catch{return""}})}function DJ($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function oU($,Z,Y){let J=$;return J=MJ(J,Z,Y),J=IJ(J,Z,Y),J=DJ(J,Z,Y),J}var iU;var kJ=S(()=>{iU=new U5});var yJ={};r(yJ,{processXElementDirectives:()=>sU,hasXElementDirectives:()=>SJ,generateXElementRuntime:()=>bJ});function bJ(){return`<script data-stx-scoped>
10466
+ `})}function g1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>g1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set(g1(X),g1(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(g1(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=g1($[Y]);return Z}function RJ($,Z=100){let Y=W5($()),J=null,X=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return n5($).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 TJ($,Z=100){let Y=W5($()),J=0,X=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return n5($).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 t0=null,D$,i5,nU;var IJ=S(()=>{D$=[],i5=new WeakMap;nU={ref:W5,computed:n5,watch:FJ,watchMultiple:VJ,watchEffect:wJ,isRef:L1,unref:HJ,toRefs:OJ,shallowRef:LJ,debouncedComputed:RJ,throttledComputed:TJ,processComputedDirectives:AJ,processWatchDirectives:NJ}});var bJ={};r(bJ,{v:()=>oU,processHasErrorsDirective:()=>kJ,processFormValidationDirectives:()=>rU,processErrorsDirective:()=>EJ,processErrorDirective:()=>DJ,defineForm:()=>sU,Validator:()=>U5});class U5{rules=[];defaultValue="";addRule($){let Z=new U5;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 U5;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 U5;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 sU($,Z){let Y=Object.keys($),J={},X={},Q={},G={},K={};for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(J[O],J);return X[O]=V,K[O]=!1,V.length===0}async function z(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function U(){for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1}function _(O){for(let V of Y)if(V in O)J[V]=O[V],G[V]=!0}function B(O,V){J[O]=V,G[O]=!0}function j(O,V=!0){if(Q[O]=V,V)W(O)}function H(O){return{value:J[O],errors:X[O],touched:Q[O],dirty:G[O],valid:X[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)Q[A]=!0;if(await z())await O(J)}}return{values:J,errors:X,touched:Q,dirty:G,get isValid(){return Y.every((O)=>X[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:z,validateField:W,reset:U,setValues:_,setFieldValue:B,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function DJ($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
10467
+ `)}catch{return""}})}function EJ($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>G.replace(/\{\{\s*message\s*\}\}/g,z)).join(`
10468
+ `)}catch{return""}})}function kJ($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function rU($,Z,Y){let J=$;return J=DJ(J,Z,Y),J=EJ(J,Z,Y),J=kJ(J,Z,Y),J}var oU;var SJ=S(()=>{oU=new U5});var PJ={};r(PJ,{processXElementDirectives:()=>aU,hasXElementDirectives:()=>CJ,generateXElementRuntime:()=>yJ});function yJ(){return`<script data-stx-scoped>
10469
10469
  (function() {
10470
10470
  'use strict';
10471
10471
 
@@ -10749,16 +10749,16 @@ else {
10749
10749
  // Expose for manual initialization
10750
10750
  window.XElement = XElement;
10751
10751
  })();
10752
- </script>`}function SJ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function sU($){if(!SJ($))return $;let Z=bJ(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
10752
+ </script>`}function CJ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function aU($){if(!CJ($))return $;let Z=yJ(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
10753
10753
  `+$.slice(Y);return $+`
10754
- `+Z}var CJ={};r(CJ,{rewriteImagesWithSiblings:()=>tU});import J1 from"path";async function tU($,Z){let Y=Z.formats??aU;if(!Z.publicDir)return $;let J=Z_($),X=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let U=K[0],_=U.match(/\bsrc=["']([^"']+)["']/i);if(!_)continue;if(Y_(K.index,J))continue;G.push({idx:K.index,length:U.length,src:_[1],raw:U})}if(G.length===0)return $;let q=await Promise.all(G.map(async(U)=>{let _=await eU(U.src,Z.publicDir,Y);return{match:U,sources:_}}));for(let{match:U,sources:_}of q){if(_.length===0)continue;let j=`<picture>${_.map((H)=>`<source type="${H.mime}" srcset="${J_(H.url)}">`).join("")}${U.raw}</picture>`;X.push({start:U.idx,end:U.idx+U.length,replacement:j})}if(X.length===0)return $;let W="",z=0;for(let U of X)W+=$.slice(z,U.start),W+=U.replacement,z=U.end;return W+=$.slice(z),W}async function eU($,Z,Y){if(!$_($))return[];let J=J1.extname($).toLowerCase();if(!rU.has(J))return[];if(!$.startsWith("/"))return[];let X=J1.join(Z,$.slice(1)),Q=J1.dirname(X),G=J1.basename(X,J),K=J1.resolve(Q),q=J1.resolve(Z);if(!K.startsWith(q))return[];let W=J1.posix.dirname($),z=Y.map(async(_)=>{let B=J1.join(Q,`${G}${_.ext}`);if(!await Bun.file(B).exists())return null;return{url:J1.posix.join(W,`${G}${_.ext}`),mime:_.mime}});return(await Promise.all(z)).filter((_)=>_!==null)}function $_($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function Z_($){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 Y_($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function J_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var rU,aU;var PJ=S(()=>{rU=new Set([".jpg",".jpeg",".png",".gif"]),aU=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var vJ=()=>{};function W6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var xJ=S(()=>{vJ()});var fJ={};r(fJ,{injectPwaTags:()=>X_,generateThemeColorMeta:()=>K_,generateSwRegistrationScript:()=>Q_,generatePwaTags:()=>E$,generateManifestLink:()=>G_});function E$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=W6($),Q=`
10754
+ `+Z}var vJ={};r(vJ,{rewriteImagesWithSiblings:()=>$_});import J1 from"path";async function $_($,Z){let Y=Z.formats??eU;if(!Z.publicDir)return $;let J=J_($),X=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let U=K[0],_=U.match(/\bsrc=["']([^"']+)["']/i);if(!_)continue;if(X_(K.index,J))continue;G.push({idx:K.index,length:U.length,src:_[1],raw:U})}if(G.length===0)return $;let q=await Promise.all(G.map(async(U)=>{let _=await Z_(U.src,Z.publicDir,Y);return{match:U,sources:_}}));for(let{match:U,sources:_}of q){if(_.length===0)continue;let j=`<picture>${_.map((H)=>`<source type="${H.mime}" srcset="${Q_(H.url)}">`).join("")}${U.raw}</picture>`;X.push({start:U.idx,end:U.idx+U.length,replacement:j})}if(X.length===0)return $;let W="",z=0;for(let U of X)W+=$.slice(z,U.start),W+=U.replacement,z=U.end;return W+=$.slice(z),W}async function Z_($,Z,Y){if(!Y_($))return[];let J=J1.extname($).toLowerCase();if(!tU.has(J))return[];if(!$.startsWith("/"))return[];let X=J1.join(Z,$.slice(1)),Q=J1.dirname(X),G=J1.basename(X,J),K=J1.resolve(Q),q=J1.resolve(Z);if(!K.startsWith(q))return[];let W=J1.posix.dirname($),z=Y.map(async(_)=>{let B=J1.join(Q,`${G}${_.ext}`);if(!await Bun.file(B).exists())return null;return{url:J1.posix.join(W,`${G}${_.ext}`),mime:_.mime}});return(await Promise.all(z)).filter((_)=>_!==null)}function Y_($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function J_($){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 X_($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function Q_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var tU,eU;var xJ=S(()=>{tU=new Set([".jpg",".jpeg",".png",".gif"]),eU=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var fJ=()=>{};function U6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var gJ=S(()=>{fJ()});var hJ={};r(hJ,{injectPwaTags:()=>G_,generateThemeColorMeta:()=>z_,generateSwRegistrationScript:()=>K_,generatePwaTags:()=>E$,generateManifestLink:()=>q_});function E$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=U6($),Q=`
10755
10755
  <!-- stx PWA Meta Tags -->
10756
10756
  <link rel="manifest" href="/manifest.json">
10757
- <meta name="theme-color" content="${U6(Y?.themeColor||"#000000")}">
10757
+ <meta name="theme-color" content="${_6(Y?.themeColor||"#000000")}">
10758
10758
  <meta name="mobile-web-app-capable" content="yes">
10759
10759
  <meta name="apple-mobile-web-app-capable" content="yes">
10760
10760
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
10761
- <meta name="apple-mobile-web-app-title" content="${U6(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)Q+=`
10761
+ <meta name="apple-mobile-web-app-title" content="${_6(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)Q+=`
10762
10762
  <link rel="apple-touch-icon" href="${J}/apple-touch-icon.png">
10763
10763
  <link rel="apple-touch-icon" sizes="120x120" href="${J}/apple-touch-icon-120x120.png">
10764
10764
  <link rel="apple-touch-icon" sizes="152x152" href="${J}/apple-touch-icon-152x152.png">
@@ -10795,12 +10795,12 @@ if ('serviceWorker' in navigator) {
10795
10795
  });
10796
10796
  }
10797
10797
  </script>
10798
- <!-- End stx PWA -->`,Q}function X_($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1){let Q=E$(Z);return $.slice(0,X)+Q+`
10798
+ <!-- End stx PWA -->`,Q}function G_($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1){let Q=E$(Z);return $.slice(0,X)+Q+`
10799
10799
  `+$.slice(X)}return $+E$(Z)}let J=E$(Z);return $.replace("</head>",`${J}
10800
- </head>`)}function Q_($){if(!$.pwa?.enabled)return"";return`<script>
10800
+ </head>`)}function K_($){if(!$.pwa?.enabled)return"";return`<script>
10801
10801
  if ('serviceWorker' in navigator) {
10802
10802
  window.addEventListener('load', function() {
10803
- navigator.serviceWorker.register('/${W6($)}')
10803
+ navigator.serviceWorker.register('/${U6($)}')
10804
10804
  .then(function(registration) {
10805
10805
  console.log('[PWA] Service Worker registered:', registration.scope);
10806
10806
  })
@@ -10809,43 +10809,43 @@ if ('serviceWorker' in navigator) {
10809
10809
  });
10810
10810
  });
10811
10811
  }
10812
- </script>`}function G_(){return'<link rel="manifest" href="/manifest.json">'}function K_($){return`<meta name="theme-color" content="${U6($)}">`}function U6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var gJ=S(()=>{xJ()});import C0 from"path";import{deriveLayoutGroup as q_}from"stx-router/layout-metadata";function hJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function z_($,Z){let Y=$.length,J=Z,X=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(J<Y){let K=$[J];if(G(J))return J;if(K==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
10812
+ </script>`}function q_(){return'<link rel="manifest" href="/manifest.json">'}function z_($){return`<meta name="theme-color" content="${_6($)}">`}function _6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var dJ=S(()=>{gJ()});import C0 from"path";import{deriveLayoutGroup as W_}from"stx-router/layout-metadata";function mJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function U_($,Z){let Y=$.length,J=Z,X=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(J<Y){let K=$[J];if(G(J))return J;if(K==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
10813
10813
  `,J+2),J===-1)return-1;J+=1,X=!0;continue}if(K==="/"&&$[J+1]==="*"){let q=$.indexOf("*/",J+2);if(q===-1)return-1;J=q+2,X=!0;continue}if(K==="/"&&X){let q=J+1,W=!1;while(q<Y){let z=$[q];if(z==="\\"){q+=2;continue}if(z==="[")W=!0;else if(z==="]")W=!1;else if(z==="/"&&!W){q++;break}else if(z===`
10814
10814
  `){q=-1;break}q++}if(q===-1){J++,X=!1;continue}while(q<Y&&/[a-z]/.test($[q]))q++;J=q,X=!1;continue}if(K==="'"||K==='"'){let q=K;J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]===q){J++;break}if($[J]===`
10815
- `)break;J++}X=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,X=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;J++}return-1}async function j0($,Z,Y,J,X){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;let Q=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!S5()&&!v4())&&Y&&Y.endsWith(".stx"))K3($,Y);try{return await Y9.timeAsync("template-processing",async()=>{let G=await W_($,Z,Y,J,X);if(Q)G=X6(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},W=(Z.__stx_runtime_head||null)??M5(),z=(Z.__stx_head_raw||"").trim(),U,_=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(_)U=_[1].trim(),z=z.replace(_[0],"").trim();let B=Z.__sections?.title,j=W.title||U||B,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,z].filter(Boolean).join(`
10816
- `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=m3(G);if(G=$2(G,H),L)G=eY(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=q_(V);G=G.replace("<head>",`<head>
10817
- <meta name="stx-layout" content="${hJ(V)}">
10818
- <meta name="stx-layout-group" content="${hJ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(Q)G=tY(G);if(Q)try{let{getStoreScript:K}=await Promise.resolve().then(() => (E2(),D2)),q=J.storesDir,W=await K(q);if(W){let z=`<script data-stx-stores>${W}</script>`,U=G.indexOf("<script data-stx-scoped>");if(U!==-1){let _=G.indexOf("</script>",U+24);if(_!==-1){let B=_+9;G=G.slice(0,B)+`
10819
- `+z+G.slice(B)}}}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await v5(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),q=new k1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(c0.log(q,{filePath:Y,context:Z}),y7.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),J.debug)throw q;return b7.createFallbackContent("Template Processing",q)}}async function W_($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!C0.isAbsolute(J.partialsDir)?C0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!C0.isAbsolute(J.componentsDir)?C0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!C0.isAbsolute(J.layoutsDir)?C0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,q=$;await B_(Y,Z),__(Z,K),q=await r1(()=>fY(q,Z,Y,K),q,(O)=>{c0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=A5(q,i6,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let z=W.tokens,U=(O)=>z.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>z[Number(w)]??""),_="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,_),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=oY(q),q=await N2(q,Y,X);let B={};q=g3(q,B);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",A=C0.dirname(Y),N=K.layoutsDir?C0.dirname(K.layoutsDir):process.cwd();for(let R=0;R<20;R++){let T=C0.join(A,"_layout.stx");if(await n(T)){w=T;break}let M=C0.dirname(A);if(M===A||M.length<N.length)break;A=M}if(w)H=w;else if(K.layoutsDir){let R=C0.isAbsolute(K.layoutsDir)?K.layoutsDir:C0.resolve(process.cwd(),K.layoutsDir),T=C0.join(R,`${K.defaultLayout}.stx`);if(await n(T))H=T}if(H&&!V)q=`@section('content')
10815
+ `)break;J++}X=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,X=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;J++}return-1}async function j0($,Z,Y,J,X){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;let Q=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!S5()&&!v4())&&Y&&Y.endsWith(".stx"))K3($,Y);try{return await J9.timeAsync("template-processing",async()=>{let G=await __($,Z,Y,J,X);if(Q)G=Q6(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},W=(Z.__stx_runtime_head||null)??M5(),z=(Z.__stx_head_raw||"").trim(),U,_=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(_)U=_[1].trim(),z=z.replace(_[0],"").trim();let B=Z.__sections?.title,j=W.title||U||B,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,z].filter(Boolean).join(`
10816
+ `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=u3(G);if(G=Y2(G,H),L)G=Z2(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=W_(V);G=G.replace("<head>",`<head>
10817
+ <meta name="stx-layout" content="${mJ(V)}">
10818
+ <meta name="stx-layout-group" content="${mJ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(Q)G=$2(G);if(Q)try{let{getStoreScript:K}=await Promise.resolve().then(() => (b2(),k2)),q=J.storesDir,W=await K(q);if(W){let z=`<script data-stx-stores>${W}</script>`,U=G.indexOf("<script data-stx-scoped>");if(U!==-1){let _=G.indexOf("</script>",U+24);if(_!==-1){let B=_+9;G=G.slice(0,B)+`
10819
+ `+z+G.slice(B)}}}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await v5(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),q=new k1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(c0.log(q,{filePath:Y,context:Z}),y7.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),J.debug)throw q;return b7.createFallbackContent("Template Processing",q)}}async function __($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!C0.isAbsolute(J.partialsDir)?C0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!C0.isAbsolute(J.componentsDir)?C0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!C0.isAbsolute(J.layoutsDir)?C0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,q=$;await H_(Y,Z),j_(Z,K),q=await r1(()=>hY(q,Z,Y,K),q,(O)=>{c0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=A5(q,n6,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let z=W.tokens,U=(O)=>z.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>z[Number(w)]??""),_="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,_),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=rY(q),q=await T2(q,Y,X);let B={};q=h3(q,B);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",A=C0.dirname(Y),N=K.layoutsDir?C0.dirname(K.layoutsDir):process.cwd();for(let R=0;R<20;R++){let T=C0.join(A,"_layout.stx");if(await n(T)){w=T;break}let M=C0.dirname(A);if(M===A||M.length<N.length)break;A=M}if(w)H=w;else if(K.layoutsDir){let R=C0.isAbsolute(K.layoutsDir)?K.layoutsDir:C0.resolve(process.cwd(),K.layoutsDir),T=C0.join(R,`${K.defaultLayout}.stx`);if(await n(T))H=T}if(H&&!V)q=`@section('content')
10820
10820
  ${q.trim()}
10821
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return j[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=Z0(w.trim(),Z);if(A===void 0)return O;return j[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))j[V]=w.replace("@parent",h1);else j[V]=w.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return j[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=h3(q,B),H){let O=[];if(q=q.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,(V)=>{return O.push(V),""}),O.length>0){let V=O.join(`
10821
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return j[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=Z0(w.trim(),Z);if(A===void 0)return O;return j[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))j[V]=w.replace("@parent",h1);else j[V]=w.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return j[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=d3(q,B),H){let O=[];if(q=q.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,(V)=>{return O.push(V),""}),O.length>0){let V=O.join(`
10822
10822
  `);j.content=j.content?`${j.content}
10823
- ${V}`:V,Z.__sections=j}}if(H)try{let O;if(C0.isAbsolute(H))O=H,X.add(H);else O=await r1(()=>s$(H,Y,G,X),null,()=>{throw new k1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(c0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new k1(T,Y);return q}let V=await r1(()=>Bun.file(O).text(),"",()=>{throw new k1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,P,b)=>{return T[P]=b.trim(),""});for(let[E,P]of Object.entries(T))if(j[E]&&j[E].includes(h1)){let b=j[E].indexOf(h1);j[E]=j[E].slice(0,b)+P+j[E].slice(b+h1.length)}else if(!j[E])j[E]=P;let I={...Z,__sections:j},D=`@layout('${w[1]}')${M}`;return await j0(D,I,O,G,X)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=g3(A,B),R={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return R[M]=I.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let D=j[M];if(D.includes(h1)){let E=R[M]||"",P=D.indexOf(h1);D=D.slice(0,P)+E+D.slice(P+h1.length)}return D}return I||""}),N=U_(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=h3(N,B),Z.__originalFilePath=Y,q=await dJ(N,Z,O,G,X),q=`<!-- stx-layout: ${H} -->
10824
- ${q}`,U(q)}catch(O){return c0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await dJ(q,Z,Y,G,X))}function U_($,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 __($,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 B_($,Z){await r1(()=>uY($,Z),void 0,(Y)=>{c0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function j_($,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:q}=await Promise.resolve().then(() => (E5(),q4));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));c0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function H_($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await Promise.resolve().then(() => (r0(),e6));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return c0.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function dJ($,Z,Y,J,X){let Q=$,G=J;if(await j_(Q,Z,Y),Q=await H_(Q,Z,Y),Q=await SY(Q,Z,Y),Q=await yY(Q,Z,Y),Q=await bZ(Q,Z,Y,G),p1(Q))Q=a3(Q,Z),Q=e3(Q,Z);Q=t3(Q);let{processStreamDirectives:K}=await Promise.resolve().then(() => (G3(),Q3));Q=K(Q,Z),Q=P3(Q,Z,Y,G),Q=await G$(Q,Z,Y,G,X),Q=await rY(Q,Z,Y,G,X),Q=T6(Q,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => b2);Q=q(Q,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => y2);Q=W(Q,Z,Y);let{processTransitionDirectives:z,processTransitionAttributes:U}=await Promise.resolve().then(() => x2);Q=z(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:_}=await Promise.resolve().then(() => g2);Q=_(Q,Z,Y);let{processSuspenseDirectives:B}=await Promise.resolve().then(() => h2);Q=B(Q,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => p2);Q=j(Q,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => l2);Q=H(Q,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (a2(),r2));Q=L(Q,Z,Y),Q=F(Q,Z,Y),Q=O(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (_J(),UJ));Q=V(Q,Z,Y),Q=w(Q);let{processComputedDirectives:A,processWatchDirectives:N}=await Promise.resolve().then(() => (TJ(),RJ));Q=A(Q,Z,Y),Q=N(Q,Z,Y);let{processFormValidationDirectives:R}=await Promise.resolve().then(() => (kJ(),EJ));Q=R(Q,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:D}=await Promise.resolve().then(() => (I5(),u$));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=T(Q);if(Q=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
10825
- `;if(Q=M(Q,Z),Q=I(Q,Z),Q=dY(Q),Q=i7(Q,Z),Q=EZ(Q),Q=vY(Q),Q=await f3(Q,Z,Y,G,X),Q=await G$(Q,Z,Y,G,X),Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=X6(Q),Q=C1(Q,Z,Y),Q=n7(Q,Z),Q=o7(Q,Z),Q=t4(Q,Z),Q=vZ(Q,Z),Q=xZ(Q,Z),Q=await jZ(Q,Z,Y,G),Q=await R9(Q,Z,Y),Q=await mZ(Q,Z,Y,G),Q=L6(Q,Z,Y,G),Q=S8(Q,Z,Y,G),Q=y8(Q,Z,Y),Q=C8(Q,Z,Y,G),Q=MZ(Q,Z,Y,G),Q=Y6(Q,Z),Q=J6(Q),Q=T2(Q),!G.skipEventDirectives)Q=KZ(Q,Z,Y);if(Q=_Z(Q,Z,Y),G.debug){let C=/\bx-data\s*=/.test(Q),x=M$($);if(C&&x)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
10823
+ ${V}`:V,Z.__sections=j}}if(H)try{let O;if(C0.isAbsolute(H))O=H,X.add(H);else O=await r1(()=>s$(H,Y,G,X),null,()=>{throw new k1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(c0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new k1(T,Y);return q}let V=await r1(()=>Bun.file(O).text(),"",()=>{throw new k1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,P,b)=>{return T[P]=b.trim(),""});for(let[E,P]of Object.entries(T))if(j[E]&&j[E].includes(h1)){let b=j[E].indexOf(h1);j[E]=j[E].slice(0,b)+P+j[E].slice(b+h1.length)}else if(!j[E])j[E]=P;let I={...Z,__sections:j},D=`@layout('${w[1]}')${M}`;return await j0(D,I,O,G,X)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=h3(A,B),R={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return R[M]=I.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let D=j[M];if(D.includes(h1)){let E=R[M]||"",P=D.indexOf(h1);D=D.slice(0,P)+E+D.slice(P+h1.length)}return D}return I||""}),N=B_(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=d3(N,B),Z.__originalFilePath=Y,q=await uJ(N,Z,O,G,X),q=`<!-- stx-layout: ${H} -->
10824
+ ${q}`,U(q)}catch(O){return c0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await uJ(q,Z,Y,G,X))}function B_($,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 j_($,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 H_($,Z){await r1(()=>cY($,Z),void 0,(Y)=>{c0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function O_($,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:q}=await Promise.resolve().then(() => (E5(),q4));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));c0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function L_($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await Promise.resolve().then(() => (r0(),$9));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return c0.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function uJ($,Z,Y,J,X){let Q=$,G=J;if(await O_(Q,Z,Y),Q=await L_(Q,Z,Y),Q=await CY(Q,Z,Y),Q=await PY(Q,Z,Y),Q=await SZ(Q,Z,Y,G),p1(Q))Q=t3(Q,Z),Q=$6(Q,Z);Q=e3(Q);let{processStreamDirectives:K}=await Promise.resolve().then(() => (G3(),Q3));Q=K(Q,Z),Q=v3(Q,Z,Y,G),Q=await G$(Q,Z,Y,G,X),Q=await tY(Q,Z,Y,G,X),Q=M6(Q,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => y2);Q=q(Q,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => P2);Q=W(Q,Z,Y);let{processTransitionDirectives:z,processTransitionAttributes:U}=await Promise.resolve().then(() => g2);Q=z(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:_}=await Promise.resolve().then(() => d2);Q=_(Q,Z,Y);let{processSuspenseDirectives:B}=await Promise.resolve().then(() => m2);Q=B(Q,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => l2);Q=j(Q,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => n2);Q=H(Q,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (e2(),t2));Q=L(Q,Z,Y),Q=F(Q,Z,Y),Q=O(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (jJ(),BJ));Q=V(Q,Z,Y),Q=w(Q);let{processComputedDirectives:A,processWatchDirectives:N}=await Promise.resolve().then(() => (IJ(),MJ));Q=A(Q,Z,Y),Q=N(Q,Z,Y);let{processFormValidationDirectives:R}=await Promise.resolve().then(() => (SJ(),bJ));Q=R(Q,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:D}=await Promise.resolve().then(() => (I5(),u$));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=T(Q);if(Q=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
10825
+ `;if(Q=M(Q,Z),Q=I(Q,Z),Q=uY(Q),Q=i7(Q,Z),Q=kZ(Q),Q=fY(Q),Q=await g3(Q,Z,Y,G,X),Q=await G$(Q,Z,Y,G,X),Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=Q6(Q),Q=C1(Q,Z,Y),Q=n7(Q,Z),Q=o7(Q,Z),Q=t4(Q,Z),Q=xZ(Q,Z),Q=fZ(Q,Z),Q=await HZ(Q,Z,Y,G),Q=await T9(Q,Z,Y),Q=await uZ(Q,Z,Y,G),Q=F6(Q,Z,Y,G),Q=y8(Q,Z,Y,G),Q=C8(Q,Z,Y),Q=P8(Q,Z,Y,G),Q=IZ(Q,Z,Y,G),Q=J6(Q,Z),Q=X6(Q),Q=I2(Q),!G.skipEventDirectives)Q=qZ(Q,Z,Y);if(Q=BZ(Q,Z,Y),G.debug){let C=/\bx-data\s*=/.test(Q),x=M$($);if(C&&x)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
10826
10826
  Both work on the same page, but they manage separate scopes.
10827
- Prefer signals (state/derived/effect) for new components.`)}Q=lY(Q,Z),Q=await s0(Q,Z,Y),Q=M2(Q),Q=I2(Q),Q=t8(Q);let{processXElementDirectives:P}=await Promise.resolve().then(() => yJ);Q=P(Q);let b=Z.__originalFilePath||Y,k=F5(Z);if(Q=await $6(Q,G,b,k),Q=await gY(Q,Z,Y,G),G.media?.image?.autoSiblings){let C=G.publicDir||"public",{rewriteImagesWithSiblings:x}=await Promise.resolve().then(() => (PJ(),CJ));Q=await x(Q,{publicDir:C})}if(G.seo?.enabled)Q=P8(Q,Z,G);let y=(C,x)=>{if(!x)return C;if(/<\/head>/i.test(C))return C.replace(/<\/head>/i,`${x}
10827
+ Prefer signals (state/derived/effect) for new components.`)}Q=nY(Q,Z),Q=await s0(Q,Z,Y),Q=D2(Q),Q=E2(Q),Q=e8(Q);let{processXElementDirectives:P}=await Promise.resolve().then(() => PJ);Q=P(Q);let b=Z.__originalFilePath||Y,k=F5(Z);if(Q=await Z6(Q,G,b,k),Q=await dY(Q,Z,Y,G),G.media?.image?.autoSiblings){let C=G.publicDir||"public",{rewriteImagesWithSiblings:x}=await Promise.resolve().then(() => (xJ(),vJ));Q=await x(Q,{publicDir:C})}if(G.seo?.enabled)Q=v8(Q,Z,G);let y=(C,x)=>{if(!x)return C;if(/<\/head>/i.test(C))return C.replace(/<\/head>/i,`${x}
10828
10828
  </head>`);if(/<head\b[^>]*>/i.test(C))return C.replace(/(<head\b[^>]*>)/i,`$1
10829
10829
  ${x}`);if(/<html\b[^>]*>/i.test(C))return C.replace(/(<html\b[^>]*>)/i,`$1
10830
10830
  <head>
10831
10831
  ${x}
10832
- </head>`);return C},{renderHead:g,getHead:h}=await Promise.resolve().then(() => (I5(),u$)),m=Z.__stx_runtime_head,i=m&&(m.title||m.meta?.length||m.link?.length)?m:h();if(i.title||i.meta?.length||i.link?.length){let C=g(i);if(C)Q=y(Q,C)}if(E.headContent)Q=y(Q,E.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)Q=TZ(Q,G.csp,Z);if(G.analytics?.enabled)Q=$Z(Q,G);if(G.heatmap?.enabled)Q=k6(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:C}=await Promise.resolve().then(() => (gJ(),fJ));Q=C(Q,G)}let c=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),q0=/\bSTX\.\w+/.test(Q),F0=/window\.STX\s*=/.test(Q);if(c&&q0&&!F0){let x=`<script data-stx-scoped>
10833
- ${o8()}
10832
+ </head>`);return C},{renderHead:g,getHead:h}=await Promise.resolve().then(() => (I5(),u$)),m=Z.__stx_runtime_head,i=m&&(m.title||m.meta?.length||m.link?.length)?m:h();if(i.title||i.meta?.length||i.link?.length){let C=g(i);if(C)Q=y(Q,C)}if(E.headContent)Q=y(Q,E.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)Q=MZ(Q,G.csp,Z);if(G.analytics?.enabled)Q=ZZ(Q,G);if(G.heatmap?.enabled)Q=b6(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:C}=await Promise.resolve().then(() => (dJ(),hJ));Q=C(Q,G)}let c=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),q0=/\bSTX\.\w+/.test(Q),F0=/window\.STX\s*=/.test(Q);if(c&&q0&&!F0){let x=`<script data-stx-scoped>
10833
+ ${s8()}
10834
10834
  </script>`;if(Q.includes("</head>")){let u=Q.indexOf("</head>"),X0=Q.slice(0,u).indexOf("<script");if(X0!==-1){let W0=Q.slice(0,X0),b0=Q.slice(X0);Q=W0+x+`
10835
10835
  `+b0}else Q=Q.replace("</head>",`${x}
10836
10836
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
10837
10837
  ${x}`);else Q=x+`
10838
- `+Q}{let C=/<script\s+server\b[^>]*>/gi,x,u=[];while((x=C.exec(Q))!==null){let p=x.index+x[0].length,X0=z_(Q,p);if(X0===-1)continue;let W0=X0+9;while(W0<Q.length&&/\s/.test(Q[W0]))W0++;u.push({start:x.index,end:W0}),C.lastIndex=W0}for(let p=u.length-1;p>=0;p--){let{start:X0,end:W0}=u[p];Q=Q.substring(0,X0)+Q.substring(W0)}}let _0=Q4(Q,Y);if(_0.hasScoped)Q=_0.html;let $0=Z.__stx_event_bindings||[],k0=!1,f0=[],v=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:f}=await Promise.resolve().then(() => (Z6(),V2));for(let C of f(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))f0.push({match:C.fullMatch,attrs:C.attrs,content:C.body});for(let{match:C,attrs:x,content:u}of f0){k0=!0;let p=u;G6(u,Y,J.strict);let X0=await V5(u,{eventBindings:$0,attrs:x,hasColonDirectives:v,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:k});Q=Q.replace(C,()=>X0)}if(k0)Z.__stx_event_bindings=[];return Q}var h1="<!--PARENT_CONTENT_PLACEHOLDER-->";var W4=S(()=>{c4();X4();S$();s8();e8();ZZ();P$();y$();qZ();w5();BZ();HZ();s4();IZ();kZ();yZ();Z1();I5();r0();fZ();uZ();bY();PY();v3();r$();hY();i1();mY();C7();A0();pY();iY();sY();aY();m$();Z6();C3();R2();Q6();K6();R0();q3();Q6();K6()});import L0 from"fs";import J0 from"path";import{matchRoute as g_,Router as JX}from"stx-router";import{findErrorPage as m_,formatRoutes as u_,generateRouteManifest as p_,generateRouteTypes as c_,matchRoute as l_}from"stx-router";function b$($,Z={}){return new JX($,Z).routes}W4();import{createHash as O_}from"crypto";function L_($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var F_=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function V_($){return Bun.hash($).toString(16)}function mJ($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,J=$.replace(F_,(Q,G,K,q)=>{let W=q.trim();if(!W)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)W=L_(W);let z=V_(W);if(!Y.has(z))Y.set(z,W);let U=Z.integrity?` data-stx-integrity="sha384-${O_("sha384").update(W).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${z}.js"${U}${K}></script>`}),X=Array.from(Y,([Q,G])=>({hash:Q,code:G}));return{html:J,chunks:X}}var w_=new Set(["visible","idle"]);function uJ($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Y.exec($))!==null)Z.set(J[1],J[2]);let X=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(w_.has(Z.get(G[1])||""))X.add(G[2]);let K=$.lastIndexOf("</head>");if(X.size===0||K===-1)return $;let q=Array.from(X).filter((W)=>!$.includes(`rel="prefetch" href="${W}"`)).map((W)=>`<link rel="prefetch" href="${W}" as="script">`).join("");if(!q)return $;return $.slice(0,K)+q+$.slice(K)}t1();H5();c4();import{abortNavigation as nw,clearMiddleware as pJ,createClientCookieManager as ow,createMiddlewareContext as cJ,createRouteLocation as lJ,createServerCookieManager as sw,createStorageManager as rw,defineMiddleware as aw,getMiddleware as tw,getMiddlewareNames as iJ,hasMiddleware as ew,loadMiddlewareFromDirectory as nJ,navigateTo as $A,registerMiddleware as ZA,runMiddleware as oJ}from"stx-router";class sJ{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=J0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,J]of Object.entries(Z))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await L0.promises.mkdir(this.cacheDir,{recursive:!0});let $=J0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,J]of this.cache)Z[Y]=J;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=L0.statSync($),J=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(L0.existsSync(Q)){let G=L0.statSync(Q);J+=`:${Q}:${G.mtimeMs}`}let X=0;for(let Q=0;Q<J.length;Q++){let G=J.charCodeAt(Q);X=(X<<5)-X+G,X=X&X}return Math.abs(X).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let J=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==J)return this.cache.delete($),null;return Y.html}set($,Z,Y,J){let X=this.getHash(Z,Y);this.cache.set($,{hash:X,html:J,generatedAt:Date.now(),dependencies:Y})}}class rJ{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return J0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await L0.promises.mkdir(J0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await L0.promises.unlink(Z)}async invalidatePattern($){let Z=J0.join(this.cacheDir,"isr");if(!L0.existsSync(Z))return;let Y=await L0.promises.readdir(Z);for(let J of Y){let X=J.replace(/_/g,"/").replace(".json","");if($.test(X))await L0.promises.unlink(J0.join(Z,J))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function A_($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let J=Y[1];if(!J.includes("getStaticPaths"))return null;let X=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!X)return null;return await Function(`
10838
+ `+Q}{let C=/<script\s+server\b[^>]*>/gi,x,u=[];while((x=C.exec(Q))!==null){let p=x.index+x[0].length,X0=U_(Q,p);if(X0===-1)continue;let W0=X0+9;while(W0<Q.length&&/\s/.test(Q[W0]))W0++;u.push({start:x.index,end:W0}),C.lastIndex=W0}for(let p=u.length-1;p>=0;p--){let{start:X0,end:W0}=u[p];Q=Q.substring(0,X0)+Q.substring(W0)}}let _0=Q4(Q,Y);if(_0.hasScoped)Q=_0.html;let $0=Z.__stx_event_bindings||[],k0=!1,f0=[],v=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:f}=await Promise.resolve().then(() => (Y6(),A2));for(let C of f(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))f0.push({match:C.fullMatch,attrs:C.attrs,content:C.body});for(let{match:C,attrs:x,content:u}of f0){k0=!0;let p=u;K6(u,Y,J.strict);let X0=await V5(u,{eventBindings:$0,attrs:x,hasColonDirectives:v,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:k});Q=Q.replace(C,()=>X0)}if(k0)Z.__stx_event_bindings=[];return Q}var h1="<!--PARENT_CONTENT_PLACEHOLDER-->";var W4=S(()=>{c4();X4();S$();r8();$Z();YZ();P$();y$();zZ();w5();jZ();OZ();s4();DZ();bZ();CZ();Z1();I5();r0();gZ();pZ();yY();xY();x3();r$();mY();i1();pY();C7();A0();lY();oY();aY();eY();m$();Y6();P3();M2();G6();q6();R0();q3();G6();q6()});import L0 from"fs";import J0 from"path";import{matchRoute as d_,Router as QX}from"stx-router";import{findErrorPage as p_,formatRoutes as c_,generateRouteManifest as l_,generateRouteTypes as i_,matchRoute as n_}from"stx-router";function b$($,Z={}){return new QX($,Z).routes}W4();import{createHash as F_}from"crypto";function V_($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var w_=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function A_($){return Bun.hash($).toString(16)}function pJ($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,J=$.replace(w_,(Q,G,K,q)=>{let W=q.trim();if(!W)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)W=V_(W);let z=A_(W);if(!Y.has(z))Y.set(z,W);let U=Z.integrity?` data-stx-integrity="sha384-${F_("sha384").update(W).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${z}.js"${U}${K}></script>`}),X=Array.from(Y,([Q,G])=>({hash:Q,code:G}));return{html:J,chunks:X}}var N_=new Set(["visible","idle"]);function cJ($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Y.exec($))!==null)Z.set(J[1],J[2]);let X=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(N_.has(Z.get(G[1])||""))X.add(G[2]);let K=$.lastIndexOf("</head>");if(X.size===0||K===-1)return $;let q=Array.from(X).filter((W)=>!$.includes(`rel="prefetch" href="${W}"`)).map((W)=>`<link rel="prefetch" href="${W}" as="script">`).join("");if(!q)return $;return $.slice(0,K)+q+$.slice(K)}t1();H5();c4();import{abortNavigation as sw,clearMiddleware as lJ,createClientCookieManager as rw,createMiddlewareContext as iJ,createRouteLocation as nJ,createServerCookieManager as aw,createStorageManager as tw,defineMiddleware as ew,getMiddleware as $A,getMiddlewareNames as oJ,hasMiddleware as ZA,loadMiddlewareFromDirectory as sJ,navigateTo as YA,registerMiddleware as JA,runMiddleware as rJ}from"stx-router";class aJ{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=J0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,J]of Object.entries(Z))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await L0.promises.mkdir(this.cacheDir,{recursive:!0});let $=J0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,J]of this.cache)Z[Y]=J;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=L0.statSync($),J=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(L0.existsSync(Q)){let G=L0.statSync(Q);J+=`:${Q}:${G.mtimeMs}`}let X=0;for(let Q=0;Q<J.length;Q++){let G=J.charCodeAt(Q);X=(X<<5)-X+G,X=X&X}return Math.abs(X).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let J=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==J)return this.cache.delete($),null;return Y.html}set($,Z,Y,J){let X=this.getHash(Z,Y);this.cache.set($,{hash:X,html:J,generatedAt:Date.now(),dependencies:Y})}}class tJ{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return J0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await L0.promises.mkdir(J0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await L0.promises.unlink(Z)}async invalidatePattern($){let Z=J0.join(this.cacheDir,"isr");if(!L0.existsSync(Z))return;let Y=await L0.promises.readdir(Z);for(let J of Y){let X=J.replace(/_/g,"/").replace(".json","");if($.test(X))await L0.promises.unlink(J0.join(Z,J))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function R_($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let J=Y[1];if(!J.includes("getStaticPaths"))return null;let X=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!X)return null;return await Function(`
10839
10839
  return (async function getStaticPaths() {
10840
10840
  ${X[1]}
10841
10841
  })()
10842
- `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function N_($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let Y=await A_($.filePath);if(!Y||Y.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let J of Y.paths){let X=$.pattern;for(let[Q,G]of Object.entries(J.params))X=X.replace(`:${Q}`,G).replace(`:${Q}*`,G);Z.push({url:X,params:J.params,props:J.props,revalidate:J.revalidate})}}return Z}async function R_($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Y of Z)if(await Bun.file(Y).exists())try{let J=await import(Y);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:X,...Q}=J;return Q}}catch(J){console.error(`Error loading data file ${Y}:`,J)}return null}async function T_($,Z,Y){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let X=J[1];if(!X.includes("getStaticProps"))return null;try{let Q=X.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!Q)return null;return await Function("params",`
10842
+ `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function T_($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let Y=await R_($.filePath);if(!Y||Y.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let J of Y.paths){let X=$.pattern;for(let[Q,G]of Object.entries(J.params))X=X.replace(`:${Q}`,G).replace(`:${Q}*`,G);Z.push({url:X,params:J.params,props:J.props,revalidate:J.revalidate})}}return Z}async function M_($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Y of Z)if(await Bun.file(Y).exists())try{let J=await import(Y);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:X,...Q}=J;return Q}}catch(J){console.error(`Error loading data file ${Y}:`,J)}return null}async function I_($,Z,Y){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let X=J[1];if(!X.includes("getStaticProps"))return null;try{let Q=X.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!Q)return null;return await Function("params",`
10843
10843
  return (async function getStaticProps() {
10844
10844
  ${Q[1]}
10845
10845
  })()
10846
- `)(Z)}catch(Q){return console.error(`Error executing getStaticProps in ${Y}:`,Q),null}}async function aJ($,Z,Y={},J,X){let Q=await Bun.file($.filePath).text(),G=await R_($.filePath),K=await T_(Q,Z,$.filePath),q={...G||{},...K||{},...Y,params:Z,$route:{path:$.pattern,params:Z}},W=new Set,z={...X,debug:!1,cache:!1,autoShell:!0},U=await j0(Q,q,$.filePath,z,W);if(Object.keys(Z).length>0){let _=`<script>if(window.stx)window.stx._rp=${JSON.stringify(Z)};else window.__stx_rp=${JSON.stringify(Z)};</script>`;if(U.includes("</head>"))U=U.replace("</head>",`${_}
10846
+ `)(Z)}catch(Q){return console.error(`Error executing getStaticProps in ${Y}:`,Q),null}}async function eJ($,Z,Y={},J,X){let Q=await Bun.file($.filePath).text(),G=await M_($.filePath),K=await I_(Q,Z,$.filePath),q={...G||{},...K||{},...Y,params:Z,$route:{path:$.pattern,params:Z}},W=new Set,z={...X,debug:!1,cache:!1,autoShell:!0},U=await j0(Q,q,$.filePath,z,W);if(Object.keys(Z).length>0){let _=`<script>if(window.stx)window.stx._rp=${JSON.stringify(Z)};else window.__stx_rp=${JSON.stringify(Z)};</script>`;if(U.includes("</head>"))U=U.replace("</head>",`${_}
10847
10847
  </head>`);else U=`${_}
10848
- ${U}`}if(U=await s3(U),U=await v5(U),J.minify!==!1)return{html:M_(U),dependencies:Array.from(W)};return{html:U,dependencies:Array.from(W)}}function M_($){let Z=[],Y=0,J=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,X;while((X=J.exec($))!==null){let G=$.slice(Y,X.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=X[1],q=X[2],W=X[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+q+W),Y=X.index+X[0].length}let Q=$.slice(Y);return Z.push(Q.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function I_($){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)}"`}function D_($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
10848
+ ${U}`}if(U=await r3(U),U=await v5(U),J.minify!==!1)return{html:D_(U),dependencies:Array.from(W)};return{html:U,dependencies:Array.from(W)}}function D_($){let Z=[],Y=0,J=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,X;while((X=J.exec($))!==null){let G=$.slice(Y,X.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=X[1],q=X[2],W=X[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+q+W),Y=X.index+X[0].length}let Q=$.slice(Y);return Z.push(Q.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function E_($){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)}"`}function k_($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
10849
10849
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
10850
10850
  ${$.map((J)=>{let X=new URL(J.loc,Z).href,Q=` <url>
10851
10851
  <loc>${n0(X)}</loc>`;if(J.lastmod)Q+=`
@@ -10854,7 +10854,7 @@ ${$.map((J)=>{let X=new URL(J.loc,Z).href,Q=` <url>
10854
10854
  <priority>${J.priority}</priority>`;return Q+=`
10855
10855
  </url>`,Q}).join(`
10856
10856
  `)}
10857
- </urlset>`}function n0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function E_($,Z){let Y=Z.map((J)=>{let X=" <item>";if(X+=`
10857
+ </urlset>`}function n0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function b_($,Z){let Y=Z.map((J)=>{let X=" <item>";if(X+=`
10858
10858
  <title>${n0(J.title)}</title>`,X+=`
10859
10859
  <link>${n0(J.link)}</link>`,J.description)X+=`
10860
10860
  <description>${n0(J.description)}</description>`;if(J.pubDate)X+=`
@@ -10875,10 +10875,10 @@ ${$.map((J)=>{let X=new URL(J.loc,Z).href,Q=` <url>
10875
10875
  ${Y.join(`
10876
10876
  `)}
10877
10877
  </channel>
10878
- </rss>`}async function k_($={}){let Z=Date.now(),Y=await S1(),J={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:$.domain||"http://localhost",revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||Q1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},X={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,G=0,K={},q={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&L0.existsSync(J.outputDir))await L0.promises.rm(J.outputDir,{recursive:!0});await L0.promises.mkdir(J.outputDir,{recursive:!0});let z=new sJ(J.cacheDir);if(J.cache)await z.load();try{let{preloadIconCollection:V}=await Promise.resolve().then(() => (J$(),GY));await V("lucide")}catch{}try{let{generateCrosswindCSS:V}=await Promise.resolve().then(() => (c4(),n8));await V('<div class="bg-black"></div>')}catch{}pJ();let U=Y?.routeMiddleware?.dir||"middleware";await nJ(process.cwd(),U);let _=iJ();if(_.length>0)console.log(`Loaded ${_.length} middleware: ${_.join(", ")}`);let B=Y?.routeMiddleware?.global||[],j=b$(".",{pagesDir:J.pagesDir});console.log(`Found ${j.length} routes`);let H=[];for(let V of j){let w=await N_(V);for(let A of w)H.push({route:V,url:A.url,params:A.params,props:A.props,revalidate:A.revalidate??J.revalidate})}X.totalPages=H.length,console.log(`Generating ${X.totalPages} pages...`);let L=[],F=[];for(let V=0;V<H.length;V+=J.concurrency)F.push(H.slice(V,V+J.concurrency));for(let V of F)await Promise.all(V.map(async(w)=>{let{route:A,url:N,params:R,props:T,revalidate:M}=w;try{await J.hooks.onPageStart?.(N);let I=await Bun.file(A.filePath).text(),D=C_(I),E=D?.middleware?Array.isArray(D.middleware)?D.middleware:[D.middleware]:[],P=[...B,...E];if(P.length>0){let m=lJ(N,R,D||{}),i=cJ(m,null),c=await oJ(P,i);if(c.redirect){let q0=typeof c.redirect==="string"?c.redirect:c.redirect.path||c.redirect,F0=P_(String(q0),N),_0=v_(N,J);await L0.promises.mkdir(J0.dirname(_0),{recursive:!0}),await Bun.write(_0,F0),X.successCount++,X.pages.push({route:N,outputPath:_0,size:Buffer.byteLength(F0),cached:!1}),L.push({loc:N,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${N} \u2192 redirect to ${q0}`);return}if(c.abort){let q0=typeof c.abort==="string"?c.abort:c.abort?.error?.message||"aborted";console.warn(` \u21B3 ${N} \u2014 middleware aborted: ${q0}`);return}}let b=I.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(b)try{if(!await Function("route",`
10878
+ </rss>`}async function S_($={}){let Z=Date.now(),Y=await S1(),J={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:$.domain||"http://localhost",revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||Q1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},X={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,G=0,K={},q={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&L0.existsSync(J.outputDir))await L0.promises.rm(J.outputDir,{recursive:!0});await L0.promises.mkdir(J.outputDir,{recursive:!0});let z=new aJ(J.cacheDir);if(J.cache)await z.load();try{let{preloadIconCollection:V}=await Promise.resolve().then(() => (J$(),qY));await V("lucide")}catch{}try{let{generateCrosswindCSS:V}=await Promise.resolve().then(() => (c4(),o8));await V('<div class="bg-black"></div>')}catch{}lJ();let U=Y?.routeMiddleware?.dir||"middleware";await sJ(process.cwd(),U);let _=oJ();if(_.length>0)console.log(`Loaded ${_.length} middleware: ${_.join(", ")}`);let B=Y?.routeMiddleware?.global||[],j=b$(".",{pagesDir:J.pagesDir});console.log(`Found ${j.length} routes`);let H=[];for(let V of j){let w=await T_(V);for(let A of w)H.push({route:V,url:A.url,params:A.params,props:A.props,revalidate:A.revalidate??J.revalidate})}X.totalPages=H.length,console.log(`Generating ${X.totalPages} pages...`);let L=[],F=[];for(let V=0;V<H.length;V+=J.concurrency)F.push(H.slice(V,V+J.concurrency));for(let V of F)await Promise.all(V.map(async(w)=>{let{route:A,url:N,params:R,props:T,revalidate:M}=w;try{await J.hooks.onPageStart?.(N);let I=await Bun.file(A.filePath).text(),D=v_(I),E=D?.middleware?Array.isArray(D.middleware)?D.middleware:[D.middleware]:[],P=[...B,...E];if(P.length>0){let m=nJ(N,R,D||{}),i=iJ(m,null),c=await rJ(P,i);if(c.redirect){let q0=typeof c.redirect==="string"?c.redirect:c.redirect.path||c.redirect,F0=x_(String(q0),N),_0=f_(N,J);await L0.promises.mkdir(J0.dirname(_0),{recursive:!0}),await Bun.write(_0,F0),X.successCount++,X.pages.push({route:N,outputPath:_0,size:Buffer.byteLength(F0),cached:!1}),L.push({loc:N,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${N} \u2192 redirect to ${q0}`);return}if(c.abort){let q0=typeof c.abort==="string"?c.abort:c.abort?.error?.message||"aborted";console.warn(` \u21B3 ${N} \u2014 middleware aborted: ${q0}`);return}}let b=I.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(b)try{if(!await Function("route",`
10879
10879
  const validate = ${b[1]};
10880
10880
  return validate(route);
10881
- `)({params:R})){console.warn(`Validation failed for ${N}, skipping...`);return}}catch{}let k=null,y=!1;if(J.cache){if(k=z.get(N,A.filePath),k)y=!0,X.cachedCount++}if(!k){let m=await aJ(A,R,T,J,Y);if(k=m.html,J.cache)z.set(N,A.filePath,m.dependencies,k)}let g;if(J.trailingSlash)g=J0.join(J.outputDir,N,"index.html");else g=N==="/"?J0.join(J.outputDir,"index.html"):J0.join(J.outputDir,`${N}.html`);if(J.chunkIslands){let{html:m,chunks:i}=mJ(k,{integrity:J.integrityIslands,minify:J.minify});if(i.length>0){let c=J0.join(J.outputDir,"_stx","islands");await L0.promises.mkdir(c,{recursive:!0});for(let q0 of i){let F0=J0.join(c,`${q0.hash}.js`);if(!await Bun.file(F0).exists())await Bun.write(F0,q0.code);if(!Q.has(q0.hash)){Q.add(q0.hash);let _0=Buffer.byteLength(q0.code,"utf8");G+=_0,K[q0.hash]={bytes:_0,file:`/_stx/islands/${q0.hash}.js`}}}if(q[N]=i.map((q0)=>q0.hash),k=m,J.prefetchIslands)k=uJ(k)}}await L0.promises.mkdir(J0.dirname(g),{recursive:!0}),await Bun.write(g,k),L.push({loc:N,lastmod:new Date().toISOString().split("T")[0],priority:N==="/"?1:0.8});let h={route:N,outputPath:g,size:Buffer.byteLength(k,"utf8"),cached:y};if(M!==!1)h.revalidateAt=Date.now()+M*1000;X.pages.push(h),X.successCount++,await J.hooks.onPageEnd?.(N,k)}catch(I){X.failedCount++,X.errors.push({route:N,error:I}),await J.hooks.onError?.(I,N),console.error(`Error generating ${N}:`,I)}}));if(J.cache)await z.save();if(J.generate404){let V=J0.join(J.pagesDir,"404.stx");if(await Bun.file(V).exists()){let w=new Set,A={...Y,debug:!1,cache:!1},N=await j0(await Bun.file(V).text(),{},V,A,w);await Bun.write(J0.join(J.outputDir,"404.html"),N)}else await Bun.write(J0.join(J.outputDir,"404.html"),`<!DOCTYPE html>
10881
+ `)({params:R})){console.warn(`Validation failed for ${N}, skipping...`);return}}catch{}let k=null,y=!1;if(J.cache){if(k=z.get(N,A.filePath),k)y=!0,X.cachedCount++}if(!k){let m=await eJ(A,R,T,J,Y);if(k=m.html,J.cache)z.set(N,A.filePath,m.dependencies,k)}let g;if(J.trailingSlash)g=J0.join(J.outputDir,N,"index.html");else g=N==="/"?J0.join(J.outputDir,"index.html"):J0.join(J.outputDir,`${N}.html`);if(J.chunkIslands){let{html:m,chunks:i}=pJ(k,{integrity:J.integrityIslands,minify:J.minify});if(i.length>0){let c=J0.join(J.outputDir,"_stx","islands");await L0.promises.mkdir(c,{recursive:!0});for(let q0 of i){let F0=J0.join(c,`${q0.hash}.js`);if(!await Bun.file(F0).exists())await Bun.write(F0,q0.code);if(!Q.has(q0.hash)){Q.add(q0.hash);let _0=Buffer.byteLength(q0.code,"utf8");G+=_0,K[q0.hash]={bytes:_0,file:`/_stx/islands/${q0.hash}.js`}}}if(q[N]=i.map((q0)=>q0.hash),k=m,J.prefetchIslands)k=cJ(k)}}await L0.promises.mkdir(J0.dirname(g),{recursive:!0}),await Bun.write(g,k),L.push({loc:N,lastmod:new Date().toISOString().split("T")[0],priority:N==="/"?1:0.8});let h={route:N,outputPath:g,size:Buffer.byteLength(k,"utf8"),cached:y};if(M!==!1)h.revalidateAt=Date.now()+M*1000;X.pages.push(h),X.successCount++,await J.hooks.onPageEnd?.(N,k)}catch(I){X.failedCount++,X.errors.push({route:N,error:I}),await J.hooks.onError?.(I,N),console.error(`Error generating ${N}:`,I)}}));if(J.cache)await z.save();if(J.generate404){let V=J0.join(J.pagesDir,"404.stx");if(await Bun.file(V).exists()){let w=new Set,A={...Y,debug:!1,cache:!1},N=await j0(await Bun.file(V).text(),{},V,A,w);await Bun.write(J0.join(J.outputDir,"404.html"),N)}else await Bun.write(J0.join(J.outputDir,"404.html"),`<!DOCTYPE html>
10882
10882
  <html lang="en">
10883
10883
  <head>
10884
10884
  <meta charset="UTF-8">
@@ -10899,7 +10899,7 @@ ${Y.join(`
10899
10899
  <a href="/">Go home</a>
10900
10900
  </div>
10901
10901
  </body>
10902
- </html>`)}for(let V of[500]){let w=J0.join(J.pagesDir,`${V}.stx`);if(await Bun.file(w).exists()){let A=new Set,N={...Y,debug:!1,cache:!1},R=await j0(await Bun.file(w).text(),{},w,N,A);await Bun.write(J0.join(J.outputDir,`${V}.html`),R)}}let O=J0.join(J.pagesDir,"error.stx");if(await Bun.file(O).exists()){let V=new Set,w={...Y,debug:!1,cache:!1},A=await j0(await Bun.file(O).text(),{},O,w,V);await Bun.write(J0.join(J.outputDir,"error.html"),A)}if(J.sitemap&&L.length>0){let V=D_(L,J.domain),w=J0.join(J.outputDir,"sitemap.xml");await Bun.write(w,V),X.sitemapPath=w,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(J.rss){let V=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},w=[];if(V.getItems)w=await V.getItems();let A=E_(V,w),N=J0.join(J.outputDir,"rss.xml");await Bun.write(N,A),X.rssPath=N,console.log(`Generated rss.xml with ${w.length} items`)}if(J.publicDir&&L0.existsSync(J.publicDir))await tJ(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`)}catch(z){throw await J.hooks.onError?.(z),z}if(X.buildTime=Date.now()-Z,Q.size>0){X.islandChunks={count:Q.size,totalBytes:G};let z={generatedChunks:Q.size,totalBytes:G,chunks:K,pages:q};await Bun.write(J0.join(J.outputDir,"_stx","islands-manifest.json"),JSON.stringify(z,null,2))}await J.hooks.onBuildEnd?.(X);let W=X.islandChunks?`
10902
+ </html>`)}for(let V of[500]){let w=J0.join(J.pagesDir,`${V}.stx`);if(await Bun.file(w).exists()){let A=new Set,N={...Y,debug:!1,cache:!1},R=await j0(await Bun.file(w).text(),{},w,N,A);await Bun.write(J0.join(J.outputDir,`${V}.html`),R)}}let O=J0.join(J.pagesDir,"error.stx");if(await Bun.file(O).exists()){let V=new Set,w={...Y,debug:!1,cache:!1},A=await j0(await Bun.file(O).text(),{},O,w,V);await Bun.write(J0.join(J.outputDir,"error.html"),A)}if(J.sitemap&&L.length>0){let V=k_(L,J.domain),w=J0.join(J.outputDir,"sitemap.xml");await Bun.write(w,V),X.sitemapPath=w,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(J.rss){let V=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},w=[];if(V.getItems)w=await V.getItems();let A=b_(V,w),N=J0.join(J.outputDir,"rss.xml");await Bun.write(N,A),X.rssPath=N,console.log(`Generated rss.xml with ${w.length} items`)}if(J.publicDir&&L0.existsSync(J.publicDir))await $X(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`)}catch(z){throw await J.hooks.onError?.(z),z}if(X.buildTime=Date.now()-Z,Q.size>0){X.islandChunks={count:Q.size,totalBytes:G};let z={generatedChunks:Q.size,totalBytes:G,chunks:K,pages:q};await Bun.write(J0.join(J.outputDir,"_stx","islands-manifest.json"),JSON.stringify(z,null,2))}await J.hooks.onBuildEnd?.(X);let W=X.islandChunks?`
10903
10903
  Island chunks: ${X.islandChunks.count} (${(X.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
10904
10904
  Build complete!
10905
10905
  Total: ${X.totalPages} pages
@@ -10907,8 +10907,8 @@ Build complete!
10907
10907
  Cached: ${X.cachedCount}
10908
10908
  Failed: ${X.failedCount}
10909
10909
  Time: ${X.buildTime}ms${W}
10910
- `),X}async function tJ($,Z){let Y=await L0.promises.readdir($,{withFileTypes:!0});for(let J of Y){let X=J0.join($,J.name),Q=J0.join(Z,J.name);if(J.isDirectory())await L0.promises.mkdir(Q,{recursive:!0}),await tJ(X,Q);else await L0.promises.copyFile(X,Q)}}function b_($={}){let Z=$.cacheDir||Q1(process.cwd(),"ssg-cache"),Y=new rJ(Z),J=$.revalidate||3600;return{async get(X){let Q=await Y.get(X);if(!Q)return null;if(Date.now()>Q.revalidateAfter)this.revalidate(X).catch(console.error);return{html:Q.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:Q.etag,"X-ISR-Generated":new Date(Q.generatedAt).toISOString(),...Q.headers}}},async revalidate(X){let G=b$(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return X.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${X}`);return}let K=X.match(G.regex),q={};if(K)G.params.forEach((U,_)=>{q[U]=K[_+1]});let W=await S1(),{html:z}=await aJ(G,q,{},$,W);await Y.set(X,{html:z,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:I_(z)}),console.log(`Revalidated: ${X}`)},async invalidate(X){if(typeof X==="string")await Y.invalidate(X);else await Y.invalidatePattern(X)}}}function S_($){return async()=>{return{paths:await $(),fallback:!1}}}function y_(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),Y=Z.match(/^---\n([\s\S]*?)\n---/),J={},X=Z;if(Y){let W=Y[1];X=Z.slice(Y[0].length).trim();for(let z of W.split(`
10911
- `)){let U=z.indexOf(":");if(U>0){let _=z.slice(0,U).trim(),B=z.slice(U+1).trim();if(B==="true")B=!0;else if(B==="false")B=!1;else if(/^\d+$/.test(B))B=parseInt(B,10);else if(/^\d+\.\d+$/.test(B))B=parseFloat(B);else if(B.startsWith("[")&&B.endsWith("]"))B=B.slice(1,-1).split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,""));J[_]=B}}}let Q=X.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),G=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,q;while((q=K.exec(Q))!==null){let W=parseInt(q[1],10),z=q[2],U=z.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:z,level:W})}return{content:Q,data:J,toc:G}}}}function C_($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function P_($,Z){return`<!DOCTYPE html>
10910
+ `),X}async function $X($,Z){let Y=await L0.promises.readdir($,{withFileTypes:!0});for(let J of Y){let X=J0.join($,J.name),Q=J0.join(Z,J.name);if(J.isDirectory())await L0.promises.mkdir(Q,{recursive:!0}),await $X(X,Q);else await L0.promises.copyFile(X,Q)}}function y_($={}){let Z=$.cacheDir||Q1(process.cwd(),"ssg-cache"),Y=new tJ(Z),J=$.revalidate||3600;return{async get(X){let Q=await Y.get(X);if(!Q)return null;if(Date.now()>Q.revalidateAfter)this.revalidate(X).catch(console.error);return{html:Q.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:Q.etag,"X-ISR-Generated":new Date(Q.generatedAt).toISOString(),...Q.headers}}},async revalidate(X){let G=b$(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return X.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${X}`);return}let K=X.match(G.regex),q={};if(K)G.params.forEach((U,_)=>{q[U]=K[_+1]});let W=await S1(),{html:z}=await eJ(G,q,{},$,W);await Y.set(X,{html:z,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:E_(z)}),console.log(`Revalidated: ${X}`)},async invalidate(X){if(typeof X==="string")await Y.invalidate(X);else await Y.invalidatePattern(X)}}}function C_($){return async()=>{return{paths:await $(),fallback:!1}}}function P_(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),Y=Z.match(/^---\n([\s\S]*?)\n---/),J={},X=Z;if(Y){let W=Y[1];X=Z.slice(Y[0].length).trim();for(let z of W.split(`
10911
+ `)){let U=z.indexOf(":");if(U>0){let _=z.slice(0,U).trim(),B=z.slice(U+1).trim();if(B==="true")B=!0;else if(B==="false")B=!1;else if(/^\d+$/.test(B))B=parseInt(B,10);else if(/^\d+\.\d+$/.test(B))B=parseFloat(B);else if(B.startsWith("[")&&B.endsWith("]"))B=B.slice(1,-1).split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,""));J[_]=B}}}let Q=X.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),G=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,q;while((q=K.exec(Q))!==null){let W=parseInt(q[1],10),z=q[2],U=z.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:z,level:W})}return{content:Q,data:J,toc:G}}}}function v_($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function x_($,Z){return`<!DOCTYPE html>
10912
10912
  <html>
10913
10913
  <head>
10914
10914
  <meta charset="utf-8">
@@ -10920,4 +10920,4 @@ Build complete!
10920
10920
  <p>Redirecting to <a href="${$}">${$}</a>...</p>
10921
10921
  <script>window.location.replace('${$}')</script>
10922
10922
  </body>
10923
- </html>`}function v_($,Z){if($==="/"||$==="")return J0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return J0.join(Z.outputDir,Y,"index.html");return J0.join(Z.outputDir,`${Y}.html`)}var UA={generateStaticSite:k_,createISRHandler:b_,defineStaticPaths:S_,createMarkdownLoader:y_};export{k_ as generateStaticSite,S_ as defineStaticPaths,UA as default,y_ as createMarkdownLoader,b_ as createISRHandler};
10923
+ </html>`}function f_($,Z){if($==="/"||$==="")return J0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return J0.join(Z.outputDir,Y,"index.html");return J0.join(Z.outputDir,`${Y}.html`)}var BA={generateStaticSite:S_,createISRHandler:y_,defineStaticPaths:C_,createMarkdownLoader:P_};export{S_ as generateStaticSite,C_ as defineStaticPaths,BA as default,P_ as createMarkdownLoader,y_ as createISRHandler};