@stacksjs/stx 0.2.47 → 0.2.48

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 GY=Object.defineProperty;var KY=($)=>$;function qY($,Z){this[$]=KY.bind(null,Z)}var r=($,Z)=>{for(var J in Z)GY($,J,{get:Z[J],enumerable:!0,configurable:!0,set:qY.bind(Z,J)})};var C=($,Z)=>()=>($&&(Z=$($=0)),Z);var Y0=import.meta.require;var W0;var K7=C(()=>{W0={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 q7($,Z,J,Y){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let W={"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||W} -->`});let X=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(X,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var W7,z7;var v9=C(()=>{W7={name:"a11y",handler:($,Z,J,Y)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),X=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"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${X||K} -->${$}`},hasEndTag:!1},z7={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function zY($,Z={}){let{duration:J,delay:Y,ease:Q,direction:X,custom:G}={...l0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${X==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="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 qY=Object.defineProperty;var WY=($)=>$;function zY($,Z){this[$]=WY.bind(null,Z)}var r=($,Z)=>{for(var J in Z)qY($,J,{get:Z[J],enumerable:!0,configurable:!0,set:zY.bind(Z,J)})};var C=($,Z)=>()=>($&&(Z=$($=0)),Z);var Y0=import.meta.require;var W0;var K7=C(()=>{W0={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 q7($,Z,J,Y){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let W={"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||W} -->`});let X=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(X,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var W7,z7;var v9=C(()=>{W7={name:"a11y",handler:($,Z,J,Y)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),X=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"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${X||K} -->${$}`},hasEndTag:!1},z7={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function _Y($,Z={}){let{duration:J,delay:Y,ease:Q,direction:X,custom:G}={...c0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${X==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="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`${X==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="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 GY=Object.defineProperty;var KY=($)=>$;function qY($,Z){this[$]=KY.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`${X==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="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 UY(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function BY(){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 _Y($){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((J)=>J.test($))}function BY($=0.1,Z="0px"){return`
40
+ `}function jY($){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((J)=>J.test($))}function OY($=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 jY(){return`
83
+ `}function HY(){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 OY($,Z,J={}){let{staggerDelay:Y=50,sequence:Q=!1}=J;return`
198
+ `}function LY($,Z,J={}){let{staggerDelay:Y=50,sequence:Q=!1}=J;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 O7($,Z,J,Y){let Q=$;if(Y.animation?.enabled===!1)return Q;let X=J.includes("test")&&J.includes("animation");if(!_Y(Q)&&!X)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=jY();Q=Q.replace("</head>",`${K}
236
- </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=BY(),z=Q.lastIndexOf("</body>");if(z!==-1)Q=Q.slice(0,z)+q+`
237
- `+Q.slice(z)}}return Q}var l0,U7,_7,B7,j7;var x9=C(()=>{l0={duration:300,delay:0,ease:"ease",direction:"both"};U7={name:"transition",handler:($,Z,J,Y)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||l0.duration:l0.duration,G=Z.length>2?Z[2]||l0.ease:l0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||l0.delay:l0.delay,q=Z.length>4?Z[4]||l0.direction:l0.direction,z=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=zY(Q,{duration:X,delay:K,ease:G,direction:q}),U="stx-transition",_="";if(Q==="fade")_="stx-fade";else if(Q==="slide")_="stx-slide";else if(Q==="scale")_="stx-scale";else if(Q==="flip")_="stx-flip";else if(Q==="rotate")_="stx-rotate";return`<div id="${z}" class="${U} ${_} ${q==="out"?"stx-out":""}"
238
- style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},_7={name:"scrollAnimate",handler:($,Z,J,Y)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],X=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,z=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(Q==="fade")U+=" stx-fade";else if(Q==="slide-up"||Q==="slide")U+=" stx-from-bottom";else if(Q==="slide-down")U+=" stx-from-top";else if(Q==="slide-left")U+=" stx-from-right";else if(Q==="slide-right")U+=" stx-from-left";else if(Q==="scale")U+=" stx-scale";else if(Q.includes("-"))U+=` stx-${Q}`;else U+=` stx-${Q}`;return`<div id="${z}" class="${U}" style="${W}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},B7={name:"animationGroup",handler:($,Z,J,Y)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],X=Z.slice(1).map((z)=>z.startsWith("#")||z.startsWith(".")?z:`#${z}`),G=J.staggerDelay||50,K=J.sequence||!0,q=OY(Q,X,{staggerDelay:G,sequence:K});return`${$}
239
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},j7={name:"motion",handler:($,Z,J,Y)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,X=UY();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as H7}from"stx-router";var L7=C(()=>{f9()});async function HY($,Z,J,Y){let Q=Z[0]?.replace(/['"]/g,"")||"main",X=H7();if(Q!=="main")X=X.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${X}</script>`}var F7;var f9=C(()=>{L7();F7={name:"stxRouter",handler:HY,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function V7($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...LY,...Z};return`
235
+ `}function O7($,Z,J,Y){let Q=$;if(Y.animation?.enabled===!1)return Q;let X=J.includes("test")&&J.includes("animation");if(!jY(Q)&&!X)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=HY();Q=Q.replace("</head>",`${K}
236
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=OY(),z=Q.lastIndexOf("</body>");if(z!==-1)Q=Q.slice(0,z)+q+`
237
+ `+Q.slice(z)}}return Q}var c0,U7,_7,B7,j7;var x9=C(()=>{c0={duration:300,delay:0,ease:"ease",direction:"both"};U7={name:"transition",handler:($,Z,J,Y)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||c0.duration:c0.duration,G=Z.length>2?Z[2]||c0.ease:c0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||c0.delay:c0.delay,q=Z.length>4?Z[4]||c0.direction:c0.direction,z=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=_Y(Q,{duration:X,delay:K,ease:G,direction:q}),U="stx-transition",_="";if(Q==="fade")_="stx-fade";else if(Q==="slide")_="stx-slide";else if(Q==="scale")_="stx-scale";else if(Q==="flip")_="stx-flip";else if(Q==="rotate")_="stx-rotate";return`<div id="${z}" class="${U} ${_} ${q==="out"?"stx-out":""}"
238
+ style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},_7={name:"scrollAnimate",handler:($,Z,J,Y)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],X=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,z=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(Q==="fade")U+=" stx-fade";else if(Q==="slide-up"||Q==="slide")U+=" stx-from-bottom";else if(Q==="slide-down")U+=" stx-from-top";else if(Q==="slide-left")U+=" stx-from-right";else if(Q==="slide-right")U+=" stx-from-left";else if(Q==="scale")U+=" stx-scale";else if(Q.includes("-"))U+=` stx-${Q}`;else U+=` stx-${Q}`;return`<div id="${z}" class="${U}" style="${W}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},B7={name:"animationGroup",handler:($,Z,J,Y)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],X=Z.slice(1).map((z)=>z.startsWith("#")||z.startsWith(".")?z:`#${z}`),G=J.staggerDelay||50,K=J.sequence||!0,q=LY(Q,X,{staggerDelay:G,sequence:K});return`${$}
239
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},j7={name:"motion",handler:($,Z,J,Y)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,X=BY();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as H7}from"stx-router";var L7=C(()=>{f9()});async function FY($,Z,J,Y){let Q=Z[0]?.replace(/['"]/g,"")||"main",X=H7();if(Q!=="main")X=X.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${X}</script>`}var F7;var f9=C(()=>{L7();F7={name:"stxRouter",handler:FY,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function V7($){let Z=$.heatmap;if(!Z?.enabled)return"";let J={...VY,...Z};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
241
241
  <script>
242
242
  (function() {
@@ -619,10 +619,10 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function w7($,Z){let J=V7(Z);if(!J)return $;let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+J+$.slice(Y);return $+J}function FY($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of J){let[Q,X]=Y.split("="),G=X?.replace(/["']/g,"");switch(Q){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 LY,A7;var g9=C(()=>{LY={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};A7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,Y)=>{let Q=J.__stx_config||{};if(Z.length>0){let X=FY(Z.join(" "));Q.heatmap={...Q.heatmap,...X,enabled:!0}}return V7(Q)}}});function s0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function N7($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function R7($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let Y=J[1],Q=$.slice(J[0].length),X={};for(let G of Y.split(`
623
- `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let z=K.slice(0,q).trim(),W=K.slice(q+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}X[z]=W}return{data:X,content:Q.trim()}}function n1($,Z={}){let{gfm:J=!0,breaks:Y=!1}=Z,Q=$,X=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,_)=>{let j=X.length,B=U?` class="language-${s0(U)}"`:"";return X.push(`<pre><code${B}>${s0(_.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Q=Q.replace(/`([^`]*)`/g,(W,U)=>`<code>${s0(U)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,U,_)=>{return`<img src="${N7(_)?s0(_):""}" alt="${s0(U)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,U,_)=>{return`<a href="${N7(_)?s0(_):""}">${U}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
624
- `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),J)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,U,_)=>{let B=`<tr>${U.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${s0(F)}</th>`).join("")}</tr>`,O=_.trim().split(`
625
- `).map((F)=>{return`<tr>${F.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<td>${s0(H)}</td>`).join("")}</tr>`}).join(`
622
+ `}function w7($,Z){let J=V7(Z);if(!J)return $;let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+J+$.slice(Y);return $+J}function wY($){let Z={},J=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of J){let[Q,X]=Y.split("="),G=X?.replace(/["']/g,"");switch(Q){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 VY,A7;var g9=C(()=>{VY={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};A7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,J,Y)=>{let Q=J.__stx_config||{};if(Z.length>0){let X=wY(Z.join(" "));Q.heatmap={...Q.heatmap,...X,enabled:!0}}return V7(Q)}}});function r0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function N7($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function R7($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,J=$.match(Z);if(!J)return{data:{},content:$.trim()};let Y=J[1],Q=$.slice(J[0].length),X={};for(let G of Y.split(`
623
+ `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let z=K.slice(0,q).trim(),W=K.slice(q+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}X[z]=W}return{data:X,content:Q.trim()}}function n1($,Z={}){let{gfm:J=!0,breaks:Y=!1}=Z,Q=$,X=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,_)=>{let j=X.length,B=U?` class="language-${r0(U)}"`:"";return X.push(`<pre><code${B}>${r0(_.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Q=Q.replace(/`([^`]*)`/g,(W,U)=>`<code>${r0(U)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),J)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,U,_)=>{return`<img src="${N7(_)?r0(_):""}" alt="${r0(U)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,U,_)=>{return`<a href="${N7(_)?r0(_):""}">${U}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
624
+ `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),J)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,U,_)=>{let B=`<tr>${U.split("|").map((F)=>F.trim()).filter(Boolean).map((F)=>`<th>${r0(F)}</th>`).join("")}</tr>`,O=_.trim().split(`
625
+ `).map((F)=>{return`<tr>${F.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<td>${r0(H)}</td>`).join("")}</tr>`}).join(`
626
626
  `);return`<table>
627
627
  <thead>
628
628
  ${B}
@@ -637,15 +637,15 @@ ${O}
637
637
  `:`
638
638
  `)}</p>`);if(Q=K.join(`
639
639
  `),Y)Q=Q.replace(/\n/g,`<br />
640
- `);for(let W=0;W<X.length;W++)Q=Q.replace(`\x00CODEBLOCK${W}\x00`,X[W]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function r0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(Y,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
640
+ `);for(let W=0;W<X.length;W++)Q=Q.replace(`\x00CODEBLOCK${W}\x00`,X[W]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function a0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(Y,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
641
641
  `});let J=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(J,(Y,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
642
- `}),$}import VY from"process";function f0($="STX_PUBLIC_"){let Z={},J={};for(let[Y,Q]of Object.entries(VY.env)){if(!Y.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${Y}`]=JSON.stringify(Q),J[Y]=Q}return Z["import.meta.env"]=JSON.stringify(J),Z}var M1=()=>{};var h9={};r(h9,{hasUserImports:()=>wY,bundleClientScript:()=>NY});import w0 from"path";import c0 from"fs";function wY($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let Y=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=Y.exec($))!==null){let G=Q[1];if(!T7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let X=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=X.exec($))!==null){let G=Q[1];if(!T7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function AY($,Z,J){let Y=(Q,X)=>{let G=Q===J?Z:w0.dirname(Q),K=w0.resolve(G,X),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 z of q)try{if(c0.existsSync(z)&&c0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return K};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(X)=>({path:X.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(X)=>({path:X.path,external:!0})),Q.onResolve({filter:/^\.\.?\//},(X)=>{return{path:Y(X.importer,X.path)}}),Q.onResolve({filter:/^@\//},(X)=>{let G=w0.resolve($,X.path.slice(2)),K=[G,`${G}.ts`,`${G}.js`,w0.join(G,"index.ts"),w0.join(G,"index.js")];for(let q of K)if(c0.existsSync(q)&&c0.statSync(q,{throwIfNoEntry:!1})?.isFile())return console.log("[stx:bundler] resolved @/ import:",X.path,"\u2192",q),{path:q};return console.warn("[stx:bundler] could not resolve @/ import:",X.path),{path:G}})}}}async function NY($,Z,J={}){let Y=J.projectRoot||process.cwd(),Q=J.minify??!1,X=J.cacheDir||w0.join(Y,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=w0.join(X,`${K}.js`),z=Bun.file(q);if(await z.exists())return console.log("[stx:bundler] cache hit:",K),await z.text();let W=w0.join(Y,".stx","bundle-tmp"),U=w0.join(W,`${K}.ts`),_=w0.join(W,"out",K);c0.mkdirSync(W,{recursive:!0}),c0.mkdirSync(_,{recursive:!0});let j=w0.dirname(Z),B=[],O=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=O.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let A=V.split(":")[0].trim();if(A)B.push(A)});else if(L[3])B.push(L[3])}while((L=F.exec($))!==null){if(L[1])continue;B.push(L[2])}let H=B.length>0?`
643
- export { ${B.join(", ")} }`:"";await Bun.write(U,$+H),console.log("[stx:bundler] bundling:",K,"from:",w0.basename(Z));try{let V=await Bun.build({entrypoints:[U],outdir:_,target:"browser",format:"esm",minify:Q,plugins:[AY(Y,j,U)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...f0()},root:Y});if(!V.success){let w=V.logs.filter((N)=>N.level==="error").map((N)=>N.message).join(", ");return console.warn("[stx:bundler] build failed:",w),$}let A="";for(let w of V.outputs){A=await w.text();break}return A=A.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),console.log("[stx:bundler] bundled:",K,"output:",A.length,"bytes"),c0.mkdirSync(X,{recursive:!0}),await Bun.write(q,A),A}catch(V){let A=V instanceof Error?V.message:String(V),w=V?.errors,N=Array.isArray(w)&&w.length>0?`
642
+ `}),$}import AY from"process";function g0($="STX_PUBLIC_"){let Z={},J={};for(let[Y,Q]of Object.entries(AY.env)){if(!Y.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${Y}`]=JSON.stringify(Q),J[Y]=Q}return Z["import.meta.env"]=JSON.stringify(J),Z}var M1=()=>{};var h9={};r(h9,{hasUserImports:()=>NY,bundleClientScript:()=>TY});import w0 from"path";import i0 from"fs";function NY($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let Y=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=Y.exec($))!==null){let G=Q[1];if(!T7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let X=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=X.exec($))!==null){let G=Q[1];if(!T7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function RY($,Z,J){let Y=(Q,X)=>{let G=Q===J?Z:w0.dirname(Q),K=w0.resolve(G,X),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 z of q)try{if(i0.existsSync(z)&&i0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return K};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(X)=>({path:X.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(X)=>({path:X.path,external:!0})),Q.onResolve({filter:/^\.\.?\//},(X)=>{return{path:Y(X.importer,X.path)}}),Q.onResolve({filter:/^@\//},(X)=>{let G=w0.resolve($,X.path.slice(2)),K=[G,`${G}.ts`,`${G}.js`,w0.join(G,"index.ts"),w0.join(G,"index.js")];for(let q of K)if(i0.existsSync(q)&&i0.statSync(q,{throwIfNoEntry:!1})?.isFile())return console.log("[stx:bundler] resolved @/ import:",X.path,"\u2192",q),{path:q};return console.warn("[stx:bundler] could not resolve @/ import:",X.path),{path:G}})}}}async function TY($,Z,J={}){let Y=J.projectRoot||process.cwd(),Q=J.minify??!1,X=J.cacheDir||w0.join(Y,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=w0.join(X,`${K}.js`),z=Bun.file(q);if(await z.exists())return console.log("[stx:bundler] cache hit:",K),await z.text();let W=w0.join(Y,".stx","bundle-tmp"),U=w0.join(W,`${K}.ts`),_=w0.join(W,"out",K);i0.mkdirSync(W,{recursive:!0}),i0.mkdirSync(_,{recursive:!0});let j=w0.dirname(Z),B=[],O=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=O.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let A=V.split(":")[0].trim();if(A)B.push(A)});else if(L[3])B.push(L[3])}while((L=F.exec($))!==null){if(L[1])continue;B.push(L[2])}let H=B.length>0?`
643
+ export { ${B.join(", ")} }`:"";await Bun.write(U,$+H),console.log("[stx:bundler] bundling:",K,"from:",w0.basename(Z));try{let V=await Bun.build({entrypoints:[U],outdir:_,target:"browser",format:"esm",minify:Q,plugins:[RY(Y,j,U)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...g0()},root:Y});if(!V.success){let w=V.logs.filter((N)=>N.level==="error").map((N)=>N.message).join(", ");return console.warn("[stx:bundler] build failed:",w),$}let A="";for(let w of V.outputs){A=await w.text();break}return A=A.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),console.log("[stx:bundler] bundled:",K,"output:",A.length,"bytes"),i0.mkdirSync(X,{recursive:!0}),await Bun.write(q,A),A}catch(V){let A=V instanceof Error?V.message:String(V),w=V?.errors,N=Array.isArray(w)&&w.length>0?`
644
644
  ${w.map((R)=>`- ${R?.message??R}`).join(`
645
- `)}`:"";return console.warn(`[stx:bundler] error: ${A}${N}`),$}finally{try{c0.rmSync(U,{force:!0}),c0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var T7;var d9=C(()=>{M1();T7=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function IY($){let Z=new Set,J=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=J.exec($))!==null)if(!MY.has(Y[1]))Z.add(Y[1]);return Array.from(Z)}function DY($){let Z=new Set,J=new Set,Y=$;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,X=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=X.exec($))!==null){let q=G[1],z=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(Q.add(U),z==="stx")Z.add(U);else J.add(U)}),Y=Y.replace(G[0],"// [auto-import processed]")}for(let q of RY){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(Y))Z.add(q)}for(let q of TY){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(Y))J.add(q)}let K=IY(Y);for(let q of K)if(!Q.has(q))J.add(q);return{code:Y,stxImports:Array.from(Z),browserImports:Array.from(J)}}function EY($,Z){let J=[];if($.length>0)J.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)J.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(J.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
645
+ `)}`:"";return console.warn(`[stx:bundler] error: ${A}${N}`),$}finally{try{i0.rmSync(U,{force:!0}),i0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var T7;var d9=C(()=>{M1();T7=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function EY($){let Z=new Set,J=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=J.exec($))!==null)if(!DY.has(Y[1]))Z.add(Y[1]);return Array.from(Z)}function kY($){let Z=new Set,J=new Set,Y=$;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,X=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=X.exec($))!==null){let q=G[1],z=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(Q.add(U),z==="stx")Z.add(U);else J.add(U)}),Y=Y.replace(G[0],"// [auto-import processed]")}for(let q of MY){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(Y))Z.add(q)}for(let q of IY){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(Y))J.add(q)}let K=EY(Y);for(let q of K)if(!Q.has(q))J.add(q);return{code:Y,stxImports:Array.from(Z),browserImports:Array.from(J)}}function bY($,Z){let J=[];if($.length>0)J.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)J.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(J.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
646
646
  ${J.join(`
647
647
  `)}
648
- `;return""}function bY($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let J of $.systemKeys)Z.push(`if (!$event.${J}Key) return`);if($.keys.length>0){let J=$.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if($.mouse!==null){let J=kY[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function SY($,Z){let{elementId:J,event:Y,handler:Q,modifiers:X}=$,G=bY(X),K=[];if(X.once)K.push("once: true");if(X.capture)K.push("capture: true");if(X.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",z="";if(G)z+=`${G}; `;let W=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function U(_){return`var scope = $el.closest('[data-stx-scope]');
648
+ `;return""}function yY($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let J of $.systemKeys)Z.push(`if (!$event.${J}Key) return`);if($.keys.length>0){let J=$.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if($.mouse!==null){let J=SY[$.mouse];Z.push(`if ($event.button !== ${J}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function CY($,Z){let{elementId:J,event:Y,handler:Q,modifiers:X}=$,G=yY(X),K=[];if(X.once)K.push("once: true");if(X.capture)K.push("capture: true");if(X.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",z="";if(G)z+=`${G}; `;let W=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function U(_){return`var scope = $el.closest('[data-stx-scope]');
649
649
  if (scope && scope.__stx_execute) {
650
650
  scope.__stx_execute('${W}', $event, $el);
651
651
  }
@@ -681,11 +681,11 @@ else {
681
681
  else {
682
682
  ${Q}
683
683
  }
684
- }${q})`}function yY($){if($.length===0)return"";return`
684
+ }${q})`}function PY($){if($.length===0)return"";return`
685
685
  // STX: auto-generated event bindings
686
- ${$.map((J,Y)=>SY(J,Y)).join(`
686
+ ${$.map((J,Y)=>CY(J,Y)).join(`
687
687
  `)}`}function M7($){let Z=[],J=new Set,Y=$.replace(/^\s*import\s+.*$/gm,""),Q=0,X=Y.length,G=0;while(G<X){let K=Y[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let z=0;while(G<X){if(Y[G]==="\\"){G+=2;continue}if(Y[G]==="`"&&z===0){G++;break}if(Y[G]==="$"&&Y[G+1]==="{"){z++,G+=2;continue}if(Y[G]==="}"&&z>0){z--,G++;continue}G++}}else while(G<X){if(Y[G]==="\\"){G+=2;continue}if(Y[G]===q){G++;break}G++}continue}if(K==="/"&&Y[G+1]==="/"){while(G<X&&Y[G]!==`
688
- `)G++;continue}if(K==="/"&&Y[G+1]==="*"){G+=2;while(G<X-1&&!(Y[G]==="*"&&Y[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=Y.slice(G),z=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(z){let _=z[1];if(!_.startsWith("_")&&!J.has(_))Z.push(_),J.add(_);G+=z[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((_)=>{let j=_.trim(),B=j.indexOf(":"),O=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(O&&!O.startsWith("_")&&!J.has(O))Z.push(O),J.add(O)}),G+=W[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let _=U[1];if(!_.startsWith("_")&&!J.has(_))Z.push(_),J.add(_);G+=U[0].length;continue}}G++}return Z}function PY($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(_){let j;while((j=J.exec(_))!==null){let B=j[0];if(!CY.has(B))Z.add(B)}}let Q=/\{\{([\s\S]*?)\}\}/g,X;while((X=Q.exec($))!==null)Y(X[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((X=G.exec($))!==null)Y(X[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((X=K.exec($))!==null)Y(X[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((X=q.exec($))!==null)Y(X[1]);let z=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((X=z.exec($))!==null)Y(X[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((X=W.exec($))!==null)Y(X[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((X=U.exec($))!==null)Y(X[1]);return Z}async function w5($,Z={}){let J=$,Y="",Q=!1,{hasUserImports:X,bundleClientScript:G}=await Promise.resolve().then(() => (d9(),h9));if(X(J))console.log("[stx:bundler] user imports detected, bundling..."),J=await G(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let B=DY(J);J=B.code,Y=EY(B.stxImports,B.browserImports)}if(J=r0(J),!Q&&q1(Z.attrs||""))J=W1(J);let K=yY(Z.eventBindings||[]),q=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(q)){let B=q.replace(/\btype\s*=\s*["']module["']/i,"").trim();return`<script ${`type="module" data-stx-scoped${B?` ${B}`:""}`}>
688
+ `)G++;continue}if(K==="/"&&Y[G+1]==="*"){G+=2;while(G<X-1&&!(Y[G]==="*"&&Y[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=Y.slice(G),z=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(z){let _=z[1];if(!_.startsWith("_")&&!J.has(_))Z.push(_),J.add(_);G+=z[0].length;continue}let W=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((_)=>{let j=_.trim(),B=j.indexOf(":"),O=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(O&&!O.startsWith("_")&&!J.has(O))Z.push(O),J.add(O)}),G+=W[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let _=U[1];if(!_.startsWith("_")&&!J.has(_))Z.push(_),J.add(_);G+=U[0].length;continue}}G++}return Z}function xY($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(_){let j;while((j=J.exec(_))!==null){let B=j[0];if(!vY.has(B))Z.add(B)}}let Q=/\{\{([\s\S]*?)\}\}/g,X;while((X=Q.exec($))!==null)Y(X[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((X=G.exec($))!==null)Y(X[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((X=K.exec($))!==null)Y(X[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((X=q.exec($))!==null)Y(X[1]);let z=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((X=z.exec($))!==null)Y(X[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((X=W.exec($))!==null)Y(X[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((X=U.exec($))!==null)Y(X[1]);return Z}async function w5($,Z={}){let J=$,Y="",Q=!1,{hasUserImports:X,bundleClientScript:G}=await Promise.resolve().then(() => (d9(),h9));if(X(J))console.log("[stx:bundler] user imports detected, bundling..."),J=await G(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let B=kY(J);J=B.code,Y=bY(B.stxImports,B.browserImports)}if(J=a0(J),!Q&&q1(Z.attrs||""))J=W1(J);let K=PY(Z.eventBindings||[]),q=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(q)){let B=q.replace(/\btype\s*=\s*["']module["']/i,"").trim();return`<script ${`type="module" data-stx-scoped${B?` ${B}`:""}`}>
689
689
  ${Y}${J}
690
690
  ${K}
691
691
  </script>`}let W=/\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($),U=/function __stx_setup_/.test(J),_=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function j(B){let O=B.length>0?`
@@ -694,12 +694,12 @@ window.stx.mount(function() {
694
694
  'use strict';
695
695
  ${Y}${J}
696
696
  ${K}${O}
697
- })</script>`}if(!_&&!U){if(W)return j(M7($));if(Z.templateContent){let B=M7($);if(B.length>0){let O=PY(Z.templateContent);if(B.some((L)=>O.has(L)))return j(B)}}}return`<script data-stx-scoped>
697
+ })</script>`}if(!_&&!U){if(W)return j(M7($));if(Z.templateContent){let B=M7($);if(B.length>0){let O=xY(Z.templateContent);if(B.some((L)=>O.has(L)))return j(B)}}}return`<script data-stx-scoped>
698
698
  ;(function() {
699
699
  'use strict';
700
700
  ${Y}${J}
701
701
  ${K}
702
- })()</script>`}var RY,TY,MY,kY,CY;var m9=C(()=>{A0();RY=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useQuery","useMutation","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","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],TY=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],MY=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"]);kY={left:0,middle:1,right:2};CY=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 fY($){let Z="",J=null,Y=!1;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(Y){Y=!1;continue}if(X==="\\"&&J){Y=!0;continue}if(J){if(J==="`"&&X==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(X===J)J=null;continue}if(X==='"'||X==="'"||X==="`"){J=X;continue}Z+=X}return Z}function o1($){let Z=$.trim(),J=fY(Z);for(let Y of D7)if(Y.test(J))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${Z}`);if(!I7.allowBracketNotation&&xY.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function gY($){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[J,Y]of Object.entries($)){if(J.startsWith("__")||D7.some((Q)=>Q.test(J)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))Z[J]=u9(Y);else Z[J]=Y}return Z}function u9($,Z=0){if(Z>=I7.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>u9(Y,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let J={};for(let[Y,Q]of Object.entries($)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(Q&&typeof Q==="object")J[Y]=u9(Q,Z+1);else J[Y]=Q}return J}function J0($,Z){try{let J=o1($),Y=gY(Z);return Function(...Object.keys(Y),`
702
+ })()</script>`}var MY,IY,DY,SY,vY;var m9=C(()=>{A0();MY=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useQuery","useMutation","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","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],IY=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],DY=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"]);SY={left:0,middle:1,right:2};vY=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 hY($){let Z="",J=null,Y=!1;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(Y){Y=!1;continue}if(X==="\\"&&J){Y=!0;continue}if(J){if(J==="`"&&X==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(X===J)J=null;continue}if(X==='"'||X==="'"||X==="`"){J=X;continue}Z+=X}return Z}function o1($){let Z=$.trim(),J=hY(Z);for(let Y of D7)if(Y.test(J))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${Z}`);if(!I7.allowBracketNotation&&gY.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function dY($){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[J,Y]of Object.entries($)){if(J.startsWith("__")||D7.some((Q)=>Q.test(J)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))Z[J]=u9(Y);else Z[J]=Y}return Z}function u9($,Z=0){if(Z>=I7.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>u9(Y,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let J={};for(let[Y,Q]of Object.entries($)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(Q&&typeof Q==="object")J[Y]=u9(Q,Z+1);else J[Y]=Q}return J}function J0($,Z){try{let J=o1($),Y=dY(Z);return Function(...Object.keys(Y),`
703
703
  'use strict';
704
704
  try {
705
705
  return ${J};
@@ -710,7 +710,7 @@ catch (e) {
710
710
  }
711
711
  throw e;
712
712
  }
713
- `)(...Object.values(Y))}catch{return}}function t($){try{return o1($),!0}catch{return!1}}function F0($,Z){try{let J=J0($,Z);if(J&&typeof J==="object"&&!Array.isArray(J))return J;return{}}catch{return{}}}function e($,Z){let J=o1($),Y=/^[A-Za-z_$][\w$]*$/,Q=[],X=[];for(let K=0;K<Z.length;K++){let q=Z[K];if(!Y.test(q))continue;if(hY.has(q))continue;Q.push(K),X.push(q)}let G=Function(...X,`
713
+ `)(...Object.values(Y))}catch{return}}function t($){try{return o1($),!0}catch{return!1}}function F0($,Z){try{let J=J0($,Z);if(J&&typeof J==="object"&&!Array.isArray(J))return J;return{}}catch{return{}}}function e($,Z){let J=o1($),Y=/^[A-Za-z_$][\w$]*$/,Q=[],X=[];for(let K=0;K<Z.length;K++){let q=Z[K];if(!Y.test(q))continue;if(mY.has(q))continue;Q.push(K),X.push(q)}let G=Function(...X,`
714
714
  'use strict';
715
715
  try {
716
716
  return ${J};
@@ -721,7 +721,7 @@ catch (e) {
721
721
  }
722
722
  throw e;
723
723
  }
724
- `);if(X.length===Z.length)return G;return(...K)=>{let q=Array(Q.length);for(let z=0;z<Q.length;z++)q[z]=K[Q[z]];return G(...q)}}function A5($){let Z=$.trim(),J=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of J)if(Y.test(Z))return!1;return!0}var vY,I7,D7,xY,hY;var R0=C(()=>{vY={maxSanitizeDepth:10,allowBracketNotation:!1},I7={...vY},D7=[/\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/],xY=/[\w)\]]\s*\[\s*['"]/;hY=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 N5($,Z){let J=dY++,Y=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return mY.set(Y,{type:$,expression:Z}),Y}var dY=0,mY;var E7=C(()=>{mY=new Map});var v7={};r(v7,{usesSignalsInScript:()=>R5,unescapeHtml:()=>p9,registerFilters:()=>pY,registerFilter:()=>S7,processExpressions:()=>a0,interpolateScriptsInTemplate:()=>cY,interpolateScriptExpressions:()=>C7,getAllFilters:()=>y7,evaluateExpression:()=>i0,escapeHtml:()=>z1,defaultFilters:()=>r1,clearCustomFilters:()=>lY,applyFilters:()=>P7});function uY($){let Z=k7.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),k7.set($,Z)}return Z.lastIndex=0,Z}function S7($,Z){if($ in r1)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);s1[$]=Z}function pY($){for(let[Z,J]of Object.entries($))S7(Z,J)}function y7(){return{...r1,...s1}}function lY(){for(let $ of Object.keys(s1))delete s1[$]}function z1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function R5($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Z.exec($))!==null){let Y=J[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;return!1}function b7($,Z){let J=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",X=!1,G=0;for(let z=0;z<Y.length;z++){let W=Y[z];if(!X&&W==="`"){X=!0,G=0;continue}if(X){if(W==="`"&&G===0){X=!1;continue}if(W==="$"&&Y[z+1]==="{"){G++,z++;continue}if(W==="}"&&G>0){G--;continue}continue}Q+=W}Y=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(Y))!==null){let z=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!J.includes(z)&&!(z in Z))return!1}}return!0}function C7($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>{try{let X=i0(Q,Z);if(X===void 0)return Y;return X===null?"":String(X)}catch{return Y}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(Y,Q)=>{let X=Q.trim();if(/^__[A-Z_]+__$/.test(X))return Y;try{let G=i0(Q,Z);if(G===void 0)return Y;return JSON.stringify(G)}catch{return Y}}),J}function cY($,Z,J={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(Y,Q,X)=>{if(/\bsrc\s*=/.test(Q))return Y;if(/\bdata-raw\b/.test(Q))return Y;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return Y;if(J.skipServer&&/\bserver\b/.test(Q))return Y;let G=C7(X,Z);return`<script${Q}>${G}</script>`})}function a0($,Z,J){let Y=$,Q=[];Y=Y.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`});let X=[];Y=Y.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{let q=X.length;return X.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`});let G=R5($);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,q,z)=>{try{let W=i0(q,Z);return W!==void 0&&W!==null?String(W):""}catch(W){let U=W instanceof Error?W.message:String(W);return X0("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${U}`,J,$,z,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,q,z)=>{try{let W=i0(q,Z);if(W===void 0&&Z.__stx_buildMode==="compile")return N5("raw",q.trim());return W!==void 0&&W!==null?String(W):""}catch(W){if(Z.__stx_buildMode==="compile")return N5("raw",q.trim());let U=W instanceof Error?W.message:String(W);return X0("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${U}`,J,$,z,K)}}),Y=Y.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{if(K.startsWith("<!--__STX_SCRIPT_EXPR_"))return K;let q=X.length;return X.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`}),Y=Y.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(K.startsWith("<!--__STX_STYLE_"))return K;if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(K,q,z)=>{let W=q.trim(),U=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],_=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,B=W.match(_)?.[1],O=B&&((B in Z)||U.includes(B)),F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,L=W.match(F),H=L&&!U.includes(L[1])&&!(L[1]in Z);if(/^__[A-Z_]+__$/.test(W))return"";try{let V=i0(q,Z);if(V===void 0&&G&&!b7(W,Z))return K;if(V===void 0&&Z.__stx_buildMode==="compile"&&!G)return N5("expr",W);return V!==void 0&&V!==null?z1(String(V)):""}catch(V){if(G&&!b7(W,Z))return K;if(H)return K;let A=V instanceof Error?V.message:String(V);return X0("Expression",`Error evaluating: {{ ${W} }}: ${A}`,J,$,z,K)}});for(let K=0;K<X.length;K++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>X[K]);for(let K=0;K<Q.length;K++)Y=Y.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return Y}function P7($,Z,J){if(!Z.trim())return $;let Y=$,Q=Z.trim();while(Q.length>0){let X=Q.match(/^(\w+)/);if(!X)break;let G=X[1];Q=Q.substring(G.length).trim();let K=s1[G]||r1[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(y7()).join(", ")}`);let q=[];if(Q.startsWith(":")){let z=Q.match(/^:([^|\s]+)/);if(z){let W=z[1].trim();try{let U=Number(W);q=[Number.isNaN(U)?W:U]}catch{q=[W]}Q=Q.substring(z[0].length).trim()}}else if(Q.startsWith("(")){let z=1,W=1;while(z>0&&W<Q.length){if(Q[W]==="(")z++;if(Q[W]===")")z--;W++}if(z===0){let U=Q.substring(1,W-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[i0(`(${U})`,J,!0)];else{let _=[],j="",B=null,O=0,F=0,L=0,H=!1;for(let V=0;V<U.length;V++){let A=U[V];if(H){j+=A,H=!1;continue}if(A==="\\"){j+=A,H=!0;continue}if(B){if(j+=A,A===B)B=null;continue}if(A==='"'||A==="'"||A==="`"){B=A,j+=A;continue}if(A==="(")O++;else if(A===")")O--;else if(A==="[")F++;else if(A==="]")F--;else if(A==="{")L++;else if(A==="}")L--;if(A===","&&O===0&&F===0&&L===0){_.push(j),j="";continue}j+=A}if(j)_.push(j);q=_.map((V)=>{let A=V.trim();return i0(A,J,!0)})}}catch{q=[U]}Q=Q.substring(W).trim()}}try{Y=K(Y,J,...q)}catch(z){let W=z instanceof Error?z.message:String(z);throw Error(`Error applying filter '${G}': ${W}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return Y}function iY($){let Z=!1,J="",Y=0,Q=0,X=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],z=$[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,J=q;else if(q===J)Z=!1,J="";continue}if(Z&&J==="`"&&q==="$"&&z==="{"){let W=1;K+=2;while(K<$.length&&W>0){if($[K]==="{")W++;else if($[K]==="}")W--;if(W>0)K++}continue}if(Z)continue;if(q==="(")Y++;else if(q===")")Y--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")X++;else if(q==="}")X--;if(q==="|"&&Y===0&&Q===0&&X===0){if(z==="|"){K++;continue}if(z==="="){K++;continue}return K}}return-1}function i0($,Z,J=!1){try{let Y=$.trim(),Q=iY(Y);if(Q>0){let X=Y.substring(0,Q).trim(),G=Y.substring(Q+1).trim(),K=i0(X,Z,!0);return P7(K,G,Z)}if(!t(Y)){if(!J)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return J0(Y,Z)}try{let X=Object.keys(Z),G=Object.values(Z);return e(Y,X)(...G)}catch{return J0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(Y.message);if(Q){let X=Q[1],G=nY(X,Object.keys(Z));if(G&&G!==X)Y.message=`${Y.message} \u2014 did you mean '${G}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function nY($,Z){let J=null;for(let Q of Z){if(Q===$)continue;let X=oY($,Q);if(J===null||X<J.dist)J={key:Q,dist:X}}if(!J)return null;let Y=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/Y<=0.35)return J.key;return null}function oY($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,Y]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(J.length+1),X=Array(J.length+1);for(let G=0;G<=J.length;G++)Q[G]=G;for(let G=1;G<=Y.length;G++){X[0]=G;for(let K=1;K<=J.length;K++){let q=J[K-1]===Y[G-1]?0:1;X[K]=Math.min(X[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=J.length;K++)Q[K]=X[K]}return Q[J.length]}function p9($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var s1,k7,r1;var t0=C(()=>{R0();A0();E7();s1={},k7=new Map;r1={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let Y=Number($);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return Y.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return z1(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let Y=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,X=String($).split("."),G=Y;for(let q of X){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(J).forEach(([q,z])=>{K=K.replace(uY(q),String(z))}),K},t:($,Z,J={})=>{return r1.translate($,Z,J)},truncate:($,Z,J=50,Y="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=J)return Q;if(J<=Y.length)return Y.substring(0,J);return Q.substring(0,J-Y.length)+Y},date:($,Z,J="short",Y="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let X={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return Q.toISOString();return new Intl.DateTimeFormat(Y,X[J]||X.short).format(Q)}catch{return String($)}},currency:($,Z,J="USD",Y="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(Y,{style:"currency",currency:J}).format(Q)}catch{return String($)}},pluralize:($,Z,J,Y)=>{let Q=Number($);if(Number.isNaN(Q))return J;let X=Y||`${J}s`;return Q===1?J:X},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 J=String($);return J.charAt(J.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,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,Y);return $},replace:($,Z,J,Y="")=>{if($===void 0||$===null)return"";let Q=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>Y)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let Y=Number($);if(Number.isNaN(Y))return 0;let Q=10**J;return Math.round(Y*Q)/Q}}});class a1{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 J=this.cache.keys().next().value;if(J!==void 0)this.cache.delete(J)}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 D1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let J=`${$}:${Z||""}`;if(!I1.has(J)){if(I1.size>=sY){let Y=I1.keys().next().value;if(Y)I1.delete(Y)}I1.set(J,new RegExp($,Z))}return I1.get(J)}class x7{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),J=Z.sort().join(","),Y=this.pool.find((K)=>K.context.join(",")===J);if(Y)return Y.func;let Q=this.fnCache,X=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let z=`${J}:${q}`,W=Q.get(z);if(!W){if(Q.size>=X){let U=Q.keys().next().value;if(U)Q.delete(U)}W=Function(...Z,`
724
+ `);if(X.length===Z.length)return G;return(...K)=>{let q=Array(Q.length);for(let z=0;z<Q.length;z++)q[z]=K[Q[z]];return G(...q)}}function A5($){let Z=$.trim(),J=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of J)if(Y.test(Z))return!1;return!0}var fY,I7,D7,gY,mY;var R0=C(()=>{fY={maxSanitizeDepth:10,allowBracketNotation:!1},I7={...fY},D7=[/\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/],gY=/[\w)\]]\s*\[\s*['"]/;mY=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 N5($,Z){let J=uY++,Y=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return pY.set(Y,{type:$,expression:Z}),Y}var uY=0,pY;var E7=C(()=>{pY=new Map});var v7={};r(v7,{usesSignalsInScript:()=>R5,unescapeHtml:()=>p9,registerFilters:()=>cY,registerFilter:()=>S7,processExpressions:()=>t0,interpolateScriptsInTemplate:()=>nY,interpolateScriptExpressions:()=>C7,getAllFilters:()=>y7,evaluateExpression:()=>y0,escapeHtml:()=>z1,defaultFilters:()=>r1,clearCustomFilters:()=>iY,applyFilters:()=>P7});function lY($){let Z=k7.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),k7.set($,Z)}return Z.lastIndex=0,Z}function S7($,Z){if($ in r1)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);s1[$]=Z}function cY($){for(let[Z,J]of Object.entries($))S7(Z,J)}function y7(){return{...r1,...s1}}function iY(){for(let $ of Object.keys(s1))delete s1[$]}function z1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function R5($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J;while((J=Z.exec($))!==null){let Y=J[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;return!1}function b7($,Z){let J=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",X=!1,G=0;for(let z=0;z<Y.length;z++){let W=Y[z];if(!X&&W==="`"){X=!0,G=0;continue}if(X){if(W==="`"&&G===0){X=!1;continue}if(W==="$"&&Y[z+1]==="{"){G++,z++;continue}if(W==="}"&&G>0){G--;continue}continue}Q+=W}Y=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(Y))!==null){let z=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!J.includes(z)&&!(z in Z))return!1}}return!0}function C7($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>{try{let X=y0(Q,Z);if(X===void 0)return Y;return X===null?"":String(X)}catch{return Y}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(Y,Q)=>{let X=Q.trim();if(/^__[A-Z_]+__$/.test(X))return Y;try{let G=y0(Q,Z);if(G===void 0)return Y;return JSON.stringify(G)}catch{return Y}}),J}function nY($,Z,J={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(Y,Q,X)=>{if(/\bsrc\s*=/.test(Q))return Y;if(/\bdata-raw\b/.test(Q))return Y;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return Y;if(J.skipServer&&/\bserver\b/.test(Q))return Y;let G=C7(X,Z);return`<script${Q}>${G}</script>`})}function t0($,Z,J){let Y=$,Q=[];Y=Y.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`});let X=[];Y=Y.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{let q=X.length;return X.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`});let G=R5($);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,q,z)=>{try{let W=y0(q,Z);return W!==void 0&&W!==null?String(W):""}catch(W){let U=W instanceof Error?W.message:String(W);return X0("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${U}`,J,$,z,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,q,z)=>{try{let W=y0(q,Z);if(W===void 0&&Z.__stx_buildMode==="compile")return N5("raw",q.trim());return W!==void 0&&W!==null?String(W):""}catch(W){if(Z.__stx_buildMode==="compile")return N5("raw",q.trim());let U=W instanceof Error?W.message:String(W);return X0("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${U}`,J,$,z,K)}}),Y=Y.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{if(K.startsWith("<!--__STX_SCRIPT_EXPR_"))return K;let q=X.length;return X.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`}),Y=Y.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(K.startsWith("<!--__STX_STYLE_"))return K;if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(K,q,z)=>{let W=q.trim(),U=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],_=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,B=W.match(_)?.[1],O=B&&((B in Z)||U.includes(B)),F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,L=W.match(F),H=L&&!U.includes(L[1])&&!(L[1]in Z);if(/^__[A-Z_]+__$/.test(W))return"";try{let V=y0(q,Z);if(V===void 0&&G&&!b7(W,Z))return K;if(V===void 0&&Z.__stx_buildMode==="compile"&&!G)return N5("expr",W);return V!==void 0&&V!==null?z1(String(V)):""}catch(V){if(G&&!b7(W,Z))return K;if(H)return K;let A=V instanceof Error?V.message:String(V);return X0("Expression",`Error evaluating: {{ ${W} }}: ${A}`,J,$,z,K)}});for(let K=0;K<X.length;K++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>X[K]);for(let K=0;K<Q.length;K++)Y=Y.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return Y}function P7($,Z,J){if(!Z.trim())return $;let Y=$,Q=Z.trim();while(Q.length>0){let X=Q.match(/^(\w+)/);if(!X)break;let G=X[1];Q=Q.substring(G.length).trim();let K=s1[G]||r1[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(y7()).join(", ")}`);let q=[];if(Q.startsWith(":")){let z=Q.match(/^:([^|\s]+)/);if(z){let W=z[1].trim();try{let U=Number(W);q=[Number.isNaN(U)?W:U]}catch{q=[W]}Q=Q.substring(z[0].length).trim()}}else if(Q.startsWith("(")){let z=1,W=1;while(z>0&&W<Q.length){if(Q[W]==="(")z++;if(Q[W]===")")z--;W++}if(z===0){let U=Q.substring(1,W-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[y0(`(${U})`,J,!0)];else{let _=[],j="",B=null,O=0,F=0,L=0,H=!1;for(let V=0;V<U.length;V++){let A=U[V];if(H){j+=A,H=!1;continue}if(A==="\\"){j+=A,H=!0;continue}if(B){if(j+=A,A===B)B=null;continue}if(A==='"'||A==="'"||A==="`"){B=A,j+=A;continue}if(A==="(")O++;else if(A===")")O--;else if(A==="[")F++;else if(A==="]")F--;else if(A==="{")L++;else if(A==="}")L--;if(A===","&&O===0&&F===0&&L===0){_.push(j),j="";continue}j+=A}if(j)_.push(j);q=_.map((V)=>{let A=V.trim();return y0(A,J,!0)})}}catch{q=[U]}Q=Q.substring(W).trim()}}try{Y=K(Y,J,...q)}catch(z){let W=z instanceof Error?z.message:String(z);throw Error(`Error applying filter '${G}': ${W}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return Y}function oY($){let Z=!1,J="",Y=0,Q=0,X=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],z=$[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,J=q;else if(q===J)Z=!1,J="";continue}if(Z&&J==="`"&&q==="$"&&z==="{"){let W=1;K+=2;while(K<$.length&&W>0){if($[K]==="{")W++;else if($[K]==="}")W--;if(W>0)K++}continue}if(Z)continue;if(q==="(")Y++;else if(q===")")Y--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")X++;else if(q==="}")X--;if(q==="|"&&Y===0&&Q===0&&X===0){if(z==="|"){K++;continue}if(z==="="){K++;continue}return K}}return-1}function y0($,Z,J=!1){try{let Y=$.trim(),Q=oY(Y);if(Q>0){let X=Y.substring(0,Q).trim(),G=Y.substring(Q+1).trim(),K=y0(X,Z,!0);return P7(K,G,Z)}if(!t(Y)){if(!J)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return J0(Y,Z)}try{let X=Object.keys(Z),G=Object.values(Z);return e(Y,X)(...G)}catch{return J0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(Y.message);if(Q){let X=Q[1],G=sY(X,Object.keys(Z));if(G&&G!==X)Y.message=`${Y.message} \u2014 did you mean '${G}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function sY($,Z){let J=null;for(let Q of Z){if(Q===$)continue;let X=rY($,Q);if(J===null||X<J.dist)J={key:Q,dist:X}}if(!J)return null;let Y=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/Y<=0.35)return J.key;return null}function rY($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,Y]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(J.length+1),X=Array(J.length+1);for(let G=0;G<=J.length;G++)Q[G]=G;for(let G=1;G<=Y.length;G++){X[0]=G;for(let K=1;K<=J.length;K++){let q=J[K-1]===Y[G-1]?0:1;X[K]=Math.min(X[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=J.length;K++)Q[K]=X[K]}return Q[J.length]}function p9($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var s1,k7,r1;var n0=C(()=>{R0();A0();E7();s1={},k7=new Map;r1={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let Y=Number($);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return Y.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return z1(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let Y=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,X=String($).split("."),G=Y;for(let q of X){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(J).forEach(([q,z])=>{K=K.replace(lY(q),String(z))}),K},t:($,Z,J={})=>{return r1.translate($,Z,J)},truncate:($,Z,J=50,Y="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=J)return Q;if(J<=Y.length)return Y.substring(0,J);return Q.substring(0,J-Y.length)+Y},date:($,Z,J="short",Y="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let X={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(J==="iso")return Q.toISOString();return new Intl.DateTimeFormat(Y,X[J]||X.short).format(Q)}catch{return String($)}},currency:($,Z,J="USD",Y="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(Y,{style:"currency",currency:J}).format(Q)}catch{return String($)}},pluralize:($,Z,J,Y)=>{let Q=Number($);if(Number.isNaN(Q))return J;let X=Y||`${J}s`;return Q===1?J:X},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 J=String($);return J.charAt(J.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,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,Y);return $},replace:($,Z,J,Y="")=>{if($===void 0||$===null)return"";let Q=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>Y)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let Y=Number($);if(Number.isNaN(Y))return 0;let Q=10**J;return Math.round(Y*Q)/Q}}});class a1{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 J=this.cache.keys().next().value;if(J!==void 0)this.cache.delete(J)}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 D1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let J=`${$}:${Z||""}`;if(!I1.has(J)){if(I1.size>=aY){let Y=I1.keys().next().value;if(Y)I1.delete(Y)}I1.set(J,new RegExp($,Z))}return I1.get(J)}class x7{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),J=Z.sort().join(","),Y=this.pool.find((K)=>K.context.join(",")===J);if(Y)return Y.func;let Q=this.fnCache,X=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let z=`${J}:${q}`,W=Q.get(z);if(!W){if(Q.size>=X){let U=Q.keys().next().value;if(U)Q.delete(U)}W=Function(...Z,`
725
725
  'use strict';
726
726
  try {
727
727
  return ${q};
@@ -732,47 +732,47 @@ catch (e) {
732
732
  }
733
733
  throw e;
734
734
  }
735
- `),Q.set(z,W)}return W(...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 f7{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,J]of Object.entries($))this.setBudget(Z,J)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,J]of this.budgets.entries())$[Z]=J;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 J=performance.now(),Y=Z(),Q=performance.now()-J;return this.recordTime($,Q),this.checkBudget($,Q),Y}async timeAsync($,Z){if(!this.enabled)return Z();let J=performance.now(),Y=await Z(),Q=performance.now()-J;return this.recordTime($,Q),this.checkBudget($,Q),Y}checkBudget($,Z){let J=this.budgets.get($);if(!J)return;let Y=Z/J.maxTime*100,Q=J.warnThreshold!==void 0?Z>=J.maxTime*J.warnThreshold&&Z<J.maxTime:!1,X=Z>=J.maxTime;if(!Q&&!X)return;let G={label:$,actualTime:Z,budgetTime:J.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:Q};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=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${Y.toFixed(1)}% of ${J.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${J.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(J.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(X)throw Error(K);else console.warn(K);break}}recordTime($,Z){let J=this.metrics.get($);if(J)J.count++,J.totalTime+=Z,J.maxTime=Math.max(J.maxTime,Z),J.minTime=Math.min(J.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let J=this.metrics.get($);if(!J)return{};let Y=this.budgets.get($);return{count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Y?.maxTime,budgetUtilization:Y?J.totalTime/J.count/Y.maxTime*100:void 0}}let Z={};for(let[J,Y]of this.metrics.entries()){let Q=this.budgets.get(J);Z[J]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:Q?.maxTime,budgetUtilization:Q?Y.totalTime/Y.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,J=0;for(let Y of this.violations)if($[Y.label]=($[Y.label]||0)+1,Y.isWarning)Z++;else J++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:J}}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 rY(){if(!l9)l9=new f7;return l9}var I1,sY=500,Yz,l9=null,g7;var E1=C(()=>{I1=new Map;Yz=new x7;g7=new Proxy({},{get($,Z){return rY()[Z]}})});function h7($,Z=""){let J=`${$}${Z}`,Y=0;for(let Q=0;Q<J.length;Q++){let X=J.charCodeAt(Q);Y=(Y<<5)-Y+X,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function d7($,Z,J={}){let{prefix:Y="",preserveHost:Q=!0,scopeKeyframes:X=!0,scopeCustomProperties:G=!1}=J;if(!$.trim())return"";let K=c9($),q=[],z=new Map;if(X)for(let W of K){let U=W.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let _=U[1],j=`${Z}_${_}`;z.set(_,j)}}for(let W of K){let U=m7(W,Z,Y,Q,z,G);q.push(U)}return q.join(`
735
+ `),Q.set(z,W)}return W(...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 f7{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,J]of Object.entries($))this.setBudget(Z,J)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,J]of this.budgets.entries())$[Z]=J;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 J=performance.now(),Y=Z(),Q=performance.now()-J;return this.recordTime($,Q),this.checkBudget($,Q),Y}async timeAsync($,Z){if(!this.enabled)return Z();let J=performance.now(),Y=await Z(),Q=performance.now()-J;return this.recordTime($,Q),this.checkBudget($,Q),Y}checkBudget($,Z){let J=this.budgets.get($);if(!J)return;let Y=Z/J.maxTime*100,Q=J.warnThreshold!==void 0?Z>=J.maxTime*J.warnThreshold&&Z<J.maxTime:!1,X=Z>=J.maxTime;if(!Q&&!X)return;let G={label:$,actualTime:Z,budgetTime:J.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:Q};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=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${Y.toFixed(1)}% of ${J.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${J.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(J.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(X)throw Error(K);else console.warn(K);break}}recordTime($,Z){let J=this.metrics.get($);if(J)J.count++,J.totalTime+=Z,J.maxTime=Math.max(J.maxTime,Z),J.minTime=Math.min(J.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let J=this.metrics.get($);if(!J)return{};let Y=this.budgets.get($);return{count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Y?.maxTime,budgetUtilization:Y?J.totalTime/J.count/Y.maxTime*100:void 0}}let Z={};for(let[J,Y]of this.metrics.entries()){let Q=this.budgets.get(J);Z[J]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:Q?.maxTime,budgetUtilization:Q?Y.totalTime/Y.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,J=0;for(let Y of this.violations)if($[Y.label]=($[Y.label]||0)+1,Y.isWarning)Z++;else J++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:J}}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 tY(){if(!l9)l9=new f7;return l9}var I1,aY=500,Xz,l9=null,g7;var E1=C(()=>{I1=new Map;Xz=new x7;g7=new Proxy({},{get($,Z){return tY()[Z]}})});function h7($,Z=""){let J=`${$}${Z}`,Y=0;for(let Q=0;Q<J.length;Q++){let X=J.charCodeAt(Q);Y=(Y<<5)-Y+X,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function d7($,Z,J={}){let{prefix:Y="",preserveHost:Q=!0,scopeKeyframes:X=!0,scopeCustomProperties:G=!1}=J;if(!$.trim())return"";let K=c9($),q=[],z=new Map;if(X)for(let W of K){let U=W.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let _=U[1],j=`${Z}_${_}`;z.set(_,j)}}for(let W of K){let U=m7(W,Z,Y,Q,z,G);q.push(U)}return q.join(`
736
736
 
737
737
  `)}function c9($){let Z=[],J=$.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,Q="",X=!1,G="";for(let K=0;K<J.length;K++){let q=J[K];if(q==="@"&&Y===0)X=!0;if(q==="{")Y++;else if(q==="}"){if(Y--,Y===0){if(X){G+=q;let z=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(z){let[,W,U,_]=z;if(W==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:_.trim()});else if(W==="media"||W==="supports"||W==="container"){let j=c9(_);Z.push({selector:`@${W} ${U.trim()}`,declarations:j.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
738
738
  `)})}else Z.push({selector:`@${W} ${U.trim()}`,declarations:_.trim()})}G="",X=!1}else if(Q.trim()){Q+=q;let z=Q.match(/([^{]+)\{([^}]*)\}/);if(z)Z.push({selector:z[1].trim(),declarations:z[2].trim()});Q=""}continue}}if(X)G+=q;else Q+=q}return Z}function m7($,Z,J,Y,Q,X){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let W=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(W)||W} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=c9(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((_)=>m7(_,Z,J,Y,Q,X)).join(`
739
739
  `);return`${G} {
740
740
  ${U}
741
- }`}return`${G} { ${K} }`}let q=aY(G,Z,J,Y),z=K;for(let[W,U]of Q)z=z.replace(new RegExp(`\\b${W}\\b`,"g"),U);if(X)z=z.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${z} }`}function aY($,Z,J,Y){let Q=$.split(",").map((G)=>G.trim()),X=[];for(let G of Q){if(G.startsWith(":host")){if(Y)X.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);X.push(q)}continue}if(G.includes("::slotted")){X.push(G);continue}if(G===":root"){X.push(`:root .${Z}`);continue}let K=J?`${J} .${Z}`:`.${Z}`;X.push(`${K} ${G}`)}return X.join(", ")}function T5($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let J=h7(Z),Y=`data-v-${J}`,Q=$,X=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(X,(K,q,z)=>{G=!0;let W=tY(z,Y),U=q.replace(/\bscoped\b/gi,"").trim(),_=U?` ${U}`:"";return`<style data-stx-scoped="${J}"${_}>${W}</style>`}),!G)return{html:$,hasScoped:!1};return Q=eY(Q,Y),{html:Q,hasScoped:!0}}function tY($,Z){return d7($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function eY($,Z){let J=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,Q,X)=>{if(J.has(Q.toLowerCase()))return Y;if(Y.includes(Z))return Y;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return Y;if(X)return Y.replace(`<${Q}${X}`,`<${Q} ${Z}${X}`);if(Y.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var i9=()=>{};var u7=()=>{};function D0($,Z,J,Y=0){let Q=0,X=Y,G=null,K=0,q=!1;while(X<$.length){let z=$[X];if(G&&q){q=!1,X++;continue}if(G&&z==="\\"){q=!0,X++;continue}if(q=!1,(z==='"'||z==="'"||z==="`")&&!G){G=z,X++;continue}if(z===G&&G!=="`"){G=null,X++;continue}if(G==="`"&&z==="$"&&$[X+1]==="{"){K++,X+=2;continue}if(K>0&&z==="}"){K--,X++;continue}if(z==="`"&&G==="`"&&K===0){G=null,X++;continue}if(G){X++;continue}if(z===Z)Q++;else if(z===J){if(Q--,Q===0)return X}X++}return-1}var n9={};r(n9,{useTitle:()=>QJ,useSeoMeta:()=>I5,usePageTitle:()=>QJ,useHead:()=>_1,resetHead:()=>YJ,renderHtmlAttrs:()=>KJ,renderHead:()=>GJ,renderBodyAttrs:()=>qJ,processTitleDirective:()=>UJ,processMetaDirective:()=>_J,processHeadDirective:()=>zJ,getPageMeta:()=>ZJ,getHead:()=>t1,definePageMeta:()=>XJ,applyHead:()=>WJ});function t1(){return e0}function ZJ(){return M5}function YJ(){e0={},$J.length=0,M5={}}function _1($){e0=JJ(e0,$)}function JJ($,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 I5($){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 J=$.ogTitle??$.title,Y=$.ogDescription??$.description;if(J)Z.push({property:"og:title",content:J});if(Y)Z.push({property:"og:description",content:Y});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 Q=$.twitterTitle??$.title,X=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(X)Z.push({name:"twitter:description",content:X});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});_1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function XJ($){if(M5={...M5,...$},$.title||$.description)I5({title:$.title,description:$.description})}function QJ($){let Z=typeof $==="function"?$():$;_1({title:Z})}function GJ($=e0){let Z=[];if($.title){let J=$.title;if($.titleTemplate)J=typeof $.titleTemplate==="function"?$.titleTemplate(J):$.titleTemplate.replace("%s",J);Z.push(`<title>${U1(J)}</title>`)}if($.base){let J=Object.entries($.base).map(([Y,Q])=>`${Y}="${U1(Q)}"`).join(" ");Z.push(`<base ${J}>`)}for(let J of $.meta||[]){let Y=Object.entries(J).filter(([Q,X])=>X!==void 0).map(([Q,X])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${U1(String(X))}"`}).join(" ");Z.push(`<meta ${Y}>`)}for(let J of $.link||[]){let Y=Object.entries(J).filter(([Q,X])=>X!==void 0).map(([Q,X])=>`${Q}="${U1(String(X))}"`).join(" ");Z.push(`<link ${Y}>`)}for(let J of $.script||[]){let{content:Y,...Q}=J,X=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${U1(String(K))}"`}).filter(Boolean).join(" ");if(Y)Z.push(`<script ${X}>${Y}</script>`);else Z.push(`<script ${X}></script>`)}for(let J of $.style||[]){let Y=J.type?` type="${J.type}"`:"";Z.push(`<style${Y}>${J.content}</style>`)}return Z.join(`
742
- `)}function KJ($=e0){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,J])=>`${Z}="${U1(J)}"`).join(" ")}function qJ($=e0){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,J])=>`${Z}="${U1(J)}"`).join(" ")}function U1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function WJ($=e0){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 J=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(J){let Y=document.querySelector(J);if(!Y){if(Y=document.createElement("meta"),Z.name)Y.setAttribute("name",Z.name);if(Z.property)Y.setAttribute("property",Z.property);document.head.appendChild(Y)}Y.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let J=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,Y=document.querySelector(J);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[Q,X]of Object.entries(Z))if(X!==void 0)Y.setAttribute(Q,String(X))}if($.htmlAttrs)for(let[Z,J]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,J);if($.bodyAttrs)for(let[Z,J]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,J)}function zJ($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,Q)=>{return Z+=Q.trim()+`
743
- `,""}),headContent:Z.trim()}}function UJ($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(J,Y,Q,X)=>{let G=Y?Q:Z[(X||"").trim()]??X;return _1({title:G}),""})}function _J($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(J,Y,Q,X,G,K)=>{let q=X?G:K,z=X?q:Z[(q||"").trim()]??q,U=Q.includes(":")?{property:Q,content:z}:{name:Q,content:z};return _1({meta:[U]}),""})}var e0,$J,M5;var e1=C(()=>{e0={},$J=[],M5={}});var D5={};r(D5,{stripTypeScript:()=>i7,hasVariables:()=>t7,extractVariables:()=>n7,extractScriptFromTemplate:()=>a7,convertToCommonJS:()=>s9});import k1 from"path";function BJ($){let Z=[],J=0,Y=$.split(`
741
+ }`}return`${G} { ${K} }`}let q=eY(G,Z,J,Y),z=K;for(let[W,U]of Q)z=z.replace(new RegExp(`\\b${W}\\b`,"g"),U);if(X)z=z.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${z} }`}function eY($,Z,J,Y){let Q=$.split(",").map((G)=>G.trim()),X=[];for(let G of Q){if(G.startsWith(":host")){if(Y)X.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);X.push(q)}continue}if(G.includes("::slotted")){X.push(G);continue}if(G===":root"){X.push(`:root .${Z}`);continue}let K=J?`${J} .${Z}`:`.${Z}`;X.push(`${K} ${G}`)}return X.join(", ")}function T5($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let J=h7(Z),Y=`data-v-${J}`,Q=$,X=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(X,(K,q,z)=>{G=!0;let W=$J(z,Y),U=q.replace(/\bscoped\b/gi,"").trim(),_=U?` ${U}`:"";return`<style data-stx-scoped="${J}"${_}>${W}</style>`}),!G)return{html:$,hasScoped:!1};return Q=ZJ(Q,Y),{html:Q,hasScoped:!0}}function $J($,Z){return d7($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function ZJ($,Z){let J=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,Q,X)=>{if(J.has(Q.toLowerCase()))return Y;if(Y.includes(Z))return Y;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return Y;if(X)return Y.replace(`<${Q}${X}`,`<${Q} ${Z}${X}`);if(Y.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var i9=()=>{};var u7=()=>{};function D0($,Z,J,Y=0){let Q=0,X=Y,G=null,K=0,q=!1;while(X<$.length){let z=$[X];if(G&&q){q=!1,X++;continue}if(G&&z==="\\"){q=!0,X++;continue}if(q=!1,(z==='"'||z==="'"||z==="`")&&!G){G=z,X++;continue}if(z===G&&G!=="`"){G=null,X++;continue}if(G==="`"&&z==="$"&&$[X+1]==="{"){K++,X+=2;continue}if(K>0&&z==="}"){K--,X++;continue}if(z==="`"&&G==="`"&&K===0){G=null,X++;continue}if(G){X++;continue}if(z===Z)Q++;else if(z===J){if(Q--,Q===0)return X}X++}return-1}var n9={};r(n9,{useTitle:()=>KJ,useSeoMeta:()=>I5,usePageTitle:()=>KJ,useHead:()=>_1,resetHead:()=>XJ,renderHtmlAttrs:()=>WJ,renderHead:()=>qJ,renderBodyAttrs:()=>zJ,processTitleDirective:()=>BJ,processMetaDirective:()=>jJ,processHeadDirective:()=>_J,getPageMeta:()=>JJ,getHead:()=>t1,definePageMeta:()=>GJ,applyHead:()=>UJ});function t1(){return e0}function JJ(){return M5}function XJ(){e0={},YJ.length=0,M5={}}function _1($){e0=QJ(e0,$)}function QJ($,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 I5($){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 J=$.ogTitle??$.title,Y=$.ogDescription??$.description;if(J)Z.push({property:"og:title",content:J});if(Y)Z.push({property:"og:description",content:Y});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 Q=$.twitterTitle??$.title,X=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(X)Z.push({name:"twitter:description",content:X});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});_1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function GJ($){if(M5={...M5,...$},$.title||$.description)I5({title:$.title,description:$.description})}function KJ($){let Z=typeof $==="function"?$():$;_1({title:Z})}function qJ($=e0){let Z=[];if($.title){let J=$.title;if($.titleTemplate)J=typeof $.titleTemplate==="function"?$.titleTemplate(J):$.titleTemplate.replace("%s",J);Z.push(`<title>${U1(J)}</title>`)}if($.base){let J=Object.entries($.base).map(([Y,Q])=>`${Y}="${U1(Q)}"`).join(" ");Z.push(`<base ${J}>`)}for(let J of $.meta||[]){let Y=Object.entries(J).filter(([Q,X])=>X!==void 0).map(([Q,X])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${U1(String(X))}"`}).join(" ");Z.push(`<meta ${Y}>`)}for(let J of $.link||[]){let Y=Object.entries(J).filter(([Q,X])=>X!==void 0).map(([Q,X])=>`${Q}="${U1(String(X))}"`).join(" ");Z.push(`<link ${Y}>`)}for(let J of $.script||[]){let{content:Y,...Q}=J,X=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${U1(String(K))}"`}).filter(Boolean).join(" ");if(Y)Z.push(`<script ${X}>${Y}</script>`);else Z.push(`<script ${X}></script>`)}for(let J of $.style||[]){let Y=J.type?` type="${J.type}"`:"";Z.push(`<style${Y}>${J.content}</style>`)}return Z.join(`
742
+ `)}function WJ($=e0){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,J])=>`${Z}="${U1(J)}"`).join(" ")}function zJ($=e0){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,J])=>`${Z}="${U1(J)}"`).join(" ")}function U1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function UJ($=e0){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 J=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(J){let Y=document.querySelector(J);if(!Y){if(Y=document.createElement("meta"),Z.name)Y.setAttribute("name",Z.name);if(Z.property)Y.setAttribute("property",Z.property);document.head.appendChild(Y)}Y.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let J=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,Y=document.querySelector(J);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[Q,X]of Object.entries(Z))if(X!==void 0)Y.setAttribute(Q,String(X))}if($.htmlAttrs)for(let[Z,J]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,J);if($.bodyAttrs)for(let[Z,J]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,J)}function _J($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,Q)=>{return Z+=Q.trim()+`
743
+ `,""}),headContent:Z.trim()}}function BJ($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(J,Y,Q,X)=>{let G=Y?Q:Z[(X||"").trim()]??X;return _1({title:G}),""})}function jJ($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(J,Y,Q,X,G,K)=>{let q=X?G:K,z=X?q:Z[(q||"").trim()]??q,U=Q.includes(":")?{property:Q,content:z}:{name:Q,content:z};return _1({meta:[U]}),""})}var e0,YJ,M5;var e1=C(()=>{e0={},YJ=[],M5={}});var D5={};r(D5,{stripTypeScript:()=>i7,hasVariables:()=>t7,extractVariables:()=>n7,extractScriptFromTemplate:()=>a7,convertToCommonJS:()=>s9});import k1 from"path";function OJ($){let Z=[],J=0,Y=$.split(`
744
744
  `);for(let Q of Y){let X=null,G=!1;for(let K=0;K<Q.length;K++){let q=Q[K];if(G){G=!1;continue}if(q==="\\"){G=!0;continue}if(X){if(q===X)X=null;continue}if(q==="'"||q==='"'||q==="`"){X=q;continue}if(q==="/"&&K+1<Q.length&&Q[K+1]==="/")break;if(q==="{")J++;else if(q==="}")J--}if(J===0){let K=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1]);else{let q=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let W=q[1].slice(1,-1).split(",").map((U)=>{let _=U.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((U)=>/^\w+$/.test(U));Z.push(...W)}}}}return[...new Set(Z)]}function i7($){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 J(Y){if(!Y.includes(":"))return Y;let Q=[],X="",G=0,K=0,q=null;for(let z=0;z<Y.length;z++){let W=Y[z];if(q){if(X+=W,W===q)q=null;continue}if(W==='"'||W==="'"||W==="`"){q=W,X+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")K++;else if(W===")")K--;if(W===","&&G===0&&K===0){Q.push(X),X="";continue}X+=W}if(X)Q.push(X);return Q.map((z)=>{let W=z.trim(),U=W.startsWith("..."),_=U?W.slice(3):W,j=-1,B=0;for(let w=0;w<_.length;w++)if(_[w]==="<")B++;else if(_[w]===">")B--;else if(_[w]===":"&&B===0){j=w;break}if(j===-1)return z;let F=_.substring(0,j).trim().replace(/\?$/,""),L=_.substring(j+1),H=-1,V=0;for(let w=0;w<L.length;w++)if(L[w]==="<")V++;else if(L[w]===">")V--;else if(L[w]==="="&&V===0){H=w;break}let A=U?"...":"";if(H!==-1)return`${A}${F} = ${L.substring(H+1).trim()}`;return`${A}${F}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,Q,X)=>{if(!X.includes(":"))return Y;return`${Q}(${J(X)})`});{let Y=/\b(function\s+\w*\s*)\(/g,Q,X=[];while((Q=Y.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,z=0,W=null;while(q<Z.length&&K>0){let j=Z[q];if(W){if(j===W)W=null;q++;continue}if(j==='"'||j==="'"||j==="`"){W=j,q++;continue}if(j==="<")z++;else if(j===">"&&z>0)z--;else if(z===0){if(j==="(")K++;else if(j===")")K--}if(K>0)q++}if(K!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let _=J(U);X.push({start:G+1,end:q,replacement:_})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:z}=X[G];Z=Z.substring(0,K)+z+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,Q)=>{if(!Q.includes(":"))return Y;if(Q.includes("{")||Q.includes("}"))return Y;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),z=K.split(":")[0].trim();if(q.length>0)return`${z} = ${q.join("=").trim()}`;return z}).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|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,`
745
745
 
746
- `),Z}async function n7($,Z,J){if(!$.trim())return;let Y;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:f0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=P.transformSync(v)}catch{Y=i7($)}let Q={exports:{}},X=Q.exports,G=process.cwd(),K={},q=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((P)=>P[1]).filter((P)=>!P.startsWith("node:")&&!P.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(P));for(let P of q)try{let v=k1.resolve(G,"node_modules",P),f=k1.join(v,"package.json"),l=JSON.parse(Y0("fs").readFileSync(f,"utf8")),q0=l.main||"index.js";if(l.exports){let g=typeof l.exports==="string"?l.exports:l.exports["."];if(typeof g==="string")q0=g;else if(g?.bun)q0=g.bun;else if(g?.import)q0=g.import;else if(g?.default)q0=g.default}K[P]=await import(k1.resolve(v,q0))}catch{}let z=(P)=>{if(K[P])return K[P];return Y0(P)},W=Z.props||{},U=Object.assign((P)=>{if(!P)return W;let v={};for(let[f,l]of Object.entries(P)){let q0=W[f];if(q0!==void 0)v[f]=q0;else if(typeof l==="function")v[f]=l();else v[f]=l}return v},W),_=()=>W,j=(P,v)=>{let f={...P};for(let[l,q0]of Object.entries(v))if(f[l]===void 0)if(typeof q0==="function")f[l]=q0();else f[l]=q0;return f},B=(P)=>{let v=()=>P;return v.set=(f)=>{},v.update=(f)=>{},v},O=(P)=>{let v,f=!1;return()=>{if(!f)try{v=P(),f=!0}catch{v=void 0}return v}},F=(P)=>{},L=(P)=>P(),H=(P)=>{},V=(P)=>{},A=(P)=>{},w=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),N=()=>({push:(P)=>{},replace:(P)=>{},back:()=>{},forward:()=>{},go:(P)=>{}}),R=(P)=>{_1(P);let v=Z.__stx_runtime_head||{},f=P||{};Z.__stx_runtime_head={...v,...f.title&&{title:f.title},meta:[...v.meta||[],...f.meta||[]],link:[...v.link||[],...f.link||[]],script:[...v.script||[],...f.script||[]],htmlAttrs:{...v.htmlAttrs||{},...f.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...f.bodyAttrs||{}}}},T=(P)=>{I5(P);let v=t1();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},I=(P)=>({value:P}),M=(P)=>P,E=(P)=>({value:typeof P==="function"?P():P}),k=(P,v)=>{},y=(P)=>{},S=(P)=>{},b=(P)=>P?P():Promise.resolve(),D=(P)=>(v,...f)=>{},x=(P)=>{},h=(P,v)=>{},i=(P,v)=>v,U0=()=>({value:"light"}),H0=()=>({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:{}},C0=new Proxy(_0,{get(P,v){if(v in P)return P[v];return},set(P,v,f){return P[v]=f,!0}}),p0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},L0=console;try{let P=s9(Y,J),v=new Set(Object.keys(W)),f=Object.keys(Z).filter((a)=>!v.has(a)&&a!=="props"),l=f.map((a)=>Z[a]),q0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),g=[],n=[];for(let[a,T1]of Object.entries(W)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(q0.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(P))continue;g.push(a),n.push(T1)}let Z0=BJ(P).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
747
- `),z0=Z.params??{},k0=[],o0=[];for(let a=0;a<f.length;a++){if(f[a]==="params")continue;k0.push(f[a]),o0.push(l[a])}let V5=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","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...g,...k0,`return (async () => {
746
+ `),Z}async function n7($,Z,J){if(!$.trim())return;let Y;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=P.transformSync(v)}catch{Y=i7($)}let Q={exports:{}},X=Q.exports,G=process.cwd(),K={},q=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((P)=>P[1]).filter((P)=>!P.startsWith("node:")&&!P.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(P));for(let P of q)try{let v=k1.resolve(G,"node_modules",P),f=k1.join(v,"package.json"),p=JSON.parse(Y0("fs").readFileSync(f,"utf8")),q0=p.main||"index.js";if(p.exports){let g=typeof p.exports==="string"?p.exports:p.exports["."];if(typeof g==="string")q0=g;else if(g?.bun)q0=g.bun;else if(g?.import)q0=g.import;else if(g?.default)q0=g.default}K[P]=await import(k1.resolve(v,q0))}catch{}let z=(P)=>{if(K[P])return K[P];return Y0(P)},W=Z.props||{},U=Object.assign((P)=>{if(!P)return W;let v={};for(let[f,p]of Object.entries(P)){let q0=W[f];if(q0!==void 0)v[f]=q0;else if(typeof p==="function")v[f]=p();else v[f]=p}return v},W),_=()=>W,j=(P,v)=>{let f={...P};for(let[p,q0]of Object.entries(v))if(f[p]===void 0)if(typeof q0==="function")f[p]=q0();else f[p]=q0;return f},B=(P)=>{let v=()=>P;return v.set=(f)=>{},v.update=(f)=>{},v},O=(P)=>{let v,f=!1;return()=>{if(!f)try{v=P(),f=!0}catch{v=void 0}return v}},F=(P)=>{},L=(P)=>P(),H=(P)=>{},V=(P)=>{},A=(P)=>{},w=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),N=()=>({push:(P)=>{},replace:(P)=>{},back:()=>{},forward:()=>{},go:(P)=>{}}),R=(P)=>{_1(P);let v=Z.__stx_runtime_head||{},f=P||{};Z.__stx_runtime_head={...v,...f.title&&{title:f.title},meta:[...v.meta||[],...f.meta||[]],link:[...v.link||[],...f.link||[]],script:[...v.script||[],...f.script||[]],htmlAttrs:{...v.htmlAttrs||{},...f.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...f.bodyAttrs||{}}}},T=(P)=>{I5(P);let v=t1();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},I=(P)=>({value:P}),M=(P)=>P,E=(P)=>({value:typeof P==="function"?P():P}),k=(P,v)=>{},y=(P)=>{},S=(P)=>{},b=(P)=>P?P():Promise.resolve(),D=(P)=>(v,...f)=>{},x=(P)=>{},h=(P,v)=>{},i=(P,v)=>v,U0=()=>({value:"light"}),H0=()=>({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:{}},P0=new Proxy(_0,{get(P,v){if(v in P)return P[v];return},set(P,v,f){return P[v]=f,!0}}),l0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},L0=console;try{let P=s9(Y,J),v=new Set(Object.keys(W)),f=Object.keys(Z).filter((a)=>!v.has(a)&&a!=="props"),p=f.map((a)=>Z[a]),q0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),g=[],n=[];for(let[a,T1]of Object.entries(W)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(q0.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(P))continue;g.push(a),n.push(T1)}let Z0=OJ(P).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
747
+ `),z0=Z.params??{},k0=[],s0=[];for(let a=0;a<f.length;a++){if(f[a]==="params")continue;k0.push(f[a]),s0.push(p[a])}let V5=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","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...g,...k0,`return (async () => {
748
748
  ${P}
749
749
  ${Z0}
750
750
  return module.exports
751
- })()`)(Q,X,z,W,U,_,j,B,O,F,L,H,V,A,w,N,R,T,I,M,E,k,y,S,b,D,x,h,i,U0,H0,C0,p0,L0,_0.confirm,_0.alert,_0.fetch,z0,...n,...o0);Object.assign(Z,V5);for(let[a,T1]of Object.entries(W))if(!(a in Z))Z[a]=T1}catch{try{await FJ(Y,Z,J)}catch{}}}function s9($,Z){let J=Z?k1.dirname(Z):process.cwd(),Y=$.split(`
751
+ })()`)(Q,X,z,W,U,_,j,B,O,F,L,H,V,A,w,N,R,T,I,M,E,k,y,S,b,D,x,h,i,U0,H0,P0,l0,L0,_0.confirm,_0.alert,_0.fetch,z0,...n,...s0);Object.assign(Z,V5);for(let[a,T1]of Object.entries(W))if(!(a in Z))Z[a]=T1}catch{try{await wJ(Y,Z,J)}catch{}}}function s9($,Z){let J=Z?k1.dirname(Z):process.cwd(),Y=$.split(`
752
752
  `),Q=[],X=0;while(X<Y.length){let G=Y[X].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(;X<Y.length;X++){for(let q of Y[X])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}X++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let z=X;z<Y.length&&!q;z++){let W=null,U=!1,_=Y[z];for(let j=0;j<_.length;j++){let B=_[j];if(U){U=!1;continue}if(B==="\\"){U=!0;continue}if(W){if(B===W)W=null;continue}if(B==='"'||B==="'"||B==="`"){W=B;continue}if(B==="(")K++;else if(B===")"){if(K--,K===0){X=z+1,q=!0;break}}}}if(!q)X=Y.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),z=G.match(/^import\s+['"](.+)['"]/),W=(U)=>{if(U.startsWith("."))return k1.resolve(J,U);return U};if(K){let[,U,_]=K,j=W(_);Q.push(`const ${U} = await import('${j}')`),Q.push(`module.exports.${U} = ${U};`)}else if(q){let[,U,_]=q,j=U.trim(),B=W(_);Q.push(`const { ${j} } = await import('${B}')`);for(let O of j.split(",")){let F=O.trim().split(/\s+as\s+/).pop()?.trim();if(F)Q.push(`module.exports.${F} = ${F};`)}}else if(z){let U=W(z[1]);Q.push(`await import('${U}')`)}else Q.push(G);X++;continue}if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=p7(Y,X),{type:q,name:z,value:W}=K;Q.push(`${q} ${z} = ${W};`),Q.push(`module.exports.${z} = ${z};`),X=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=o9(Y,X);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),X=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=p7(Y,X),{type:q,name:z,value:W}=K;Q.push(`${q} ${z} = ${W};`),Q.push(`module.exports.${z} = ${z};`),X=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=o9(Y,X);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),X=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=Y[X].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...Y];q[X]=K;let z=o9(q,X);if(Q.push(z.functionCode),z.name)Q.push(`module.exports.default = ${z.name};`);X=z.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),X++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],z=Y[X].replace(/^export\s+/,""),W=0,U=X;for(;U<Y.length;U++){let _=Y[U];for(let j of _)if(j==="{")W++;else if(j==="}")W--;if(U>X)z+=`
753
- `+_;if(W<=0&&U>=X)break}Q.push(z),Q.push(`module.exports.${q} = ${q};`),X=U+1}else Q.push(G),X++}else if(G.includes("module.exports"))Q.push(G),X++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),X++;else X++}return jJ(Q.join(`
754
- `),J)}function jJ($,Z){let J=$.length,Y="",Q=0,X=null,G=!1,K=!1,q=0;while(Q<J){let z=$[Q],W=$[Q+1];if(G){if(Y+=z,z===`
755
- `)G=!1;Q++;continue}if(K){if(Y+=z,z==="*"&&W==="/"){Y+=W,Q+=2,K=!1;continue}Q++;continue}if(!X&&z==="/"&&W==="/"){G=!0,Y+=z,Q++;continue}if(!X&&z==="/"&&W==="*"){K=!0,Y+=z,Q++;continue}if(X){if(Y+=z,z==="\\"){Y+=W,Q+=2;continue}if(z===X&&X!=="`"){X=null,Q++;continue}if(X==="`"){if(z==="$"&&W==="{"){q++,Y+=W,Q+=2;continue}if(z==="`"){X=null,Q++;continue}}Q++;continue}if(q>0){if(z==="{")q++;else if(z==="}")q--}if(z==='"'||z==="'"||z==="`"){X=z,Y+=z,Q++;continue}if(z==="a"&&$.startsWith("await",Q)){let U=OJ($,Q);if(U){let{quote:_,path:j,end:B}=U;if(j.startsWith(".")){let O=k1.resolve(Z,j);Y+=`await import(${_}${O}${_})`,Q=B;continue}}}Y+=z,Q++}return Y}function OJ($,Z){let J=Z+5;if(J>=$.length)return null;if(!/\s/.test($[J]))return null;while(J<$.length&&/\s/.test($[J]))J++;if(!$.startsWith("import",J))return null;J+=6;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;J++;while(J<$.length&&/\s/.test($[J]))J++;let Y=$[J];if(Y!=="'"&&Y!=='"')return null;J++;let Q=J;while(J<$.length&&$[J]!==Y)if($[J]==="\\")J+=2;else J++;if(J>=$.length)return null;let X=$.slice(Q,J);J++;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!==")")return null;return{quote:Y,path:X,end:J+1}}function o7($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Q=D0($,J,J==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function s7($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let Y=0,Q=0,X="";while(Y<J.length){let G=J[Y];if(G==="{"||G==="["){if(Q++,Q===1){let K=o7(J,Y);if(K){let q=s7(K.pattern);Z.push(...q),Y=K.endPos,X="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){Y++;continue}if(G===","){if(X.trim())Z.push(X.trim());X="",Y++;continue}if(G===":"){X="",Y++;continue}if(G==="="){if(X.trim())Z.push(X.trim());X="",Y++;while(Y<J.length&&J[Y]!==","&&Q===0){if(J[Y]==="{"||J[Y]==="[")Q++;else if(J[Y]==="}"||J[Y]==="]")Q--;Y++}continue}if(/[\w$]/.test(G))X+=G;Y++}if(X.trim())Z.push(X.trim());return Z}function p7($,Z){let J=$[Z].trim(),Y=J.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!Y){let z=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(z){let W=J.slice(z[0].length),U=Z;if((W.startsWith("{")||W.startsWith("["))&&!W.includes(W.startsWith("{")?"}":"]")){let j=W.startsWith("{")?"}":"]",B=W;for(let O=Z+1;O<$.length;O++)if(B+=" "+$[O].trim(),U=O,$[O].includes(j))break;W=B}let _=o7(W,0);if(_){let j=z[1],B=_.pattern,O=W.slice(_.endPos).trim();if(O.startsWith("=")){let F=O.slice(1).trim(),L=F,H=Math.max(U,Z);if(l7(F)){let N=c7($,H,F);L=N.value,H=N.nextIndex}else H=H+1;L=L.trim().replace(/;$/,"");let V=s7(B),A=`__stx_src_${Z}`,w=V.map((N)=>`module.exports.${N} = ${N};`).join(`
753
+ `+_;if(W<=0&&U>=X)break}Q.push(z),Q.push(`module.exports.${q} = ${q};`),X=U+1}else Q.push(G),X++}else if(G.includes("module.exports"))Q.push(G),X++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),X++;else X++}return HJ(Q.join(`
754
+ `),J)}function HJ($,Z){let J=$.length,Y="",Q=0,X=null,G=!1,K=!1,q=0;while(Q<J){let z=$[Q],W=$[Q+1];if(G){if(Y+=z,z===`
755
+ `)G=!1;Q++;continue}if(K){if(Y+=z,z==="*"&&W==="/"){Y+=W,Q+=2,K=!1;continue}Q++;continue}if(!X&&z==="/"&&W==="/"){G=!0,Y+=z,Q++;continue}if(!X&&z==="/"&&W==="*"){K=!0,Y+=z,Q++;continue}if(X){if(Y+=z,z==="\\"){Y+=W,Q+=2;continue}if(z===X&&X!=="`"){X=null,Q++;continue}if(X==="`"){if(z==="$"&&W==="{"){q++,Y+=W,Q+=2;continue}if(z==="`"){X=null,Q++;continue}}Q++;continue}if(q>0){if(z==="{")q++;else if(z==="}")q--}if(z==='"'||z==="'"||z==="`"){X=z,Y+=z,Q++;continue}if(z==="a"&&$.startsWith("await",Q)){let U=LJ($,Q);if(U){let{quote:_,path:j,end:B}=U;if(j.startsWith(".")){let O=k1.resolve(Z,j);Y+=`await import(${_}${O}${_})`,Q=B;continue}}}Y+=z,Q++}return Y}function LJ($,Z){let J=Z+5;if(J>=$.length)return null;if(!/\s/.test($[J]))return null;while(J<$.length&&/\s/.test($[J]))J++;if(!$.startsWith("import",J))return null;J+=6;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return null;J++;while(J<$.length&&/\s/.test($[J]))J++;let Y=$[J];if(Y!=="'"&&Y!=='"')return null;J++;let Q=J;while(J<$.length&&$[J]!==Y)if($[J]==="\\")J+=2;else J++;if(J>=$.length)return null;let X=$.slice(Q,J);J++;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!==")")return null;return{quote:Y,path:X,end:J+1}}function o7($,Z){let J=$[Z];if(J!=="{"&&J!=="[")return null;let Q=D0($,J,J==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function s7($){let Z=[],J=$.slice(1,-1).trim();if(!J)return Z;let Y=0,Q=0,X="";while(Y<J.length){let G=J[Y];if(G==="{"||G==="["){if(Q++,Q===1){let K=o7(J,Y);if(K){let q=s7(K.pattern);Z.push(...q),Y=K.endPos,X="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){Y++;continue}if(G===","){if(X.trim())Z.push(X.trim());X="",Y++;continue}if(G===":"){X="",Y++;continue}if(G==="="){if(X.trim())Z.push(X.trim());X="",Y++;while(Y<J.length&&J[Y]!==","&&Q===0){if(J[Y]==="{"||J[Y]==="[")Q++;else if(J[Y]==="}"||J[Y]==="]")Q--;Y++}continue}if(/[\w$]/.test(G))X+=G;Y++}if(X.trim())Z.push(X.trim());return Z}function p7($,Z){let J=$[Z].trim(),Y=J.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!Y){let z=J.match(/^(?:export\s+)?(const|let|var)\s+/);if(z){let W=J.slice(z[0].length),U=Z;if((W.startsWith("{")||W.startsWith("["))&&!W.includes(W.startsWith("{")?"}":"]")){let j=W.startsWith("{")?"}":"]",B=W;for(let O=Z+1;O<$.length;O++)if(B+=" "+$[O].trim(),U=O,$[O].includes(j))break;W=B}let _=o7(W,0);if(_){let j=z[1],B=_.pattern,O=W.slice(_.endPos).trim();if(O.startsWith("=")){let F=O.slice(1).trim(),L=F,H=Math.max(U,Z);if(l7(F)){let N=c7($,H,F);L=N.value,H=N.nextIndex}else H=H+1;L=L.trim().replace(/;$/,"");let V=s7(B),A=`__stx_src_${Z}`,w=V.map((N)=>`module.exports.${N} = ${N};`).join(`
756
756
  `);return{type:j,name:A,value:`${L}; ${j} ${B} = ${A};
757
757
  ${w}`,nextIndex:H}}}}throw Error(`Failed to parse variable declaration: ${J}`)}let[,Q,X,G]=Y,K=G,q=Z;if(l7(G)){let z=c7($,Z,G);K=z.value,q=z.nextIndex}else q=Z+1;while(q<$.length){let z=$[q].trim();if(z.startsWith(".")||z.startsWith("?."))K+=`
758
- ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:X,value:K,nextIndex:q}}function o9($,Z){let J=$[Z].trim(),Y=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${J}`);let[,Q]=Y,X=J.replace(/^export\s+/,""),G=Z;if(HJ(J)){let K=LJ($,Z,X);X=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:X,nextIndex:G}}function l7($){let Z=$.trim();if(Z.startsWith("{"))return D0(Z,"{","}",0)===-1;if(Z.startsWith("["))return D0(Z,"[","]",0)===-1;return!r7(Z)}function r7($){let Z={paren:0,bracket:0,brace:0},J=null,Y=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&J)continue;if((X==='"'||X==="'")&&!J){J=X;continue}if(X===J&&J!=="`"){J=null;continue}if(X==="`"&&!J){J="`";continue}if(X==="`"&&J==="`"&&Y===0){J=null;continue}if(J==="`"&&X==="$"&&$[Q+1]==="{"){Y++,Q++;continue}if(Y>0&&X==="{"){Y++;continue}if(Y>0&&X==="}"){Y--;continue}if(J)continue;if(X==="(")Z.paren++;else if(X===")")Z.paren--;else if(X==="[")Z.bracket++;else if(X==="]")Z.bracket--;else if(X==="{")Z.brace++;else if(X==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function HJ($){let Z=$.indexOf("{");if(Z===-1)return!0;return D0($,"{","}",Z)===-1}function c7($,Z,J){let Y=J,Q=Z+1;while(Q<$.length&&!r7(Y)){let X=$[Q];Y+=`
758
+ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:X,value:K,nextIndex:q}}function o9($,Z){let J=$[Z].trim(),Y=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${J}`);let[,Q]=Y,X=J.replace(/^export\s+/,""),G=Z;if(FJ(J)){let K=VJ($,Z,X);X=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:X,nextIndex:G}}function l7($){let Z=$.trim();if(Z.startsWith("{"))return D0(Z,"{","}",0)===-1;if(Z.startsWith("["))return D0(Z,"[","]",0)===-1;return!r7(Z)}function r7($){let Z={paren:0,bracket:0,brace:0},J=null,Y=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&J)continue;if((X==='"'||X==="'")&&!J){J=X;continue}if(X===J&&J!=="`"){J=null;continue}if(X==="`"&&!J){J="`";continue}if(X==="`"&&J==="`"&&Y===0){J=null;continue}if(J==="`"&&X==="$"&&$[Q+1]==="{"){Y++,Q++;continue}if(Y>0&&X==="{"){Y++;continue}if(Y>0&&X==="}"){Y--;continue}if(J)continue;if(X==="(")Z.paren++;else if(X===")")Z.paren--;else if(X==="[")Z.bracket++;else if(X==="]")Z.bracket--;else if(X==="{")Z.brace++;else if(X==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&J===null}function FJ($){let Z=$.indexOf("{");if(Z===-1)return!0;return D0($,"{","}",Z)===-1}function c7($,Z,J){let Y=J,Q=Z+1;while(Q<$.length&&!r7(Y)){let X=$[Q];Y+=`
759
759
  ${X}`,Q++}while(Q<$.length){let X=$[Q].trim();if(X.startsWith(".")||X.startsWith("?."))Y+=`
760
- ${$[Q]}`,Q++;else break}return{value:Y,nextIndex:Q}}function LJ($,Z,J){let Y=J,Q=Z+1;while(Q<$.length){let X=Y.indexOf("{");if(X!==-1){if(D0(Y,"{","}",X)!==-1)break}let G=$[Q];Y+=`
761
- ${G}`,Q++}return{functionCode:Y,nextIndex:Q}}async function FJ($,Z,J){let Y=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let X of Y){let[,,G,K]=X;try{let q=K.trim().replace(/;$/,""),z=Function(`return ${q}`);Z[G]=z()}catch{try{let q=K.trim().replace(/;$/,""),z=Function(`return (${q})`);Z[G]=z()}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let X of Q){let[,,G,K]=X;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),z=Function(`return ${q}`);Z[G]=z()}catch{}}try{let X=$.replace(/^export\s+/gm,""),K=Function(`
760
+ ${$[Q]}`,Q++;else break}return{value:Y,nextIndex:Q}}function VJ($,Z,J){let Y=J,Q=Z+1;while(Q<$.length){let X=Y.indexOf("{");if(X!==-1){if(D0(Y,"{","}",X)!==-1)break}let G=$[Q];Y+=`
761
+ ${G}`,Q++}return{functionCode:Y,nextIndex:Q}}async function wJ($,Z,J){let Y=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let X of Y){let[,,G,K]=X;try{let q=K.trim().replace(/;$/,""),z=Function(`return ${q}`);Z[G]=z()}catch{try{let q=K.trim().replace(/;$/,""),z=Function(`return (${q})`);Z[G]=z()}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let X of Q){let[,,G,K]=X;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),z=Function(`return ${q}`);Z[G]=z()}catch{}}try{let X=$.replace(/^export\s+/gm,""),K=Function(`
762
762
  ${X}
763
763
  const result = {};
764
764
  ${Array.from($.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)).map((q)=>`if (typeof ${q[1]} !== 'undefined') result.${q[1]} = ${q[1]};`).join(`
765
765
  `)}
766
766
  return result;
767
- `)();Object.entries(K).forEach(([q,z])=>{if(z!==void 0&&!(q in Z))Z[q]=z})}catch{}}function a7($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",Y=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:Y}}function t7($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var $5=C(()=>{e1();M1()});var J3={};r(J3,{renderSlot:()=>$3,processSlots:()=>Y3,parseSlots:()=>e7,parseSlotElement:()=>wJ,extractSlotContent:()=>RJ,applySlots:()=>TJ});function VJ($,Z){let J=1,Y=Z,Q="<template",X="</template";while(Y<$.length&&J>0){let G=$.indexOf("<",Y);if(G===-1)break;if(Y=G,$.startsWith(Q,Y)&&(Y+Q.length>=$.length||/[\s>\/]/.test($[Y+Q.length]))){J++,Y+=Q.length;continue}if($.startsWith(X,Y)){let K=$.indexOf(">",Y+X.length);if(K!==-1){if(J--,J===0)return K+1;Y=K+1;continue}}Y++}return J===0?Y:-1}function e7($){let Z={default:"",named:new Map},J=$,Y=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,Q=[],X;while((X=Y.exec($))!==null){let[W,U,_,j,B]=X,O=U||_||j,F=X.index+W.length,L=VJ($,F);if(L!==-1){let H=$.slice(F,L-11).trim();Q.push({start:X.index,end:L,slotName:O,content:H,propsBinding:B||void 0}),Z.named.set(O,{name:O,content:H,propsBinding:B||void 0})}}Q.sort((W,U)=>U.start-W.start);for(let W of Q)J=J.slice(0,W.start)+J.slice(W.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(J))!==null){let[W,U,_,j,B,O]=q,F=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(F+L).trim(),V=`<${U}${H?" "+H:""}>${O}</${U}>`;G.push({start:q.index,end:q.index+W.length,slotName:j,element:V})}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=z.exec(J))!==null){let[W,U,_,j,B]=q,O=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+F).trim(),H=`<${U}${L?" "+L:""} />`;G.push({start:q.index,end:q.index+W.length,slotName:j,element:H})}G.sort((W,U)=>U.start-W.start);for(let W of G){let U=Z.named.get(W.slotName);if(U)U.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});J=J.slice(0,W.start)+J.slice(W.end)}return Z.default=J.trim(),Z}function wJ($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),J=Z?Z[1]:"",Y={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=Q.exec($))!==null)Y[X[1]]=X[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:J,props:Y,defaultContent:K}}async function $3($,Z,J,Y){if(!$)return J;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let X=$.propsBinding.trim(),G={...Y};if(X.startsWith("{")&&X.endsWith("}")){let K=X.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[z,W]=q.split(":").map((_)=>_.trim()),U=W||z;if(Z[z]!==void 0)G[U]=Z[z]}}else G[X]=Z;Q=AJ(Q,G)}return Q}function AJ($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(J,Y)=>{try{let Q=Y.trim(),X=Z3(Q,Z);return z1(String(X??""))}catch{return`{{ ${Y} }}`}})}function Z3($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let Y=$.split("."),Q=Z;for(let X of Y)if(Q&&typeof Q==="object"&&X in Q)Q=Q[X];else return;return Q}let J=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(J){let[,Y,Q,X]=J,G=Z[Y],K=parseInt(X,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!t($))return;return e($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function Y3($,Z,J){let Y=$;Y=await NJ(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,z)=>{let W=Z.named.get(K),U=z?.trim()||"",_=q||"",j={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,O;while((O=B.exec(_))!==null){let F=O[1],L=O[2];j[F]=Z3(L,J)}return await $3(W,j,U,J)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(X,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),Y}async function NJ($,Z,J){let Y=[],Q=[];$.replace(Z,(K,...q)=>{let z=q[q.length-2];return Q.push({match:K,index:z}),Y.push(J(K,...q.slice(0,-2))),K});let X=await Promise.all(Y),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:z}=Q[K];G=G.slice(0,z)+X[K]+G.slice(z+q.length)}return G}function RJ($){let Z=e7($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function TJ($,Z,J,Y){return await Y3($,{default:Z,named:J},Y)}var X3=C(()=>{t0();R0()});import MJ from"fs";import u from"path";function DJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function EJ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function q1($){return!EJ($)}function W1($){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 J=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:f0()}).transformSync(Z);for(let X=0;X<J.length;X++)Q=Q.replace(`"__STX_EXPR_${X}__"`,J[X]),Q=Q.replace(`'__STX_EXPR_${X}__'`,J[X]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function kJ($){let Z=[],J=new Set,Y=0,Q=0,X=$.length,G=(W)=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]===W){Q++;return}Q++}},K=()=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let W=1;while(Q<X&&W>0)if($[Q]==="{")W++;else if($[Q]==="}")W--;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<X&&$[Q]!==`
768
- `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<X-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(Y!==0)return;let W=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((O)=>{let F=O.trim().split(":");return F[F.length-1].trim()});for(let O of B)if(O&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(O)&&!J.has(O))Z.push(O),J.add(O);return}let U=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let _=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Q<X){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){Y++,Q++;continue}if($[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))z();Q++}return Z}async function B1($,Z,J,Y,Q,X,G,K=new Set,q){let{extractVariables:z}=await Promise.resolve().then(() => ($5(),D5)),W=K??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let U=new Set(W);U.add($);try{let _=(P)=>P.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),B=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=Q.__importedComponents;if(F){let P=[B,B.toLowerCase(),_(B),j(B)];for(let v of P)if(F.has(v)){O=F.get(v);break}}let L=[];if(!O){let P=[`${B}.stx`,`${_(B)}.stx`,`${j(B)}.stx`],v=[...new Set(P)],f=Q.__originalFilePath,l=[];if(f){let G0=u.join(u.dirname(f),"components");l.push(G0)}if(Y)l.push(Y);let q0=u.join(u.dirname(X),"components");if(!l.includes(q0))l.push(q0);if(G.componentsDir&&G.componentsDir!==Y&&!l.includes(G.componentsDir))l.push(G.componentsDir);let g=process.cwd(),n=[u.resolve(g,"src/components"),u.resolve(g,"components"),u.resolve(import.meta.dir,"components")];for(let G0 of n)if(!l.includes(G0))l.push(G0);if(B.startsWith("./")||B.startsWith("../"))O=u.resolve(u.dirname(X),`${B}.stx`),L.push(O);else for(let G0 of l){if(!G0)continue;for(let Z0 of v){let z0=u.join(G0,Z0);if(L.push(z0),await c(z0)){O=z0;break}}if(O)break;if(!O)try{let Z0=await import("fs");if(!Z0.statSync(G0,{throwIfNoEntry:!1})?.isDirectory())continue;let k0=8,o0=[{path:G0,depth:0}];while(o0.length>0&&!O){let i1=o0.pop();if(i1.depth>=k0)continue;let V5;try{V5=Z0.readdirSync(i1.path,{withFileTypes:!0})}catch{continue}for(let a of V5){if(!a.isDirectory())continue;if(a.name==="node_modules"||a.name.startsWith("."))continue;let T1=u.join(i1.path,a.name);for(let G7 of v){let C9=u.join(T1,G7);if(L.push(C9),await c(C9)){O=C9;break}}if(O)break;o0.push({path:T1,depth:i1.depth+1})}}}catch{}if(O)break}}if(!O||!await c(O)){let P=L.length>0?`
767
+ `)();Object.entries(K).forEach(([q,z])=>{if(z!==void 0&&!(q in Z))Z[q]=z})}catch{}}function a7($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",Y=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:Y}}function t7($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var $5=C(()=>{e1();M1()});var J3={};r(J3,{renderSlot:()=>$3,processSlots:()=>Y3,parseSlots:()=>e7,parseSlotElement:()=>NJ,extractSlotContent:()=>MJ,applySlots:()=>IJ});function AJ($,Z){let J=1,Y=Z,Q="<template",X="</template";while(Y<$.length&&J>0){let G=$.indexOf("<",Y);if(G===-1)break;if(Y=G,$.startsWith(Q,Y)&&(Y+Q.length>=$.length||/[\s>\/]/.test($[Y+Q.length]))){J++,Y+=Q.length;continue}if($.startsWith(X,Y)){let K=$.indexOf(">",Y+X.length);if(K!==-1){if(J--,J===0)return K+1;Y=K+1;continue}}Y++}return J===0?Y:-1}function e7($){let Z={default:"",named:new Map},J=$,Y=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,Q=[],X;while((X=Y.exec($))!==null){let[W,U,_,j,B]=X,O=U||_||j,F=X.index+W.length,L=AJ($,F);if(L!==-1){let H=$.slice(F,L-11).trim();Q.push({start:X.index,end:L,slotName:O,content:H,propsBinding:B||void 0}),Z.named.set(O,{name:O,content:H,propsBinding:B||void 0})}}Q.sort((W,U)=>U.start-W.start);for(let W of Q)J=J.slice(0,W.start)+J.slice(W.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(J))!==null){let[W,U,_,j,B,O]=q,F=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(F+L).trim(),V=`<${U}${H?" "+H:""}>${O}</${U}>`;G.push({start:q.index,end:q.index+W.length,slotName:j,element:V})}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=z.exec(J))!==null){let[W,U,_,j,B]=q,O=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+F).trim(),H=`<${U}${L?" "+L:""} />`;G.push({start:q.index,end:q.index+W.length,slotName:j,element:H})}G.sort((W,U)=>U.start-W.start);for(let W of G){let U=Z.named.get(W.slotName);if(U)U.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});J=J.slice(0,W.start)+J.slice(W.end)}return Z.default=J.trim(),Z}function NJ($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),J=Z?Z[1]:"",Y={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=Q.exec($))!==null)Y[X[1]]=X[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:J,props:Y,defaultContent:K}}async function $3($,Z,J,Y){if(!$)return J;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let X=$.propsBinding.trim(),G={...Y};if(X.startsWith("{")&&X.endsWith("}")){let K=X.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[z,W]=q.split(":").map((_)=>_.trim()),U=W||z;if(Z[z]!==void 0)G[U]=Z[z]}}else G[X]=Z;Q=RJ(Q,G)}return Q}function RJ($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(J,Y)=>{try{let Q=Y.trim(),X=Z3(Q,Z);return z1(String(X??""))}catch{return`{{ ${Y} }}`}})}function Z3($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let Y=$.split("."),Q=Z;for(let X of Y)if(Q&&typeof Q==="object"&&X in Q)Q=Q[X];else return;return Q}let J=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(J){let[,Y,Q,X]=J,G=Z[Y],K=parseInt(X,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!t($))return;return e($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function Y3($,Z,J){let Y=$;Y=await TJ(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,z)=>{let W=Z.named.get(K),U=z?.trim()||"",_=q||"",j={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,O;while((O=B.exec(_))!==null){let F=O[1],L=O[2];j[F]=Z3(L,J)}return await $3(W,j,U,J)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(X,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),Y}async function TJ($,Z,J){let Y=[],Q=[];$.replace(Z,(K,...q)=>{let z=q[q.length-2];return Q.push({match:K,index:z}),Y.push(J(K,...q.slice(0,-2))),K});let X=await Promise.all(Y),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:z}=Q[K];G=G.slice(0,z)+X[K]+G.slice(z+q.length)}return G}function MJ($){let Z=e7($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function IJ($,Z,J,Y){return await Y3($,{default:Z,named:J},Y)}var X3=C(()=>{n0();R0()});import DJ from"fs";import m from"path";function kJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bJ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function q1($){return!bJ($)}function W1($){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 J=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(X)=>{let G=J.length;return J.push(X),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}).transformSync(Z);for(let X=0;X<J.length;X++)Q=Q.replace(`"__STX_EXPR_${X}__"`,J[X]),Q=Q.replace(`'__STX_EXPR_${X}__'`,J[X]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function SJ($){let Z=[],J=new Set,Y=0,Q=0,X=$.length,G=(W)=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]===W){Q++;return}Q++}},K=()=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let W=1;while(Q<X&&W>0)if($[Q]==="{")W++;else if($[Q]==="}")W--;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<X&&$[Q]!==`
768
+ `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<X-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(Y!==0)return;let W=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let B=W[2].split(",").map((O)=>{let F=O.trim().split(":");return F[F.length-1].trim()});for(let O of B)if(O&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(O)&&!J.has(O))Z.push(O),J.add(O);return}let U=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let _=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(Q<X){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){Y++,Q++;continue}if($[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))z();Q++}return Z}async function B1($,Z,J,Y,Q,X,G,K=new Set,q){let{extractVariables:z}=await Promise.resolve().then(() => ($5(),D5)),W=K??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let U=new Set(W);U.add($);try{let _=(P)=>P.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),B=$.endsWith(".stx")?$.slice(0,-4):$,O=null,F=Q.__importedComponents;if(F){let P=[B,B.toLowerCase(),_(B),j(B)];for(let v of P)if(F.has(v)){O=F.get(v);break}}let L=[];if(!O){let P=[`${B}.stx`,`${_(B)}.stx`,`${j(B)}.stx`],v=[...new Set(P)],f=Q.__originalFilePath,p=[];if(f){let G0=m.join(m.dirname(f),"components");p.push(G0)}if(Y)p.push(Y);let q0=m.join(m.dirname(X),"components");if(!p.includes(q0))p.push(q0);if(G.componentsDir&&G.componentsDir!==Y&&!p.includes(G.componentsDir))p.push(G.componentsDir);let g=process.cwd(),n=[m.resolve(g,"src/components"),m.resolve(g,"components"),m.resolve(import.meta.dir,"components")];for(let G0 of n)if(!p.includes(G0))p.push(G0);if(B.startsWith("./")||B.startsWith("../"))O=m.resolve(m.dirname(X),`${B}.stx`),L.push(O);else for(let G0 of p){if(!G0)continue;for(let Z0 of v){let z0=m.join(G0,Z0);if(L.push(z0),await l(z0)){O=z0;break}}if(O)break;if(!O)try{let Z0=await import("fs");if(!Z0.statSync(G0,{throwIfNoEntry:!1})?.isDirectory())continue;let k0=8,s0=[{path:G0,depth:0}];while(s0.length>0&&!O){let i1=s0.pop();if(i1.depth>=k0)continue;let V5;try{V5=Z0.readdirSync(i1.path,{withFileTypes:!0})}catch{continue}for(let a of V5){if(!a.isDirectory())continue;if(a.name==="node_modules"||a.name.startsWith("."))continue;let T1=m.join(i1.path,a.name);for(let G7 of v){let C9=m.join(T1,G7);if(L.push(C9),await l(C9)){O=C9;break}}if(O)break;s0.push({path:T1,depth:i1.depth+1})}}}catch{}if(O)break}}if(!O||!await l(O)){let P=L.length>0?`
769
769
  Searched paths:
770
770
  ${L.map((v)=>` - ${v}`).join(`
771
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}q.add(O);let H;if(r9.has(O))H=r9.get(O);else try{H=await Bun.file(O).text(),r9.set(O,H)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let V=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[P,v]of Object.entries(Q))if(!P.startsWith("__")||V.has(P))A[P]=v;let w={...A,...Z,props:Z,slot:J,__processedComponents:U,__sections:{}},N=H,R=N.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(R)N=R[1].trim();let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...H.matchAll(T)],M=[];for(let P of I){let v=P[1]||"",f=P[2]||"",l=v.includes("server");if(q1(v)&&f.trim())f=W1(f);if(l&&f)try{await z(f,w,O)}catch(g){}if(!l){let g=f.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),n=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");M.push(`<script${n}>${g}</script>`)}}let E=H.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k=E?E[1]:"",y=E?E[2]:"",S="",b=k&&/\bscoped\b/i.test(k);if(E)S=`<style${k}>${y}</style>`;let D=N;if(D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E)D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(J&&D.includes("{{ text || slot }}"))D=D.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{extractSlotContent:x,applySlots:h}=await Promise.resolve().then(() => (X3(),J3)),{defaultSlot:i,namedSlots:U0}=x(J);D=await h(D,i||J,U0,w);for(let[P,v]of Object.entries(w))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let f=p9(v);w[P]=f}}let H0=M.some((P)=>/\b(state|derived|effect)\s*\(/.test(P)),_0={...G,componentsDir:u.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:H0,defaultLayout:void 0};w.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let C0=await $1(D,w,O,_0,q),p0=`stx_${B.replace(/[^a-zA-Z0-9]/g,"_")}_${++IJ}_${Math.random().toString(36).slice(2,8)}`,L0=C0;if(H0){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${DJ(JSON.stringify(Z))}"`}catch{}if(L0=`<div data-stx-scope="${p0}"${P}>${C0}</div>`,L0=M.map((f)=>{let l=f.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!l)return f;let[,q0,g]=l,n=r0(g),G0=`
771
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}q.add(O);let H;if(r9.has(O))H=r9.get(O);else try{H=await Bun.file(O).text(),r9.set(O,H)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let V=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[P,v]of Object.entries(Q))if(!P.startsWith("__")||V.has(P))A[P]=v;let w={...A,...Z,props:Z,slot:J,__processedComponents:U,__sections:{}},N=H,R=N.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(R)N=R[1].trim();let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...H.matchAll(T)],M=[];for(let P of I){let v=P[1]||"",f=P[2]||"",p=v.includes("server");if(q1(v)&&f.trim())f=W1(f);if(p&&f)try{await z(f,w,O)}catch(g){}if(!p){let g=f.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),n=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");M.push(`<script${n}>${g}</script>`)}}let E=H.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k=E?E[1]:"",y=E?E[2]:"",S="",b=k&&/\bscoped\b/i.test(k);if(E)S=`<style${k}>${y}</style>`;let D=N;if(D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E)D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(J&&D.includes("{{ text || slot }}"))D=D.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{extractSlotContent:x,applySlots:h}=await Promise.resolve().then(() => (X3(),J3)),{defaultSlot:i,namedSlots:U0}=x(J);D=await h(D,i||J,U0,w);for(let[P,v]of Object.entries(w))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let f=p9(v);w[P]=f}}let H0=M.some((P)=>/\b(state|derived|effect)\s*\(/.test(P)),_0={...G,componentsDir:m.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:H0,defaultLayout:void 0};w.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let P0=await $1(D,w,O,_0,q),l0=`stx_${B.replace(/[^a-zA-Z0-9]/g,"_")}_${++EJ}_${Math.random().toString(36).slice(2,8)}`,L0=P0;if(H0){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${kJ(JSON.stringify(Z))}"`}catch{}if(L0=`<div data-stx-scope="${l0}"${P}>${P0}</div>`,L0=M.map((f)=>{let p=f.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!p)return f;let[,q0,g]=p,n=a0(g),G0=`
772
772
  (function() {
773
773
  const { state, derived, effect, batch } = window.stx;
774
774
  const __scope = window.stx._scopes = window.stx._scopes || {};
775
- const __scopeVars = __scope['${p0}'] = __scope['${p0}'] || {};
775
+ const __scopeVars = __scope['${l0}'] = __scope['${l0}'] || {};
776
776
 
777
777
  // Scope-specific lifecycle callbacks
778
778
  __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
@@ -785,7 +785,7 @@ ${n}
785
785
  // Register all defined signals and functions in this scope
786
786
  const __localVars = {};
787
787
  try {
788
- ${kJ(n).map((Z0)=>`if (typeof ${Z0} !== 'undefined') __localVars['${Z0}'] = ${Z0};`).join(`
788
+ ${SJ(n).map((Z0)=>`if (typeof ${Z0} !== 'undefined') __localVars['${Z0}'] = ${Z0};`).join(`
789
789
  `)}
790
790
  }
791
791
  catch (e) {}
@@ -794,9 +794,9 @@ catch (e) {}
794
794
  `)+`
795
795
  `+L0,S)L0+=`
796
796
  `+S}else{if(S)L0+=`
797
- `+S;if(M.length>0){let P=w.__stx_event_bindings||[],v=await Promise.all(M.map(async(f)=>{let l=f.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!l)return f;return await w5(l[1],{eventBindings:P,templateContent:L0,filePath:O,projectRoot:process.cwd()})}));L0+=`
797
+ `+S;if(M.length>0){let P=w.__stx_event_bindings||[],v=await Promise.all(M.map(async(f)=>{let p=f.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!p)return f;return await w5(p[1],{eventBindings:P,templateContent:L0,filePath:O,projectRoot:process.cwd()})}));L0+=`
798
798
  `+v.join(`
799
- `),w.__stx_event_bindings=[]}}if(b){let P=T5(L0,O);if(P.hasScoped)L0=P.html}return L0}catch(_){return`[Error processing component: ${_ instanceof Error?_.message:String(_)}]`}finally{W.delete($)}}async function c($){return Bun.file($).exists()}function a9($,Z){let J=u.resolve(Z),Y=u.resolve($),Q=J.endsWith(u.sep)?J:J+u.sep;if(Y===J||Y.startsWith(Q))return Y;return null}async function t9($,Z,J,Y){let Q=await bJ($,Z,J,Y);if(Q===null)return null;let X=a9(Q,process.cwd());if(X)return X;let G=[J.root,J.layoutsDir,J.componentsDir,J.partialsDir,J.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=u.isAbsolute(K)?K:u.resolve(process.cwd(),K);if(a9(Q,q))return u.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function bJ($,Z,J,Y){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=u.dirname(Z),X=process.cwd();if($.startsWith("/")){let _=u.join(X,$),j=a9(_,X);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(J.debug)console.log(`Checking absolute path: ${j}`);if(await c(j)&&Y)Y.add(j);return j}let G=u.join(Q,$);if(await c(G)){if(J.debug)console.log(`Found direct path: ${G}`);if(Y)Y.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let _ of[".stx",".tsx",".jsx"]){let j=`${G}${_}`;if(await c(j)){if(J.debug)console.log(`Found direct path with extension: ${j}`);if(Y)Y.add(j);return j}}let K="",q=u.resolve(Q),z=process.cwd();for(let _=0;_<10;_++){let j=u.join(q,"layouts"),B=!1;try{B=MJ.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=j;break}let O=u.dirname(q);if(O===q||O.length<z.length)break;q=O}if(K){let _=$.startsWith("layouts/")?$.slice(8):$,j=u.join(K,_);if(await c(j)){if(J.debug)console.log(`Found in current layouts dir: ${j}`);if(Y)Y.add(j);return j}if(!_.endsWith(".stx")){let B=`${j}.stx`;if(await c(B)){if(J.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(J.layoutsDir){let _=u.isAbsolute(J.layoutsDir)?J.layoutsDir:u.resolve(process.cwd(),J.layoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=u.join(_,j);if(await c(B)){if(J.debug)console.log(`Found in options.layoutsDir: ${B}`);if(Y)Y.add(B);return B}if(!$.endsWith(".stx")){let O=`${B}.stx`;if(await c(O)){if(J.debug)console.log(`Found in options.layoutsDir with extension: ${O}`);if(Y)Y.add(O);return O}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let _=$.split("layouts/"),j=u.join(J.partialsDir||Q,"layouts",_[1]);if(await c(j)){if(J.debug)console.log(`Found in layouts path: ${j}`);if(Y)Y.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await c(B)){if(J.debug)console.log(`Found in layouts path with extension: ${B}`);if(Y)Y.add(B);return B}}}if(J.partialsDir){if(K=u.join(J.partialsDir,"layouts"),await c(K)){let _=u.join(K,$);if(await c(_)){if(J.debug)console.log(`Found in partials layouts dir: ${_}`);if(Y)Y.add(_);return _}if(!$.endsWith(".stx")){let j=`${_}.stx`;if(await c(j)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}}let W=J.partialsDir||u.join(process.cwd(),"views"),U=u.join(W,$);if(await c(U)){if(J.debug)console.log(`Found in views path: ${U}`);if(Y)Y.add(U);return U}if(!$.endsWith(".stx")){let _=`${U}.stx`;if(await c(_)){if(J.debug)console.log(`Found in views path with extension: ${_}`);if(Y)Y.add(_);return _}}if(Q.includes("temp")){let _=u.join(u.dirname(Q),"layouts",$);if(await c(_)){if(J.debug)console.log(`Found in temp layouts dir: ${_}`);if(Y)Y.add(_);return _}if(!$.endsWith(".stx")){let j=`${_}.stx`;if(await c(j)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(J.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 Q3($,Z,J){let Y=0,Q="",X="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
799
+ `),w.__stx_event_bindings=[]}}if(b){let P=T5(L0,O);if(P.hasScoped)L0=P.html}return L0}catch(_){return`[Error processing component: ${_ instanceof Error?_.message:String(_)}]`}finally{W.delete($)}}async function l($){return Bun.file($).exists()}function a9($,Z){let J=m.resolve(Z),Y=m.resolve($),Q=J.endsWith(m.sep)?J:J+m.sep;if(Y===J||Y.startsWith(Q))return Y;return null}async function t9($,Z,J,Y){let Q=await yJ($,Z,J,Y);if(Q===null)return null;let X=a9(Q,process.cwd());if(X)return X;let G=[J.root,J.layoutsDir,J.componentsDir,J.partialsDir,J.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=m.isAbsolute(K)?K:m.resolve(process.cwd(),K);if(a9(Q,q))return m.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function yJ($,Z,J,Y){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=m.dirname(Z),X=process.cwd();if($.startsWith("/")){let _=m.join(X,$),j=a9(_,X);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(J.debug)console.log(`Checking absolute path: ${j}`);if(await l(j)&&Y)Y.add(j);return j}let G=m.join(Q,$);if(await l(G)){if(J.debug)console.log(`Found direct path: ${G}`);if(Y)Y.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let _ of[".stx",".tsx",".jsx"]){let j=`${G}${_}`;if(await l(j)){if(J.debug)console.log(`Found direct path with extension: ${j}`);if(Y)Y.add(j);return j}}let K="",q=m.resolve(Q),z=process.cwd();for(let _=0;_<10;_++){let j=m.join(q,"layouts"),B=!1;try{B=DJ.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=j;break}let O=m.dirname(q);if(O===q||O.length<z.length)break;q=O}if(K){let _=$.startsWith("layouts/")?$.slice(8):$,j=m.join(K,_);if(await l(j)){if(J.debug)console.log(`Found in current layouts dir: ${j}`);if(Y)Y.add(j);return j}if(!_.endsWith(".stx")){let B=`${j}.stx`;if(await l(B)){if(J.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(J.layoutsDir){let _=m.isAbsolute(J.layoutsDir)?J.layoutsDir:m.resolve(process.cwd(),J.layoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=m.join(_,j);if(await l(B)){if(J.debug)console.log(`Found in options.layoutsDir: ${B}`);if(Y)Y.add(B);return B}if(!$.endsWith(".stx")){let O=`${B}.stx`;if(await l(O)){if(J.debug)console.log(`Found in options.layoutsDir with extension: ${O}`);if(Y)Y.add(O);return O}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let _=$.split("layouts/"),j=m.join(J.partialsDir||Q,"layouts",_[1]);if(await l(j)){if(J.debug)console.log(`Found in layouts path: ${j}`);if(Y)Y.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await l(B)){if(J.debug)console.log(`Found in layouts path with extension: ${B}`);if(Y)Y.add(B);return B}}}if(J.partialsDir){if(K=m.join(J.partialsDir,"layouts"),await l(K)){let _=m.join(K,$);if(await l(_)){if(J.debug)console.log(`Found in partials layouts dir: ${_}`);if(Y)Y.add(_);return _}if(!$.endsWith(".stx")){let j=`${_}.stx`;if(await l(j)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}}let W=J.partialsDir||m.join(process.cwd(),"views"),U=m.join(W,$);if(await l(U)){if(J.debug)console.log(`Found in views path: ${U}`);if(Y)Y.add(U);return U}if(!$.endsWith(".stx")){let _=`${U}.stx`;if(await l(_)){if(J.debug)console.log(`Found in views path with extension: ${_}`);if(Y)Y.add(_);return _}}if(Q.includes("temp")){let _=m.join(m.dirname(Q),"layouts",$);if(await l(_)){if(J.debug)console.log(`Found in temp layouts dir: ${_}`);if(Y)Y.add(_);return _}if(!$.endsWith(".stx")){let j=`${_}.stx`;if(await l(j)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(J.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 Q3($,Z,J){let Y=0,Q="",X="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
800
800
  `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){Y=q+1,Q=G[q].trim();let z=Math.max(0,q-2),W=Math.min(G.length,q+3);X=G.slice(z,W).map((U,_)=>{let j=z+_+1;return`${j===Y?"> ":" "}${j}: ${U}`}).join(`
801
801
  `);break}}else if(J){let G=$.indexOf(J);if(G>=0)return Q3($,G)}}catch{}return{lineNumber:Y,lineContent:Q,context:X}}function X0($,Z,J,Y,Q,X){let{lineNumber:G,context:K}=Q3(Y,Q,X),q=J.split("/").pop(),z=0;if(typeof Q==="number"&&Q>=0&&Y){let U=Y.lastIndexOf(`
802
802
  `,Math.max(0,Q-1));z=Q-(U+1)+1}let W="";if(G>0)W+=`
@@ -811,8 +811,8 @@ ${o.yellow}${o.bold}Message:${o.reset} ${Z}
811
811
  `,K)W+=`
812
812
  ${o.blue}${o.bold}Context:${o.reset}
813
813
  ${o.dim}${K}${o.reset}
814
- `;return W}var r9,IJ=0,o;var A0=C(()=>{m9();t0();E1();e9();M1();i9();u7();$5();r9=new a1(500);o={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 G3($,Z,J=""){let Y=$,Q=[],X=/@markdown(?:\([^)]*\))?/g,G;while((G=X.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),z=q?q[1]:"",W=K+G[0].length,U=1,_=W,j=-1;while(U>0&&_<$.length){let F=$.indexOf("@markdown",_),L=$.indexOf("@endmarkdown",_);if(L===-1)break;if(F!==-1&&F<L&&F!==K){let H=$[F+9];if(H==="("||H===`
815
- `||H==="\r"||H===" "||H===void 0)U++;_=F+9}else{if(U--,U===0){j=L;break}_=L+12}}if(j===-1)continue;let B=$.slice(W,j),O=$.slice(K,j+12);Q.push({fullMatch:O,options:z,content:B,index:K}),X.lastIndex=j+12}for(let{fullMatch:K,options:q,content:z,index:W}of Q)try{let U={};if(q)q.split(",").forEach((B)=>{let O=B.trim();if(O)U[O]=!0});let _={gfm:U.gfm??!0,breaks:U.breaks??!1},j=n1(z.trim(),_);Y=Y.split(K).join(j)}catch(U){let _=U instanceof Error?U.message:String(U),j=X0("Markdown Directive",`Error processing markdown: ${_}`,J,$,W,K);Y=Y.split(K).join(j)}return Y}async function K3($,Z,J,Y){let Q={gfm:!0,breaks:!1};return Z.forEach((X)=>{let G=X.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),n1($.trim(),Q)}var $$=C(()=>{A0()});function CJ($){if(SJ.set($.name,$),$.client)yJ.set($.name,$.client)}function E5($){return CJ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(J,Y,Q,X)=>{let G=PJ(Y,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let z=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(z)}}let K=J;if($.transform)K=await $.transform(J,G,Q,X);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function PJ($,Z){let J={...Z};for(let Y of $){let Q=Y.indexOf(":"),X=Y.indexOf("="),G=Q>=0&&(X<0||Q<X)?Q:X;if(G>=0){let K=Y.slice(0,G).trim(),q=Y.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{}J[K]=q}else{let K=Object.keys(J).filter((q)=>!Z||!(q in Z)).length;J[K===0?"value":`arg${K}`]=Y}}return J}var SJ,yJ;var Z$=C(()=>{SJ=new Map,yJ=new Map});function Y$($,Z=b1,J={},Y){return Z.sort((Q,X)=>Q-X).map((Q)=>{return`${Y5($,{...J,w:Q,fm:Y})} ${Q}w`}).join(", ")}function q3($,Z,J=vJ,Y={},Q){return J.sort((X,G)=>X-G).map((X)=>{let G=Math.round(Z*X);return`${Y5($,{...Y,w:G,dpr:X,fm:Q})} ${X}x`}).join(", ")}function J$($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let Y=Object.entries($).map(([Q,X])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:X,numericBp:Number.parseInt(G)||0}}).sort((Q,X)=>Q.numericBp-X.numericBp).map(({bp:Q,size:X})=>`(max-width: ${Q}) ${X}`);return Y.push(Z),Y.join(", ")}function Y5($,Z={}){let J=Object.entries(Z).filter(([,X])=>X!==void 0&&X!==null).map(([X,G])=>{if(Array.isArray(G))return[X,G.join(",")];return[X,String(G)]});if(J.length===0)return $;let Y=J.map(([X,G])=>`${X}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${Y}`}function X$($){return xJ[$]||"application/octet-stream"}var b1,vJ,Z5,xJ;var Q$=C(()=>{b1=[320,480,640,768,1024,1280,1536,1920,2560],vJ=[1,1.5,2,3],Z5=["avif","webp","jpeg"],xJ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function gJ(){try{return await import("ts-images")}catch{return null}}async function hJ($,Z={}){let J={...fJ,...Z},Y=await gJ();if(Y)try{return await dJ($,J,Y)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return mJ($,J)}async function dJ($,Z,J){let{generatePlaceholder:Y,generateThumbHash:Q}=J,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 Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await Y($,{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 mJ($,Z){let J=Z.width||20,Y=Z.height||J,Q="#e5e7eb",X=`<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${Y}" viewBox="0 0 ${J} ${Y}"><rect fill="#e5e7eb" width="${J}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`,width:J,height:Y,aspectRatio:J/Y,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function W3($,Z,J={}){let Y=J.transitionDuration||300,Q=J.easing||"ease-out";return`
814
+ `;return W}var r9,EJ=0,o;var A0=C(()=>{m9();n0();E1();e9();M1();i9();u7();$5();r9=new a1(500);o={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 G3($,Z,J=""){let Y=$,Q=[],X=/@markdown(?:\([^)]*\))?/g,G;while((G=X.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),z=q?q[1]:"",W=K+G[0].length,U=1,_=W,j=-1;while(U>0&&_<$.length){let F=$.indexOf("@markdown",_),L=$.indexOf("@endmarkdown",_);if(L===-1)break;if(F!==-1&&F<L&&F!==K){let H=$[F+9];if(H==="("||H===`
815
+ `||H==="\r"||H===" "||H===void 0)U++;_=F+9}else{if(U--,U===0){j=L;break}_=L+12}}if(j===-1)continue;let B=$.slice(W,j),O=$.slice(K,j+12);Q.push({fullMatch:O,options:z,content:B,index:K}),X.lastIndex=j+12}for(let{fullMatch:K,options:q,content:z,index:W}of Q)try{let U={};if(q)q.split(",").forEach((B)=>{let O=B.trim();if(O)U[O]=!0});let _={gfm:U.gfm??!0,breaks:U.breaks??!1},j=n1(z.trim(),_);Y=Y.split(K).join(j)}catch(U){let _=U instanceof Error?U.message:String(U),j=X0("Markdown Directive",`Error processing markdown: ${_}`,J,$,W,K);Y=Y.split(K).join(j)}return Y}async function K3($,Z,J,Y){let Q={gfm:!0,breaks:!1};return Z.forEach((X)=>{let G=X.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),n1($.trim(),Q)}var $$=C(()=>{A0()});function vJ($){if(CJ.set($.name,$),$.client)PJ.set($.name,$.client)}function E5($){return vJ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(J,Y,Q,X)=>{let G=xJ(Y,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let z=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(z)}}let K=J;if($.transform)K=await $.transform(J,G,Q,X);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function xJ($,Z){let J={...Z};for(let Y of $){let Q=Y.indexOf(":"),X=Y.indexOf("="),G=Q>=0&&(X<0||Q<X)?Q:X;if(G>=0){let K=Y.slice(0,G).trim(),q=Y.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{}J[K]=q}else{let K=Object.keys(J).filter((q)=>!Z||!(q in Z)).length;J[K===0?"value":`arg${K}`]=Y}}return J}var CJ,PJ;var Z$=C(()=>{CJ=new Map,PJ=new Map});function Y$($,Z=b1,J={},Y){return Z.sort((Q,X)=>Q-X).map((Q)=>{return`${Y5($,{...J,w:Q,fm:Y})} ${Q}w`}).join(", ")}function q3($,Z,J=fJ,Y={},Q){return J.sort((X,G)=>X-G).map((X)=>{let G=Math.round(Z*X);return`${Y5($,{...Y,w:G,dpr:X,fm:Q})} ${X}x`}).join(", ")}function J$($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let Y=Object.entries($).map(([Q,X])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:X,numericBp:Number.parseInt(G)||0}}).sort((Q,X)=>Q.numericBp-X.numericBp).map(({bp:Q,size:X})=>`(max-width: ${Q}) ${X}`);return Y.push(Z),Y.join(", ")}function Y5($,Z={}){let J=Object.entries(Z).filter(([,X])=>X!==void 0&&X!==null).map(([X,G])=>{if(Array.isArray(G))return[X,G.join(",")];return[X,String(G)]});if(J.length===0)return $;let Y=J.map(([X,G])=>`${X}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${Y}`}function X$($){return gJ[$]||"application/octet-stream"}var b1,fJ,Z5,gJ;var Q$=C(()=>{b1=[320,480,640,768,1024,1280,1536,1920,2560],fJ=[1,1.5,2,3],Z5=["avif","webp","jpeg"],gJ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function dJ(){try{return await import("ts-images")}catch{return null}}async function mJ($,Z={}){let J={...hJ,...Z},Y=await dJ();if(Y)try{return await uJ($,J,Y)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return pJ($,J)}async function uJ($,Z,J){let{generatePlaceholder:Y,generateThumbHash:Q}=J,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 Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await Y($,{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 pJ($,Z){let J=Z.width||20,Y=Z.height||J,Q="#e5e7eb",X=`<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${Y}" viewBox="0 0 ${J} ${Y}"><rect fill="#e5e7eb" width="${J}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`,width:J,height:Y,aspectRatio:J/Y,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function W3($,Z,J={}){let Y=J.transitionDuration||300,Q=J.easing||"ease-out";return`
816
816
  #${$} {
817
817
  --stx-img-transition-duration: ${Y}ms;
818
818
  --stx-img-transition-easing: ${Q};
@@ -829,7 +829,7 @@ ${o.dim}${K}${o.reset}
829
829
  #${$}.stx-img-loaded img {
830
830
  opacity: 1;
831
831
  }
832
- `.trim()}async function z3($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(G$.has(J))return G$.get(J);let Y=await hJ($,Z);return G$.set(J,Y),Y}var fJ,K$,G$;var U3=C(()=>{fJ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},K$=`
832
+ `.trim()}async function z3($,Z={}){let J=`${$}:${JSON.stringify(Z)}`;if(G$.has(J))return G$.get(J);let Y=await mJ($,Z);return G$.set(J,Y),Y}var hJ,K$,G$;var U3=C(()=>{hJ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},K$=`
833
833
  .stx-img-placeholder {
834
834
  position: relative;
835
835
  overflow: hidden;
@@ -858,8 +858,8 @@ ${o.dim}${K}${o.reset}
858
858
  filter: blur(0);
859
859
  transform: scale(1);
860
860
  }
861
- `.trim();G$=new Map});import{createHash as B3}from"crypto";import{readFile as uJ,stat as j3}from"fs/promises";async function T0($){try{let Z=await uJ($);return B3("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function _3($){return B3("sha256").update($).digest("hex").slice(0,16)}function k5($,Z){let J=JSON.stringify(Z,Object.keys(Z).sort());return`${_3($)}-${_3(J)}`}async function q$($){try{return(await j3($)).mtimeMs}catch{return 0}}async function N0($){try{return await j3($),!0}catch{return!1}}var j1=()=>{};import{mkdir as pJ,readFile as lJ,writeFile as cJ,readdir as pz,rm as iJ,stat as lz}from"fs/promises";import{join as H3,dirname as nJ}from"path";async function oJ($){try{await pJ($,{recursive:!0})}catch{}}function L3($,Z,J){return H3($,J,`${Z}.json`)}async function O3($,Z,J){if((Date.now()-$.createdAt)/86400000>J)return!1;if(await q$(Z)!==$.srcMtime)return!1;return!0}async function b5($,Z,J,Y=W$){if(!Y.enabled)return null;let Q=k5($,Z),X=S1.get(Q);if(X){if(await O3(X,$,Y.maxAge))return X.lastAccessedAt=Date.now(),X.data;S1.delete(Q)}let G=L3(Y.directory,Q,J);if(await N0(G))try{let K=await lJ(G,"utf-8"),q=JSON.parse(K);if(await O3(q,$,Y.maxAge))return q.lastAccessedAt=Date.now(),S1.set(Q,q),q.data}catch{}return null}async function S5($,Z,J,Y,Q=W$){if(!Q.enabled)return;let X=k5($,Z),G=await T0($),K=await q$($),q={key:X,src:$,srcHash:G,srcMtime:K,optionsHash:k5("",Z),data:J,createdAt:Date.now(),lastAccessedAt:Date.now()};S1.set(X,q);let z=L3(Q.directory,X,Y);try{await oJ(nJ(z)),await cJ(z,JSON.stringify(q,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function y5($,Z=W$){if($==="all")S1.clear();else S1.clear();let J=$==="all"?["image","video"]:[$];for(let Y of J){let Q=H3(Z.directory,Y);try{await iJ(Q,{recursive:!0,force:!0})}catch{}}}var S1,W$;var z$=C(()=>{j1();S1=new Map,W$={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class P5{config;constructor($={}){this.config={...sJ,...$}}async get($,Z){return b5($,Z,"image",this.config)}async set($,Z,J){return S5($,Z,J,"image",this.config)}async clear(){return y5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function U$($){if(!C5)C5=new P5($);else if($)C5.updateConfig($);return C5}async function v5($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return U$(Y).get($,Z)}async function x5($,Z,J,Y){let Q=Y?{directory:`${Y.outputDir}/../.cache`}:{};return U$(Q).set($,Z,J)}async function F3(){return U$().clear()}var sJ,C5=null;var _$=C(()=>{z$();sJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as rJ,basename as aJ,extname as tJ,join as eJ}from"path";import{mkdir as $X}from"fs/promises";async function B$(){try{return await import("ts-images")}catch{return null}}function V3($){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 ZX($,Z){let J=Z?V3(Z):V3("web"),Y=$.formatQuality||{};return{jpeg:{...J.jpeg,...Y.jpeg},png:{...J.png,...Y.png},webp:{...J.webp,...Y.webp},avif:{...J.avif,...Y.avif}}}async function w3($,Z,J){let Y=await B$();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await v5($,Z,J);if(Q)return Q;try{let X=rJ($);if(!await N0(X))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=ZX(J,Z.preset),K=J.outputDir||"dist/images",q=J.baseUrl||"/images";await $X(K,{recursive:!0});let z=await T0(X),W=aJ($,tJ($)),U=Z.outputFormat?[Z.outputFormat]:J.defaultFormats||["avif","webp","jpeg"],_={src:$,processed:!0,variants:[],hash:z},j=null;if(Z.transformations&&Z.transformations.length>0)j=await j$(X,Z.transformations,Y);for(let B of U){let O=G[B]||{},F=`${W}-${z}.${B}`,L=eJ(K,F);try{let H=await Y.optimizeImage({input:j||X,output:L,format:B,quality:O.quality,progressive:O.progressive});if(H){if(_.variants.push({path:L,url:`${q}/${F}`,width:H.width||0,height:H.height||0,format:B,size:H.outputSize||0}),!_.originalWidth&&H.width)_.originalWidth=H.width,_.originalHeight=H.height}}catch(H){_.errors=_.errors||[],_.errors.push(`Failed to optimize ${B}: ${H}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await Y.generateThumbHash(X);_.placeholder=B.dataUrl}catch(B){_.errors=_.errors||[],_.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await Y.generatePlaceholder(X,{strategy:"dominant-color"});_.dominantColor=B.dominantColor}catch(B){_.errors=_.errors||[],_.errors.push(`Failed to extract dominant color: ${B}`)}return await x5($,Z,_,J),_}catch(X){return{src:$,processed:!1,errors:[`Processing failed: ${X}`]}}}async function A3($,Z,J,Y){let Q=await B$();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:Y,format:Z,quality:J}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function j$($,Z,J){let Y=J||await B$();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await Y.decode($);for(let X of Z){let G=X.options||{};switch(X.type){case"resize":if(G.width||G.height)Q=await Y.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await Y.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await Y.sharpen(Q,G.amount);break;case"grayscale":Q=await Y.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await Y.rotate(Q,G.angle);break;case"flip":Q=await Y.flip(Q);break;case"flop":Q=await Y.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await Y.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await Y.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await Y.saturation(Q,G.value);break}}return await Y.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var N3=C(()=>{j1();_$()});import{resolve as YX,basename as JX,extname as XX,join as QX}from"path";import{mkdir as GX}from"fs/promises";async function KX(){try{return await import("ts-images")}catch{return null}}async function R3($,Z,J){let Y=await KX();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=YX($);if(!await N0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let X=Z.responsiveWidths||J.breakpoints||qX,G=Z.formats||J.defaultFormats||["avif","webp","jpeg"],K=J.outputDir||"dist/images",q=J.baseUrl||"/images";await GX(K,{recursive:!0});let z=await T0(Q),W=JX($,XX($)),U=J.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},_={src:$,byFormat:{},srcsets:{}};for(let B of G){_.byFormat[B]=[];let O=[];for(let F of X){let L=`${W}-${F}w-${z}.${B}`,H=QX(K,L),V=`${q}/${L}`;try{let A=U[B]?.quality||80;if(await N0(H)){_.byFormat[B].push({path:H,url:V,width:F,height:0,format:B,size:0}),O.push(`${V} ${F}w`);continue}let w=await Y.processImage({input:Q,output:H,format:B,quality:A,resize:{width:F}});if(w)_.byFormat[B].push({path:H,url:V,width:F,height:w.height||Math.round(F*(w.height||1)/(w.width||1)),format:B,size:w.outputSize||0}),O.push(`${V} ${F}w`)}catch(A){console.warn(`[stx-media] Failed to generate ${B} at ${F}w: ${A}`)}}_.srcsets[B]=O.join(", ")}let j=Z.placeholder||J.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let B=await Y.generateThumbHash(Q);_.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await Y.generatePlaceholder(Q,{strategy:j,width:20});_.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:j}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return _.sizes=Z.sizes||WX(X),_}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function WX($){let Z=[...$].sort((Y,Q)=>Y-Q),J=[];for(let Y=0;Y<Z.length-1;Y++){let Q=Z[Y];J.push(`(max-width: ${Q}px) ${Q}px`)}return J.push(`${Z[Z.length-1]}px`),J.join(", ")}function T3($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((J)=>J.dpr).map((J)=>`${J.url} ${J.dpr}x`).join(", ");return $.map((J)=>`${J.url} ${J.width}w`).join(", ")}var qX;var M3=C(()=>{j1();qX=[320,480,640,768,1024,1280,1536,1920]});var I3={};r(I3,{setCachedImageResult:()=>x5,processImage:()=>w3,optimizeImage:()=>A3,getCachedImageResult:()=>v5,generateSrcset:()=>T3,generateResponsiveVariants:()=>R3,clearImageCache:()=>F3,applyTransformations:()=>j$,ImageProcessorCache:()=>P5});var D3=C(()=>{N3();M3();_$()});async function zX(){try{return await Promise.resolve().then(() => (D3(),I3))}catch($){if(!E3)console.warn("[stx-media] Image processor not available, some features disabled:",$),E3=!0;return null}}async function f5($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return jX(Y,J)}if(J.processedResult?.processed)return F$($,J.processedResult,Z);if(J.responsiveVariants)return y3($,J.responsiveVariants,Z);let{src:Q,alt:X,width:G,height:K,sizes:q,widths:z=b1,dpr:W,formats:U=Z5,quality:_=O$,params:j={},placeholder:B="none",placeholderOptions:O={},lazy:F=!0,priority:L=!1,loading:H=L?"eager":h5,decoding:V=g5,fetchpriority:A,objectFit:w,objectPosition:N,crossorigin:R,referrerpolicy:T}=$,I=$.class,M=$.style,E=$.id,k=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return BX($);let b,D,x=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!L)try{b=await z3(Q,{strategy:B,...O}),D=W3(x,b,O)}catch{}let h=W!==void 0&&G!==void 0,i;if(h)i=_X($,x,b,Z);else i=await UX($,x,b,Z);let U0;if(L){let C0=U.includes("webp")?"webp":U[0],p0=Y$(Q,z,{...j,q:_},C0),L0=typeof q==="object"?J$(q):q||"100vw";U0=`<link rel="preload" as="image" imagesrcset="${p0}" imagesizes="${L0}" />`}let H0=[];if(!k3&&B!=="none")H0.push(K$),k3=!0;if(D)H0.push(D);let _0=F?S3(x):void 0;return{html:i,preloadLink:U0,css:H0.length>0?H0.join(`
862
- `):void 0,script:_0}}async function UX($,Z,J,Y){let{src:Q,alt:X,width:G,height:K,sizes:q,widths:z=b1,formats:W=Z5,quality:U=O$,params:_={},lazy:j=!0,priority:B=!1,loading:O=B?"eager":h5,decoding:F=g5,fetchpriority:L,objectFit:H,objectPosition:V,crossorigin:A,referrerpolicy:w}=$,N=$.class,R=$.style,T=$.data||{},I=typeof q==="object"?J$(q):q||"100vw",M=[];for(let y of W){let S=Y$(Q,z,{..._,q:U},y),b=X$(y);if(j&&!B)M.push(` <source type="${b}" data-srcset="${S}" data-sizes="${I}" />`);else M.push(` <source type="${b}" srcset="${S}" sizes="${I}" />`)}let E=H$({src:Y5(Q,{..._,q:U}),alt:X,width:G,height:K,loading:B?void 0:O,decoding:F,fetchpriority:B?"high":L,objectFit:H,objectPosition:V,crossorigin:A,referrerpolicy:w,className:b3(N,J),style:L$(R,H,V,J),lazy:j&&!B,data:T}),k;if(J){let y=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;k=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
861
+ `.trim();G$=new Map});import{createHash as B3}from"crypto";import{readFile as lJ,stat as j3}from"fs/promises";async function T0($){try{let Z=await lJ($);return B3("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function _3($){return B3("sha256").update($).digest("hex").slice(0,16)}function k5($,Z){let J=JSON.stringify(Z,Object.keys(Z).sort());return`${_3($)}-${_3(J)}`}async function q$($){try{return(await j3($)).mtimeMs}catch{return 0}}async function N0($){try{return await j3($),!0}catch{return!1}}var j1=()=>{};import{mkdir as cJ,readFile as iJ,writeFile as nJ,readdir as cz,rm as oJ,stat as iz}from"fs/promises";import{join as H3,dirname as sJ}from"path";async function rJ($){try{await cJ($,{recursive:!0})}catch{}}function L3($,Z,J){return H3($,J,`${Z}.json`)}async function O3($,Z,J){if((Date.now()-$.createdAt)/86400000>J)return!1;if(await q$(Z)!==$.srcMtime)return!1;return!0}async function b5($,Z,J,Y=W$){if(!Y.enabled)return null;let Q=k5($,Z),X=S1.get(Q);if(X){if(await O3(X,$,Y.maxAge))return X.lastAccessedAt=Date.now(),X.data;S1.delete(Q)}let G=L3(Y.directory,Q,J);if(await N0(G))try{let K=await iJ(G,"utf-8"),q=JSON.parse(K);if(await O3(q,$,Y.maxAge))return q.lastAccessedAt=Date.now(),S1.set(Q,q),q.data}catch{}return null}async function S5($,Z,J,Y,Q=W$){if(!Q.enabled)return;let X=k5($,Z),G=await T0($),K=await q$($),q={key:X,src:$,srcHash:G,srcMtime:K,optionsHash:k5("",Z),data:J,createdAt:Date.now(),lastAccessedAt:Date.now()};S1.set(X,q);let z=L3(Q.directory,X,Y);try{await rJ(sJ(z)),await nJ(z,JSON.stringify(q,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function y5($,Z=W$){if($==="all")S1.clear();else S1.clear();let J=$==="all"?["image","video"]:[$];for(let Y of J){let Q=H3(Z.directory,Y);try{await oJ(Q,{recursive:!0,force:!0})}catch{}}}var S1,W$;var z$=C(()=>{j1();S1=new Map,W$={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class P5{config;constructor($={}){this.config={...aJ,...$}}async get($,Z){return b5($,Z,"image",this.config)}async set($,Z,J){return S5($,Z,J,"image",this.config)}async clear(){return y5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function U$($){if(!C5)C5=new P5($);else if($)C5.updateConfig($);return C5}async function v5($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return U$(Y).get($,Z)}async function x5($,Z,J,Y){let Q=Y?{directory:`${Y.outputDir}/../.cache`}:{};return U$(Q).set($,Z,J)}async function F3(){return U$().clear()}var aJ,C5=null;var _$=C(()=>{z$();aJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as tJ,basename as eJ,extname as $X,join as ZX}from"path";import{mkdir as YX}from"fs/promises";async function B$(){try{return await import("ts-images")}catch{return null}}function V3($){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 JX($,Z){let J=Z?V3(Z):V3("web"),Y=$.formatQuality||{};return{jpeg:{...J.jpeg,...Y.jpeg},png:{...J.png,...Y.png},webp:{...J.webp,...Y.webp},avif:{...J.avif,...Y.avif}}}async function w3($,Z,J){let Y=await B$();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await v5($,Z,J);if(Q)return Q;try{let X=tJ($);if(!await N0(X))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=JX(J,Z.preset),K=J.outputDir||"dist/images",q=J.baseUrl||"/images";await YX(K,{recursive:!0});let z=await T0(X),W=eJ($,$X($)),U=Z.outputFormat?[Z.outputFormat]:J.defaultFormats||["avif","webp","jpeg"],_={src:$,processed:!0,variants:[],hash:z},j=null;if(Z.transformations&&Z.transformations.length>0)j=await j$(X,Z.transformations,Y);for(let B of U){let O=G[B]||{},F=`${W}-${z}.${B}`,L=ZX(K,F);try{let H=await Y.optimizeImage({input:j||X,output:L,format:B,quality:O.quality,progressive:O.progressive});if(H){if(_.variants.push({path:L,url:`${q}/${F}`,width:H.width||0,height:H.height||0,format:B,size:H.outputSize||0}),!_.originalWidth&&H.width)_.originalWidth=H.width,_.originalHeight=H.height}}catch(H){_.errors=_.errors||[],_.errors.push(`Failed to optimize ${B}: ${H}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await Y.generateThumbHash(X);_.placeholder=B.dataUrl}catch(B){_.errors=_.errors||[],_.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await Y.generatePlaceholder(X,{strategy:"dominant-color"});_.dominantColor=B.dominantColor}catch(B){_.errors=_.errors||[],_.errors.push(`Failed to extract dominant color: ${B}`)}return await x5($,Z,_,J),_}catch(X){return{src:$,processed:!1,errors:[`Processing failed: ${X}`]}}}async function A3($,Z,J,Y){let Q=await B$();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:Y,format:Z,quality:J}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function j$($,Z,J){let Y=J||await B$();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await Y.decode($);for(let X of Z){let G=X.options||{};switch(X.type){case"resize":if(G.width||G.height)Q=await Y.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await Y.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await Y.sharpen(Q,G.amount);break;case"grayscale":Q=await Y.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await Y.rotate(Q,G.angle);break;case"flip":Q=await Y.flip(Q);break;case"flop":Q=await Y.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await Y.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await Y.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await Y.saturation(Q,G.value);break}}return await Y.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var N3=C(()=>{j1();_$()});import{resolve as XX,basename as QX,extname as GX,join as KX}from"path";import{mkdir as qX}from"fs/promises";async function WX(){try{return await import("ts-images")}catch{return null}}async function R3($,Z,J){let Y=await WX();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=XX($);if(!await N0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let X=Z.responsiveWidths||J.breakpoints||zX,G=Z.formats||J.defaultFormats||["avif","webp","jpeg"],K=J.outputDir||"dist/images",q=J.baseUrl||"/images";await qX(K,{recursive:!0});let z=await T0(Q),W=QX($,GX($)),U=J.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},_={src:$,byFormat:{},srcsets:{}};for(let B of G){_.byFormat[B]=[];let O=[];for(let F of X){let L=`${W}-${F}w-${z}.${B}`,H=KX(K,L),V=`${q}/${L}`;try{let A=U[B]?.quality||80;if(await N0(H)){_.byFormat[B].push({path:H,url:V,width:F,height:0,format:B,size:0}),O.push(`${V} ${F}w`);continue}let w=await Y.processImage({input:Q,output:H,format:B,quality:A,resize:{width:F}});if(w)_.byFormat[B].push({path:H,url:V,width:F,height:w.height||Math.round(F*(w.height||1)/(w.width||1)),format:B,size:w.outputSize||0}),O.push(`${V} ${F}w`)}catch(A){console.warn(`[stx-media] Failed to generate ${B} at ${F}w: ${A}`)}}_.srcsets[B]=O.join(", ")}let j=Z.placeholder||J.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let B=await Y.generateThumbHash(Q);_.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await Y.generatePlaceholder(Q,{strategy:j,width:20});_.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:j}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return _.sizes=Z.sizes||UX(X),_}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function UX($){let Z=[...$].sort((Y,Q)=>Y-Q),J=[];for(let Y=0;Y<Z.length-1;Y++){let Q=Z[Y];J.push(`(max-width: ${Q}px) ${Q}px`)}return J.push(`${Z[Z.length-1]}px`),J.join(", ")}function T3($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((J)=>J.dpr).map((J)=>`${J.url} ${J.dpr}x`).join(", ");return $.map((J)=>`${J.url} ${J.width}w`).join(", ")}var zX;var M3=C(()=>{j1();zX=[320,480,640,768,1024,1280,1536,1920]});var I3={};r(I3,{setCachedImageResult:()=>x5,processImage:()=>w3,optimizeImage:()=>A3,getCachedImageResult:()=>v5,generateSrcset:()=>T3,generateResponsiveVariants:()=>R3,clearImageCache:()=>F3,applyTransformations:()=>j$,ImageProcessorCache:()=>P5});var D3=C(()=>{N3();M3();_$()});async function _X(){try{return await Promise.resolve().then(() => (D3(),I3))}catch($){if(!E3)console.warn("[stx-media] Image processor not available, some features disabled:",$),E3=!0;return null}}async function f5($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return HX(Y,J)}if(J.processedResult?.processed)return F$($,J.processedResult,Z);if(J.responsiveVariants)return y3($,J.responsiveVariants,Z);let{src:Q,alt:X,width:G,height:K,sizes:q,widths:z=b1,dpr:W,formats:U=Z5,quality:_=O$,params:j={},placeholder:B="none",placeholderOptions:O={},lazy:F=!0,priority:L=!1,loading:H=L?"eager":h5,decoding:V=g5,fetchpriority:A,objectFit:w,objectPosition:N,crossorigin:R,referrerpolicy:T}=$,I=$.class,M=$.style,E=$.id,k=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return OX($);let b,D,x=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!L)try{b=await z3(Q,{strategy:B,...O}),D=W3(x,b,O)}catch{}let h=W!==void 0&&G!==void 0,i;if(h)i=jX($,x,b,Z);else i=await BX($,x,b,Z);let U0;if(L){let P0=U.includes("webp")?"webp":U[0],l0=Y$(Q,z,{...j,q:_},P0),L0=typeof q==="object"?J$(q):q||"100vw";U0=`<link rel="preload" as="image" imagesrcset="${l0}" imagesizes="${L0}" />`}let H0=[];if(!k3&&B!=="none")H0.push(K$),k3=!0;if(D)H0.push(D);let _0=F?S3(x):void 0;return{html:i,preloadLink:U0,css:H0.length>0?H0.join(`
862
+ `):void 0,script:_0}}async function BX($,Z,J,Y){let{src:Q,alt:X,width:G,height:K,sizes:q,widths:z=b1,formats:W=Z5,quality:U=O$,params:_={},lazy:j=!0,priority:B=!1,loading:O=B?"eager":h5,decoding:F=g5,fetchpriority:L,objectFit:H,objectPosition:V,crossorigin:A,referrerpolicy:w}=$,N=$.class,R=$.style,T=$.data||{},I=typeof q==="object"?J$(q):q||"100vw",M=[];for(let y of W){let S=Y$(Q,z,{..._,q:U},y),b=X$(y);if(j&&!B)M.push(` <source type="${b}" data-srcset="${S}" data-sizes="${I}" />`);else M.push(` <source type="${b}" srcset="${S}" sizes="${I}" />`)}let E=H$({src:Y5(Q,{..._,q:U}),alt:X,width:G,height:K,loading:B?void 0:O,decoding:F,fetchpriority:B?"high":L,objectFit:H,objectPosition:V,crossorigin:A,referrerpolicy:w,className:b3(N,J),style:L$(R,H,V,J),lazy:j&&!B,data:T}),k;if(J){let y=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;k=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
863
863
  <picture>
864
864
  ${M.join(`
865
865
  `)}
@@ -869,9 +869,9 @@ ${M.join(`
869
869
  ${M.join(`
870
870
  `)}
871
871
  <img ${E} />
872
- </picture>`;return k}function _X($,Z,J,Y){let{src:Q,alt:X,width:G,height:K,dpr:q=[1,2,3],quality:z=O$,params:W={},lazy:U=!0,priority:_=!1,loading:j=_?"eager":h5,decoding:B=g5,fetchpriority:O,objectFit:F,objectPosition:L,crossorigin:H,referrerpolicy:V}=$,A=$.class,w=$.style,N=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),T=q3(Q,R,q,{...W,q:z}),I=H$({src:Y5(Q,{...W,w:R,q:z}),alt:X,width:G,height:K,loading:_?void 0:j,decoding:B,fetchpriority:_?"high":O,objectFit:F,objectPosition:L,crossorigin:H,referrerpolicy:V,className:b3(A,J),style:L$(w,F,L,J),lazy:U&&!_,data:N}),M=U&&!_?`data-srcset="${T}"`:`srcset="${T}"`;if(J){let E=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
872
+ </picture>`;return k}function jX($,Z,J,Y){let{src:Q,alt:X,width:G,height:K,dpr:q=[1,2,3],quality:z=O$,params:W={},lazy:U=!0,priority:_=!1,loading:j=_?"eager":h5,decoding:B=g5,fetchpriority:O,objectFit:F,objectPosition:L,crossorigin:H,referrerpolicy:V}=$,A=$.class,w=$.style,N=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),T=q3(Q,R,q,{...W,q:z}),I=H$({src:Y5(Q,{...W,w:R,q:z}),alt:X,width:G,height:K,loading:_?void 0:j,decoding:B,fetchpriority:_?"high":O,objectFit:F,objectPosition:L,crossorigin:H,referrerpolicy:V,className:b3(A,J),style:L$(w,F,L,J),lazy:U&&!_,data:N}),M=U&&!_?`data-srcset="${T}"`:`srcset="${T}"`;if(J){let E=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
873
873
  <img ${I} ${M} />
874
- </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${M} />`}function BX($){let{src:Z,alt:J,width:Y,height:Q,loading:X=h5,decoding:G=g5,fetchpriority:K,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U,priority:_=!1}=$,j=$.class,B=$.style,O=$.id,F=$.data||{};return{html:`<img ${H$({src:Z,alt:J,width:Y,height:Q,loading:_?"eager":X,decoding:G,fetchpriority:_?"high":K,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U,className:j,style:L$(B,q,z),id:O,data:F})} />`}}function H$($){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[J,Y]of Object.entries($.data))Z.push(`data-${J}="${P0(Y)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function b3($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function L$($,Z,J,Y){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(J)Q.push(`object-position: ${J}`);if(Y)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function P0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function S3($){return`
874
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${M} />`}function OX($){let{src:Z,alt:J,width:Y,height:Q,loading:X=h5,decoding:G=g5,fetchpriority:K,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U,priority:_=!1}=$,j=$.class,B=$.style,O=$.id,F=$.data||{};return{html:`<img ${H$({src:Z,alt:J,width:Y,height:Q,loading:_?"eager":X,decoding:G,fetchpriority:_?"high":K,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U,className:j,style:L$(B,q,z),id:O,data:F})} />`}}function H$($){let Z=[];if($.lazy)Z.push(`data-src="${v0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${v0($.src)}"`);if(Z.push(`alt="${v0($.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="${v0($.className)}"`);if($.style)Z.push(`style="${v0($.style)}"`);if($.id)Z.push(`id="${v0($.id)}"`);if($.data)for(let[J,Y]of Object.entries($.data))Z.push(`data-${J}="${v0(Y)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function b3($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function L$($,Z,J,Y){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(J)Q.push(`object-position: ${J}`);if(Y)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function v0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function S3($){return`
875
875
  (function() {
876
876
  const container = document.getElementById('${$}');
877
877
  if (!container) return;
@@ -908,7 +908,7 @@ ${M.join(`
908
908
 
909
909
  observer.observe(container);
910
910
  })();
911
- `.trim()}async function jX($,Z){let J=await zX();if(!J)return f5({...$,process:!1},Z);let Y=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let X=await J.generateResponsiveVariants($.src,$,Y);if(X)return y3($,X,Z)}else{let X=await J.processImage($.src,$,Y);if(X.processed)return F$($,X,Z)}return f5({...$,process:!1},Z)}async function F$($,Z,J){let{alt:Y,width:Q,height:X,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U}=$,_=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,O=$.data||{},F=Z.variants||[],L=F.find((D)=>D.format==="jpeg")||F.find((D)=>D.format==="webp")||F[0],H=L?.url||$.src,V=F.filter((D)=>D.format===(L?.format||"jpeg")).map((D)=>`${D.url} ${D.width}w`).join(", "),A=new Map;for(let D of F){if(!A.has(D.format))A.set(D.format,[]);A.get(D.format).push(D)}let w=[],N=["avif","webp","jpeg","png"];for(let D of N){let x=A.get(D);if(x&&x.length>0){let h=x.map((U0)=>`${U0.url} ${U0.width}w`).join(", "),i=X$(D);if(G&&!K)w.push(` <source type="${i}" data-srcset="${h}" />`);else w.push(` <source type="${i}" srcset="${h}" />`)}}let R=[];if(G&&!K){if(R.push(`data-src="${P0(H)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${P0(H)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${P0(Y)}"`);let T=Q||Z.originalWidth,I=X||Z.originalHeight;if(T)R.push(`width="${T}"`);if(I)R.push(`height="${I}"`);if(!K)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(W)R.push(`crossorigin="${W}"`);if(U)R.push(`referrerpolicy="${U}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(z)M.push(`object-position: ${z}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)R.push(`style="${M.join("; ")}"`);let E=[];if(_)E.push(_);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)R.push(`class="${E.join(" ")}"`);if(G&&!K)R.push("data-stx-lazy");for(let[D,x]of Object.entries(O))R.push(`data-${D}="${P0(x)}"`);let k;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let D=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;k=`<div id="${B}" class="stx-img-placeholder" style="${D}">
911
+ `.trim()}async function HX($,Z){let J=await _X();if(!J)return f5({...$,process:!1},Z);let Y=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let X=await J.generateResponsiveVariants($.src,$,Y);if(X)return y3($,X,Z)}else{let X=await J.processImage($.src,$,Y);if(X.processed)return F$($,X,Z)}return f5({...$,process:!1},Z)}async function F$($,Z,J){let{alt:Y,width:Q,height:X,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:z,crossorigin:W,referrerpolicy:U}=$,_=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,O=$.data||{},F=Z.variants||[],L=F.find((D)=>D.format==="jpeg")||F.find((D)=>D.format==="webp")||F[0],H=L?.url||$.src,V=F.filter((D)=>D.format===(L?.format||"jpeg")).map((D)=>`${D.url} ${D.width}w`).join(", "),A=new Map;for(let D of F){if(!A.has(D.format))A.set(D.format,[]);A.get(D.format).push(D)}let w=[],N=["avif","webp","jpeg","png"];for(let D of N){let x=A.get(D);if(x&&x.length>0){let h=x.map((U0)=>`${U0.url} ${U0.width}w`).join(", "),i=X$(D);if(G&&!K)w.push(` <source type="${i}" data-srcset="${h}" />`);else w.push(` <source type="${i}" srcset="${h}" />`)}}let R=[];if(G&&!K){if(R.push(`data-src="${v0(H)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${v0(H)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${v0(Y)}"`);let T=Q||Z.originalWidth,I=X||Z.originalHeight;if(T)R.push(`width="${T}"`);if(I)R.push(`height="${I}"`);if(!K)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(W)R.push(`crossorigin="${W}"`);if(U)R.push(`referrerpolicy="${U}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(z)M.push(`object-position: ${z}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)R.push(`style="${M.join("; ")}"`);let E=[];if(_)E.push(_);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)R.push(`class="${E.join(" ")}"`);if(G&&!K)R.push("data-stx-lazy");for(let[D,x]of Object.entries(O))R.push(`data-${D}="${v0(x)}"`);let k;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let D=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;k=`<div id="${B}" class="stx-img-placeholder" style="${D}">
912
912
  <picture>
913
913
  ${w.join(`
914
914
  `)}
@@ -919,11 +919,11 @@ ${w.join(`
919
919
  `)}
920
920
  <img ${R.join(" ")} />
921
921
  </picture>`;let y=[];if(Z.placeholder)y.push(K$);let S=G?S3(B):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:k,preloadLink:b,css:y.length>0?y.join(`
922
- `):void 0,script:S}}async function y3($,Z,J){let Y={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,X]of Object.entries(Z.byFormat))if(X)Y.variants.push(...X);return F$($,Y,J)}var E3=!1,O$=80,g5="async",h5="lazy",k3=!1;var C3=C(()=>{Q$();U3()});function OX(){return E5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,Y)=>{let{src:Q,alt:X,options:G}=HX($,Z,J);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:X||"",widths:G.widths||b1,formats:G.formats||Z5,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=J.__isDev||!1,z=await f5(K,{isDev:q}),W=z.html;if(z.preloadLink)W=z.preloadLink+`
922
+ `):void 0,script:S}}async function y3($,Z,J){let Y={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,X]of Object.entries(Z.byFormat))if(X)Y.variants.push(...X);return F$($,Y,J)}var E3=!1,O$=80,g5="async",h5="lazy",k3=!1;var C3=C(()=>{Q$();U3()});function LX(){return E5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,J,Y)=>{let{src:Q,alt:X,options:G}=FX($,Z,J);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:X||"",widths:G.widths||b1,formats:G.formats||Z5,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=J.__isDev||!1,z=await f5(K,{isDev:q}),W=z.html;if(z.preloadLink)W=z.preloadLink+`
923
923
  `+W;if(z.css)W+=`
924
924
  <style>${z.css}</style>`;if(z.script)W+=`
925
- <script>${z.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function HX($,Z,J){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let Y=$.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=LX(Y),X=V$(Q[0],J)||"",G=V$(Q[1],J)||"",K={};if(Q[2]){let q=V$(Q[2],J);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:X,alt:G,options:K}}function LX($){let Z=[],J="",Y=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],z=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&z!=="\\"){if(!Y)Y=!0,Q=q;else if(q===Q)Y=!1,Q="";else J+=q;continue}if(!Y){if(q==="{")X++;if(q==="}")X--;if(q==="[")G++;if(q==="]")G--;if(q===","&&X===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function V$($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let Y=Z[J];if(Y!==void 0)return Y}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var P3;var v3=C(()=>{Z$();C3();Q$();P3=OX()});class m5{config;constructor($={}){this.config={...FX,...$}}async get($,Z){return b5($,Z,"video",this.config)}async set($,Z,J){return S5($,Z,J,"video",this.config)}async clear(){return y5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function w$($){if(!d5)d5=new m5($);else if($)d5.updateConfig($);return d5}async function u5($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return w$(Y).get($,Z)}async function p5($,Z,J,Y){let Q=Y?{directory:`${Y.outputDir}/../.cache`}:{};return w$(Q).set($,Z,J)}async function x3(){return w$().clear()}var FX,d5=null;var A$=C(()=>{z$();FX={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as N$,basename as R$,extname as T$,join as l5}from"path";import{mkdir as M$}from"fs/promises";async function I$(){try{return await import("ts-videos")}catch{return null}}async function c5($,Z,J,Y){let Q=await I$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=N$($);if(!await N0(X))return null;await M$(J,{recursive:!0});let G=await T0(X),K=R$($,T$($)),q=Z.format||"webp",z=Z.timestamp||0,W=`${K}-poster-${G}.${q}`,U=l5(J,W),_=await Q.extractThumbnails(X,{timestamps:[z],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:J,outputPattern:W.replace(`.${q}`,"")});if(_&&_.length>0){let j=_[0];return{path:U,url:`${Y}/${W}`,width:j.width||Z.width||1280,height:j.height||720,timestamp:z,size:j.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function i5($,Z,J,Y){let Q=await I$();if(!Q)return[];try{let X=N$($);if(!await N0(X))return[];await M$(J,{recursive:!0});let G=await T0(X),K=R$($,T$($)),q=Z.format||"webp",U=(await new Q.Input(X).getInfo()).duration||60,_=Z.count||10,j=Z.interval||U/_,B=[];for(let F=0;F<_&&F*j<U;F++)B.push(F*j);let O=await Q.extractThumbnails(X,{timestamps:B,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:J,outputPattern:`${K}-thumb-${G}`});if(O&&O.length>0)return O.map((F,L)=>({path:F.path||l5(J,`${K}-thumb-${G}-${L}.${q}`),url:`${Y}/${K}-thumb-${G}-${L}.${q}`,width:F.width||Z.width||320,height:F.height||180,timestamp:B[L],size:F.size||0}));return[]}catch(X){return console.warn(`[stx-media] Failed to generate thumbnails: ${X}`),[]}}async function f3($,Z,J,Y){let Q=await I$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=N$($);if(!await N0(X))return null;await M$(J,{recursive:!0});let G=await T0(X),K=R$($,T$($)),W=(await new Q.Input(X).getInfo()).duration||60,U=Z.columns||10,_=Z.interval||5,j=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,O=Z.format||"jpeg",F=Math.ceil(W/_),L=Math.ceil(F/U),H=`${K}-sprite-${G}.${O}`,V=l5(J,H),A=[];for(let N=0;N<F;N++)A.push(N*_);let w=await Q.extractThumbnails(X,{timestamps:A,width:j,height:B,format:O,quality:Z.quality||70,outputDir:l5(J,".temp")});if(!w||w.length===0)return null;try{let N=await import("ts-images"),R=U*j,T=L*B,I=await N.createSprite({images:w.map((M)=>M.path),columns:U,padding:0,outputPath:V,format:O,quality:Z.quality||70});return{url:`${Y}/${H}`,path:V,columns:U,rows:L,thumbnailWidth:j,thumbnailHeight:B,interval:_,totalFrames:F}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(X){return console.warn(`[stx-media] Failed to generate sprite sheet: ${X}`),null}}var D$=C(()=>{j1()});import{resolve as h3,basename as d3,extname as m3,join as O1}from"path";import{mkdir as n5,writeFile as u3}from"fs/promises";async function p3(){try{return await import("ts-videos")}catch{return null}}async function o5($,Z,J,Y,Q){let X=await p3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=h3($);if(!await N0(G))return null;let K=await T0(G),q=d3($,m3($)),z=O1(J,`${q}-${K}-hls`);await n5(z,{recursive:!0});let W=Z.length>0?Z:l3,U=Q?.segmentDuration||6,B=(await new X.Input(G).getInfo()).duration||0,O=[],F=0;for(let V of W){let A=O1(z,V.label);await n5(A,{recursive:!0});let w=`${V.label}.m3u8`,N=O1(A,w);try{let R=await X.generateHLS(G,{outputDir:A,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)O.push({quality:V,url:`${Y}/${q}-${K}-hls/${V.label}/${w}`,path:N}),F+=R.segmentCount||Math.ceil(B/U)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(O.length===0)return null;let L=O1(z,"master.m3u8"),H=VX(O,Y,q,K);return await u3(L,H),{manifestUrl:`${Y}/${q}-${K}-hls/master.m3u8`,manifestPath:L,playlists:O,segmentCount:F,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function VX($,Z,J,Y){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let X of $){let{quality:G}=X,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
926
- `)}async function s5($,Z,J,Y,Q){let X=await p3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=h3($);if(!await N0(G))return null;let K=await T0(G),q=d3($,m3($)),z=O1(J,`${q}-${K}-dash`);await n5(z,{recursive:!0});let W=Z.length>0?Z:l3,U=Q?.segmentDuration||4,_=Q?.minBufferTime||2,O=(await new X.Input(G).getInfo()).duration||0,F=[],L=[];for(let w of W){let N=O1(z,w.label);await n5(N,{recursive:!0});try{if(await X.generateDASH(G,{outputDir:N,segmentDuration:U,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate})){if(F.push({bandwidth:w.bitrate,width:w.width,height:w.height||Math.round(w.width*9/16),url:`${Y}/${q}-${K}-dash/${w.label}/video`}),w.audioBitrate)L.push({bandwidth:w.audioBitrate,url:`${Y}/${q}-${K}-dash/${w.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${w.label}: ${R}`)}}if(F.length===0)return null;let H=O1(z,"manifest.mpd"),V=wX(F,L,O,U,_);await u3(H,V);let A=[{type:"video",representations:F}];if(L.length>0)A.push({type:"audio",representations:L});return{manifestUrl:`${Y}/${q}-${K}-dash/manifest.mpd`,manifestPath:H,adaptationSets:A,duration:O}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function wX($,Z,J,Y,Q){let X=g3(J),G=g3(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
925
+ <script>${z.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function FX($,Z,J){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let Y=$.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=VX(Y),X=V$(Q[0],J)||"",G=V$(Q[1],J)||"",K={};if(Q[2]){let q=V$(Q[2],J);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:X,alt:G,options:K}}function VX($){let Z=[],J="",Y=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],z=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&z!=="\\"){if(!Y)Y=!0,Q=q;else if(q===Q)Y=!1,Q="";else J+=q;continue}if(!Y){if(q==="{")X++;if(q==="}")X--;if(q==="[")G++;if(q==="]")G--;if(q===","&&X===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function V$($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let Y=Z[J];if(Y!==void 0)return Y}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var P3;var v3=C(()=>{Z$();C3();Q$();P3=LX()});class m5{config;constructor($={}){this.config={...wX,...$}}async get($,Z){return b5($,Z,"video",this.config)}async set($,Z,J){return S5($,Z,J,"video",this.config)}async clear(){return y5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function w$($){if(!d5)d5=new m5($);else if($)d5.updateConfig($);return d5}async function u5($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return w$(Y).get($,Z)}async function p5($,Z,J,Y){let Q=Y?{directory:`${Y.outputDir}/../.cache`}:{};return w$(Q).set($,Z,J)}async function x3(){return w$().clear()}var wX,d5=null;var A$=C(()=>{z$();wX={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as N$,basename as R$,extname as T$,join as l5}from"path";import{mkdir as M$}from"fs/promises";async function I$(){try{return await import("ts-videos")}catch{return null}}async function c5($,Z,J,Y){let Q=await I$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=N$($);if(!await N0(X))return null;await M$(J,{recursive:!0});let G=await T0(X),K=R$($,T$($)),q=Z.format||"webp",z=Z.timestamp||0,W=`${K}-poster-${G}.${q}`,U=l5(J,W),_=await Q.extractThumbnails(X,{timestamps:[z],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:J,outputPattern:W.replace(`.${q}`,"")});if(_&&_.length>0){let j=_[0];return{path:U,url:`${Y}/${W}`,width:j.width||Z.width||1280,height:j.height||720,timestamp:z,size:j.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function i5($,Z,J,Y){let Q=await I$();if(!Q)return[];try{let X=N$($);if(!await N0(X))return[];await M$(J,{recursive:!0});let G=await T0(X),K=R$($,T$($)),q=Z.format||"webp",U=(await new Q.Input(X).getInfo()).duration||60,_=Z.count||10,j=Z.interval||U/_,B=[];for(let F=0;F<_&&F*j<U;F++)B.push(F*j);let O=await Q.extractThumbnails(X,{timestamps:B,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:J,outputPattern:`${K}-thumb-${G}`});if(O&&O.length>0)return O.map((F,L)=>({path:F.path||l5(J,`${K}-thumb-${G}-${L}.${q}`),url:`${Y}/${K}-thumb-${G}-${L}.${q}`,width:F.width||Z.width||320,height:F.height||180,timestamp:B[L],size:F.size||0}));return[]}catch(X){return console.warn(`[stx-media] Failed to generate thumbnails: ${X}`),[]}}async function f3($,Z,J,Y){let Q=await I$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=N$($);if(!await N0(X))return null;await M$(J,{recursive:!0});let G=await T0(X),K=R$($,T$($)),W=(await new Q.Input(X).getInfo()).duration||60,U=Z.columns||10,_=Z.interval||5,j=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,O=Z.format||"jpeg",F=Math.ceil(W/_),L=Math.ceil(F/U),H=`${K}-sprite-${G}.${O}`,V=l5(J,H),A=[];for(let N=0;N<F;N++)A.push(N*_);let w=await Q.extractThumbnails(X,{timestamps:A,width:j,height:B,format:O,quality:Z.quality||70,outputDir:l5(J,".temp")});if(!w||w.length===0)return null;try{let N=await import("ts-images"),R=U*j,T=L*B,I=await N.createSprite({images:w.map((M)=>M.path),columns:U,padding:0,outputPath:V,format:O,quality:Z.quality||70});return{url:`${Y}/${H}`,path:V,columns:U,rows:L,thumbnailWidth:j,thumbnailHeight:B,interval:_,totalFrames:F}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(X){return console.warn(`[stx-media] Failed to generate sprite sheet: ${X}`),null}}var D$=C(()=>{j1()});import{resolve as h3,basename as d3,extname as m3,join as O1}from"path";import{mkdir as n5,writeFile as u3}from"fs/promises";async function p3(){try{return await import("ts-videos")}catch{return null}}async function o5($,Z,J,Y,Q){let X=await p3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=h3($);if(!await N0(G))return null;let K=await T0(G),q=d3($,m3($)),z=O1(J,`${q}-${K}-hls`);await n5(z,{recursive:!0});let W=Z.length>0?Z:l3,U=Q?.segmentDuration||6,B=(await new X.Input(G).getInfo()).duration||0,O=[],F=0;for(let V of W){let A=O1(z,V.label);await n5(A,{recursive:!0});let w=`${V.label}.m3u8`,N=O1(A,w);try{let R=await X.generateHLS(G,{outputDir:A,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)O.push({quality:V,url:`${Y}/${q}-${K}-hls/${V.label}/${w}`,path:N}),F+=R.segmentCount||Math.ceil(B/U)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(O.length===0)return null;let L=O1(z,"master.m3u8"),H=AX(O,Y,q,K);return await u3(L,H),{manifestUrl:`${Y}/${q}-${K}-hls/master.m3u8`,manifestPath:L,playlists:O,segmentCount:F,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function AX($,Z,J,Y){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let X of $){let{quality:G}=X,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
926
+ `)}async function s5($,Z,J,Y,Q){let X=await p3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=h3($);if(!await N0(G))return null;let K=await T0(G),q=d3($,m3($)),z=O1(J,`${q}-${K}-dash`);await n5(z,{recursive:!0});let W=Z.length>0?Z:l3,U=Q?.segmentDuration||4,_=Q?.minBufferTime||2,O=(await new X.Input(G).getInfo()).duration||0,F=[],L=[];for(let w of W){let N=O1(z,w.label);await n5(N,{recursive:!0});try{if(await X.generateDASH(G,{outputDir:N,segmentDuration:U,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate})){if(F.push({bandwidth:w.bitrate,width:w.width,height:w.height||Math.round(w.width*9/16),url:`${Y}/${q}-${K}-dash/${w.label}/video`}),w.audioBitrate)L.push({bandwidth:w.audioBitrate,url:`${Y}/${q}-${K}-dash/${w.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${w.label}: ${R}`)}}if(F.length===0)return null;let H=O1(z,"manifest.mpd"),V=NX(F,L,O,U,_);await u3(H,V);let A=[{type:"video",representations:F}];if(L.length>0)A.push({type:"audio",representations:L});return{manifestUrl:`${Y}/${q}-${K}-dash/manifest.mpd`,manifestPath:H,adaptationSets:A,duration:O}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function NX($,Z,J,Y,Q){let X=g3(J),G=g3(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
927
927
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
928
928
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
929
929
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -949,7 +949,7 @@ ${w.join(`
949
949
  </Representation>
950
950
  `}K+=` </AdaptationSet>
951
951
  `}return K+=` </Period>
952
- </MPD>`,K}function g3($){let Z=Math.floor($/3600),J=Math.floor($%3600/60),Y=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(J>0)Q+=`${J}M`;return Q+=`${Y}S`,Q}var l3;var E$=C(()=>{j1();l3=[{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 c3,basename as AX,extname as NX,join as RX}from"path";import{mkdir as TX}from"fs/promises";async function i3(){try{return await import("ts-videos")}catch{return null}}function MX($){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 IX($){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 k$($){let Z=await i3();if(!Z)return null;try{let J=c3($),Q=await new Z.Input(J).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(J){return console.warn(`[stx-media] Failed to analyze video: ${J}`),null}}async function n3($,Z,J,Y){let Q=await i3();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let X=await u5($,Z,J);if(X)return X;try{let G=c3($);if(!await N0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=J.outputDir||"dist/videos",q=J.baseUrl||"/videos";await TX(K,{recursive:!0});let z=await T0(G),W=AX($,NX($)),U={src:$,processed:!0,hash:z};Y?.({percentage:5,stage:"analyzing"}),U.metadata=await k$(G)||void 0;let _={};if(Z.quality)_.bitrate=MX(Z.quality);if(Z.platform)Object.assign(_,IX(Z.platform));if(Z.transcode)Object.assign(_,Z.transcode);if(Object.keys(_).length>0||Z.process){Y?.({percentage:10,stage:"transcoding"});let j=`${W}-${z}.mp4`,B=RX(K,j);try{let O=await DX(G,B,_,Q,(F)=>Y?.({percentage:10+F*0.5,stage:"transcoding"}));if(O)U.transcoded={path:B,url:`${q}/${j}`,duration:O.duration,size:O.size,video:{codec:_.codec||"h264",width:O.width,height:O.height,bitrate:O.bitrate,frameRate:O.frameRate},audio:O.audioCodec?{codec:_.audioCodec||"aac",bitrate:_.audioBitrate||128000,sampleRate:_.sampleRate||48000,channels:_.channels||2}:void 0}}catch(O){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${O}`)}}if(Z.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let j=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await c5(G,j,K,q);if(B)U.poster=B}if(J.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let j=await i5(G,J.thumbnails,K,q);if(j.length>0)U.thumbnails=j}if(Z.streaming){Y?.({percentage:80,stage:"generating-manifests"});let j=typeof Z.streaming==="object"?Z.streaming:J.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let B=await o5(G,j.qualities||J.streaming?.defaultQualities||[],K,q);if(B)U.streaming={...U.streaming,hls:B}}if(j.format==="dash"){let B=await s5(G,j.qualities||J.streaming?.defaultQualities||[],K,q);if(B)U.streaming={...U.streaming,dash:B}}}if(Z.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await p5($,Z,U,J),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function DX($,Z,J,Y,Q){try{let G=await new Y.Conversion($,Z,{videoCodec:J.codec,videoBitrate:J.bitrate,width:J.maxWidth,height:J.maxHeight,frameRate:J.frameRate,audioCodec:J.audioCodec,audioBitrate:J.audioBitrate,sampleRate:J.sampleRate,channels:J.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||J.maxWidth||0,height:G.height||J.maxHeight||0,bitrate:G.bitrate||J.bitrate||0,frameRate:G.frameRate||J.frameRate||30,audioCodec:G.audioCodec}}catch(X){return console.error(`[stx-media] Transcoding failed: ${X}`),null}}var o3=C(()=>{j1();A$();D$();E$()});var s3={};r(s3,{setCachedVideoResult:()=>p5,processVideo:()=>n3,getCachedVideoResult:()=>u5,generateThumbnails:()=>i5,generateSpriteSheet:()=>f3,generatePoster:()=>c5,generateHLSManifest:()=>o5,generateDASHManifest:()=>s5,clearVideoCache:()=>x3,analyzeVideo:()=>k$,VideoProcessorCache:()=>m5});var r3=C(()=>{o3();D$();E$();A$()});async function t3(){try{return await Promise.resolve().then(() => (r3(),s3))}catch($){if(!a3)console.warn("[stx-media] Video processor not available, some features disabled:",$),a3=!0;return null}}async function r5($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return CX(Y,J)}if(J.processedResult?.processed)return Y6($,J.processedResult,Z);let Q;if(Y.generatePoster&&Y.src&&!$.poster)Q=await PX(Y,J);let{src:X,sources:G=[],poster:K,posterPlaceholder:q,controls:z=e3,autoplay:W=!1,muted:U=!1,loop:_=!1,preload:j=$6,playsinline:B=!0,lazy:O=!0,player:F="native",type:L,width:H,height:V,crossorigin:A,disablePictureInPicture:w=!1,disableRemotePlayback:N=!1}=$,R=Q||K,T=$.class,I=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return bX($,Z);if(L&&L!=="video")return kX(X||"",L,$);let E=G.length>0?G:X?[{src:X,type:Z6(X)}]:[],k=[`id="${M}"`];if(z)k.push("controls");if(W)k.push("autoplay");if(U)k.push("muted");if(_)k.push("loop");if(B)k.push("playsinline");if(w)k.push("disablepictureinpicture");if(N)k.push("disableremoteplayback");if(A)k.push(`crossorigin="${A}"`);if(O){if(k.push(`data-preload="${j}"`),k.push('preload="none"'),R)k.push(`data-poster="${j0(R)}"`);k.push("data-stx-lazy")}else if(k.push(`preload="${j}"`),R)k.push(`poster="${j0(R)}"`);if(H)k.push(`width="${H}"`);if(V)k.push(`height="${V}"`);if(T)k.push(`class="${j0(T)}"`);if(I)k.push(`style="${j0(I)}"`);let y=E.map((D)=>{return` <source ${O?`data-src="${j0(D.src)}"`:`src="${j0(D.src)}"`} type="${D.type}"${D.media?` media="${D.media}"`:""} />`}).join(`
952
+ </MPD>`,K}function g3($){let Z=Math.floor($/3600),J=Math.floor($%3600/60),Y=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(J>0)Q+=`${J}M`;return Q+=`${Y}S`,Q}var l3;var E$=C(()=>{j1();l3=[{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 c3,basename as RX,extname as TX,join as MX}from"path";import{mkdir as IX}from"fs/promises";async function i3(){try{return await import("ts-videos")}catch{return null}}function DX($){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 EX($){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 k$($){let Z=await i3();if(!Z)return null;try{let J=c3($),Q=await new Z.Input(J).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(J){return console.warn(`[stx-media] Failed to analyze video: ${J}`),null}}async function n3($,Z,J,Y){let Q=await i3();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let X=await u5($,Z,J);if(X)return X;try{let G=c3($);if(!await N0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=J.outputDir||"dist/videos",q=J.baseUrl||"/videos";await IX(K,{recursive:!0});let z=await T0(G),W=RX($,TX($)),U={src:$,processed:!0,hash:z};Y?.({percentage:5,stage:"analyzing"}),U.metadata=await k$(G)||void 0;let _={};if(Z.quality)_.bitrate=DX(Z.quality);if(Z.platform)Object.assign(_,EX(Z.platform));if(Z.transcode)Object.assign(_,Z.transcode);if(Object.keys(_).length>0||Z.process){Y?.({percentage:10,stage:"transcoding"});let j=`${W}-${z}.mp4`,B=MX(K,j);try{let O=await kX(G,B,_,Q,(F)=>Y?.({percentage:10+F*0.5,stage:"transcoding"}));if(O)U.transcoded={path:B,url:`${q}/${j}`,duration:O.duration,size:O.size,video:{codec:_.codec||"h264",width:O.width,height:O.height,bitrate:O.bitrate,frameRate:O.frameRate},audio:O.audioCodec?{codec:_.audioCodec||"aac",bitrate:_.audioBitrate||128000,sampleRate:_.sampleRate||48000,channels:_.channels||2}:void 0}}catch(O){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${O}`)}}if(Z.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let j=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await c5(G,j,K,q);if(B)U.poster=B}if(J.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let j=await i5(G,J.thumbnails,K,q);if(j.length>0)U.thumbnails=j}if(Z.streaming){Y?.({percentage:80,stage:"generating-manifests"});let j=typeof Z.streaming==="object"?Z.streaming:J.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let B=await o5(G,j.qualities||J.streaming?.defaultQualities||[],K,q);if(B)U.streaming={...U.streaming,hls:B}}if(j.format==="dash"){let B=await s5(G,j.qualities||J.streaming?.defaultQualities||[],K,q);if(B)U.streaming={...U.streaming,dash:B}}}if(Z.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await p5($,Z,U,J),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function kX($,Z,J,Y,Q){try{let G=await new Y.Conversion($,Z,{videoCodec:J.codec,videoBitrate:J.bitrate,width:J.maxWidth,height:J.maxHeight,frameRate:J.frameRate,audioCodec:J.audioCodec,audioBitrate:J.audioBitrate,sampleRate:J.sampleRate,channels:J.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||J.maxWidth||0,height:G.height||J.maxHeight||0,bitrate:G.bitrate||J.bitrate||0,frameRate:G.frameRate||J.frameRate||30,audioCodec:G.audioCodec}}catch(X){return console.error(`[stx-media] Transcoding failed: ${X}`),null}}var o3=C(()=>{j1();A$();D$();E$()});var s3={};r(s3,{setCachedVideoResult:()=>p5,processVideo:()=>n3,getCachedVideoResult:()=>u5,generateThumbnails:()=>i5,generateSpriteSheet:()=>f3,generatePoster:()=>c5,generateHLSManifest:()=>o5,generateDASHManifest:()=>s5,clearVideoCache:()=>x3,analyzeVideo:()=>k$,VideoProcessorCache:()=>m5});var r3=C(()=>{o3();D$();E$();A$()});async function t3(){try{return await Promise.resolve().then(() => (r3(),s3))}catch($){if(!a3)console.warn("[stx-media] Video processor not available, some features disabled:",$),a3=!0;return null}}async function r5($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return vX(Y,J)}if(J.processedResult?.processed)return Y6($,J.processedResult,Z);let Q;if(Y.generatePoster&&Y.src&&!$.poster)Q=await xX(Y,J);let{src:X,sources:G=[],poster:K,posterPlaceholder:q,controls:z=e3,autoplay:W=!1,muted:U=!1,loop:_=!1,preload:j=$6,playsinline:B=!0,lazy:O=!0,player:F="native",type:L,width:H,height:V,crossorigin:A,disablePictureInPicture:w=!1,disableRemotePlayback:N=!1}=$,R=Q||K,T=$.class,I=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return yX($,Z);if(L&&L!=="video")return SX(X||"",L,$);let E=G.length>0?G:X?[{src:X,type:Z6(X)}]:[],k=[`id="${M}"`];if(z)k.push("controls");if(W)k.push("autoplay");if(U)k.push("muted");if(_)k.push("loop");if(B)k.push("playsinline");if(w)k.push("disablepictureinpicture");if(N)k.push("disableremoteplayback");if(A)k.push(`crossorigin="${A}"`);if(O){if(k.push(`data-preload="${j}"`),k.push('preload="none"'),R)k.push(`data-poster="${j0(R)}"`);k.push("data-stx-lazy")}else if(k.push(`preload="${j}"`),R)k.push(`poster="${j0(R)}"`);if(H)k.push(`width="${H}"`);if(V)k.push(`height="${V}"`);if(T)k.push(`class="${j0(T)}"`);if(I)k.push(`style="${j0(I)}"`);let y=E.map((D)=>{return` <source ${O?`data-src="${j0(D.src)}"`:`src="${j0(D.src)}"`} type="${D.type}"${D.media?` media="${D.media}"`:""} />`}).join(`
953
953
  `),S=`<video ${k.join(" ")}>
954
954
  ${y}
955
955
  Your browser does not support the video tag.
@@ -988,9 +988,9 @@ ${y}
988
988
 
989
989
  observer.observe(video);
990
990
  })();
991
- `.trim();return{html:S,script:b}}function kX($,Z,J){let{width:Y=640,height:Q=360}=J,X=J.class,G=J.style,K=J.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,z=null;switch(Z){case"youtube":z=SX($),q=z?`https://www.youtube-nocookie.com/embed/${z}`:$;break;case"vimeo":z=yX($),q=z?`https://player.vimeo.com/video/${z}`:$;break;case"dailymotion":z=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${z}`;break;case"twitch":z=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${z}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let W=[`id="${K}"`,`src="${j0(q)}"`,`width="${Y}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(X)W.push(`class="${j0(X)}"`);if(G)W.push(`style="${j0(G)}"`);if(J.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
991
+ `.trim();return{html:S,script:b}}function SX($,Z,J){let{width:Y=640,height:Q=360}=J,X=J.class,G=J.style,K=J.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,z=null;switch(Z){case"youtube":z=CX($),q=z?`https://www.youtube-nocookie.com/embed/${z}`:$;break;case"vimeo":z=PX($),q=z?`https://player.vimeo.com/video/${z}`:$;break;case"dailymotion":z=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${z}`;break;case"twitch":z=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${z}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let W=[`id="${K}"`,`src="${j0(q)}"`,`width="${Y}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(X)W.push(`class="${j0(X)}"`);if(G)W.push(`style="${j0(G)}"`);if(J.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
992
992
  <iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
993
- </div>`}}function bX($,Z={}){let{src:J,sources:Y=[],poster:Q,controls:X=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:z="metadata",playsinline:W=!0,lazy:U=!0,width:_,height:j}=$,B=$.class,O=$.style,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:Y.length>0?Y:J,autoplay:G,loop:q,muted:K,playsinline:W,preload:z,poster:Q,controls:X,title:$.title},H=["position: relative",_?`width: ${typeof _==="number"?_+"px":_}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",O||""].filter(Boolean).join("; "),V=`
993
+ </div>`}}function yX($,Z={}){let{src:J,sources:Y=[],poster:Q,controls:X=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:z="metadata",playsinline:W=!0,lazy:U=!0,width:_,height:j}=$,B=$.class,O=$.style,F=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:Y.length>0?Y:J,autoplay:G,loop:q,muted:K,playsinline:W,preload:z,poster:Q,controls:X,title:$.title},H=["position: relative",_?`width: ${typeof _==="number"?_+"px":_}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",O||""].filter(Boolean).join("; "),V=`
994
994
  <div
995
995
  id="${F}"
996
996
  class="ts-video-player${B?" "+j0(B):""}"
@@ -1027,7 +1027,7 @@ ${y}
1027
1027
 
1028
1028
  // Load ts-video-player from CDN
1029
1029
  var script = document.createElement('script');
1030
- script.src = '${EX}';
1030
+ script.src = '${bX}';
1031
1031
  script.onload = initPlayer;
1032
1032
  script.onerror = function() {
1033
1033
  console.error('[stx] Failed to load ts-video-player');
@@ -1157,7 +1157,7 @@ else {
1157
1157
  .ts-video-player__play-button svg {
1158
1158
  margin-left: 4px;
1159
1159
  }
1160
- `.trim();return{html:V,script:A,css:w}}function Z6($){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 SX($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let J of Z){let Y=$.match(J);if(Y)return Y[1]}return null}function yX($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function j0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function CX($,Z){let J=await t3();if(!J)return r5({...$,process:!1},Z);let Y=Z.tsVideosConfig,Q=await J.processVideo($.src,$,Y,$.onProcessProgress);if(Q.processed)return Y6($,Q,Z);return r5({...$,process:!1},Z)}async function PX($,Z){let J=await t3();if(!J||!$.src)return;let Y=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,Y,Q.outputDir,Q.baseUrl||"/videos"))?.url}function Y6($,Z,J){let{controls:Y=e3,autoplay:Q=!1,muted:X=!1,loop:G=!1,preload:K=$6,playsinline:q=!0,lazy:z=!0,width:W,height:U,crossorigin:_,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,O=$.class,F=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,H=$.src,V=Z6(H);if(Z.transcoded)H=Z.transcoded.url,V="video/mp4";let A=Z.streaming?.hls||Z.streaming?.dash;if(A){if(Z.streaming?.hls)H=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)H=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let w=Z.poster?.url||$.poster,N=[`id="${L}"`];if(Y)N.push("controls");if(Q)N.push("autoplay");if(X)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(j)N.push("disablepictureinpicture");if(B)N.push("disableremoteplayback");if(_)N.push(`crossorigin="${_}"`);if(z){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),w)N.push(`data-poster="${j0(w)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),w)N.push(`poster="${j0(w)}"`);let R=W||Z.metadata?.width,T=U||Z.metadata?.height;if(R)N.push(`width="${R}"`);if(T)N.push(`height="${T}"`);if(O)N.push(`class="${j0(O)}"`);if(F)N.push(`style="${j0(F)}"`);let M=` <source ${z?`data-src="${j0(H)}"`:`src="${j0(H)}"`} type="${V}" />`,E=`<video ${N.join(" ")}>
1160
+ `.trim();return{html:V,script:A,css:w}}function Z6($){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 CX($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let J of Z){let Y=$.match(J);if(Y)return Y[1]}return null}function PX($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function j0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function vX($,Z){let J=await t3();if(!J)return r5({...$,process:!1},Z);let Y=Z.tsVideosConfig,Q=await J.processVideo($.src,$,Y,$.onProcessProgress);if(Q.processed)return Y6($,Q,Z);return r5({...$,process:!1},Z)}async function xX($,Z){let J=await t3();if(!J||!$.src)return;let Y=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await J.generatePoster($.src,Y,Q.outputDir,Q.baseUrl||"/videos"))?.url}function Y6($,Z,J){let{controls:Y=e3,autoplay:Q=!1,muted:X=!1,loop:G=!1,preload:K=$6,playsinline:q=!0,lazy:z=!0,width:W,height:U,crossorigin:_,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,O=$.class,F=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,H=$.src,V=Z6(H);if(Z.transcoded)H=Z.transcoded.url,V="video/mp4";let A=Z.streaming?.hls||Z.streaming?.dash;if(A){if(Z.streaming?.hls)H=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)H=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let w=Z.poster?.url||$.poster,N=[`id="${L}"`];if(Y)N.push("controls");if(Q)N.push("autoplay");if(X)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(j)N.push("disablepictureinpicture");if(B)N.push("disableremoteplayback");if(_)N.push(`crossorigin="${_}"`);if(z){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),w)N.push(`data-poster="${j0(w)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),w)N.push(`poster="${j0(w)}"`);let R=W||Z.metadata?.width,T=U||Z.metadata?.height;if(R)N.push(`width="${R}"`);if(T)N.push(`height="${T}"`);if(O)N.push(`class="${j0(O)}"`);if(F)N.push(`style="${j0(F)}"`);let M=` <source ${z?`data-src="${j0(H)}"`:`src="${j0(H)}"`} type="${V}" />`,E=`<video ${N.join(" ")}>
1161
1161
  ${M}
1162
1162
  Your browser does not support the video tag.
1163
1163
  </video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${j0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -1206,9 +1206,9 @@ ${E}
1206
1206
  width: 100%;
1207
1207
  height: auto;
1208
1208
  }
1209
- `.trim();return{html:E,script:k,css:y}}var a3=!1,e3=!0,$6="metadata",EX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var J6=C(()=>{S$()});function X6(){return E5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,Y)=>{let{src:Q,options:X}=vX($,Z,J);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:X.poster,controls:X.controls!==!1,autoplay:X.autoplay||!1,muted:X.muted||!1,loop:X.loop||!1,preload:X.preload||"metadata",playsinline:X.playsinline!==!1,lazy:X.lazy!==!1,player:X.player||"native",type:X.type,width:X.width,height:X.height,class:X.class,style:X.style,id:X.id,crossorigin:X.crossorigin,disablePictureInPicture:X.disablePictureInPicture,disableRemotePlayback:X.disableRemotePlayback,title:X.title,quality:X.quality,platform:X.platform,process:X.process,generatePoster:X.generatePoster,streaming:X.streaming,transcode:X.transcode,spriteSheet:X.spriteSheet,waveform:X.waveform},q={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},z=await r5(G,q),W=z.html;if(z.css)W+=`
1209
+ `.trim();return{html:E,script:k,css:y}}var a3=!1,e3=!0,$6="metadata",bX="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var J6=C(()=>{S$()});function X6(){return E5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,J,Y)=>{let{src:Q,options:X}=fX($,Z,J);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:X.poster,controls:X.controls!==!1,autoplay:X.autoplay||!1,muted:X.muted||!1,loop:X.loop||!1,preload:X.preload||"metadata",playsinline:X.playsinline!==!1,lazy:X.lazy!==!1,player:X.player||"native",type:X.type,width:X.width,height:X.height,class:X.class,style:X.style,id:X.id,crossorigin:X.crossorigin,disablePictureInPicture:X.disablePictureInPicture,disableRemotePlayback:X.disableRemotePlayback,title:X.title,quality:X.quality,platform:X.platform,process:X.process,generatePoster:X.generatePoster,streaming:X.streaming,transcode:X.transcode,spriteSheet:X.spriteSheet,waveform:X.waveform},q={isDev:J.__isDev||!1,tsVideosConfig:J.__tsVideosConfig},z=await r5(G,q),W=z.html;if(z.css)W+=`
1210
1210
  <style>${z.css}</style>`;if(z.script)W+=`
1211
- <script>${z.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function vX($,Z,J){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let Y=$.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=xX(Y),X=Q6(Q[0],J)||"",G={};if(Q[1]){let K=Q6(Q[1],J);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:X,options:G}}function xX($){let Z=[],J="",Y=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],z=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&z!=="\\"){if(!Y)Y=!0,Q=q;else if(q===Q)Y=!1,Q="";else J+=q;continue}if(!Y){if(q==="{")X++;if(q==="}")X--;if(q==="[")G++;if(q==="]")G--;if(q===","&&X===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function Q6($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let Y=Z[J];if(Y!==void 0)return Y}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var b$;var S$=C(()=>{Z$();J6();b$=X6()});function fX($,Z){let J=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1211
+ <script>${z.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function fX($,Z,J){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let Y=$.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=gX(Y),X=Q6(Q[0],J)||"",G={};if(Q[1]){let K=Q6(Q[1],J);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:X,options:G}}function gX($){let Z=[],J="",Y=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],z=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&z!=="\\"){if(!Y)Y=!0,Q=q;else if(q===Q)Y=!1,Q="";else J+=q;continue}if(!Y){if(q==="{")X++;if(q==="}")X--;if(q==="[")G++;if(q==="]")G--;if(q===","&&X===0&&G===0){Z.push(J.trim()),J="";continue}}J+=q}if(J.trim())Z.push(J.trim());return Z}function Q6($,Z){if(typeof $!=="string")return $;let J=$.trim();if(J.startsWith('"')&&J.endsWith('"')||J.startsWith("'")&&J.endsWith("'"))return J.slice(1,-1);if(!J.startsWith("/")&&!J.startsWith(".")&&!J.startsWith("http")&&!J.startsWith("{")){let Y=Z[J];if(Y!==void 0)return Y}if(J.startsWith("{")||J.startsWith("["))try{return JSON.parse(J)}catch{}return J}var b$;var S$=C(()=>{Z$();J6();b$=X6()});function hX($,Z){let J=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1212
1212
  ${$}
1213
1213
  </div>
1214
1214
  <script>
@@ -1253,7 +1253,7 @@ ${E}
1253
1253
  }
1254
1254
  }
1255
1255
  })();
1256
- </script>`}function gX($,Z){let J=Z.pwa?.updates,Y=J?.message||"A new version is available. Reload to update?",Q=J?.autoReload||!1,X=$.trim().length>0,G=`
1256
+ </script>`}function dX($,Z){let J=Z.pwa?.updates,Y=J?.message||"A new version is available. Reload to update?",Q=J?.autoReload||!1,X=$.trim().length>0,G=`
1257
1257
  <div class="stx-pwa-update-banner" style="
1258
1258
  position: fixed;
1259
1259
  bottom: 0;
@@ -1364,7 +1364,7 @@ else {
1364
1364
  // Also listen for custom event
1365
1365
  window.addEventListener('pwa-update-available', showUpdate);
1366
1366
  })();
1367
- </script>`}function hX($,Z){let J=$.trim().length>0,Y=`
1367
+ </script>`}function mX($,Z){let J=$.trim().length>0,Y=`
1368
1368
  <div class="stx-offline-indicator" style="
1369
1369
  position: fixed;
1370
1370
  top: 16px;
@@ -1425,7 +1425,7 @@ else {
1425
1425
  window.addEventListener('offline', updateStatus);
1426
1426
  updateStatus();
1427
1427
  })();
1428
- </script>`}function dX($,Z){let J=Z.pwa?.push,Y=J?.vapidPublicKey||"",Q=J?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
1428
+ </script>`}function uX($,Z){let J=Z.pwa?.push,Y=J?.vapidPublicKey||"",Q=J?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
1429
1429
  ${$}
1430
1430
  </div>
1431
1431
  <script>
@@ -1507,33 +1507,33 @@ catch (error) {
1507
1507
  init();
1508
1508
  }
1509
1509
  })();
1510
- </script>`}var mX,uX,pX,lX,G6;var K6=C(()=>{mX={name:"pwa.installButton",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return fX($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},uX={name:"pwa.updatePrompt",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return gX($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},pX={name:"pwa.offlineIndicator",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return hX($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},lX={name:"pwa.pushSubscribe",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return dX($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},G6=[mX,uX,pX,lX]});function y$($){for(let[Z,J]of Object.entries(p))if(J===$)return Z;return}var p;var a5=C(()=>{p={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 cX(){return!1}function J5(){return!cX()||process.env.STX_DEBUG==="true"}import iX from"path";function t5(){return{...C$}}function e5($){if(!C$.showRelativePaths||!$)return $;let Z=C$.baseDir||process.cwd();try{let J=iX.relative(Z,$);return J.startsWith("..")?$:J}catch{return $}}var nX,C$,$9,H1,Z9;var Y9=C(()=>{a5();nX={showRelativePaths:!1,enableAutoRecovery:J5(),logRecoveryWarnings:!0},C$={...nX};$9=class $9 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,J,Y,Q,X,G){super($);this.code=Z;this.filePath=J;this.line=Y;this.column=Q;this.context=X;if(this.name="StxError",this.numericCode=G||p.EVALUATION_ERROR,this.filePath)this.filePath=e5(this.filePath)}};H1=class H1 extends $9{constructor($,Z,J,Y,Q,X){super($,"stx_RUNTIME_ERROR",Z,J,Y,Q,X||p.EVALUATION_ERROR);this.name="StxRuntimeError"}};Z9=class Z9 extends $9{isFatal=!0;constructor($,Z,J,Y,Q,X){super($,"stx_VALIDATION_ERROR",Z,J,Y,Q,X||p.DOM_API_VIOLATION);this.name="StxValidationError"}}});function W6($){let{type:Z,message:J,code:Y,filePath:Q,line:X,column:G,template:K,offset:q,snippet:z,suggestion:W,format:U="text"}=$,_=X,j=G;if(!_&&K&&q!==void 0){let H=eX(K,q);_=H.line,j=H.column}let B=Q?e5(Q):void 0,O=Y?y$(Y):void 0,F={type:Z,code:Y,codeName:O,message:J,filePath:B,line:_,column:j,snippet:z,suggestion:W,timestamp:new Date().toISOString()},L;switch(U){case"html":L=sX(F);break;case"json":L=JSON.stringify(F,null,2);break;case"console":L=rX(F,K,q);break;case"text":default:L=oX(F,K,q);break}return{formatted:L,data:F}}function oX($,Z,J){let Y=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(Y.push(`[${$.type} Error${Q}]`),$.filePath){let X=$.filePath;if($.line){if(X+=`:${$.line}`,$.column)X+=`:${$.column}`}Y.push(`at ${X}`)}if(Y.push(`
1511
- ${$.message}`),Z&&$.line){let X=aX(Z,$.line,2);if(X)Y.push(`
1510
+ </script>`}var pX,lX,cX,iX,G6;var K6=C(()=>{pX={name:"pwa.installButton",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return hX($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},lX={name:"pwa.updatePrompt",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return dX($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},cX={name:"pwa.offlineIndicator",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return mX($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},iX={name:"pwa.pushSubscribe",handler:($,Z,J,Y)=>{let Q=J.__stx_options||{};return uX($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},G6=[pX,lX,cX,iX]});function y$($){for(let[Z,J]of Object.entries(u))if(J===$)return Z;return}var u;var a5=C(()=>{u={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 nX(){return!1}function J5(){return!nX()||process.env.STX_DEBUG==="true"}import oX from"path";function t5(){return{...C$}}function e5($){if(!C$.showRelativePaths||!$)return $;let Z=C$.baseDir||process.cwd();try{let J=oX.relative(Z,$);return J.startsWith("..")?$:J}catch{return $}}var sX,C$,$9,H1,Z9;var Y9=C(()=>{a5();sX={showRelativePaths:!1,enableAutoRecovery:J5(),logRecoveryWarnings:!0},C$={...sX};$9=class $9 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,J,Y,Q,X,G){super($);this.code=Z;this.filePath=J;this.line=Y;this.column=Q;this.context=X;if(this.name="StxError",this.numericCode=G||u.EVALUATION_ERROR,this.filePath)this.filePath=e5(this.filePath)}};H1=class H1 extends $9{constructor($,Z,J,Y,Q,X){super($,"stx_RUNTIME_ERROR",Z,J,Y,Q,X||u.EVALUATION_ERROR);this.name="StxRuntimeError"}};Z9=class Z9 extends $9{isFatal=!0;constructor($,Z,J,Y,Q,X){super($,"stx_VALIDATION_ERROR",Z,J,Y,Q,X||u.DOM_API_VIOLATION);this.name="StxValidationError"}}});function W6($){let{type:Z,message:J,code:Y,filePath:Q,line:X,column:G,template:K,offset:q,snippet:z,suggestion:W,format:U="text"}=$,_=X,j=G;if(!_&&K&&q!==void 0){let H=ZQ(K,q);_=H.line,j=H.column}let B=Q?e5(Q):void 0,O=Y?y$(Y):void 0,F={type:Z,code:Y,codeName:O,message:J,filePath:B,line:_,column:j,snippet:z,suggestion:W,timestamp:new Date().toISOString()},L;switch(U){case"html":L=aX(F);break;case"json":L=JSON.stringify(F,null,2);break;case"console":L=tX(F,K,q);break;case"text":default:L=rX(F,K,q);break}return{formatted:L,data:F}}function rX($,Z,J){let Y=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(Y.push(`[${$.type} Error${Q}]`),$.filePath){let X=$.filePath;if($.line){if(X+=`:${$.line}`,$.column)X+=`:${$.column}`}Y.push(`at ${X}`)}if(Y.push(`
1511
+ ${$.message}`),Z&&$.line){let X=eX(Z,$.line,2);if(X)Y.push(`
1512
1512
  ${X}`)}if($.snippet)Y.push(`
1513
1513
  Snippet: ${$.snippet}`);if($.suggestion)Y.push(`
1514
- Suggestion: ${$.suggestion}`);return Y.join(" ")}function sX($){let Z=$.code?` [${$.code}]`:"",J=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",Y=`<!-- [${$.type} Error${Z}]${J}: ${q6($.message)}`;if($.suggestion)Y+=` | Suggestion: ${q6($.suggestion)}`;return Y+=" -->",Y}function rX($,Z,J){let z=[],W=$.code?` [${$.codeName||$.code}]`:"";if(z.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${W} \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`}z.push(`
1514
+ Suggestion: ${$.suggestion}`);return Y.join(" ")}function aX($){let Z=$.code?` [${$.code}]`:"",J=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",Y=`<!-- [${$.type} Error${Z}]${J}: ${q6($.message)}`;if($.suggestion)Y+=` | Suggestion: ${q6($.suggestion)}`;return Y+=" -->",Y}function tX($,Z,J){let z=[],W=$.code?` [${$.codeName||$.code}]`:"";if(z.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${W} \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`}z.push(`
1515
1515
  \x1B[90mat\x1B[0m ${U}`)}if(z.push(`
1516
1516
 
1517
- ${$.message}`),Z&&$.line){let U=tX(Z,$.line,2);if(U)z.push(`
1517
+ ${$.message}`),Z&&$.line){let U=$Q(Z,$.line,2);if(U)z.push(`
1518
1518
 
1519
1519
  \x1B[90mContext:\x1B[0m
1520
1520
  ${U}`)}if($.suggestion)z.push(`
1521
1521
 
1522
1522
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return z.push(`
1523
- ${"\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"}`),z.join("")}function aX($,Z,J){let Y=$.split(`
1523
+ ${"\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"}`),z.join("")}function eX($,Z,J){let Y=$.split(`
1524
1524
  `),Q=Math.max(0,Z-J-1),X=Math.min(Y.length-1,Z+J-1),G=[];for(let K=Q;K<=X;K++){let q=(K+1).toString().padStart(4),z=K===Z-1?">":" ";G.push(`${z}${q} | ${Y[K]}`)}return G.join(`
1525
- `)}function tX($,Z,J){let Y=$.split(`
1525
+ `)}function $Q($,Z,J){let Y=$.split(`
1526
1526
  `),Q=Math.max(0,Z-J-1),X=Math.min(Y.length-1,Z+J-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",z=[];for(let W=Q;W<=X;W++){let U=(W+1).toString().padStart(4),_=W===Z-1,j=_?"\x1B[31m>\x1B[0m":" ",B=_?`\x1B[31m${Y[W]}\x1B[0m`:`\x1B[90m${Y[W]}\x1B[0m`;z.push(`${j}\x1B[90m${U}\x1B[0m | ${B}`)}return z.join(`
1527
- `)}function q6($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function eX($,Z){let Y=$.substring(0,Z).split(`
1527
+ `)}function q6($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function ZQ($,Z){let Y=$.substring(0,Z).split(`
1528
1528
  `);return{line:Y.length,column:Y[Y.length-1].length}}function s($,Z,J){return W6({type:$,message:Z,code:J,format:"html"}).formatted}async function y1($,Z,J){try{return await $()}catch(Y){if(J&&Y instanceof Error)J(Y);return Z}}var z6=C(()=>{a5();Y9()});class v${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,J="error"){let Y={timestamp:new Date,error:$,context:Z,level:J};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(J))this.writeToFile(Y)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
1529
1529
  `).slice(1).join(`
1530
1530
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
1531
1531
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(Y))Z.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded(Z);let Q=`${this.formatEntry($)}
1532
1532
  `;Z.appendFileSync(this.logFilePath,Q,"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 J=this.maxLogFiles-1;J>=1;J--){let Y=`${this.logFilePath}.${J}`,Q=`${this.logFilePath}.${J+1}`;if($.existsSync(Y))if(J>=this.maxLogFiles-1)$.unlinkSync(Y);else $.renameSync(Y,Q)}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 J of this.errors){let Y=J.error.constructor.name;$[Y]=($[Y]||0)+1;let Q=J.level||"error";Z[Q]=(Z[Q]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let J=await import("fs"),Q=(await import("path")).dirname($);if(!J.existsSync(Q))J.mkdirSync(Q,{recursive:!0});if(Z==="json"){let X=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}));J.writeFileSync($,JSON.stringify(X,null,2),"utf-8")}else{let X=this.errors.map((G)=>this.formatEntry(G));J.writeFileSync($,X.join(`
1533
1533
 
1534
- `),"utf-8")}}async flush(){await this.writeQueue}}var P$,v0,x$;var U6=C(()=>{Y9();P$={isEnabled(){return t5().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=t5();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let J=$,Y=[],Q=(J.match(/\{\{/g)||[]).length,X=(J.match(/\}\}/g)||[]).length;if(Q>X){let K=Q-X;J+="}}".repeat(K),Y.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(J.match(new RegExp(`@${K}\\b`,"g"))||[]).length,z=(J.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>z){let W=q-z;for(let U=0;U<W;U++)J+=`
1535
- @end${K}`;Y.push(`Added ${W} missing @end${K}`)}}if(Y.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:J,fixes:Y}},createFallbackContent($,Z){if(J5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};v0=new v$,x$={isDevelopment(){return J5()},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 J=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)J.push(`Context: ${JSON.stringify(Z,null,2)}`);return J.push("========================"),J.join(`
1536
- `)}}});var _6=()=>{};var B6=C(()=>{a5();z6();U6();_6();Y9()});var n0=C(()=>{B6()});function j6($,Z,J,Y){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,z)=>{if(!z&&q.includes(":")){let W=q.split(":"),U=q,_=W.length>1?W[1]:"";if(_&&Z[_])z=Z[_];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[W[1]])z=Z.openGraph[W[1]];else z="";return z?`<meta property="${d(U)}" content="${d(z)}">`:""}return z?`<meta name="${d(q)}" content="${d(z)}">`:""});let X=/@metaTag\s*\(/g,G;while((G=X.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,z=1,W=q+1;while(W<Q.length&&z>0){if(Q[W]==="(")z++;else if(Q[W]===")"){if(z--,z===0)break}W++}if(z!==0)break;let U=Q.substring(q+1,W).trim(),_=W+1,j=(()=>{try{let B=F0(U,Z);if(!B)return"";let O="<meta";if(B.name)O+=` name="${d(String(B.name))}"`;if(B.property)O+=` property="${d(String(B.property))}"`;if(B.httpEquiv)O+=` http-equiv="${d(String(B.httpEquiv))}"`;if(B.content)O+=` content="${d(String(B.content))}"`;return O+=">",O}catch(B){let O=B instanceof Error?B.message:String(B);return s("MetaTag",O,p.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+j+Q.substring(_),X.lastIndex=0}return Q}function O6($,Z,J){let Y=$,Q=/@structuredData\s*\(/g,X;while((X=Q.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,q=1,z=K+1;while(z<Y.length&&q>0){if(Y[z]==="(")q++;else if(Y[z]===")"){if(q--,q===0)break}z++}if(q!==0)break;let W=Y.substring(K+1,z).trim(),U=z+1,_=(()=>{try{let j=F0(W,Z);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let B=j instanceof Error?j.message:String(j);return s("StructuredData",B,p.EVALUATION_ERROR)}})();Y=Y.substring(0,G)+_+Y.substring(U),Q.lastIndex=0}return Y}function H6($,Z,J,Y){let Q=$,X=/@seo\s*\(\s*\{/g,G;while((G=X.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,z=K+1,W=null,U=!1;while(z<Q.length&&q>0){let L=Q[z];if(U){U=!1,z++;continue}if(L==="\\"&&W){U=!0,z++;continue}if(W){if(L===W)W=null;z++;continue}if(L==='"'||L==="'"||L==="`"){W=L,z++;continue}if(L==="{")q++;else if(L==="}")q--;z++}if(q!==0)break;let _=Q.substring(z).match(/^\s*\)/);if(!_)break;let j=z+_[0].length,B=Q.substring(K,z),O=Q.substring(G.index,j),F=((L)=>{try{let H=F0(L,Z);if(!H)return"";let V="";if(H.title)V+=`<title>${d(H.title)}</title>
1534
+ `),"utf-8")}}async flush(){await this.writeQueue}}var P$,x0,x$;var U6=C(()=>{Y9();P$={isEnabled(){return t5().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=t5();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let J=$,Y=[],Q=(J.match(/\{\{/g)||[]).length,X=(J.match(/\}\}/g)||[]).length;if(Q>X){let K=Q-X;J+="}}".repeat(K),Y.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(J.match(new RegExp(`@${K}\\b`,"g"))||[]).length,z=(J.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>z){let W=q-z;for(let U=0;U<W;U++)J+=`
1535
+ @end${K}`;Y.push(`Added ${W} missing @end${K}`)}}if(Y.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:J,fixes:Y}},createFallbackContent($,Z){if(J5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};x0=new v$,x$={isDevelopment(){return J5()},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 J=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)J.push(`Context: ${JSON.stringify(Z,null,2)}`);return J.push("========================"),J.join(`
1536
+ `)}}});var _6=()=>{};var B6=C(()=>{a5();z6();U6();_6();Y9()});var o0=C(()=>{B6()});function j6($,Z,J,Y){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,z)=>{if(!z&&q.includes(":")){let W=q.split(":"),U=q,_=W.length>1?W[1]:"";if(_&&Z[_])z=Z[_];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[W[1]])z=Z.openGraph[W[1]];else z="";return z?`<meta property="${d(U)}" content="${d(z)}">`:""}return z?`<meta name="${d(q)}" content="${d(z)}">`:""});let X=/@metaTag\s*\(/g,G;while((G=X.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,z=1,W=q+1;while(W<Q.length&&z>0){if(Q[W]==="(")z++;else if(Q[W]===")"){if(z--,z===0)break}W++}if(z!==0)break;let U=Q.substring(q+1,W).trim(),_=W+1,j=(()=>{try{let B=F0(U,Z);if(!B)return"";let O="<meta";if(B.name)O+=` name="${d(String(B.name))}"`;if(B.property)O+=` property="${d(String(B.property))}"`;if(B.httpEquiv)O+=` http-equiv="${d(String(B.httpEquiv))}"`;if(B.content)O+=` content="${d(String(B.content))}"`;return O+=">",O}catch(B){let O=B instanceof Error?B.message:String(B);return s("MetaTag",O,u.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+j+Q.substring(_),X.lastIndex=0}return Q}function O6($,Z,J){let Y=$,Q=/@structuredData\s*\(/g,X;while((X=Q.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,q=1,z=K+1;while(z<Y.length&&q>0){if(Y[z]==="(")q++;else if(Y[z]===")"){if(q--,q===0)break}z++}if(q!==0)break;let W=Y.substring(K+1,z).trim(),U=z+1,_=(()=>{try{let j=F0(W,Z);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let B=j instanceof Error?j.message:String(j);return s("StructuredData",B,u.EVALUATION_ERROR)}})();Y=Y.substring(0,G)+_+Y.substring(U),Q.lastIndex=0}return Y}function H6($,Z,J,Y){let Q=$,X=/@seo\s*\(\s*\{/g,G;while((G=X.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,z=K+1,W=null,U=!1;while(z<Q.length&&q>0){let L=Q[z];if(U){U=!1,z++;continue}if(L==="\\"&&W){U=!0,z++;continue}if(W){if(L===W)W=null;z++;continue}if(L==='"'||L==="'"||L==="`"){W=L,z++;continue}if(L==="{")q++;else if(L==="}")q--;z++}if(q!==0)break;let _=Q.substring(z).match(/^\s*\)/);if(!_)break;let j=z+_[0].length,B=Q.substring(K,z),O=Q.substring(G.index,j),F=((L)=>{try{let H=F0(L,Z);if(!H)return"";let V="";if(H.title)V+=`<title>${d(H.title)}</title>
1537
1537
  `,V+=`<meta name="title" content="${d(H.title)}">
1538
1538
  `;if(H.description)V+=`<meta name="description" content="${d(H.description)}">
1539
1539
  `;if(H.keywords){let A=Array.isArray(H.keywords)?H.keywords.join(", "):H.keywords;V+=`<meta name="keywords" content="${d(A)}">
@@ -1555,7 +1555,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
1555
1555
  `}if(A.site)V+=`<meta name="twitter:site" content="${d(A.site)}">
1556
1556
  `;if(A.creator)V+=`<meta name="twitter:creator" content="${d(A.creator)}">
1557
1557
  `}if(H.structuredData){let A=JSON.stringify(H.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${A}</script>
1558
- `}return V.trim()}catch(H){let V=H instanceof Error?H.message:String(H);return s("SEO",`Error processing @seo directive: ${V}`,p.EVALUATION_ERROR)}})(B);Q=Q.substring(0,G.index)+F+Q.substring(j),X.lastIndex=G.index+F.length}return Q}function L6($,Z,J){if(J.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||J.skipDefaultSeoTags===!0)return $;let Y=Z.__stx_runtime_head;if(!!(Y?.title||Y?.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 X=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(J.seo?.defaultConfig?.title)G=J.seo.defaultConfig.title;else G=J.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(J.seo?.defaultConfig?.description)K=J.seo.defaultConfig.description;else K=J.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(J.seo?.defaultImage)q=J.seo.defaultImage;else if(J.defaultImage)q=J.defaultImage;let z=`
1558
+ `}return V.trim()}catch(H){let V=H instanceof Error?H.message:String(H);return s("SEO",`Error processing @seo directive: ${V}`,u.EVALUATION_ERROR)}})(B);Q=Q.substring(0,G.index)+F+Q.substring(j),X.lastIndex=G.index+F.length}return Q}function L6($,Z,J){if(J.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||J.skipDefaultSeoTags===!0)return $;let Y=Z.__stx_runtime_head;if(!!(Y?.title||Y?.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 X=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(J.seo?.defaultConfig?.title)G=J.seo.defaultConfig.title;else G=J.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(J.seo?.defaultConfig?.description)K=J.seo.defaultConfig.description;else K=J.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(J.seo?.defaultImage)q=J.seo.defaultImage;else if(J.defaultImage)q=J.defaultImage;let z=`
1559
1559
  <!-- stx SEO Tags -->
1560
1560
  <meta name="title" content="${d(G)}">
1561
1561
  <meta name="description" content="${d(K)}">
@@ -1571,7 +1571,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
1571
1571
  `;let W=$;if(!X)W=W.replace(/<head[^>]*>/,`$&
1572
1572
  <title>${d(G)}</title>`);return W.replace(/<head[^>]*>/,`$&
1573
1573
  ${z}
1574
- `)}function d($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var F6,V6;var f$=C(()=>{n0();R0();F6={name:"meta",handler:($,Z,J,Y)=>{if(Z.length<1)return s("Meta","meta directive requires at least the meta name",p.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${d(Q)}" content="${d(X)}">`},hasEndTag:!1},V6={name:"structuredData",handler:($,Z,J,Y)=>{if($.trim()==="")return s("StructuredData","structuredData directive requires JSON-LD content",p.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return s("StructuredData","structuredData requires @type property",p.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let X=Q instanceof Error?Q.message:String(Q);return s("StructuredData",X,p.EVALUATION_ERROR)}},hasEndTag:!0}});import X5 from"path";function $Q($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=J?J[1].trim():"",Q=Z,X=[],G=!0;if(Y){let U=Y.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let _=U[1],j=_.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Q=j[1];let B=_.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)X=B[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let O=_.match(/shadowDOM\s*:\s*(true|false)/);if(O)G=O[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",z=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=z?z[1].trim():"";return{tag:Q,props:X,template:q,styles:W,script:Y,shadowDOM:G}}function ZQ($){let{tag:Z,props:J,template:Y,styles:Q,shadowDOM:X}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),z=J.map((U)=>`'${U}'`).join(", "),W=J.map((U)=>`
1574
+ `)}function d($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var F6,V6;var f$=C(()=>{o0();R0();F6={name:"meta",handler:($,Z,J,Y)=>{if(Z.length<1)return s("Meta","meta directive requires at least the meta name",u.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${d(Q)}" content="${d(X)}">`},hasEndTag:!1},V6={name:"structuredData",handler:($,Z,J,Y)=>{if($.trim()==="")return s("StructuredData","structuredData directive requires JSON-LD content",u.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return s("StructuredData","structuredData requires @type property",u.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let X=Q instanceof Error?Q.message:String(Q);return s("StructuredData",X,u.EVALUATION_ERROR)}},hasEndTag:!0}});import X5 from"path";function YQ($,Z){let J=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=J?J[1].trim():"",Q=Z,X=[],G=!0;if(Y){let U=Y.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let _=U[1],j=_.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Q=j[1];let B=_.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)X=B[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let O=_.match(/shadowDOM\s*:\s*(true|false)/);if(O)G=O[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",z=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=z?z[1].trim():"";return{tag:Q,props:X,template:q,styles:W,script:Y,shadowDOM:G}}function JQ($){let{tag:Z,props:J,template:Y,styles:Q,shadowDOM:X}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),z=J.map((U)=>`'${U}'`).join(", "),W=J.map((U)=>`
1575
1575
  get ${U}() {
1576
1576
  return this.getAttribute('${U}') || '';
1577
1577
  }
@@ -1622,16 +1622,16 @@ ${W}
1622
1622
  }
1623
1623
 
1624
1624
  customElements.define('${Z}', ${G});
1625
- `}async function w6($,Z,J,Y){if(Z.length<1)return s("WebComponent","@webcomponent directive requires at least the tag name parameter",p.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",K=[X5.join(X5.dirname(Y),G,`${Q}.stx`),X5.join(process.cwd(),G,`${Q}.stx`),X5.join(X5.dirname(Y),`${Q}.stx`)],q=null;for(let U of K)if(await c(U)){q=await Bun.file(U).text();break}if(!q)return s("WebComponent",`Component file not found: ${Q}.stx`,p.FILE_NOT_FOUND);let z=$Q(q,Q);return`<script type="module">
1626
- ${ZQ(z)}
1627
- </script>`}var A6=C(()=>{n0();A0()});var N6={};r(N6,{timingPlugin:()=>GQ,pluginManager:()=>YQ,definePlugin:()=>J9,debugPlugin:()=>QQ,createVariablesPlugin:()=>KQ,createFilterPlugin:()=>XQ,createDirectivePlugin:()=>JQ,PluginManager:()=>g$});function J9($){return $}class g${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 J of $.dependencies)if(!this.plugins.has(J))throw Error(`Plugin "${$.name}" depends on "${J}" 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[J,Y]of this.plugins)if(Y.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${J}" 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 J=await Z.onError($);if(J){if(J.template!==void 0)$.template=J.template;if(J.context)$.context={...$.context,...J.context};if(J.metadata)$.metadata={...$.metadata,...J.metadata};if(J.skip)return $}}catch(J){console.error(`Error in plugin "${Z.name}" onError hook:`,J)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let J={...Z};for(let Y of this.sortedPlugins){let Q=Y[$];if(Q)try{let X=await Q(J);if(X){if(X.template!==void 0)J.template=X.template;if(X.context)J.context={...J.context,...X.context};if(X.metadata)J.metadata={...J.metadata,...X.metadata};if(X.skip)break}}catch(X){console.error(`Error in plugin "${Y.name}" ${$} hook:`,X)}}return J}async runDirectiveHooks($,Z,J){let Y={...J};for(let Q of this.sortedPlugins){let X=Q[$];if(X)try{let G=await X(Z,Y);if(G){if(G.template!==void 0)Y.template=G.template;if(G.context)Y.context={...Y.context,...G.context};if(G.metadata)Y.metadata={...Y.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return Y}}function JQ($,Z,J={}){return{name:$,...J,registerDirectives:()=>Z}}function XQ($,Z,J={}){return{name:$,...J,registerFilters:()=>Z}}function KQ($){return J9({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var YQ,QQ,GQ;var R6=C(()=>{YQ=new g$;QQ=J9({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)}}),GQ=J9({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 J=performance.now()-Z;console.log(`[stx-timing] Processing took ${J.toFixed(2)}ms`)}}})});var M6={};r(M6,{validateConfig:()=>UQ,loadStxConfig:()=>L1,defineStxConfig:()=>zQ,defaultConfig:()=>d$,config:()=>m$});import h$ from"fs";import M0 from"path";import{loadConfigWithResult as qQ}from"bunfig";function WQ($,Z){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=M0.join(process.cwd(),"resources","views"),Q=M0.join(process.cwd(),"resources","layouts");if(h$.existsSync(Y)&&h$.existsSync(Q))return{root:"resources",pagesDir:"views"};let X=M0.join(process.cwd(),"resources","views","pages");if(h$.existsSync(X))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}async function L1($){if(!$){if(C1)return C1;if(X9)return X9}let Z=$?M0.resolve($):process.cwd(),J=T6.get(Z);if(J)return J;let Y=(async()=>{let X=(await qQ({name:"stx",alias:"ui",cwd:Z,defaultConfig:d$,verbose:!1})).config,G=WQ(X.root,X.pagesDir);if(X.root=G.root,X.pagesDir=G.pagesDir,X.root&&X.root!=="."){let K=X.root;if(X.partialsDir&&!M0.isAbsolute(X.partialsDir))X.partialsDir=M0.join(K,X.partialsDir);if(X.componentsDir&&!M0.isAbsolute(X.componentsDir))X.componentsDir=M0.join(K,X.componentsDir);if(X.layoutsDir&&!M0.isAbsolute(X.layoutsDir))X.layoutsDir=M0.join(K,X.layoutsDir)}if(X.plugins&&X.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (R6(),N6)),q=[],z=[];for(let W of X.plugins){let U=typeof W==="string"?W:W[0],_=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(U),B=M0.dirname(Y0.resolve(U))}catch{let F=M0.resolve(process.cwd(),U);j=await import(F),B=M0.dirname(F)}let O=j.default||j;if(K.register(O,X),O.components){let F=M0.resolve(B,O.components);q.push(F)}if(O.pages){let F=M0.resolve(B,O.pages),L=_.path||"/";z.push({dir:F,prefix:L})}if(O.setup){let F={addDirective:(L)=>{X.customDirectives=X.customDirectives||[],X.customDirectives.push(L)},addRoute:(L,H)=>{X.apiRoutes=X.apiRoutes||{},X.apiRoutes[L]=H},addMiddleware:(L)=>{X.middleware=X.middleware||[],X.middleware.push(L)},pluginDir:B,config:X};await O.setup(_,F)}console.log(`[stx] Plugin loaded: ${O.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}X._pluginComponentDirs=q,X._pluginPageDirs=z}return X})();if(T6.set(Z,Y),!$)X9=Y,Y.then((Q)=>{C1=Q}).catch(()=>{});return Y}function zQ($){return $}function UQ($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((Y,Q)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((Y,Q)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.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)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,X)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${X}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(Q.strategy))Z.push({path:`pwa.routes[${X}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${X}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${X}].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((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((X)=>!Y.includes(X)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.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)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var d$,C1=null,T6,X9=null,m$;var Q5=C(()=>{v9();x9();f9();g9();$$();v3();S$();K6();f$();A6();d$={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,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:K3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:w6,hasEndTag:!1,description:"Include a web component in the template"},W7,z7,F6,V6,U7,B7,j7,_7,F7,A7,P3,b$,...G6],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}};T6=new Map;m$=new Proxy(d$,{get($,Z){if(C1&&Z in C1)return C1[Z];if(!X9)L1().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}})});var S6={};r(S6,{resetCssCache:()=>BQ,resetCrosswindCache:()=>jQ,rebuildCrosswindCSS:()=>OQ,loadCrosswindConfig:()=>l$,loadCrosswind:()=>p$,injectCrosswindCSS:()=>K5,getCachedCSS:()=>HQ,generateCrosswindCSS:()=>b6,extractClassNames:()=>k6,buildCrosswindCSS:()=>E6});import I6 from"fs";import Q0 from"path";async function D6($){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 _Q(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",J=process.cwd();while(J!==Q0.dirname(J))$.push(Q0.join(J,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Q0.join(J,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Q0.join(J,"node_modules","@stacksjs","crosswind","dist","index.js")),J=Q0.dirname(J);if(Z){let Y=[Q0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Q0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(Q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function p$(){if(u$)return v1;u$=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of $){let Y=await D6(J);if(Y)return v1=Y,console.log(`${W0.green}[Crosswind]${W0.reset} CSS engine loaded`),v1}let Z=_Q();for(let J of Z)if(await Bun.file(J).exists()){let Y=await D6(J);if(Y)return v1=Y,console.log(`${W0.green}[Crosswind]${W0.reset} CSS engine loaded from ${Q0.dirname(Q0.dirname(J))}`),v1}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${W0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${W0.reset}`),console.warn(`${W0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${W0.reset}`),null}}function BQ(){Q9.clear()}function jQ(){v1=null,u$=!1,g0=null,G5="",Q9.clear()}async function l$($){try{let{loadConfigWithResult:Z}=await import("bunfig"),J=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!J?.path||!J.config||Object.keys(J.config).length===0)return null;let Y=Q0.relative($,J.path);return console.log(`${W0.green}[Crosswind]${W0.reset} Loaded config from ${Y||J.path}`),J.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${W0.yellow}[Crosswind]${W0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function E6($){if(P1)return G5;P1=!0;try{let Z=await p$();if(!Z||!Z.build)return P1=!1,"";if(!g0)g0=await l$($);if(!g0)return P1=!1,"";let J=Z.defaultConfig?.theme||{},Y=g0.theme||{},Q={...Z.defaultConfig,...g0,theme:{...J,...Y,extend:{...J.extend||{},...Y.extend||{}}}},X=performance.now(),G=await Z.build(Q),K=performance.now()-X;if(G5=G.css,console.log(`${W0.cyan}[Crosswind]${W0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),Q.output){let q=Q0.isAbsolute(Q.output)?Q.output:Q0.join($,Q.output),z=Q0.dirname(q);if(!I6.existsSync(z))I6.mkdirSync(z,{recursive:!0});await Bun.write(q,G.css)}return P1=!1,G.css}catch(Z){return console.error(`${W0.red}[Crosswind]${W0.reset} Build error:`,Z),P1=!1,G5}}async function OQ($){g0=null,await E6($)}function HQ(){return G5}function k6($){let Z=new Set,J=/class\s*=\s*["']([^"']+)["']/gi,Y=J.exec($);while(Y!==null){for(let G of Y[1].split(/\s+/))if(G.trim())Z.add(G.trim());Y=J.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,X=Q.exec($);while(X!==null){let G=X[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())}X=Q.exec($)}return Z}async function b6($,Z){try{let J=await p$();if(!J)return"";let Y=k6($);if(Y.size===0)return"";let Q=[...Y].sort().join(" "),X=Q9.get(Q);if(X!==void 0)return X;let G=Z?Q0.resolve(Z):process.cwd();if(!g0){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (Q5(),M6)),w=await A(G);if(w.css)if(typeof w.css==="string"){let N=Q0.isAbsolute(w.css)?w.css:Q0.resolve(G,w.css);if(await Bun.file(N).exists()){let R=await import(N);V=R.default||R,console.log(`${W0.green}[Crosswind]${W0.reset} Loaded config from stx.config.ts \u2192 ${w.css}`)}}else{if(V={content:w.css.content||[],preflight:w.css.preflight??!0,minify:w.css.minify??!1},w.css.config){let N=Q0.isAbsolute(w.css.config)?w.css.config:Q0.resolve(G,w.css.config);if(await Bun.file(N).exists()){let R=await import(N);V={...R.default||R,...V}}}console.log(`${W0.green}[Crosswind]${W0.reset} Using inline CSS config from stx.config.ts`)}}catch{}g0=V||await l$(G)}let K=J.defaultConfig||J.config,q=g0||{},z=K.theme||{},U=(q.theme||{}).extend||{},_={...z};if(Object.keys(U).length>0)_.extend=U;let j=[...K.safelist||[],...q.safelist||[]],B={...K,...q,content:[],output:"",preflight:!0,minify:!1,theme:_,safelist:j},O=new J.CSSGenerator(B);for(let V of j)O.generate(V);for(let V of Y)O.generate(V);let F=O.toCSS(!0,!1),L=B.shortcuts||q.shortcuts||{};for(let[V,A]of Object.entries(L)){if(!Y.has(V)&&!j.includes(V))continue;let w=A.split(/\s+/).filter(Boolean);for(let N of w)O.generate(N)}F=O.toCSS(!0,!1);let H=F.split(`
1625
+ `}async function w6($,Z,J,Y){if(Z.length<1)return s("WebComponent","@webcomponent directive requires at least the tag name parameter",u.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",K=[X5.join(X5.dirname(Y),G,`${Q}.stx`),X5.join(process.cwd(),G,`${Q}.stx`),X5.join(X5.dirname(Y),`${Q}.stx`)],q=null;for(let U of K)if(await l(U)){q=await Bun.file(U).text();break}if(!q)return s("WebComponent",`Component file not found: ${Q}.stx`,u.FILE_NOT_FOUND);let z=YQ(q,Q);return`<script type="module">
1626
+ ${JQ(z)}
1627
+ </script>`}var A6=C(()=>{o0();A0()});var N6={};r(N6,{timingPlugin:()=>qQ,pluginManager:()=>XQ,definePlugin:()=>J9,debugPlugin:()=>KQ,createVariablesPlugin:()=>WQ,createFilterPlugin:()=>GQ,createDirectivePlugin:()=>QQ,PluginManager:()=>g$});function J9($){return $}class g${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 J of $.dependencies)if(!this.plugins.has(J))throw Error(`Plugin "${$.name}" depends on "${J}" 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[J,Y]of this.plugins)if(Y.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${J}" 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 J=await Z.onError($);if(J){if(J.template!==void 0)$.template=J.template;if(J.context)$.context={...$.context,...J.context};if(J.metadata)$.metadata={...$.metadata,...J.metadata};if(J.skip)return $}}catch(J){console.error(`Error in plugin "${Z.name}" onError hook:`,J)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let J={...Z};for(let Y of this.sortedPlugins){let Q=Y[$];if(Q)try{let X=await Q(J);if(X){if(X.template!==void 0)J.template=X.template;if(X.context)J.context={...J.context,...X.context};if(X.metadata)J.metadata={...J.metadata,...X.metadata};if(X.skip)break}}catch(X){console.error(`Error in plugin "${Y.name}" ${$} hook:`,X)}}return J}async runDirectiveHooks($,Z,J){let Y={...J};for(let Q of this.sortedPlugins){let X=Q[$];if(X)try{let G=await X(Z,Y);if(G){if(G.template!==void 0)Y.template=G.template;if(G.context)Y.context={...Y.context,...G.context};if(G.metadata)Y.metadata={...Y.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return Y}}function QQ($,Z,J={}){return{name:$,...J,registerDirectives:()=>Z}}function GQ($,Z,J={}){return{name:$,...J,registerFilters:()=>Z}}function WQ($){return J9({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var XQ,KQ,qQ;var R6=C(()=>{XQ=new g$;KQ=J9({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)}}),qQ=J9({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 J=performance.now()-Z;console.log(`[stx-timing] Processing took ${J.toFixed(2)}ms`)}}})});var M6={};r(M6,{validateConfig:()=>BQ,loadStxConfig:()=>L1,defineStxConfig:()=>_Q,defaultConfig:()=>d$,config:()=>m$});import h$ from"fs";import M0 from"path";import{loadConfigWithResult as zQ}from"bunfig";function UQ($,Z){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=M0.join(process.cwd(),"resources","views"),Q=M0.join(process.cwd(),"resources","layouts");if(h$.existsSync(Y)&&h$.existsSync(Q))return{root:"resources",pagesDir:"views"};let X=M0.join(process.cwd(),"resources","views","pages");if(h$.existsSync(X))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}async function L1($){if(!$){if(C1)return C1;if(X9)return X9}let Z=$?M0.resolve($):process.cwd(),J=T6.get(Z);if(J)return J;let Y=(async()=>{let X=(await zQ({name:"stx",alias:"ui",cwd:Z,defaultConfig:d$,verbose:!1})).config,G=UQ(X.root,X.pagesDir);if(X.root=G.root,X.pagesDir=G.pagesDir,X.root&&X.root!=="."){let K=X.root;if(X.partialsDir&&!M0.isAbsolute(X.partialsDir))X.partialsDir=M0.join(K,X.partialsDir);if(X.componentsDir&&!M0.isAbsolute(X.componentsDir))X.componentsDir=M0.join(K,X.componentsDir);if(X.layoutsDir&&!M0.isAbsolute(X.layoutsDir))X.layoutsDir=M0.join(K,X.layoutsDir)}if(X.plugins&&X.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (R6(),N6)),q=[],z=[];for(let W of X.plugins){let U=typeof W==="string"?W:W[0],_=typeof W==="string"?{}:W[1]||{};try{let j,B;try{j=await import(U),B=M0.dirname(Y0.resolve(U))}catch{let F=M0.resolve(process.cwd(),U);j=await import(F),B=M0.dirname(F)}let O=j.default||j;if(K.register(O,X),O.components){let F=M0.resolve(B,O.components);q.push(F)}if(O.pages){let F=M0.resolve(B,O.pages),L=_.path||"/";z.push({dir:F,prefix:L})}if(O.setup){let F={addDirective:(L)=>{X.customDirectives=X.customDirectives||[],X.customDirectives.push(L)},addRoute:(L,H)=>{X.apiRoutes=X.apiRoutes||{},X.apiRoutes[L]=H},addMiddleware:(L)=>{X.middleware=X.middleware||[],X.middleware.push(L)},pluginDir:B,config:X};await O.setup(_,F)}console.log(`[stx] Plugin loaded: ${O.name||U}`)}catch(j){console.warn(`[stx] Failed to load plugin ${U}:`,j.message)}}X._pluginComponentDirs=q,X._pluginPageDirs=z}return X})();if(T6.set(Z,Y),!$)X9=Y,Y.then((Q)=>{C1=Q}).catch(()=>{});return Y}function _Q($){return $}function BQ($){let Z=[],J=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((Y,Q)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((Y,Q)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.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)J.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,X)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${X}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(Q.strategy))Z.push({path:`pwa.routes[${X}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${X}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${X}].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((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((X)=>!Y.includes(X)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.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)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var d$,C1=null,T6,X9=null,m$;var Q5=C(()=>{v9();x9();f9();g9();$$();v3();S$();K6();f$();A6();d$={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,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:K3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:w6,hasEndTag:!1,description:"Include a web component in the template"},W7,z7,F6,V6,U7,B7,j7,_7,F7,A7,P3,b$,...G6],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}};T6=new Map;m$=new Proxy(d$,{get($,Z){if(C1&&Z in C1)return C1[Z];if(!X9)L1().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}})});var S6={};r(S6,{resetCssCache:()=>OQ,resetCrosswindCache:()=>HQ,rebuildCrosswindCSS:()=>LQ,loadCrosswindConfig:()=>l$,loadCrosswind:()=>p$,injectCrosswindCSS:()=>K5,getCachedCSS:()=>FQ,generateCrosswindCSS:()=>b6,extractClassNames:()=>k6,buildCrosswindCSS:()=>E6});import I6 from"fs";import Q0 from"path";async function D6($){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 jQ(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",J=process.cwd();while(J!==Q0.dirname(J))$.push(Q0.join(J,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Q0.join(J,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Q0.join(J,"node_modules","@stacksjs","crosswind","dist","index.js")),J=Q0.dirname(J);if(Z){let Y=[Q0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Q0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(Q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function p$(){if(u$)return v1;u$=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of $){let Y=await D6(J);if(Y)return v1=Y,console.log(`${W0.green}[Crosswind]${W0.reset} CSS engine loaded`),v1}let Z=jQ();for(let J of Z)if(await Bun.file(J).exists()){let Y=await D6(J);if(Y)return v1=Y,console.log(`${W0.green}[Crosswind]${W0.reset} CSS engine loaded from ${Q0.dirname(Q0.dirname(J))}`),v1}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${W0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${W0.reset}`),console.warn(`${W0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${W0.reset}`),null}}function OQ(){Q9.clear()}function HQ(){v1=null,u$=!1,h0=null,G5="",Q9.clear()}async function l$($){try{let{loadConfigWithResult:Z}=await import("bunfig"),J=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!J?.path||!J.config||Object.keys(J.config).length===0)return null;let Y=Q0.relative($,J.path);return console.log(`${W0.green}[Crosswind]${W0.reset} Loaded config from ${Y||J.path}`),J.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${W0.yellow}[Crosswind]${W0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function E6($){if(P1)return G5;P1=!0;try{let Z=await p$();if(!Z||!Z.build)return P1=!1,"";if(!h0)h0=await l$($);if(!h0)return P1=!1,"";let J=Z.defaultConfig?.theme||{},Y=h0.theme||{},Q={...Z.defaultConfig,...h0,theme:{...J,...Y,extend:{...J.extend||{},...Y.extend||{}}}},X=performance.now(),G=await Z.build(Q),K=performance.now()-X;if(G5=G.css,console.log(`${W0.cyan}[Crosswind]${W0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),Q.output){let q=Q0.isAbsolute(Q.output)?Q.output:Q0.join($,Q.output),z=Q0.dirname(q);if(!I6.existsSync(z))I6.mkdirSync(z,{recursive:!0});await Bun.write(q,G.css)}return P1=!1,G.css}catch(Z){return console.error(`${W0.red}[Crosswind]${W0.reset} Build error:`,Z),P1=!1,G5}}async function LQ($){h0=null,await E6($)}function FQ(){return G5}function k6($){let Z=new Set,J=/class\s*=\s*["']([^"']+)["']/gi,Y=J.exec($);while(Y!==null){for(let G of Y[1].split(/\s+/))if(G.trim())Z.add(G.trim());Y=J.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,X=Q.exec($);while(X!==null){let G=X[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())}X=Q.exec($)}return Z}async function b6($,Z){try{let J=await p$();if(!J)return"";let Y=k6($);if(Y.size===0)return"";let Q=[...Y].sort().join(" "),X=Q9.get(Q);if(X!==void 0)return X;let G=Z?Q0.resolve(Z):process.cwd();if(!h0){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (Q5(),M6)),w=await A(G);if(w.css)if(typeof w.css==="string"){let N=Q0.isAbsolute(w.css)?w.css:Q0.resolve(G,w.css);if(await Bun.file(N).exists()){let R=await import(N);V=R.default||R,console.log(`${W0.green}[Crosswind]${W0.reset} Loaded config from stx.config.ts \u2192 ${w.css}`)}}else{if(V={content:w.css.content||[],preflight:w.css.preflight??!0,minify:w.css.minify??!1},w.css.config){let N=Q0.isAbsolute(w.css.config)?w.css.config:Q0.resolve(G,w.css.config);if(await Bun.file(N).exists()){let R=await import(N);V={...R.default||R,...V}}}console.log(`${W0.green}[Crosswind]${W0.reset} Using inline CSS config from stx.config.ts`)}}catch{}h0=V||await l$(G)}let K=J.defaultConfig||J.config,q=h0||{},z=K.theme||{},U=(q.theme||{}).extend||{},_={...z};if(Object.keys(U).length>0)_.extend=U;let j=[...K.safelist||[],...q.safelist||[]],B={...K,...q,content:[],output:"",preflight:!0,minify:!1,theme:_,safelist:j},O=new J.CSSGenerator(B);for(let V of j)O.generate(V);for(let V of Y)O.generate(V);let F=O.toCSS(!0,!1),L=B.shortcuts||q.shortcuts||{};for(let[V,A]of Object.entries(L)){if(!Y.has(V)&&!j.includes(V))continue;let w=A.split(/\s+/).filter(Boolean);for(let N of w)O.generate(N)}F=O.toCSS(!0,!1);let H=F.split(`
1628
1628
  `);for(let[V,A]of Object.entries(L)){if(!Y.has(V)&&!j.includes(V))continue;let w=A.split(/\s+/).filter(Boolean),N=[],R=[];for(let T of w){let I=T.startsWith("dark:"),k=`.${(I?T.slice(5):T).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<H.length;y++){let S=H[y].trim();if(S===`${k} {`||S.startsWith(`${k} {`)){let b=y,D="";while(b<H.length){if(D+=H[b],H[b].includes("}"))break;b++}let x=D.match(/\{([^}]+)\}/);if(x)if(I)R.push(x[1].trim());else N.push(x[1].trim());break}}}if(N.length)F+=`
1629
1629
  .${V} { ${N.join(" ")} }`;if(R.length)F+=`
1630
1630
  @media (prefers-color-scheme: dark) { .dark .${V} { ${R.join(" ")} } }`}return Q9.set(Q,F),F}catch(J){return console.warn("Failed to generate Crosswind CSS:",J),""}}async function K5($,Z){if($.includes('data-crosswind="generated"'))return $;let J=await b6($,Z);if(!J)return $;let Y=`<style data-crosswind="generated">
1631
1631
  ${J}
1632
1632
  </style>`;if($.includes("</head>"))return $.replace("</head>",`${Y}
1633
1633
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
1634
- ${Y}`);return Y+$}var v1=null,u$=!1,g0=null,G5="",P1=!1,Q9;var G9=C(()=>{K7();Q9=new Map});function y6(){return`
1634
+ ${Y}`);return Y+$}var v1=null,u$=!1,h0=null,G5="",P1=!1,Q9;var G9=C(()=>{K7();Q9=new Map});function y6(){return`
1635
1635
  // STX Lifecycle Runtime
1636
1636
  (function() {
1637
1637
  if (typeof window === 'undefined') return;
@@ -1976,7 +1976,7 @@ else {
1976
1976
 
1977
1977
  console.log('[stx] Lifecycle runtime initialized');
1978
1978
  })();
1979
- `}function c$($){return Symbol($)}var ZB,YB,JB;var C6=C(()=>{ZB=c$("theme"),YB=c$("router"),JB=c$("i18n")});import*as v6 from"crypto";function P6($){let Z=/\$(\w+)\./g,J=[],Y;while((Y=Z.exec($))!==null)if(!J.includes(Y[1]))J.push(Y[1]);return J}function LQ(){return`stx-${v6.randomBytes(4).toString("hex")}`}function FQ($){return/\$\w+\./.test($)}function VQ($){let Z=[],J=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(Y,(X,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return X;let z=[],W=!1,U=K,_=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(_)];for(let F of j){let L=F[0],H=F[1],V=F[2];if(FQ(V)){W=!0;let A=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(A){let w=A[1];if(z.push({attr:H,expr:w,fullMatch:L,originalAttr:H}),P6(w).forEach((R)=>J.add(R)),H==="text")U=U.replace(L,"");else if(H==="class")U=U.replace(L,'class=""');else if(H==="disabled"||H==="hidden")U=U.replace(L,"");else U=U.replace(L,`${H}=""`)}}}if(!W)return X;let B=U.match(/\bid\s*=\s*"([^"]+)"/),O;if(B)O=B[1];else O=LQ(),U=` id="${O}"${U}`;for(let F of z)Z.push({elementId:O,attribute:F.attr,expression:F.expr,stores:P6(F.expr)});return`<${G}${U}${q}`}),{html:Q,bindings:Z,stores:J}}function wQ($,Z){if($.length===0)return"";let J=Array.from(Z),Y=`
1979
+ `}function c$($){return Symbol($)}var JB,XB,QB;var C6=C(()=>{JB=c$("theme"),XB=c$("router"),QB=c$("i18n")});import*as v6 from"crypto";function P6($){let Z=/\$(\w+)\./g,J=[],Y;while((Y=Z.exec($))!==null)if(!J.includes(Y[1]))J.push(Y[1]);return J}function VQ(){return`stx-${v6.randomBytes(4).toString("hex")}`}function wQ($){return/\$\w+\./.test($)}function AQ($){let Z=[],J=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(Y,(X,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return X;let z=[],W=!1,U=K,_=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(_)];for(let F of j){let L=F[0],H=F[1],V=F[2];if(wQ(V)){W=!0;let A=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(A){let w=A[1];if(z.push({attr:H,expr:w,fullMatch:L,originalAttr:H}),P6(w).forEach((R)=>J.add(R)),H==="text")U=U.replace(L,"");else if(H==="class")U=U.replace(L,'class=""');else if(H==="disabled"||H==="hidden")U=U.replace(L,"");else U=U.replace(L,`${H}=""`)}}}if(!W)return X;let B=U.match(/\bid\s*=\s*"([^"]+)"/),O;if(B)O=B[1];else O=VQ(),U=` id="${O}"${U}`;for(let F of z)Z.push({elementId:O,attribute:F.attr,expression:F.expr,stores:P6(F.expr)});return`<${G}${U}${q}`}),{html:Q,bindings:Z,stores:J}}function NQ($,Z){if($.length===0)return"";let J=Array.from(Z),Y=`
1980
1980
  <script>
1981
1981
  (function() {
1982
1982
  'use strict';
@@ -2102,10 +2102,10 @@ else {
2102
2102
  }
2103
2103
  })();
2104
2104
  </script>
2105
- `,Y}function x6($){let{html:Z,bindings:J,stores:Y}=VQ($);if(J.length===0)return $;let Q=wQ(J,Y),X=Z.lastIndexOf("</body>");if(X!==-1)return Z.slice(0,X)+Q+Z.slice(X);return Z+Q}var f6=()=>{};function AQ($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return NQ(Z);case"google-analytics":return RQ(Z);case"plausible":return TQ(Z);case"self-hosted":return MQ(Z);case"custom":return IQ(Z);default:return""}}function NQ($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",Y=Z.defer!==!1?" defer":"",Q=[`data-site="${b0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${b0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
2105
+ `,Y}function x6($){let{html:Z,bindings:J,stores:Y}=AQ($);if(J.length===0)return $;let Q=NQ(J,Y),X=Z.lastIndexOf("</body>");if(X!==-1)return Z.slice(0,X)+Q+Z.slice(X);return Z+Q}var f6=()=>{};function RQ($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return TQ(Z);case"google-analytics":return MQ(Z);case"plausible":return IQ(Z);case"self-hosted":return DQ(Z);case"custom":return EQ(Z);default:return""}}function TQ($){let Z=$.fathom;if(!Z?.siteId)return"";let J=Z.scriptUrl||"https://cdn.usefathom.com/script.js",Y=Z.defer!==!1?" defer":"",Q=[`data-site="${b0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${b0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
2106
2106
  <!-- Fathom Analytics -->
2107
2107
  <script src="${b0(J)}" ${Q.join(" ")}${Y}></script>
2108
- `}function RQ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=b0(Z.measurementId),Y=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
2108
+ `}function MQ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let J=b0(Z.measurementId),Y=Z.debug?`gtag('config', '${J}', { 'debug_mode': true });`:"";return`
2109
2109
  <!-- Google Analytics -->
2110
2110
  <script async src="https://www.googletagmanager.com/gtag/js?id=${J}"></script>
2111
2111
  <script>
@@ -2115,10 +2115,10 @@ else {
2115
2115
  gtag('config', '${J}');
2116
2116
  ${Y}
2117
2117
  </script>
2118
- `}function TQ($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${b0(Z.domain)}"`],Q=J,X=[];if(Z.trackLocalhost)X.push("local");if(Z.hashMode)X.push("hash");if(X.length>0&&J==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${X.join(".")}.js`;return`
2118
+ `}function IQ($){let Z=$.plausible;if(!Z?.domain)return"";let J=Z.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${b0(Z.domain)}"`],Q=J,X=[];if(Z.trackLocalhost)X.push("local");if(Z.hashMode)X.push("hash");if(X.length>0&&J==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${X.join(".")}.js`;return`
2119
2119
  <!-- Plausible Analytics -->
2120
2120
  <script defer data-domain="${b0(Z.domain)}" src="${b0(Q)}"></script>
2121
- `}function MQ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=b0(Z.siteId),Y=b0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",X=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
2121
+ `}function DQ($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let J=b0(Z.siteId),Y=b0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",X=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
2122
2122
  d.addEventListener('click',function(e){
2123
2123
  var a=e.target.closest('a');
2124
2124
  if(a&&a.hostname!==location.hostname){
@@ -2151,7 +2151,7 @@ else {
2151
2151
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
2152
2152
  })();
2153
2153
  </script>
2154
- `}function IQ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
2154
+ `}function EQ($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
2155
2155
  <!-- Custom Analytics -->
2156
2156
  <script>
2157
2157
  ${Z.inlineScript}
@@ -2159,7 +2159,7 @@ ${Z.inlineScript}
2159
2159
  `;if(!Z.scriptUrl)return"";let J=[];if(Z.scriptId)J.push(`id="${b0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,X]of Object.entries(Z.attributes))J.push(`${b0(Q)}="${b0(X)}"`);return`
2160
2160
  <!-- Custom Analytics -->
2161
2161
  <script${J.length>0?` ${J.join(" ")}`:""} src="${b0(Z.scriptUrl)}" defer></script>
2162
- `}function g6($,Z){let J=AQ(Z);if(!J)return $;if(!$.includes("</head>")){let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+J+$.slice(Y);return $+J}return $.replace("</head>",`${J}</head>`)}function b0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var h6=()=>{};function u6($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let Y=J.toLowerCase();if(Y==="prevent")Z.prevent=!0;else if(Y==="stop")Z.stop=!0;else if(Y==="once")Z.once=!0;else if(Y==="capture")Z.capture=!0;else if(Y==="self")Z.self=!0;else if(Y==="passive")Z.passive=!0;else if(DQ.has(Y))Z.systemKeys.push(Y);else if(Y in p6)Z.mouse=Y;else if(Y in m6||/^[a-z]$/.test(Y))Z.keys.push(m6[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let Q=Y.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(Y.startsWith("throttle")){let Q=Y.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function l6($){let Z=[],J=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=Y.exec($))!==null){let[X,G,K]=Q,q=Q.index,z=q+X.length,W=`__stx_evt_${J++}`,U=[],_=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=_.exec(K))!==null){let[,O,F]=j,L=O.split("."),H=L[0];if(!d6.has(H))continue;U.push({attribute:`@${O}`,event:H,handler:F,modifiers:u6(L.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(K))!==null){let[,O,F]=j,L=O.split("."),H=L[0];if(!d6.has(H))continue;U.push({attribute:`@${O}`,event:H,handler:F,modifiers:u6(L.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:X,elementId:W,events:U,startIndex:q,endIndex:z})}return Z}function EQ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let Y of J.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if(J.keys.length>0){let Y=J.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if(J.mouse!==null){let Y=p6[J.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function kQ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function bQ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=EQ($),Q=kQ($.handler,Z),X=[];if(Z.once)X.push("once: true");if(Z.capture)X.push("capture: true");if(Z.passive)X.push("passive: true");let G=X.length>0?`, { ${X.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2162
+ `}function g6($,Z){let J=RQ(Z);if(!J)return $;if(!$.includes("</head>")){let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+J+$.slice(Y);return $+J}return $.replace("</head>",`${J}</head>`)}function b0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var h6=()=>{};function u6($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let Y=J.toLowerCase();if(Y==="prevent")Z.prevent=!0;else if(Y==="stop")Z.stop=!0;else if(Y==="once")Z.once=!0;else if(Y==="capture")Z.capture=!0;else if(Y==="self")Z.self=!0;else if(Y==="passive")Z.passive=!0;else if(kQ.has(Y))Z.systemKeys.push(Y);else if(Y in p6)Z.mouse=Y;else if(Y in m6||/^[a-z]$/.test(Y))Z.keys.push(m6[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let Q=Y.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(Y.startsWith("throttle")){let Q=Y.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function l6($){let Z=[],J=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=Y.exec($))!==null){let[X,G,K]=Q,q=Q.index,z=q+X.length,W=`__stx_evt_${J++}`,U=[],_=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=_.exec(K))!==null){let[,O,F]=j,L=O.split("."),H=L[0];if(!d6.has(H))continue;U.push({attribute:`@${O}`,event:H,handler:F,modifiers:u6(L.slice(1)),elementId:W})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(K))!==null){let[,O,F]=j,L=O.split("."),H=L[0];if(!d6.has(H))continue;U.push({attribute:`@${O}`,event:H,handler:F,modifiers:u6(L.slice(1)),elementId:W})}if(U.length>0)Z.push({originalTag:X,elementId:W,events:U,startIndex:q,endIndex:z})}return Z}function bQ($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let Y of J.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if(J.keys.length>0){let Y=J.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if(J.mouse!==null){let Y=p6[J.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function SQ($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function yQ($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=bQ($),Q=SQ($.handler,Z),X=[];if(Z.once)X.push("once: true");if(Z.capture)X.push("capture: true");if(Z.passive)X.push("passive: true");let G=X.length>0?`, { ${X.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2163
2163
  (function() {
2164
2164
  var $el = document.getElementById('${J}');
2165
2165
  if (!$el) return;
@@ -2213,7 +2213,7 @@ else {
2213
2213
  ${Q}
2214
2214
  }
2215
2215
  }${G});
2216
- })();`}function SQ($){if($.length===0)return"";return`
2216
+ })();`}function CQ($){if($.length===0)return"";return`
2217
2217
  <script data-stx-events>
2218
2218
  (function() {
2219
2219
  'use strict';
@@ -2241,11 +2241,11 @@ else {
2241
2241
  }
2242
2242
 
2243
2243
  // Event listeners
2244
- ${$.flatMap((J)=>J.events).map(bQ).join(`
2244
+ ${$.flatMap((J)=>J.events).map(yQ).join(`
2245
2245
  `)}
2246
2246
  })();
2247
- </script>`}function yQ($){let Z=l6($);if(Z.length===0)return{template:$,bindings:[]};let J=$,Y=[];for(let Q=Z.length-1;Q>=0;Q--){let X=Z[Q],G=X.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${X.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of X.events)q.elementId=K[1]}for(let K of X.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(z,""),G=G.replace(W,"")}J=J.slice(0,X.startIndex)+G+J.slice(X.endIndex),Y.push(...X.events)}return{template:J,bindings:Y}}function c6($,Z,J){if(/\b(?:state|derived|effect)\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:z}=yQ($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...z],q}let Q=l6($);if(Q.length===0)return $;let X=$;for(let q=Q.length-1;q>=0;q--){let z=Q[q],W=z.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let U=W.match(/id=["']([^"']+)["']/);if(U)for(let _ of z.events)_.elementId=U[1]}for(let U of z.events){let _=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${_}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${_}\\s*=\\s*'[^']*'`,"g");W=W.replace(j,""),W=W.replace(B,"")}X=X.slice(0,z.startIndex)+W+X.slice(z.endIndex)}let G=SQ(Q),K=X.lastIndexOf("</body>");if(K!==-1)X=X.slice(0,K)+G+`
2248
- `+X.slice(K);else X+=G;return X}var d6,m6,DQ,p6;var i6=C(()=>{d6=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"]),m6={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"},DQ=new Set(["ctrl","alt","shift","meta"]),p6={left:0,middle:1,right:2}});function K9($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function n6($,Z){let J=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(J)return J[1];let Y=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function PQ($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,X,G]=Y,K=Y.index,q=n6(G,"x-data");if(!q)continue;let z=`__stx_scope_${o6++}`,W=n6(G,"x-init"),U=vQ($,X,K+Q.length),_=$.slice(K,U.endIndex),j=xQ(_);Z.push({id:z,selector:`[data-stx-scope="${z}"]`,stateExpr:q,initExpr:W,bindings:[],refs:j})}return Z}function vQ($,Z,J){let Y=1,Q=J,X=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(Y>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=X.exec($),z=G.exec($),W=K.exec($);if(W&&W.index<(q?.index??1/0)){Q=W.index+W[0].length;continue}if(!z)return{endIndex:$.length};if(q&&q.index<z.index)Y++,Q=q.index+q[0].length;else{if(Y--,Y===0)return{endIndex:z.index+z[0].length};Q=z.index+z[0].length}}return{endIndex:$.length}}function xQ($){let Z=new Map,J=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=Y.exec(J))!==null){let[,X,G]=Q,K=fQ(X);Z.set(G,K)}return Z}function fQ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${CQ++}`}function gQ(){return`
2247
+ </script>`}function PQ($){let Z=l6($);if(Z.length===0)return{template:$,bindings:[]};let J=$,Y=[];for(let Q=Z.length-1;Q>=0;Q--){let X=Z[Q],G=X.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${X.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of X.events)q.elementId=K[1]}for(let K of X.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(z,""),G=G.replace(W,"")}J=J.slice(0,X.startIndex)+G+J.slice(X.endIndex),Y.push(...X.events)}return{template:J,bindings:Y}}function c6($,Z,J){if(/\b(?:state|derived|effect)\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:z}=PQ($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...z],q}let Q=l6($);if(Q.length===0)return $;let X=$;for(let q=Q.length-1;q>=0;q--){let z=Q[q],W=z.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let U=W.match(/id=["']([^"']+)["']/);if(U)for(let _ of z.events)_.elementId=U[1]}for(let U of z.events){let _=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${_}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${_}\\s*=\\s*'[^']*'`,"g");W=W.replace(j,""),W=W.replace(B,"")}X=X.slice(0,z.startIndex)+W+X.slice(z.endIndex)}let G=CQ(Q),K=X.lastIndexOf("</body>");if(K!==-1)X=X.slice(0,K)+G+`
2248
+ `+X.slice(K);else X+=G;return X}var d6,m6,kQ,p6;var i6=C(()=>{d6=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"]),m6={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"},kQ=new Set(["ctrl","alt","shift","meta"]),p6={left:0,middle:1,right:2}});function K9($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function n6($,Z){let J=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(J)return J[1];let Y=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function xQ($){let Z=[],J=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,X,G]=Y,K=Y.index,q=n6(G,"x-data");if(!q)continue;let z=`__stx_scope_${s6++}`,W=n6(G,"x-init"),U=fQ($,X,K+Q.length),_=$.slice(K,U.endIndex),j=gQ(_);Z.push({id:z,selector:`[data-stx-scope="${z}"]`,stateExpr:q,initExpr:W,bindings:[],refs:j})}return Z}function fQ($,Z,J){let Y=1,Q=J,X=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(Y>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=X.exec($),z=G.exec($),W=K.exec($);if(W&&W.index<(q?.index??1/0)){Q=W.index+W[0].length;continue}if(!z)return{endIndex:$.length};if(q&&q.index<z.index)Y++,Q=q.index+q[0].length;else{if(Y--,Y===0)return{endIndex:z.index+z[0].length};Q=z.index+z[0].length}}return{endIndex:$.length}}function gQ($){let Z=new Map,J=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=Y.exec(J))!==null){let[,X,G]=Q,K=hQ(X);Z.set(G,K)}return Z}function hQ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${vQ++}`}function dQ(){return`
2249
2249
  // STX Reactive Runtime - x-cloak and transition CSS
2250
2250
  (function() {
2251
2251
  var style = document.createElement('style');
@@ -2437,10 +2437,13 @@ window.__stx_reactive = (function() {
2437
2437
  scopeEl.__stx_state = ctxProxy;
2438
2438
  scopeEl.__stx_execute = function(stmt, $event, $el) {
2439
2439
  try {
2440
- var keys = Object.keys(scopeVars);
2441
- var vals = keys.map(function(k) { return scopeVars[k]; });
2442
- var fn = new Function(keys.join(','), '$event', '$el', stmt);
2443
- fn.apply(ctxProxy, vals.concat([$event, $el]));
2440
+ // Run the statement with the reactive proxy as the lexical scope.
2441
+ // Wrapping in a with-block on the proxy makes bare reads/writes go
2442
+ // through it (so foo = bar triggers signal.set()) instead of treating
2443
+ // each state key as a local function parameter \u2014 bare assignments
2444
+ // would otherwise just rebind the local and never reach the signal.
2445
+ var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
2446
+ fn.call(ctxProxy, $event, $el);
2444
2447
  } catch (e) {
2445
2448
  console.warn('[stx-reactive] execute error:', e);
2446
2449
  }
@@ -2449,33 +2452,33 @@ window.__stx_reactive = (function() {
2449
2452
 
2450
2453
  return { initScope: initScope, reactive: reactive };
2451
2454
  })();
2452
- `}function hQ($){if($.length===0)return"";let Z=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),Q=JSON.stringify(J.stateExpr),X=J.initExpr?JSON.stringify(J.initExpr):"null";return`
2455
+ `}function o6($,Z){let J=$.replace(/\{!!([\s\S]*?)!!\}/g,(Y,Q)=>{try{let X=y0(Q,Z,!0);if(X===void 0)return Y;return String(X)}catch{return Y}});return J=J.replace(/\{\{([\s\S]*?)\}\}/g,(Y,Q)=>{try{let X=y0(Q,Z,!0);if(X===void 0)return Y;return JSON.stringify(X)}catch{return Y}}),J}function mQ($,Z){if($.length===0)return"";let J=$.map((Y)=>{let Q=JSON.stringify(Object.fromEntries(Y.refs)),X=o6(Y.stateExpr,Z),G=Y.initExpr?o6(Y.initExpr,Z):null,K=JSON.stringify(X),q=G?JSON.stringify(G):"null";return`
2453
2456
  (function() {
2454
- var scopeEl = document.querySelector('${J.selector}');
2457
+ var scopeEl = document.querySelector('${Y.selector}');
2455
2458
  if (!scopeEl) return;
2456
- var refs = ${Y};
2457
- __stx_reactive.initScope(scopeEl, ${Q}, [], refs, ${X});
2459
+ var refs = ${Q};
2460
+ __stx_reactive.initScope(scopeEl, ${K}, [], refs, ${q});
2458
2461
  })();`}).join(`
2459
2462
  `);return`
2460
2463
  <script data-stx-scoped data-stx-reactive>
2461
- ${gQ()}
2462
- ${Z}
2463
- </script>`}function s6($,Z,J){if(o6=0,!mQ($))return $;let Y=PQ($);if(Y.length===0)return $;let Q=dQ($,Y),X=hQ(Y),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+X+`
2464
- `+Q.slice(G);else Q+=X;return Q}function dQ($,Z){let J=$;for(let Y of Z){let X=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${K9(Y.stateExpr)}["']`,"gi").exec(J);if(X)Y.id=X[1],Y.selector=`[data-stx-scope="${Y.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${K9(Y.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(J);if(K)Y.id=K[1],Y.selector=`[data-stx-scope="${Y.id}"]`;else J=J.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${K9(Y.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${Y.id}" $2$3$4`),J=J.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${K9(Y.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${Y.id}" $2$3$4`)}}return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),J=J.replace(/\s*x-init\s*=\s*'[^']*'/g,""),J}function mQ($){return/x-data\s*=\s*["']/.test($)}var o6=0,CQ=0;import uQ from"fs";import i$ from"path";import{createHighlighter as pQ}from"ts-syntax-highlighter";async function lQ($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let Y=(await uQ.promises.stat($)).mtime.getTime();if(Z.cache&&n$.has($)){let U=n$.get($);if(U.updatedAt>=Y)return{content:U.content,data:U.data}}let Q=await Bun.file($).text(),{data:X,content:G}=R7(Q),K=Z.markdown||m$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},z=n1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)z=await cQ(z,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:z,data:X||{}};if(Z.cache)n$.set($,{...W,updatedAt:Y});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let Y=J instanceof Error?J.message:String(J);return{content:X0("Markdown File",`Error reading/parsing markdown file: ${Y}`,$,"",0,""),data:{}}}}async function cQ($,Z,J){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!q9)try{q9=await pQ({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,z,W)=>{let U=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),_=z||(J?"text":"");if(!_)return K;try{if(!q9.getSupportedLanguages().includes(_))return K;return(await q9.highlight(U,_,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${z}:`,j)}return K},X=$,G=$.matchAll(Y);for(let K of G){let[q,z,W,U]=K,_=await Q(q,z,W,U);X=X.replace(q,_)}return X}async function r6($,Z,J="",Y={}){return await iQ($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,z)=>{try{let W=K;if(!i$.isAbsolute(K))W=i$.resolve(i$.dirname(J),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let H=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of H){let A=V.indexOf(":");if(A>0){let w=V.substring(0,A).trim(),N=V.substring(A+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(R||T)N=N.substring(1,N.length-1);U[w]=N}}}}catch(L){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:_,data:j}=await lQ(W,Y),B={...Z,...j,...U},O=_,F=/\{\{([^}]+)\}\}/g;return O=O.replace(F,(L,H)=>{let V=H.trim();return B[V]!==void 0?String(B[V]):L}),O}catch(W){let U=W instanceof Error?W.message:String(W);return X0("Markdown File",`Error including markdown file: ${U}`,J,$,z,G)}})}async function iQ($,Z,J){let Y=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,z=Q;Y.push(J(...z).then((W)=>({match:K,replacement:W,index:q})))}let X=await Promise.all(Y);X.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of X)G=G.replace(K,()=>q);return G}var n$,q9=null;var a6=C(()=>{Q5();A0();n$=new Map});function Z1($,Z){try{let J=$.trim();if(t(J))return e(J,Object.keys(Z))(...Object.values(Z));else return J0(J,Z)}catch{return!1}}var t6=C(()=>{R0()});function Y1($,Z){let J=nQ($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function nQ($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let Y=D0($,"(",")",J);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,Y),endPos:Y+1}}function F1($,Z,J,Y){let Q=1,X=Y,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${J}(?![a-z])`,"g");while(X<$.length&&Q>0){G.lastIndex=X,K.lastIndex=X;let q=G.exec($),z=K.exec($),W=q?q.index:1/0,U=z?z.index:1/0;if(W<U)Q++,X=W+q[0].length;else if(U<1/0){if(Q--,Q===0)return U;X=U+z[0].length}else break}return-1}function e6($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let Y=Z+J[0].length,Q=Y1($,Y);if(!Q)return null;let X=Q.endPos,G=F1($,"if","endif",X);if(G===-1)return null;let K=$.slice(X,G),q=[],z=0,W="if",U=Q.expression,_=0,j=0;while(z<K.length){let B=K.indexOf("@",z);if(B===-1)break;z=B;let O=K.substring(B);if(/^@if\s*\(/.test(O)){j++,z++;continue}if(/^@endif(?![a-z])/.test(O)){j--,z+=6;continue}if(j===0){let F=O.match(/^@elseif\s*/);if(F){q.push({type:W,condition:U,content:K.substring(_,z),start:X+_,end:X+z});let L=z+F[0].length,H=Y1(K,L);if(!H){z++;continue}W="elseif",U=H.expression,z=H.endPos,_=z;continue}else if(/^@else(?![a-z])/.test(O)){q.push({type:W,condition:U,content:K.substring(_,z),start:X+_,end:X+z}),W="else",U=void 0,z+=5,_=z;continue}}z++}return q.push({type:W,condition:U,content:K.slice(_),start:X+_,end:X+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function o$($){let Z=[],J=/@if\s*\(/g,Y=J.exec($);while(Y!==null){if(Z.some((G)=>Y.index>G.start&&Y.index<G.end)){Y=J.exec($);continue}let X=e6($,Y.index);if(X)Z.push(X),J.lastIndex=X.end;Y=J.exec($)}return Z}function W9($,Z,J){let Y=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),X=Q.exec($);while(X!==null){if(Y.some((O)=>X.index>O.start&&X.index<O.end)){X=Q.exec($);continue}let K=X.index,q=K+X[0].length-1,z=D0($,"(",")",q);if(z===-1){X=Q.exec($);continue}let W=$.slice(q+1,z),U=z+1,_=F1($,Z,J,U);if(_===-1){X=Q.exec($);continue}let j=$.slice(U,_),B=_+`@${J}`.length;Y.push({fullMatch:$.slice(K,B),name:Z,params:W,content:j,start:K,end:B}),Q.lastIndex=B,X=Q.exec($)}return Y}function s$($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let Y=Z+J[0].length,Q=Y1($,Y);if(!Q)return null;let X=Q.endPos,G=F1($,"switch","endswitch",X);if(G===-1)return null;let K=$.slice(X,G),q=[],z=0,W=null,U=0;while(z<K.length){let _=K.slice(z),j=_.match(/^@switch\s*\(/),B=_.match(/^@endswitch(?![a-z])/);if(j){if(U++,W)W.content+=j[0];z+=j[0].length;continue}if(B){if(U--,W)W.content+=B[0];z+=B[0].length;continue}if(U>0){if(W)W.content+=K[z];z++;continue}let O=_.match(/^@case\s*/),F=_.match(/^@default(?![a-z])/),L=_.match(/^@break(?![a-z])/);if(O&&_.startsWith("@case")){if(W)q.push(W);let H=z+O[0].length,V=Y1(K,H);if(!V){z++;continue}W={type:"case",value:V.expression,content:""},z=V.endPos}else if(F&&_.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},z+=F[0].length}else if(L&&_.startsWith("@break"))z+=L[0].length;else{if(W)W.content+=K[z];z++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var $2=()=>{};var Z2=()=>{};var r$=C(()=>{$2();Z2()});function aQ($,Z,J){let Y=$,Q=!0;while(Q){Q=!1;let X=Y.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=s$(Y,G);if(!K)break;try{let q;if(t(K.expression))q=e(K.expression,Object.keys(Z))(...Object.values(Z));else q=J0(K.expression,Z);let z="",W=!1;for(let U of K.cases)if(U.type==="default"){if(!W)z=U.content.trim()}else try{let _;if(U.value&&t(U.value))_=e(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)_=J0(U.value,Z);if(q===_){z=U.content.trim(),W=!0;break}}catch{continue}Y=Y.substring(0,G)+z+Y.substring(K.end),Q=!0}catch(q){let z=q instanceof Error?q.message:String(q),W=s("Switch",`Error evaluating @switch expression: ${z}`,p.EVALUATION_ERROR);Y=Y.substring(0,G)+W+Y.substring(K.end);break}}return Y}function V1($,Z,J){let Y=$;Y=aQ(Y,Z,J);{let X=!0;while(X){X=!1;let G=Y.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=Y1(Y,K+7);if(!q)break;let z=q.endPos,W=F1(Y,"unless","endunless",z);if(W===-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=Y.slice(z,W),_=q.expression,j=-1;{let O=0,F=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,H=/@else(?![a-z])/g,V=[],A;while((A=F.exec(U))!==null)V.push({pos:A.index,type:"open"});while((A=L.exec(U))!==null)V.push({pos:A.index,type:"close"});while((A=H.exec(U))!==null)V.push({pos:A.index,type:"else"});V.sort((w,N)=>w.pos-N.pos);for(let w of V)if(w.type==="open")O++;else if(w.type==="close")O--;else if(w.type==="else"&&O===0){j=w.pos;break}}let B;if(j!==-1){let O=U.slice(0,j),F=U.slice(j+5);B=`@if (${_})${F}@else ${O}@endif`}else B=`@if (!(${_}))${U}@endif`;Y=Y.substring(0,K)+B+Y.substring(W+10),X=!0}}Y=t$(Y,Z,J),Y=e$(Y,Z,J),Y=a$(Y,Z);let Q=()=>{let X=o$(Y);if(X.length===0)return!1;for(let G=X.length-1;G>=0;G--){let K=X[G];try{let q="",z=!1;for(let W of K.branches){if(z)break;if(W.type==="else")q=W.content,z=!0;else try{let U;if(W.condition&&t(W.condition))U=e(W.condition,Object.keys(Z))(...Object.values(Z));else if(W.condition)U=J0(W.condition,Z);if(U)q=W.content,z=!0}catch(U){q=s(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${U instanceof Error?U.message:String(U)}`,p.EVALUATION_ERROR),z=!0}}Y=Y.substring(0,K.start)+q+Y.substring(K.end)}catch(q){let z=q instanceof Error?q.message:String(q),W=s("If",`Error processing @if block: ${z}`,p.EVALUATION_ERROR);Y=Y.substring(0,K.start)+W+Y.substring(K.end)}}return!0};while(Q());return Y}function Y2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let Y=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){Y.push($[Z+1]),Z+=2;continue}if(Q===J){Z++;break}Y.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:Y.join(""),consumed:Z}}function a$($,Z){let J=$;function Y(K,q,z,W){let U=1,_=W,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${z}(?![a-z])`,"g");while(_<K.length&&U>0){j.lastIndex=_,B.lastIndex=_;let O=j.exec(K),F=B.exec(K),L=O?O.index:1/0,H=F?F.index:1/0;if(L<H)U++,_=L+O[0].length;else if(H<1/0){if(U--,U===0)return H;_=H+F[0].length}else break}return-1}function Q(K,q,z){let W=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${z}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],O;while((O=U.exec(K))!==null)B.push({pos:O.index,type:"open"});while((O=_.exec(K))!==null)B.push({pos:O.index,type:"close"});while((O=j.exec(K))!==null)B.push({pos:O.index,type:"else"});B.sort((F,L)=>F.pos-L.pos);for(let F of B)if(F.type==="open")W++;else if(F.type==="close")W--;else if(F.type==="else"&&W===0)return F.pos;return-1}{let K=!0;while(K){K=!1;let q=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let z=q.index,W,U,_=J.slice(z+5),j=Y2(_);if(j)W=j.value,U=z+5+j.consumed;else U=z+5;let B=Y(J,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${z} has no matching @endauth \u2014 the block was skipped.`);break}let O=J.slice(U,B),F=Q(O,"auth","endauth"),L;if(!Z.auth)L=!1;else L=W?Z1(`auth?.check && auth?.user?.[${W}]`,Z):Z1("auth?.check",Z);let H;if(F!==-1){let V=O.slice(0,F),A=O.slice(F+5);H=L?V:A}else H=L?O:"";J=J.substring(0,z)+H+J.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let q=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let z=q.index,W,U,_=J.slice(z+6),j=Y2(_);if(j)W=j.value,U=z+6+j.consumed;else U=z+6;let B=Y(J,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${z} has no matching @endguest \u2014 the block was skipped.`);break}let O=J.slice(U,B),F=Q(O,"guest","endguest"),L;if(!Z.auth)L=!0;else L=W?Z1(`!auth?.check || !auth?.user?.[${W}]`,Z):Z1("!auth?.check",Z);let H;if(F!==-1){let V=O.slice(0,F),A=O.slice(F+5);H=L?V:A}else H=L?O:"";J=J.substring(0,z)+H+J.substring(B+9),K=!0}}function X(K,q,z){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[K];if(q)W.push(q);if(z){let U=Z1(z,Z);W.push(U)}return Z.permissions.check(...W)}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}`,z=K==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let U=J.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let _=U.index,j=J.slice(_+`@${K}`.length),B=G(j);if(!B)break;let O=_+`@${K}`.length+B.paramsEnd,F=Y(J,K,q,O);if(F===-1){console.warn(`[stx] @${K} directive at position ${_} has no matching @${q} \u2014 the block was skipped.`);break}let L=J.slice(O,F),H=[],V=0,A=new RegExp(`@${K}\\s*\\(`,"g"),w=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${z}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],I;while((I=A.exec(L))!==null)T.push({pos:I.index,type:"open"});while((I=w.exec(L))!==null)T.push({pos:I.index,type:"close"});while((I=N.exec(L))!==null)T.push({pos:I.index,type:"elseDirective"});while((I=R.exec(L))!==null)T.push({pos:I.index,type:"else"});T.sort((b,D)=>b.pos-D.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)H.push(b)}let M=[],E=0;for(let b=0;b<H.length;b++){let D=H[b];if(M.push({content:L.slice(E,D.pos),ability:void 0}),D.type==="elseDirective"){let x=L.slice(D.pos+`@${z}`.length),h=G(x);if(h){M[M.length-1]={content:L.slice(E,D.pos)},E=D.pos+`@${z}`.length+h.paramsEnd,M.push({content:"",ability:h.ability,type:h.type,id:h.id}),M.pop();let i=H[b+1],U0=i?i.pos:L.length;M.push({content:L.slice(E,U0),ability:h.ability,type:h.type,id:h.id}),E=U0}}else E=D.pos+5}if(E<L.length){let b=M[M.length-1];if(H.length>0&&H[H.length-1].type==="else")M.push({content:L.slice(E),isFinalElse:!0});else if(M.length===0)M.push({content:L.slice(E)})}let k=X(B.ability,B.type,B.id),y=K==="can"?k:!k,S="";if(y)S=M[0]?.content||"";else{let b=!1;for(let D=1;D<M.length;D++){let x=M[D];if(x.isFinalElse){S=x.content,b=!0;break}if(x.ability){let h=X(x.ability,x.type,x.id);if(K==="can"?h:!h){S=x.content,b=!0;break}}}if(!b&&M.length>0){let D=M[M.length-1];if(D.isFinalElse)S=D.content}}J=J.substring(0,_)+S+J.substring(F+`@${q}`.length),W=!0}}return J}function t$($,Z,J){let Y=$;function Q(X,G,K,q,z){let W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\s*\\(`),_=X.match(U);if(!_||_.index===void 0)break;let j=_.index,B=Y1(X,j+`@${G}`.length);if(!B)break;let O=B.endPos,F=F1(X,G,K,O);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let L=X.slice(O,F),H=B.expression,V=-1,A=0,w=0;while(w<L.length){let N=L.indexOf("@",w);if(N===-1)break;let R=L.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){A++,w=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){A--,w=N+1;continue}if(A===0&&/^@else(?![a-z])/.test(R)){V=N;break}w=N+1}try{let N=q(H.trim()),R;if(V!==-1){let T=L.slice(0,V),I=L.slice(V+5);R=N?T:I}else R=N?L:"";X=X.substring(0,j)+R+X.substring(F+`@${K}`.length),W=!0}catch(N){let R=N instanceof Error?N.message:String(N),T=s(z,`Error processing @${G} directive: ${R}`,p.EVALUATION_ERROR);X=X.substring(0,j)+T+X.substring(F+`@${K}`.length);break}}return X}return Y=Q(Y,"isset","endisset",(X)=>{let G=Z1(X,Z);return G!==void 0&&G!==null},"Isset"),Y=Q(Y,"empty","endempty",(X)=>{let G=Z1(X,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),Y}function e$($,Z,J){let Y=$,Q="development";function X(G,K,q,z){let W=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),_=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,O=!0;while(O){O=!1,W.lastIndex=0;let F=W.exec(B);if(!F)break;let L=F.index,H=L+F[0].length;if(K==="env"){let k=B.substring(H).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!k)break;H+=k[0].length,z=Q===k[2]}let V=1,A=H,w=-1;while(V>0&&A<B.length){W.lastIndex=A,U.lastIndex=A;let k=W.exec(B),y=U.exec(B),S=k?k.index:1/0,b=y?y.index:1/0;if(S<b)V++,A=S+k[0].length;else if(b<1/0){if(V--,V===0){w=b;break}A=b+y[0].length}else break}if(w===-1){console.warn(`[stx] @${K} directive at position ${L} has no matching @${q} \u2014 the block was skipped.`);break}let N=B.substring(H,w),R=-1,T=0,I=0;while(I<N.length){let k=N.indexOf("@",I);if(k===-1)break;let y=N.substring(k);if(_.test(y)){T++,I=k+1;continue}if(j.test(y)){T--,I=k+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){R=k;break}I=k+1}let M;if(R!==-1){let k=N.slice(0,R),y=N.slice(R+5);M=z?k:y}else M=z?N:"";let E=`@${q}`.length;B=B.substring(0,L)+M+B.substring(w+E),O=!0}return B}return Y=X(Y,"env","endenv",!1),Y=X(Y,"production","endproduction",Q==="production"),Y=X(Y,"development","enddevelopment",Q==="development"),Y=X(Y,"staging","endstaging",Q==="staging"),Y=X(Y,"testing","endtesting",Q==="testing"),Y}var z9=C(()=>{t6();n0();r$();R0()});function X2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function U9($,Z){if(!$)return Z?.nonceGenerator?.()??X2();let J=J2.get($);if(!J)J=Z?.nonceGenerator?.()??X2(),J2.set($,J);return J}function tQ($,Z){let J=[];for(let[Y,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)J.push(Y);continue}if(Array.isArray(Q)){let X=[...Q];if(Z&&(Y==="script-src"||Y==="style-src"))X=X.filter((G)=>!G.startsWith("'nonce-")),X.push(`'nonce-${Z}'`);if(X.length>0)J.push(`${Y} ${X.join(" ")}`)}}return J.join("; ")}function Q2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${tQ($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function G2($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=Z.useNonce?U9(J,Z):void 0,Q=Q2(Z.directives,Y);return $.replace(/<head([^>]*)>/,`<head$1>
2465
- ${Q}`)}function K2($,Z,J,Y){let Q=$,X=Y.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!X?.enabled||!X.directives)return"<!-- CSP not configured -->";let G=X.useNonce?U9(Z,X):void 0;return Q2(X.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return U9(Z,X)}),X?.enabled&&X.useNonce)Z.cspNonce=U9(Z,X);return Q}var J2;var q2=C(()=>{J2=new WeakMap});import eQ from"crypto";function ZG($=$G){let Z=eQ.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return $4=Z,Z}function YG(){if(!$4)ZG();return $4}function JG($=W2){let Z=YG();return`<input type="hidden" name="${$}" value="${Z}">`}function z2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,Y)=>{return JG(Y||W2)})}var $G=40,W2="_token",$4=null;var U2=()=>{};async function _2($,Z,J,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return $;let Q=$;for(let X of Y.customDirectives){if(!X.name||typeof X.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",X);continue}if(X.hasEndTag)Q=await XG(Q,X,Z,J,Y);else Q=await QG(Q,X,Z,J,Y)}return Q}async function XG($,Z,J,Y,Q){let{name:X,handler:G}=Z,K=`@${X}`,q=`@end${X}`,z=$,W=D1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],_=W.exec(z);while(_!==null){let[j,B="",O=""]=_,F=_.index||0;try{let L=B?B2(B):[],H=O.trim(),V=await G(H,L,J,Y);U.push({original:j,processed:V,startIndex:F})}catch(L){let H=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${X}:`,L);U.push({original:j,processed:s("CustomDirective",`Error in @${X}${B?`(${B})`:""}: ${H}`,p.EVALUATION_ERROR),startIndex:F})}_=W.exec(z)}for(let j=U.length-1;j>=0;j--){let{original:B,processed:O}=U[j];z=z.replace(B,O)}return z}async function QG($,Z,J,Y,Q){let{name:X,handler:G}=Z,K=$,q=D1(`@${X}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),z=[],W=q.exec(K);while(W!==null){let[j,B=""]=W,O=W.index||0;try{let F=B2(B),L=await G("",F,J,Y);z.push({original:j,processed:L,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${X}:`,F);z.push({original:j,processed:s("CustomDirective",`Error in @${X}(${B}): ${L}`,p.EVALUATION_ERROR),startIndex:O})}W=q.exec(K)}let U=D1(`@${X}(?!\\w)(?!\\s*\\()`,"g"),_=U.exec(K);while(_!==null){let[j]=_,B=_.index||0;try{let O=await G("",[],J,Y);z.push({original:j,processed:O,startIndex:B})}catch(O){let F=O instanceof Error?O.message:String(O);if(Q.debug)console.error(`Error processing custom directive @${X}:`,O);z.push({original:j,processed:s("CustomDirective",`Error in @${X}: ${F}`,p.EVALUATION_ERROR),startIndex:B})}_=U.exec(K)}for(let j=z.length-1;j>=0;j--){let{original:B,processed:O}=z[j];K=K.replace(B,O)}return K}function B2($){if(!$.trim())return[];let Z=[],J="",Y=!1,Q="";for(let X=0;X<$.length;X++){let G=$[X];if((G==='"'||G==="'")&&(X===0||$[X-1]!=="\\"))if(!Y)Y=!0,Q=G;else if(G===Q)Y=!1;else J+=G;else if(G===","&&!Y)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((X)=>{let G=X.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var j2=C(()=>{n0();E1()});import GG from"crypto";function V0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function _9($,Z,J,Y){let Q=$||Z;return J?`${Q} ${Y}`:Q}function KG(){return GG.randomUUID()}function B9($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let Y=KG();Z.csrf={token:Y}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${V0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,Q)=>{let X=Q.toUpperCase();if(Q&&!["GET","POST"].includes(X))return`<input type="hidden" name="_method" value="${V0(X)}">`;return Y}),J}function L2($,Z,J=H2){let Y=$;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,X,G,K,q,z="")=>{let W=X||G||"POST",U=K||q||"",_=J1(z),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",O=`<form method="${V0(B)}" action="${V0(U)}"${_?` ${_}`:""}>`;if(O+=`
2464
+ ${dQ()}
2465
+ ${J}
2466
+ </script>`}function r6($,Z,J){if(s6=0,!pQ($))return $;let Y=xQ($);if(Y.length===0)return $;let Q=uQ($,Y),X=mQ(Y,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+X+`
2467
+ `+Q.slice(G);else Q+=X;return Q}function uQ($,Z){let J=$;for(let Y of Z){let X=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${K9(Y.stateExpr)}["']`,"gi").exec(J);if(X)Y.id=X[1],Y.selector=`[data-stx-scope="${Y.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${K9(Y.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(J);if(K)Y.id=K[1],Y.selector=`[data-stx-scope="${Y.id}"]`;else J=J.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${K9(Y.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${Y.id}" $2$3$4`),J=J.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${K9(Y.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${Y.id}" $2$3$4`)}}return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),J=J.replace(/\s*x-init\s*=\s*'[^']*'/g,""),J}function pQ($){return/x-data\s*=\s*["']/.test($)}var s6=0,vQ=0;var a6=C(()=>{n0()});import lQ from"fs";import i$ from"path";import{createHighlighter as cQ}from"ts-syntax-highlighter";async function iQ($,Z={}){try{if(!await l($))throw Error(`Markdown file not found: ${$}`);let Y=(await lQ.promises.stat($)).mtime.getTime();if(Z.cache&&n$.has($)){let U=n$.get($);if(U.updatedAt>=Y)return{content:U.content,data:U.data}}let Q=await Bun.file($).text(),{data:X,content:G}=R7(Q),K=Z.markdown||m$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},z=n1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)z=await nQ(z,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:z,data:X||{}};if(Z.cache)n$.set($,{...W,updatedAt:Y});return W}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let Y=J instanceof Error?J.message:String(J);return{content:X0("Markdown File",`Error reading/parsing markdown file: ${Y}`,$,"",0,""),data:{}}}}async function nQ($,Z,J){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!q9)try{q9=await cQ({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,z,W)=>{let U=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),_=z||(J?"text":"");if(!_)return K;try{if(!q9.getSupportedLanguages().includes(_))return K;return(await q9.highlight(U,_,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${z}:`,j)}return K},X=$,G=$.matchAll(Y);for(let K of G){let[q,z,W,U]=K,_=await Q(q,z,W,U);X=X.replace(q,_)}return X}async function t6($,Z,J="",Y={}){return await oQ($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,z)=>{try{let W=K;if(!i$.isAbsolute(K))W=i$.resolve(i$.dirname(J),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let H=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of H){let A=V.indexOf(":");if(A>0){let w=V.substring(0,A).trim(),N=V.substring(A+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(R||T)N=N.substring(1,N.length-1);U[w]=N}}}}catch(L){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:_,data:j}=await iQ(W,Y),B={...Z,...j,...U},O=_,F=/\{\{([^}]+)\}\}/g;return O=O.replace(F,(L,H)=>{let V=H.trim();return B[V]!==void 0?String(B[V]):L}),O}catch(W){let U=W instanceof Error?W.message:String(W);return X0("Markdown File",`Error including markdown file: ${U}`,J,$,z,G)}})}async function oQ($,Z,J){let Y=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,z=Q;Y.push(J(...z).then((W)=>({match:K,replacement:W,index:q})))}let X=await Promise.all(Y);X.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of X)G=G.replace(K,()=>q);return G}var n$,q9=null;var e6=C(()=>{Q5();A0();n$=new Map});function Z1($,Z){try{let J=$.trim();if(t(J))return e(J,Object.keys(Z))(...Object.values(Z));else return J0(J,Z)}catch{return!1}}var $2=C(()=>{R0()});function Y1($,Z){let J=sQ($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function sQ($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let Y=D0($,"(",")",J);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,Y),endPos:Y+1}}function F1($,Z,J,Y){let Q=1,X=Y,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${J}(?![a-z])`,"g");while(X<$.length&&Q>0){G.lastIndex=X,K.lastIndex=X;let q=G.exec($),z=K.exec($),W=q?q.index:1/0,U=z?z.index:1/0;if(W<U)Q++,X=W+q[0].length;else if(U<1/0){if(Q--,Q===0)return U;X=U+z[0].length}else break}return-1}function Z2($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let Y=Z+J[0].length,Q=Y1($,Y);if(!Q)return null;let X=Q.endPos,G=F1($,"if","endif",X);if(G===-1)return null;let K=$.slice(X,G),q=[],z=0,W="if",U=Q.expression,_=0,j=0;while(z<K.length){let B=K.indexOf("@",z);if(B===-1)break;z=B;let O=K.substring(B);if(/^@if\s*\(/.test(O)){j++,z++;continue}if(/^@endif(?![a-z])/.test(O)){j--,z+=6;continue}if(j===0){let F=O.match(/^@elseif\s*/);if(F){q.push({type:W,condition:U,content:K.substring(_,z),start:X+_,end:X+z});let L=z+F[0].length,H=Y1(K,L);if(!H){z++;continue}W="elseif",U=H.expression,z=H.endPos,_=z;continue}else if(/^@else(?![a-z])/.test(O)){q.push({type:W,condition:U,content:K.substring(_,z),start:X+_,end:X+z}),W="else",U=void 0,z+=5,_=z;continue}}z++}return q.push({type:W,condition:U,content:K.slice(_),start:X+_,end:X+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function o$($){let Z=[],J=/@if\s*\(/g,Y=J.exec($);while(Y!==null){if(Z.some((G)=>Y.index>G.start&&Y.index<G.end)){Y=J.exec($);continue}let X=Z2($,Y.index);if(X)Z.push(X),J.lastIndex=X.end;Y=J.exec($)}return Z}function W9($,Z,J){let Y=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),X=Q.exec($);while(X!==null){if(Y.some((O)=>X.index>O.start&&X.index<O.end)){X=Q.exec($);continue}let K=X.index,q=K+X[0].length-1,z=D0($,"(",")",q);if(z===-1){X=Q.exec($);continue}let W=$.slice(q+1,z),U=z+1,_=F1($,Z,J,U);if(_===-1){X=Q.exec($);continue}let j=$.slice(U,_),B=_+`@${J}`.length;Y.push({fullMatch:$.slice(K,B),name:Z,params:W,content:j,start:K,end:B}),Q.lastIndex=B,X=Q.exec($)}return Y}function s$($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let Y=Z+J[0].length,Q=Y1($,Y);if(!Q)return null;let X=Q.endPos,G=F1($,"switch","endswitch",X);if(G===-1)return null;let K=$.slice(X,G),q=[],z=0,W=null,U=0;while(z<K.length){let _=K.slice(z),j=_.match(/^@switch\s*\(/),B=_.match(/^@endswitch(?![a-z])/);if(j){if(U++,W)W.content+=j[0];z+=j[0].length;continue}if(B){if(U--,W)W.content+=B[0];z+=B[0].length;continue}if(U>0){if(W)W.content+=K[z];z++;continue}let O=_.match(/^@case\s*/),F=_.match(/^@default(?![a-z])/),L=_.match(/^@break(?![a-z])/);if(O&&_.startsWith("@case")){if(W)q.push(W);let H=z+O[0].length,V=Y1(K,H);if(!V){z++;continue}W={type:"case",value:V.expression,content:""},z=V.endPos}else if(F&&_.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},z+=F[0].length}else if(L&&_.startsWith("@break"))z+=L[0].length;else{if(W)W.content+=K[z];z++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var Y2=()=>{};var J2=()=>{};var r$=C(()=>{Y2();J2()});function eQ($,Z,J){let Y=$,Q=!0;while(Q){Q=!1;let X=Y.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=s$(Y,G);if(!K)break;try{let q;if(t(K.expression))q=e(K.expression,Object.keys(Z))(...Object.values(Z));else q=J0(K.expression,Z);let z="",W=!1;for(let U of K.cases)if(U.type==="default"){if(!W)z=U.content.trim()}else try{let _;if(U.value&&t(U.value))_=e(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)_=J0(U.value,Z);if(q===_){z=U.content.trim(),W=!0;break}}catch{continue}Y=Y.substring(0,G)+z+Y.substring(K.end),Q=!0}catch(q){let z=q instanceof Error?q.message:String(q),W=s("Switch",`Error evaluating @switch expression: ${z}`,u.EVALUATION_ERROR);Y=Y.substring(0,G)+W+Y.substring(K.end);break}}return Y}function V1($,Z,J){let Y=$;Y=eQ(Y,Z,J);{let X=!0;while(X){X=!1;let G=Y.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=Y1(Y,K+7);if(!q)break;let z=q.endPos,W=F1(Y,"unless","endunless",z);if(W===-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=Y.slice(z,W),_=q.expression,j=-1;{let O=0,F=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,H=/@else(?![a-z])/g,V=[],A;while((A=F.exec(U))!==null)V.push({pos:A.index,type:"open"});while((A=L.exec(U))!==null)V.push({pos:A.index,type:"close"});while((A=H.exec(U))!==null)V.push({pos:A.index,type:"else"});V.sort((w,N)=>w.pos-N.pos);for(let w of V)if(w.type==="open")O++;else if(w.type==="close")O--;else if(w.type==="else"&&O===0){j=w.pos;break}}let B;if(j!==-1){let O=U.slice(0,j),F=U.slice(j+5);B=`@if (${_})${F}@else ${O}@endif`}else B=`@if (!(${_}))${U}@endif`;Y=Y.substring(0,K)+B+Y.substring(W+10),X=!0}}Y=t$(Y,Z,J),Y=e$(Y,Z,J),Y=a$(Y,Z);let Q=()=>{let X=o$(Y);if(X.length===0)return!1;for(let G=X.length-1;G>=0;G--){let K=X[G];try{let q="",z=!1;for(let W of K.branches){if(z)break;if(W.type==="else")q=W.content,z=!0;else try{let U;if(W.condition&&t(W.condition))U=e(W.condition,Object.keys(Z))(...Object.values(Z));else if(W.condition)U=J0(W.condition,Z);if(U)q=W.content,z=!0}catch(U){q=s(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${U instanceof Error?U.message:String(U)}`,u.EVALUATION_ERROR),z=!0}}Y=Y.substring(0,K.start)+q+Y.substring(K.end)}catch(q){let z=q instanceof Error?q.message:String(q),W=s("If",`Error processing @if block: ${z}`,u.EVALUATION_ERROR);Y=Y.substring(0,K.start)+W+Y.substring(K.end)}}return!0};while(Q());return Y}function X2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let Y=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){Y.push($[Z+1]),Z+=2;continue}if(Q===J){Z++;break}Y.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:Y.join(""),consumed:Z}}function a$($,Z){let J=$;function Y(K,q,z,W){let U=1,_=W,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${z}(?![a-z])`,"g");while(_<K.length&&U>0){j.lastIndex=_,B.lastIndex=_;let O=j.exec(K),F=B.exec(K),L=O?O.index:1/0,H=F?F.index:1/0;if(L<H)U++,_=L+O[0].length;else if(H<1/0){if(U--,U===0)return H;_=H+F[0].length}else break}return-1}function Q(K,q,z){let W=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${z}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],O;while((O=U.exec(K))!==null)B.push({pos:O.index,type:"open"});while((O=_.exec(K))!==null)B.push({pos:O.index,type:"close"});while((O=j.exec(K))!==null)B.push({pos:O.index,type:"else"});B.sort((F,L)=>F.pos-L.pos);for(let F of B)if(F.type==="open")W++;else if(F.type==="close")W--;else if(F.type==="else"&&W===0)return F.pos;return-1}{let K=!0;while(K){K=!1;let q=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let z=q.index,W,U,_=J.slice(z+5),j=X2(_);if(j)W=j.value,U=z+5+j.consumed;else U=z+5;let B=Y(J,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${z} has no matching @endauth \u2014 the block was skipped.`);break}let O=J.slice(U,B),F=Q(O,"auth","endauth"),L;if(!Z.auth)L=!1;else L=W?Z1(`auth?.check && auth?.user?.[${W}]`,Z):Z1("auth?.check",Z);let H;if(F!==-1){let V=O.slice(0,F),A=O.slice(F+5);H=L?V:A}else H=L?O:"";J=J.substring(0,z)+H+J.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let q=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let z=q.index,W,U,_=J.slice(z+6),j=X2(_);if(j)W=j.value,U=z+6+j.consumed;else U=z+6;let B=Y(J,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${z} has no matching @endguest \u2014 the block was skipped.`);break}let O=J.slice(U,B),F=Q(O,"guest","endguest"),L;if(!Z.auth)L=!0;else L=W?Z1(`!auth?.check || !auth?.user?.[${W}]`,Z):Z1("!auth?.check",Z);let H;if(F!==-1){let V=O.slice(0,F),A=O.slice(F+5);H=L?V:A}else H=L?O:"";J=J.substring(0,z)+H+J.substring(B+9),K=!0}}function X(K,q,z){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[K];if(q)W.push(q);if(z){let U=Z1(z,Z);W.push(U)}return Z.permissions.check(...W)}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}`,z=K==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let U=J.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let _=U.index,j=J.slice(_+`@${K}`.length),B=G(j);if(!B)break;let O=_+`@${K}`.length+B.paramsEnd,F=Y(J,K,q,O);if(F===-1){console.warn(`[stx] @${K} directive at position ${_} has no matching @${q} \u2014 the block was skipped.`);break}let L=J.slice(O,F),H=[],V=0,A=new RegExp(`@${K}\\s*\\(`,"g"),w=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${z}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],I;while((I=A.exec(L))!==null)T.push({pos:I.index,type:"open"});while((I=w.exec(L))!==null)T.push({pos:I.index,type:"close"});while((I=N.exec(L))!==null)T.push({pos:I.index,type:"elseDirective"});while((I=R.exec(L))!==null)T.push({pos:I.index,type:"else"});T.sort((b,D)=>b.pos-D.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)H.push(b)}let M=[],E=0;for(let b=0;b<H.length;b++){let D=H[b];if(M.push({content:L.slice(E,D.pos),ability:void 0}),D.type==="elseDirective"){let x=L.slice(D.pos+`@${z}`.length),h=G(x);if(h){M[M.length-1]={content:L.slice(E,D.pos)},E=D.pos+`@${z}`.length+h.paramsEnd,M.push({content:"",ability:h.ability,type:h.type,id:h.id}),M.pop();let i=H[b+1],U0=i?i.pos:L.length;M.push({content:L.slice(E,U0),ability:h.ability,type:h.type,id:h.id}),E=U0}}else E=D.pos+5}if(E<L.length){let b=M[M.length-1];if(H.length>0&&H[H.length-1].type==="else")M.push({content:L.slice(E),isFinalElse:!0});else if(M.length===0)M.push({content:L.slice(E)})}let k=X(B.ability,B.type,B.id),y=K==="can"?k:!k,S="";if(y)S=M[0]?.content||"";else{let b=!1;for(let D=1;D<M.length;D++){let x=M[D];if(x.isFinalElse){S=x.content,b=!0;break}if(x.ability){let h=X(x.ability,x.type,x.id);if(K==="can"?h:!h){S=x.content,b=!0;break}}}if(!b&&M.length>0){let D=M[M.length-1];if(D.isFinalElse)S=D.content}}J=J.substring(0,_)+S+J.substring(F+`@${q}`.length),W=!0}}return J}function t$($,Z,J){let Y=$;function Q(X,G,K,q,z){let W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\s*\\(`),_=X.match(U);if(!_||_.index===void 0)break;let j=_.index,B=Y1(X,j+`@${G}`.length);if(!B)break;let O=B.endPos,F=F1(X,G,K,O);if(F===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let L=X.slice(O,F),H=B.expression,V=-1,A=0,w=0;while(w<L.length){let N=L.indexOf("@",w);if(N===-1)break;let R=L.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){A++,w=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){A--,w=N+1;continue}if(A===0&&/^@else(?![a-z])/.test(R)){V=N;break}w=N+1}try{let N=q(H.trim()),R;if(V!==-1){let T=L.slice(0,V),I=L.slice(V+5);R=N?T:I}else R=N?L:"";X=X.substring(0,j)+R+X.substring(F+`@${K}`.length),W=!0}catch(N){let R=N instanceof Error?N.message:String(N),T=s(z,`Error processing @${G} directive: ${R}`,u.EVALUATION_ERROR);X=X.substring(0,j)+T+X.substring(F+`@${K}`.length);break}}return X}return Y=Q(Y,"isset","endisset",(X)=>{let G=Z1(X,Z);return G!==void 0&&G!==null},"Isset"),Y=Q(Y,"empty","endempty",(X)=>{let G=Z1(X,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),Y}function e$($,Z,J){let Y=$,Q="development";function X(G,K,q,z){let W=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),_=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,O=!0;while(O){O=!1,W.lastIndex=0;let F=W.exec(B);if(!F)break;let L=F.index,H=L+F[0].length;if(K==="env"){let k=B.substring(H).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!k)break;H+=k[0].length,z=Q===k[2]}let V=1,A=H,w=-1;while(V>0&&A<B.length){W.lastIndex=A,U.lastIndex=A;let k=W.exec(B),y=U.exec(B),S=k?k.index:1/0,b=y?y.index:1/0;if(S<b)V++,A=S+k[0].length;else if(b<1/0){if(V--,V===0){w=b;break}A=b+y[0].length}else break}if(w===-1){console.warn(`[stx] @${K} directive at position ${L} has no matching @${q} \u2014 the block was skipped.`);break}let N=B.substring(H,w),R=-1,T=0,I=0;while(I<N.length){let k=N.indexOf("@",I);if(k===-1)break;let y=N.substring(k);if(_.test(y)){T++,I=k+1;continue}if(j.test(y)){T--,I=k+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){R=k;break}I=k+1}let M;if(R!==-1){let k=N.slice(0,R),y=N.slice(R+5);M=z?k:y}else M=z?N:"";let E=`@${q}`.length;B=B.substring(0,L)+M+B.substring(w+E),O=!0}return B}return Y=X(Y,"env","endenv",!1),Y=X(Y,"production","endproduction",Q==="production"),Y=X(Y,"development","enddevelopment",Q==="development"),Y=X(Y,"staging","endstaging",Q==="staging"),Y=X(Y,"testing","endtesting",Q==="testing"),Y}var z9=C(()=>{$2();o0();r$();R0()});function G2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function U9($,Z){if(!$)return Z?.nonceGenerator?.()??G2();let J=Q2.get($);if(!J)J=Z?.nonceGenerator?.()??G2(),Q2.set($,J);return J}function $G($,Z){let J=[];for(let[Y,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)J.push(Y);continue}if(Array.isArray(Q)){let X=[...Q];if(Z&&(Y==="script-src"||Y==="style-src"))X=X.filter((G)=>!G.startsWith("'nonce-")),X.push(`'nonce-${Z}'`);if(X.length>0)J.push(`${Y} ${X.join(" ")}`)}}return J.join("; ")}function K2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${$G($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function q2($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=Z.useNonce?U9(J,Z):void 0,Q=K2(Z.directives,Y);return $.replace(/<head([^>]*)>/,`<head$1>
2468
+ ${Q}`)}function W2($,Z,J,Y){let Q=$,X=Y.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!X?.enabled||!X.directives)return"<!-- CSP not configured -->";let G=X.useNonce?U9(Z,X):void 0;return K2(X.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return U9(Z,X)}),X?.enabled&&X.useNonce)Z.cspNonce=U9(Z,X);return Q}var Q2;var z2=C(()=>{Q2=new WeakMap});import ZG from"crypto";function JG($=YG){let Z=ZG.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return $4=Z,Z}function XG(){if(!$4)JG();return $4}function QG($=U2){let Z=XG();return`<input type="hidden" name="${$}" value="${Z}">`}function _2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,Y)=>{return QG(Y||U2)})}var YG=40,U2="_token",$4=null;var B2=()=>{};async function j2($,Z,J,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return $;let Q=$;for(let X of Y.customDirectives){if(!X.name||typeof X.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",X);continue}if(X.hasEndTag)Q=await GG(Q,X,Z,J,Y);else Q=await KG(Q,X,Z,J,Y)}return Q}async function GG($,Z,J,Y,Q){let{name:X,handler:G}=Z,K=`@${X}`,q=`@end${X}`,z=$,W=D1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],_=W.exec(z);while(_!==null){let[j,B="",O=""]=_,F=_.index||0;try{let L=B?O2(B):[],H=O.trim(),V=await G(H,L,J,Y);U.push({original:j,processed:V,startIndex:F})}catch(L){let H=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${X}:`,L);U.push({original:j,processed:s("CustomDirective",`Error in @${X}${B?`(${B})`:""}: ${H}`,u.EVALUATION_ERROR),startIndex:F})}_=W.exec(z)}for(let j=U.length-1;j>=0;j--){let{original:B,processed:O}=U[j];z=z.replace(B,O)}return z}async function KG($,Z,J,Y,Q){let{name:X,handler:G}=Z,K=$,q=D1(`@${X}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),z=[],W=q.exec(K);while(W!==null){let[j,B=""]=W,O=W.index||0;try{let F=O2(B),L=await G("",F,J,Y);z.push({original:j,processed:L,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${X}:`,F);z.push({original:j,processed:s("CustomDirective",`Error in @${X}(${B}): ${L}`,u.EVALUATION_ERROR),startIndex:O})}W=q.exec(K)}let U=D1(`@${X}(?!\\w)(?!\\s*\\()`,"g"),_=U.exec(K);while(_!==null){let[j]=_,B=_.index||0;try{let O=await G("",[],J,Y);z.push({original:j,processed:O,startIndex:B})}catch(O){let F=O instanceof Error?O.message:String(O);if(Q.debug)console.error(`Error processing custom directive @${X}:`,O);z.push({original:j,processed:s("CustomDirective",`Error in @${X}: ${F}`,u.EVALUATION_ERROR),startIndex:B})}_=U.exec(K)}for(let j=z.length-1;j>=0;j--){let{original:B,processed:O}=z[j];K=K.replace(B,O)}return K}function O2($){if(!$.trim())return[];let Z=[],J="",Y=!1,Q="";for(let X=0;X<$.length;X++){let G=$[X];if((G==='"'||G==="'")&&(X===0||$[X-1]!=="\\"))if(!Y)Y=!0,Q=G;else if(G===Q)Y=!1;else J+=G;else if(G===","&&!Y)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.trim());return Z.map((X)=>{let G=X.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var H2=C(()=>{o0();E1()});import qG from"crypto";function V0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function _9($,Z,J,Y){let Q=$||Z;return J?`${Q} ${Y}`:Q}function WG(){return qG.randomUUID()}function B9($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let Y=WG();Z.csrf={token:Y}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${V0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,Q)=>{let X=Q.toUpperCase();if(Q&&!["GET","POST"].includes(X))return`<input type="hidden" name="_method" value="${V0(X)}">`;return Y}),J}function V2($,Z,J=F2){let Y=$;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,X,G,K,q,z="")=>{let W=X||G||"POST",U=K||q||"",_=J1(z),j=W.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",O=`<form method="${V0(B)}" action="${V0(U)}"${_?` ${_}`:""}>`;if(O+=`
2466
2469
  ${B9("@csrf",Z)}`,!["GET","POST"].includes(j))O+=`
2467
- ${B9(`@method('${j}')`,Z)}`;return O}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,X,G,K,q,z="")=>{let W=X||G||"",U=K||q||"",_=J1(z),j=q5(W,Z),B=j!==void 0&&j!==null?j:U||"",O=_.match(/type=['"]([^'"]+)['"]/i),F=O?O[1]:"text",L=W5(W,Z),H=_.match(/class=['"]([^'"]+)['"]/i),V=_9(H?H[1]:"",J.input,L,J.inputError),A=_.replace(/class=['"][^'"]+['"]/i,"");return A=A.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(F)}" name="${V0(W)}" value="${V0(B)}" class="${V}"${A?` ${A}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,X,G="",K="")=>{let q=J1(G),z=q5(X,Z)||K.trim(),W=W5(X,Z),U=q.match(/class=['"]([^'"]+)['"]/i),_=_9(U?U[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(X)}" class="${_}"${j?` ${j}`:""}>${V0(z)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,X,G="",K)=>{let q=J1(G),z=q5(X,Z),W=W5(X,Z),U=q.match(/class=['"]([^'"]+)['"]/i),_=_9(U?U[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(z!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(O,F,L)=>{if((Array.isArray(z)?z.some((V)=>String(V)===L):String(z)===L)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return O});return`<select name="${V0(X)}" class="${_}"${j?` ${j}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="1",K="")=>{let q=J1(K),z=q5(X,Z),W=z!==void 0&&(Array.isArray(z)?z.some((B)=>String(B)===G):z===!0||String(z)===G),U=q.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(X)}" value="${V0(G)}" class="${_}"${W?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G,K="")=>{let q=J1(K),z=q5(X,Z),W=z!==void 0&&z===G,U=q.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(X)}" value="${V0(G)}" class="${_}"${W?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="")=>{let K=J1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),z=q?q[1]:"",W=K.includes("multiple"),U=W5(X,Z),_=K.match(/class=['"]([^'"]+)['"]/i),j=_9(_?_[1]:"",J.input,U,J.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),O=[`<input type="file" name="${V0(X)}"`,`class="${j}"`];if(z)O.push(`accept="${V0(z)}"`);if(W)O.push("multiple");if(B)O.push(B);return`${O.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,X,G="",K)=>{let q=J1(G),z=q.match(/class=['"]([^'"]+)['"]/i),W=z?z[1]:J.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(X)}" class="${W}"${U?` ${U}`:""}>${K}</label>`}),Y}function F2($,Z,J=H2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,Q,X)=>{try{if(W5(Q,Z))return X.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return O2(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return O2(Q,Z)}let q=K.trim();if(t(q)){let z=J0(q,Z);return z!==void 0?String(z):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),Y}})}function W5($,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 O2($,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 J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function q5($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let Y=$.slice(0,-2);if(J=Z[Y],J!==void 0)return J}return Z[$]}function J1($){if(!$.trim())return"";let Z=[],J=$.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=Y.exec(J))!==null){let[,X,,G]=Q;Z.push(`${X}="${G.trim()}"`)}return Z.join(" ")}var H2;var V2=C(()=>{R0();H2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import w2 from"path";function qG($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function WG($,Z){if({...X4,...Z.i18n}.cache&&J4[$]){let Q=J4[$],X=Z.i18n?.cacheMaxAge??0;if(!qG(Q,X))return Q.translations}if(z5[$]?.state==="loading")return z5[$].promise;Z4[$]="loading";let Y=R2($,Z).then((Q)=>{return Z4[$]="loaded",delete z5[$],Q}).catch((Q)=>{throw Z4[$]="error",z5[$]={promise:Y,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return z5[$]={promise:Y,state:"loading"},Y}async function R2($,Z){let J={...X4,...Z.i18n},Y=w2.resolve(import.meta.dir,"..",J.translationsDir),Q=BG(J.format),X=w2.join(Y,`${$}${Q}`);try{let G={};try{let K=await import(X);G=K.default||K}catch(K){let q=await Bun.file(X).text();if(J.format==="yaml"||J.format==="yml")G=UG(q);else if(J.format==="json")G=JSON.parse(q);else throw K}if(J.cache)J4[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(G){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,G);if($!==J.defaultLocale)return R2(J.defaultLocale,Z);return{}}}async function zG($,Z){return WG($,Z)}function UG($){let Z={},J=$.split(`
2468
- `),Y=[{obj:Z,indent:-1}];for(let Q of J){let X=Q.replace(/#.*$/,"").trimEnd();if(!X.trim())continue;let G=X.search(/\S/);if(G===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=G)Y.pop();let K=Y[Y.length-1].obj,q=X.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,z,W]=q,U=z.trim(),_=W.trim();if(_==="")K[U]={},Y.push({obj:K[U],indent:G});else K[U]=_G(_)}}return Z}function _G($){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 J=Number($);if(!Number.isNaN(J))return J;return $}function BG($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function jG($,Z){for(let J of $){let Y=J.trim(),Q=Y.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let X=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10),K=X[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(X[2],10);if(Z>=G&&Z<=K)return X[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function OG($,Z={}){return T2($,Z)}function T2($,Z){let J="",Y=0;while(Y<$.length)if($[Y]==="{"){let Q=HG($,Y);if(Q===-1){J+=$[Y],Y++;continue}let X=$.slice(Y+1,Q);J+=LG(X,Z),Y=Q+1}else if($[Y]==="'"&&Y+1<$.length)if($[Y+1]==="'")J+="'",Y+=2;else if($[Y+1]==="{"||$[Y+1]==="}")J+=$[Y+1],Y+=2;else J+=$[Y],Y++;else J+=$[Y],Y++;return J}function HG($,Z){let J=0;for(let Y=Z;Y<$.length;Y++)if($[Y]==="{")J++;else if($[Y]==="}"){if(J--,J===0)return Y}return-1}function LG($,Z){let J=FG($);if(J.length===0)return`{${$}}`;let Y=J[0].trim(),Q=Z[Y];if(J.length===1)return Q!==void 0?String(Q):`{${Y}}`;switch(J[1].trim().toLowerCase()){case"plural":return VG(Q,J.slice(2).join(","),Z);case"select":return AG(Q,J.slice(2).join(","));case"selectordinal":return NG(Q,J.slice(2).join(","));case"number":return TG(Q,J[2]?.trim());case"date":return MG(Q,J[2]?.trim());case"time":return IG(Q,J[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function FG($){let Z=[],J="",Y=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X==="{")Y++,J+=X;else if(X==="}")Y--,J+=X;else if(X===","&&Y===0)Z.push(J),J="";else J+=X}if(J)Z.push(J);return Z}function VG($,Z,J){let Y=Number($)||0,Q=Q4(Z),X=`=${Y}`;if(Q[X])return Y4(Q[X],Y,J);let G=wG(Y);if(Q[G])return Y4(Q[G],Y,J);if(Q.other)return Y4(Q.other,Y,J);return String(Y)}function Y4($,Z,J){let Y=$.replace(/#/g,String(Z));return T2(Y,J)}function wG($){let Z=Math.abs($),J=Math.floor(Z),Y=String($).includes(".")?String($).split(".")[1].length:0;if(J===1&&Y===0)return"one";return"other"}function AG($,Z){let J=String($||""),Y=Q4(Z);if(Y[J])return Y[J];return Y.other||String($)}function NG($,Z){let J=Number($)||0,Y=Q4(Z),Q=RG(J);if(Y[Q])return Y[Q].replace(/#/g,String(J));if(Y.other)return Y.other.replace(/#/g,String(J));return String(J)}function RG($){let Z=Math.abs($),J=Z%10,Y=Z%100;if(J===1&&Y!==11)return"one";if(J===2&&Y!==12)return"two";if(J===3&&Y!==13)return"few";return"other"}function Q4($){let Z={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=J.exec($);while(Y!==null)Z[Y[1]]=Y[2],Y=J.exec($);return Z}function TG($,Z){let J=Number($);if(Number.isNaN(J))return String($);switch(Z){case"integer":return Math.floor(J).toLocaleString();case"percent":return`${(J*100).toFixed(0)}%`;case"currency":return J.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return J.toLocaleString()}}function MG($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return J.toLocaleDateString(void 0,Y)}function IG($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return J.toLocaleTimeString(void 0,Y)}function DG($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function A2($,Z,J=!0,Y={}){let Q=$.split("."),X=Z;for(let K of Q){if(X===void 0||X===null)break;X=X[K]}if(X===void 0||X===null)return J?$:"";let G=String(X);if(DG(G))return OG(G,Y);if(G.includes("|")&&"count"in Y){let K=Number(Y.count),q=G.split("|");G=jG(q,K)}for(let[K,q]of Object.entries(Y)){let z=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${z}`,"g"),String(q))}return G}async function M2($,Z,J,Y){let Q=$,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...X4,...Y.i18n},K=await zG(G.locale,Y);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await N2(Q,X,async(W,U,_,j,B)=>{try{let O={};if(_)try{let L=[()=>JSON.parse(_),()=>{let H=`{"data":${_}}`,V=JSON.parse(H);return typeof V.data==="object"?V.data:{}},()=>{return F0(_,Z)}];for(let H of L)try{if(O=H(),Object.keys(O).length>0)break}catch{}}catch(L){if(Y.debug)console.error("Error parsing parameters for @translate directive:",L)}return A2(U,K,G.fallbackToKey,O)||j.trim()}catch(O){if(Y.debug)console.error("Error processing @translate directive:",O);return s("Translate",`Error in @translate('${U}'): ${O instanceof Error?O.message:String(O)}`,p.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let W=[...Q.matchAll(q)];console.warn(`Found ${W.length} @translate matches`),W.forEach((U,_)=>console.warn(`Match ${_}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return Q=await N2(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,U,_,j)=>{try{let B={};if(_)try{let O=[()=>JSON.parse(_),()=>{let F=`{"data":${_}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return F0(_,Z)}];for(let F of O)try{if(B=F(),Object.keys(B).length>0)break}catch{}}catch(O){if(Y.debug)console.error("Error parsing parameters for @translate directive:",O)}return A2(U,K,G.fallbackToKey,B)}catch(B){if(Y.debug)console.error("Error processing @translate directive:",B);return s("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,p.EVALUATION_ERROR)}}),Q}async function N2($,Z,J){let Y=[];return $.replace(Z,(X,...G)=>{let K=J(X,...G).then((q)=>({match:X,replacement:q}));return Y.push(K),X}),(await Promise.all(Y)).reduce((X,{match:G,replacement:K})=>X.replace(G,K),$)}var X4,J4,z5,Z4;var I2=C(()=>{n0();R0();X4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},J4={},z5={},Z4={}});var C2={};r(C2,{processLoops:()=>G4});function bG($,Z){let J=/@component\s*\(/g,Y=$,Q,X=[];while((Q=J.exec(Y))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,z=K+1;while(z<Y.length&&q>0){if(Y[z]==="(")q++;else if(Y[z]===")"){if(q--,q===0)break}z++}if(q!==0)continue;let W=Y.substring(K+1,z),U=z+1,_=W.match(/^\s*['"]([^'"]+)['"]/);if(!_)continue;let j=_[1],B=W.slice(_[0].length),O=B.match(/^\s*,\s*/);if(!O)continue;let F=B.slice(O[0].length).trim();if(!F)continue;try{let L=F0(F,Z),H=JSON.stringify(L),V=`@component('${j}', ${H})`;X.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:z}=X[G];Y=Y.substring(0,K)+z+Y.substring(q)}return Y}function j9($,Z,J){let Y=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),X;while((X=Q.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,q=1,z=K+1,W=null,U=!1;while(z<Y.length&&q>0){let B=Y[z];if(U){U=!1,z++;continue}if(B==="\\"&&W){U=!0,z++;continue}if(W){if(B===W)W=null;z++;continue}if(B==='"'||B==="'"||B==="`"){W=B,z++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}z++}if(q!==0)break;let _=Y.substring(K+1,z),j=J(_);Y=Y.substring(0,G)+j+Y.substring(z+1)}return Y}function SG($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return Y}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,Q,X)=>{try{let G=Object.keys(Z),K=Object.values(Z);o1(X);let z=e(X,G)(...K),U=JSON.stringify(z).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${Q}="${U}"`}catch(G){return Y}}),J}function yG($,Z){let J=$;return J=j9(J,"@break",(Y)=>{try{let X=`!!(${Y.trim()})`,G;if(t(X)){let K=e(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(X,Z));return G?O9:""}catch{return""}}),J=j9(J,"@continue",(Y)=>{try{let X=`!!(${Y.trim()})`,G;if(t(X)){let K=e(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(X,Z));return G?H9:""}catch{return""}}),J}function CG($){let Z=$;return Z=Z.replace(/@break(?!\()/g,O9),Z=Z.replace(/@continue(?!\()/g,H9),Z}function D2($){let Z=$.includes(O9),J=Z?$.substring(0,$.indexOf(O9)):$;return{hasBreak:Z,content:J}}function E2($){let Z=$.includes(H9),J=Z?$.substring(0,$.indexOf(H9)):$;return{hasContinue:Z,content:J}}function b2($){let Z=$;return Z=j9(Z,"@break",(J)=>{let Y=J.trim();if(!A5(Y))return"";return`\`; if (${Y}) { break; } result += \``}),Z=j9(Z,"@continue",(J)=>{let Y=J.trim();if(!A5(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function PG($){let Z=/@forelse\s*\(/g,J,Y=[],Q=/@foreach\s*\(/g,X=/@endforeach/g,G;while((G=Q.exec($))!==null)Y.push({pos:G.index,delta:1});while((G=X.exec($))!==null)Y.push({pos:G.index,delta:-1});Y.sort((W,U)=>W.pos-U.pos);let K=[],q=0;for(let W of Y)q+=W.delta,K.push({pos:W.pos,depth:q});function z(W){let U=0,_=K.length-1,j=0;while(U<=_){let B=U+_>>1;if(K[B].pos<=W)j=K[B].depth,U=B+1;else _=B-1}return j}while((J=Z.exec($))!==null){if(z(J.index)>0)continue;let W=J.index,U=J.index+J[0].length-1,_=1,j=U+1,B=-1;while(j<$.length&&_>0){if($[j]==="(")_++;else if($[j]===")"){if(_--,_===0){B=j;break}}j++}if(B===-1)continue;let O=$.substring(U+1,B),F=O.indexOf(" as ");if(F===-1)continue;let L=O.substring(0,F).trim(),H=O.substring(F+4).trim(),V=B+1,A=1,w=V,N=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(A>0&&w<$.length){N.lastIndex=w,R.lastIndex=w;let S=N.exec($),b=R.exec($);if(!b)break;if(S&&S.index<b.index)A++,w=S.index+S[0].length;else{if(A--,A===0){T=b.index;break}w=b.index+11}}if(T===-1)continue;let I=$.substring(V,T),M=T+11,E=-1,k=0,y=0;while(y<I.length){let S=I.indexOf("@",y);if(S===-1)break;let b=I.substring(S);if(/^@forelse\s*\(/.test(b))k++,y=S+1;else if(b.startsWith("@endforelse"))k--,y=S+11;else if(k===0&&b.startsWith("@empty")){if(I.length<=S+6||!/[a-z]/i.test(I[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:W,end:M,arrayExpr:L,itemVar:H,foreachContent:I.substring(0,E),emptyContent:I.substring(E+6)}}return null}function k2($,Z){let J=$;while(!0){let Y=PG(J);if(!Y)break;let{start:Q,end:X,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:z}=Y;try{let W;if(t(G))W=e(G,Object.keys(Z))(...Object.values(Z));else W=J0(G,Z);let U;if(!Array.isArray(W)||W.length===0)U=z;else U=`@foreach (${G} as ${K})${q}@endforeach`;J=J.substring(0,Q)+U+J.substring(X)}catch(W){let U=W instanceof Error?W.message:String(W),_=s("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,p.EVALUATION_ERROR);J=J.substring(0,Q)+_+J.substring(X)}}return J}function G4($,Z,J,Y){let Q=$;Q=k2(Q,Z);function X(q){let z=/@foreach\s*\(/g,W;while((W=z.exec(q))!==null){let U=W.index,_=W.index+W[0].length-1,j=1,B=_+1,O=-1;while(B<q.length&&j>0){if(q[B]==="(")j++;else if(q[B]===")"){if(j--,j===0){O=B;break}}B++}if(O===-1)continue;let F=q.substring(_+1,O),L=F.indexOf(" as ");if(L===-1)continue;let H=U,V=F.substring(0,L),A=F.substring(L+4),w=O+1,N=1,R=w,T=/@foreach\s*\(/g,I=/@endforeach/g;while(N>0&&R<q.length){T.lastIndex=R,I.lastIndex=R;let M=T.exec(q),E=I.exec(q);if(!E)break;if(M&&M.index<E.index)N++,R=M.index+M[0].length;else{if(N--,N===0){let k=q.substring(w,E.index),y=E.index+11;return{start:H,end:y,arrayExpr:V,itemVar:A,content:k}}R=E.index+11}}}return null}function G(q,z){let W=q;while(!0){let U=X(W);if(!U)break;let{start:_,end:j,arrayExpr:B,itemVar:O,content:F}=U;try{let L=B.trim(),H;if(t(L))H=e(L,Object.keys(z))(...Object.values(z));else H=J0(L,z);let V=!1;if(!Array.isArray(H))if(H instanceof Map)H=Array.from(H),V=!0;else if(H instanceof Set)H=Array.from(H);else if(typeof H==="string")H=Array.from(H);else if(H&&typeof H==="object"&&!(H instanceof Date)&&!(H instanceof RegExp))H=Object.entries(H),V=!0;else{let M=s("Foreach",`Error in @foreach: ${L} is not iterable`,p.TYPE_ERROR);W=W.substring(0,_)+M+W.substring(j);continue}let A=Y?.loops?.useAltLoopVariable??kG,w=O.trim(),N=null,R;if(w.includes("=>")){let M=w.split("=>").map((E)=>E.trim());if(M.length===2)N=M[0],R=M[1];else R=w}else R=w;let T="",I=H;for(let M=0;M<I.length;M++){let E=I[M],k={index:M,iteration:M+1,first:M===0,last:M===I.length-1,count:I.length},y={...z,loop:k,$loop:k};if(R.startsWith("[")&&R.endsWith("]")){let x=R.slice(1,-1).split(",").map((h)=>h.trim());if(Array.isArray(E))x.forEach((h,i)=>{if(h)y[h]=E[i]});else y[R]=E}else y[R]=E;if(N)if(V&&Array.isArray(E)&&E.length===2)y[N]=E[0],y[R]=E[1];else y[N]=M;let S=yG(F,y),b=E2(S);if(b.hasContinue){T+=b.content;continue}let D=D2(S);if(D.hasBreak){T+=D.content;break}if(S=k2(S,y),S=G(S,y),S=V1(S,y,J),S=CG(S),D=D2(S),D.hasBreak){T+=D.content;break}if(b=E2(S),b.hasContinue){T+=b.content;continue}S=a0(S,y,J),S=SG(S,y),S=bG(S,y),T+=S}W=W.substring(0,_)+T+W.substring(j)}catch(L){let H=s("Foreach",`Error in @foreach(${B.trim()} as ${O.trim()}): ${L instanceof Error?L.message:String(L)}`,p.EVALUATION_ERROR);W=W.substring(0,_)+H+W.substring(j)}}return W}Q=G(Q,Z),Q=y2(Q,Z,J,Y);let K=Y?.loops?.maxWhileIterations??EG;return Q=fG(Q,Z,K),Q}function S2($){return A5($)}function y2($,Z,J,Y){let Q=$,X=!0;while(X){X=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,z=D0(Q,"(",")",q);if(z===-1)break;let W=Q.slice(q+1,z),U=z+1,_=W9(Q.slice(K),"for","endfor");if(_.length===0)break;let j=_[0].content,B=K+_[0].end;if(!S2(W)){let O=s("For",`Unsafe expression in @for: ${W}`,p.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+O+Q.substring(B),X=!0;continue}try{let O=vG(W),F=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(O.length>0&&F){let N=xG({forExpr:W,content:j,iterVarNames:O,context:Z,filePath:J,options:Y});Q=Q.substring(0,K)+N+Q.substring(B),X=!0;continue}let L=Object.keys(Z),H=Object.values(Z),V=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});V=b2(V);let w=Function(...L,`
2470
+ ${B9(`@method('${j}')`,Z)}`;return O}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,X,G,K,q,z="")=>{let W=X||G||"",U=K||q||"",_=J1(z),j=q5(W,Z),B=j!==void 0&&j!==null?j:U||"",O=_.match(/type=['"]([^'"]+)['"]/i),F=O?O[1]:"text",L=W5(W,Z),H=_.match(/class=['"]([^'"]+)['"]/i),V=_9(H?H[1]:"",J.input,L,J.inputError),A=_.replace(/class=['"][^'"]+['"]/i,"");return A=A.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(F)}" name="${V0(W)}" value="${V0(B)}" class="${V}"${A?` ${A}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,X,G="",K="")=>{let q=J1(G),z=q5(X,Z)||K.trim(),W=W5(X,Z),U=q.match(/class=['"]([^'"]+)['"]/i),_=_9(U?U[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(X)}" class="${_}"${j?` ${j}`:""}>${V0(z)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,X,G="",K)=>{let q=J1(G),z=q5(X,Z),W=W5(X,Z),U=q.match(/class=['"]([^'"]+)['"]/i),_=_9(U?U[1]:"",J.input,W,J.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(z!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(O,F,L)=>{if((Array.isArray(z)?z.some((V)=>String(V)===L):String(z)===L)&&!F.includes("selected"))return F.replace(/(<option)/,"$1 selected");return O});return`<select name="${V0(X)}" class="${_}"${j?` ${j}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="1",K="")=>{let q=J1(K),z=q5(X,Z),W=z!==void 0&&(Array.isArray(z)?z.some((B)=>String(B)===G):z===!0||String(z)===G),U=q.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(X)}" value="${V0(G)}" class="${_}"${W?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G,K="")=>{let q=J1(K),z=q5(X,Z),W=z!==void 0&&z===G,U=q.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:J.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(X)}" value="${V0(G)}" class="${_}"${W?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="")=>{let K=J1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),z=q?q[1]:"",W=K.includes("multiple"),U=W5(X,Z),_=K.match(/class=['"]([^'"]+)['"]/i),j=_9(_?_[1]:"",J.input,U,J.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),O=[`<input type="file" name="${V0(X)}"`,`class="${j}"`];if(z)O.push(`accept="${V0(z)}"`);if(W)O.push("multiple");if(B)O.push(B);return`${O.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,X,G="",K)=>{let q=J1(G),z=q.match(/class=['"]([^'"]+)['"]/i),W=z?z[1]:J.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(X)}" class="${W}"${U?` ${U}`:""}>${K}</label>`}),Y}function w2($,Z,J=F2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,Q,X)=>{try{if(W5(Q,Z))return X.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return L2(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return L2(Q,Z)}let q=K.trim();if(t(q)){let z=J0(q,Z);return z!==void 0?String(z):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),Y}})}function W5($,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 L2($,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 J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function q5($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let Y=$.slice(0,-2);if(J=Z[Y],J!==void 0)return J}return Z[$]}function J1($){if(!$.trim())return"";let Z=[],J=$.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=Y.exec(J))!==null){let[,X,,G]=Q;Z.push(`${X}="${G.trim()}"`)}return Z.join(" ")}var F2;var A2=C(()=>{R0();F2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import N2 from"path";function zG($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function UG($,Z){if({...X4,...Z.i18n}.cache&&J4[$]){let Q=J4[$],X=Z.i18n?.cacheMaxAge??0;if(!zG(Q,X))return Q.translations}if(z5[$]?.state==="loading")return z5[$].promise;Z4[$]="loading";let Y=M2($,Z).then((Q)=>{return Z4[$]="loaded",delete z5[$],Q}).catch((Q)=>{throw Z4[$]="error",z5[$]={promise:Y,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return z5[$]={promise:Y,state:"loading"},Y}async function M2($,Z){let J={...X4,...Z.i18n},Y=N2.resolve(import.meta.dir,"..",J.translationsDir),Q=OG(J.format),X=N2.join(Y,`${$}${Q}`);try{let G={};try{let K=await import(X);G=K.default||K}catch(K){let q=await Bun.file(X).text();if(J.format==="yaml"||J.format==="yml")G=BG(q);else if(J.format==="json")G=JSON.parse(q);else throw K}if(J.cache)J4[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(G){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,G);if($!==J.defaultLocale)return M2(J.defaultLocale,Z);return{}}}async function _G($,Z){return UG($,Z)}function BG($){let Z={},J=$.split(`
2471
+ `),Y=[{obj:Z,indent:-1}];for(let Q of J){let X=Q.replace(/#.*$/,"").trimEnd();if(!X.trim())continue;let G=X.search(/\S/);if(G===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=G)Y.pop();let K=Y[Y.length-1].obj,q=X.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,z,W]=q,U=z.trim(),_=W.trim();if(_==="")K[U]={},Y.push({obj:K[U],indent:G});else K[U]=jG(_)}}return Z}function jG($){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 J=Number($);if(!Number.isNaN(J))return J;return $}function OG($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function HG($,Z){for(let J of $){let Y=J.trim(),Q=Y.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let X=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10),K=X[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(X[2],10);if(Z>=G&&Z<=K)return X[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function LG($,Z={}){return I2($,Z)}function I2($,Z){let J="",Y=0;while(Y<$.length)if($[Y]==="{"){let Q=FG($,Y);if(Q===-1){J+=$[Y],Y++;continue}let X=$.slice(Y+1,Q);J+=VG(X,Z),Y=Q+1}else if($[Y]==="'"&&Y+1<$.length)if($[Y+1]==="'")J+="'",Y+=2;else if($[Y+1]==="{"||$[Y+1]==="}")J+=$[Y+1],Y+=2;else J+=$[Y],Y++;else J+=$[Y],Y++;return J}function FG($,Z){let J=0;for(let Y=Z;Y<$.length;Y++)if($[Y]==="{")J++;else if($[Y]==="}"){if(J--,J===0)return Y}return-1}function VG($,Z){let J=wG($);if(J.length===0)return`{${$}}`;let Y=J[0].trim(),Q=Z[Y];if(J.length===1)return Q!==void 0?String(Q):`{${Y}}`;switch(J[1].trim().toLowerCase()){case"plural":return AG(Q,J.slice(2).join(","),Z);case"select":return RG(Q,J.slice(2).join(","));case"selectordinal":return TG(Q,J.slice(2).join(","));case"number":return IG(Q,J[2]?.trim());case"date":return DG(Q,J[2]?.trim());case"time":return EG(Q,J[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function wG($){let Z=[],J="",Y=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X==="{")Y++,J+=X;else if(X==="}")Y--,J+=X;else if(X===","&&Y===0)Z.push(J),J="";else J+=X}if(J)Z.push(J);return Z}function AG($,Z,J){let Y=Number($)||0,Q=Q4(Z),X=`=${Y}`;if(Q[X])return Y4(Q[X],Y,J);let G=NG(Y);if(Q[G])return Y4(Q[G],Y,J);if(Q.other)return Y4(Q.other,Y,J);return String(Y)}function Y4($,Z,J){let Y=$.replace(/#/g,String(Z));return I2(Y,J)}function NG($){let Z=Math.abs($),J=Math.floor(Z),Y=String($).includes(".")?String($).split(".")[1].length:0;if(J===1&&Y===0)return"one";return"other"}function RG($,Z){let J=String($||""),Y=Q4(Z);if(Y[J])return Y[J];return Y.other||String($)}function TG($,Z){let J=Number($)||0,Y=Q4(Z),Q=MG(J);if(Y[Q])return Y[Q].replace(/#/g,String(J));if(Y.other)return Y.other.replace(/#/g,String(J));return String(J)}function MG($){let Z=Math.abs($),J=Z%10,Y=Z%100;if(J===1&&Y!==11)return"one";if(J===2&&Y!==12)return"two";if(J===3&&Y!==13)return"few";return"other"}function Q4($){let Z={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=J.exec($);while(Y!==null)Z[Y[1]]=Y[2],Y=J.exec($);return Z}function IG($,Z){let J=Number($);if(Number.isNaN(J))return String($);switch(Z){case"integer":return Math.floor(J).toLocaleString();case"percent":return`${(J*100).toFixed(0)}%`;case"currency":return J.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return J.toLocaleString()}}function DG($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return J.toLocaleDateString(void 0,Y)}function EG($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return J.toLocaleTimeString(void 0,Y)}function kG($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function R2($,Z,J=!0,Y={}){let Q=$.split("."),X=Z;for(let K of Q){if(X===void 0||X===null)break;X=X[K]}if(X===void 0||X===null)return J?$:"";let G=String(X);if(kG(G))return LG(G,Y);if(G.includes("|")&&"count"in Y){let K=Number(Y.count),q=G.split("|");G=HG(q,K)}for(let[K,q]of Object.entries(Y)){let z=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${z}`,"g"),String(q))}return G}async function D2($,Z,J,Y){let Q=$,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...X4,...Y.i18n},K=await _G(G.locale,Y);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await T2(Q,X,async(W,U,_,j,B)=>{try{let O={};if(_)try{let L=[()=>JSON.parse(_),()=>{let H=`{"data":${_}}`,V=JSON.parse(H);return typeof V.data==="object"?V.data:{}},()=>{return F0(_,Z)}];for(let H of L)try{if(O=H(),Object.keys(O).length>0)break}catch{}}catch(L){if(Y.debug)console.error("Error parsing parameters for @translate directive:",L)}return R2(U,K,G.fallbackToKey,O)||j.trim()}catch(O){if(Y.debug)console.error("Error processing @translate directive:",O);return s("Translate",`Error in @translate('${U}'): ${O instanceof Error?O.message:String(O)}`,u.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let W=[...Q.matchAll(q)];console.warn(`Found ${W.length} @translate matches`),W.forEach((U,_)=>console.warn(`Match ${_}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return Q=await T2(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,U,_,j)=>{try{let B={};if(_)try{let O=[()=>JSON.parse(_),()=>{let F=`{"data":${_}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return F0(_,Z)}];for(let F of O)try{if(B=F(),Object.keys(B).length>0)break}catch{}}catch(O){if(Y.debug)console.error("Error parsing parameters for @translate directive:",O)}return R2(U,K,G.fallbackToKey,B)}catch(B){if(Y.debug)console.error("Error processing @translate directive:",B);return s("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,u.EVALUATION_ERROR)}}),Q}async function T2($,Z,J){let Y=[];return $.replace(Z,(X,...G)=>{let K=J(X,...G).then((q)=>({match:X,replacement:q}));return Y.push(K),X}),(await Promise.all(Y)).reduce((X,{match:G,replacement:K})=>X.replace(G,K),$)}var X4,J4,z5,Z4;var E2=C(()=>{o0();R0();X4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},J4={},z5={},Z4={}});var v2={};r(v2,{processLoops:()=>G4});function yG($,Z){let J=/@component\s*\(/g,Y=$,Q,X=[];while((Q=J.exec(Y))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,z=K+1;while(z<Y.length&&q>0){if(Y[z]==="(")q++;else if(Y[z]===")"){if(q--,q===0)break}z++}if(q!==0)continue;let W=Y.substring(K+1,z),U=z+1,_=W.match(/^\s*['"]([^'"]+)['"]/);if(!_)continue;let j=_[1],B=W.slice(_[0].length),O=B.match(/^\s*,\s*/);if(!O)continue;let F=B.slice(O[0].length).trim();if(!F)continue;try{let L=F0(F,Z),H=JSON.stringify(L),V=`@component('${j}', ${H})`;X.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:z}=X[G];Y=Y.substring(0,K)+z+Y.substring(q)}return Y}function j9($,Z,J){let Y=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),X;while((X=Q.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,q=1,z=K+1,W=null,U=!1;while(z<Y.length&&q>0){let B=Y[z];if(U){U=!1,z++;continue}if(B==="\\"&&W){U=!0,z++;continue}if(W){if(B===W)W=null;z++;continue}if(B==='"'||B==="'"||B==="`"){W=B,z++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}z++}if(q!==0)break;let _=Y.substring(K+1,z),j=J(_);Y=Y.substring(0,G)+j+Y.substring(z+1)}return Y}function CG($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return Y}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,Q,X)=>{try{let G=Object.keys(Z),K=Object.values(Z);o1(X);let z=e(X,G)(...K),U=JSON.stringify(z).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${Q}="${U}"`}catch(G){return Y}}),J}function PG($,Z){let J=$;return J=j9(J,"@break",(Y)=>{try{let X=`!!(${Y.trim()})`,G;if(t(X)){let K=e(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(X,Z));return G?O9:""}catch{return""}}),J=j9(J,"@continue",(Y)=>{try{let X=`!!(${Y.trim()})`,G;if(t(X)){let K=e(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(J0(X,Z));return G?H9:""}catch{return""}}),J}function vG($){let Z=$;return Z=Z.replace(/@break(?!\()/g,O9),Z=Z.replace(/@continue(?!\()/g,H9),Z}function k2($){let Z=$.includes(O9),J=Z?$.substring(0,$.indexOf(O9)):$;return{hasBreak:Z,content:J}}function b2($){let Z=$.includes(H9),J=Z?$.substring(0,$.indexOf(H9)):$;return{hasContinue:Z,content:J}}function y2($){let Z=$;return Z=j9(Z,"@break",(J)=>{let Y=J.trim();if(!A5(Y))return"";return`\`; if (${Y}) { break; } result += \``}),Z=j9(Z,"@continue",(J)=>{let Y=J.trim();if(!A5(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function xG($){let Z=/@forelse\s*\(/g,J,Y=[],Q=/@foreach\s*\(/g,X=/@endforeach/g,G;while((G=Q.exec($))!==null)Y.push({pos:G.index,delta:1});while((G=X.exec($))!==null)Y.push({pos:G.index,delta:-1});Y.sort((W,U)=>W.pos-U.pos);let K=[],q=0;for(let W of Y)q+=W.delta,K.push({pos:W.pos,depth:q});function z(W){let U=0,_=K.length-1,j=0;while(U<=_){let B=U+_>>1;if(K[B].pos<=W)j=K[B].depth,U=B+1;else _=B-1}return j}while((J=Z.exec($))!==null){if(z(J.index)>0)continue;let W=J.index,U=J.index+J[0].length-1,_=1,j=U+1,B=-1;while(j<$.length&&_>0){if($[j]==="(")_++;else if($[j]===")"){if(_--,_===0){B=j;break}}j++}if(B===-1)continue;let O=$.substring(U+1,B),F=O.indexOf(" as ");if(F===-1)continue;let L=O.substring(0,F).trim(),H=O.substring(F+4).trim(),V=B+1,A=1,w=V,N=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(A>0&&w<$.length){N.lastIndex=w,R.lastIndex=w;let S=N.exec($),b=R.exec($);if(!b)break;if(S&&S.index<b.index)A++,w=S.index+S[0].length;else{if(A--,A===0){T=b.index;break}w=b.index+11}}if(T===-1)continue;let I=$.substring(V,T),M=T+11,E=-1,k=0,y=0;while(y<I.length){let S=I.indexOf("@",y);if(S===-1)break;let b=I.substring(S);if(/^@forelse\s*\(/.test(b))k++,y=S+1;else if(b.startsWith("@endforelse"))k--,y=S+11;else if(k===0&&b.startsWith("@empty")){if(I.length<=S+6||!/[a-z]/i.test(I[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:W,end:M,arrayExpr:L,itemVar:H,foreachContent:I.substring(0,E),emptyContent:I.substring(E+6)}}return null}function S2($,Z){let J=$;while(!0){let Y=xG(J);if(!Y)break;let{start:Q,end:X,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:z}=Y;try{let W;if(t(G))W=e(G,Object.keys(Z))(...Object.values(Z));else W=J0(G,Z);let U;if(!Array.isArray(W)||W.length===0)U=z;else U=`@foreach (${G} as ${K})${q}@endforeach`;J=J.substring(0,Q)+U+J.substring(X)}catch(W){let U=W instanceof Error?W.message:String(W),_=s("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,u.EVALUATION_ERROR);J=J.substring(0,Q)+_+J.substring(X)}}return J}function G4($,Z,J,Y){let Q=$;Q=S2(Q,Z);function X(q){let z=/@foreach\s*\(/g,W;while((W=z.exec(q))!==null){let U=W.index,_=W.index+W[0].length-1,j=1,B=_+1,O=-1;while(B<q.length&&j>0){if(q[B]==="(")j++;else if(q[B]===")"){if(j--,j===0){O=B;break}}B++}if(O===-1)continue;let F=q.substring(_+1,O),L=F.indexOf(" as ");if(L===-1)continue;let H=U,V=F.substring(0,L),A=F.substring(L+4),w=O+1,N=1,R=w,T=/@foreach\s*\(/g,I=/@endforeach/g;while(N>0&&R<q.length){T.lastIndex=R,I.lastIndex=R;let M=T.exec(q),E=I.exec(q);if(!E)break;if(M&&M.index<E.index)N++,R=M.index+M[0].length;else{if(N--,N===0){let k=q.substring(w,E.index),y=E.index+11;return{start:H,end:y,arrayExpr:V,itemVar:A,content:k}}R=E.index+11}}}return null}function G(q,z){let W=q;while(!0){let U=X(W);if(!U)break;let{start:_,end:j,arrayExpr:B,itemVar:O,content:F}=U;try{let L=B.trim(),H;if(t(L))H=e(L,Object.keys(z))(...Object.values(z));else H=J0(L,z);let V=!1;if(!Array.isArray(H))if(H instanceof Map)H=Array.from(H),V=!0;else if(H instanceof Set)H=Array.from(H);else if(typeof H==="string")H=Array.from(H);else if(H&&typeof H==="object"&&!(H instanceof Date)&&!(H instanceof RegExp))H=Object.entries(H),V=!0;else{let M=s("Foreach",`Error in @foreach: ${L} is not iterable`,u.TYPE_ERROR);W=W.substring(0,_)+M+W.substring(j);continue}let A=Y?.loops?.useAltLoopVariable??SG,w=O.trim(),N=null,R;if(w.includes("=>")){let M=w.split("=>").map((E)=>E.trim());if(M.length===2)N=M[0],R=M[1];else R=w}else R=w;let T="",I=H;for(let M=0;M<I.length;M++){let E=I[M],k={index:M,iteration:M+1,first:M===0,last:M===I.length-1,count:I.length},y={...z,loop:k,$loop:k};if(R.startsWith("[")&&R.endsWith("]")){let x=R.slice(1,-1).split(",").map((h)=>h.trim());if(Array.isArray(E))x.forEach((h,i)=>{if(h)y[h]=E[i]});else y[R]=E}else y[R]=E;if(N)if(V&&Array.isArray(E)&&E.length===2)y[N]=E[0],y[R]=E[1];else y[N]=M;let S=PG(F,y),b=b2(S);if(b.hasContinue){T+=b.content;continue}let D=k2(S);if(D.hasBreak){T+=D.content;break}if(S=S2(S,y),S=G(S,y),S=V1(S,y,J),S=vG(S),D=k2(S),D.hasBreak){T+=D.content;break}if(b=b2(S),b.hasContinue){T+=b.content;continue}S=t0(S,y,J),S=CG(S,y),S=yG(S,y),T+=S}W=W.substring(0,_)+T+W.substring(j)}catch(L){let H=s("Foreach",`Error in @foreach(${B.trim()} as ${O.trim()}): ${L instanceof Error?L.message:String(L)}`,u.EVALUATION_ERROR);W=W.substring(0,_)+H+W.substring(j)}}return W}Q=G(Q,Z),Q=P2(Q,Z,J,Y);let K=Y?.loops?.maxWhileIterations??bG;return Q=hG(Q,Z,K),Q}function C2($){return A5($)}function P2($,Z,J,Y){let Q=$,X=!0;while(X){X=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,z=D0(Q,"(",")",q);if(z===-1)break;let W=Q.slice(q+1,z),U=z+1,_=W9(Q.slice(K),"for","endfor");if(_.length===0)break;let j=_[0].content,B=K+_[0].end;if(!C2(W)){let O=s("For",`Unsafe expression in @for: ${W}`,u.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+O+Q.substring(B),X=!0;continue}try{let O=fG(W),F=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(O.length>0&&F){let N=gG({forExpr:W,content:j,iterVarNames:O,context:Z,filePath:J,options:Y});Q=Q.substring(0,K)+N+Q.substring(B),X=!0;continue}let L=Object.keys(Z),H=Object.values(Z),V=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});V=y2(V);let w=Function(...L,`
2469
2472
  let result = '';
2470
2473
  for (${W}) {
2471
2474
  result += \`${V}\`;
2472
2475
  }
2473
2476
  return result;
2474
- `)(...H);Q=Q.substring(0,K)+w+Q.substring(B),X=!0}catch(O){let F=s("For",`Error in @for(${W}): ${O instanceof Error?O.message:String(O)}`,p.EVALUATION_ERROR);Q=Q.substring(0,K)+F+Q.substring(B),X=!0}}return Q}function vG($){let Z=$.trim(),J=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(J){let X=J[1];return X.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let z=q.indexOf(":");if(z>=0&&X.startsWith("{")){let _=q.slice(z+1).trim(),j=_.indexOf("=");return(j>=0?_.slice(0,j):_).trim()}let W=q.indexOf("="),U=(W>=0?q.slice(0,W):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function xG($){let{forExpr:Z,content:J,iterVarNames:Y,context:Q,filePath:X,options:G}=$,K=Object.keys(Q),q=Object.values(Q),z=Function(...K,"__pushIter",`
2477
+ `)(...H);Q=Q.substring(0,K)+w+Q.substring(B),X=!0}catch(O){let F=s("For",`Error in @for(${W}): ${O instanceof Error?O.message:String(O)}`,u.EVALUATION_ERROR);Q=Q.substring(0,K)+F+Q.substring(B),X=!0}}return Q}function fG($){let Z=$.trim(),J=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(J){let X=J[1];return X.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let z=q.indexOf(":");if(z>=0&&X.startsWith("{")){let _=q.slice(z+1).trim(),j=_.indexOf("=");return(j>=0?_.slice(0,j):_).trim()}let W=q.indexOf("="),U=(W>=0?q.slice(0,W):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function gG($){let{forExpr:Z,content:J,iterVarNames:Y,context:Q,filePath:X,options:G}=$,K=Object.keys(Q),q=Object.values(Q),z=Function(...K,"__pushIter",`
2475
2478
  for (${Z}) {
2476
2479
  __pushIter([${Y.join(", ")}])
2477
2480
  }
2478
- `),W=[];z(...q,(j)=>{W.push(j)});let U=X??"inline.stx",_="";for(let j of W){let B={...Q};Y.forEach((F,L)=>{B[F]=j[L]});let O=y2(J,B,X,G);O=V1(O,B,U),O=a0(O,B,U),_+=O}return _}function fG($,Z,J){let Y=$,Q=!0;while(Q){Q=!1;let X=Y.match(/@while\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=G+X[0].length-1,q=D0(Y,"(",")",K);if(q===-1)break;let z=Y.slice(K+1,q),W=W9(Y.slice(G),"while","endwhile");if(W.length===0)break;let U=W[0].content,_=G+W[0].end;if(!S2(z)){let j=s("While",`Unsafe expression in @while: ${z}`,p.UNSAFE_EXPRESSION);Y=Y.substring(0,G)+j+Y.substring(_),Q=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),O=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,V)=>{return`\${${V}}`});O=b2(O);let L=Function(...j,`
2481
+ `),W=[];z(...q,(j)=>{W.push(j)});let U=X??"inline.stx",_="";for(let j of W){let B={...Q};Y.forEach((F,L)=>{B[F]=j[L]});let O=P2(J,B,X,G);O=V1(O,B,U),O=t0(O,B,U),_+=O}return _}function hG($,Z,J){let Y=$,Q=!0;while(Q){Q=!1;let X=Y.match(/@while\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=G+X[0].length-1,q=D0(Y,"(",")",K);if(q===-1)break;let z=Y.slice(K+1,q),W=W9(Y.slice(G),"while","endwhile");if(W.length===0)break;let U=W[0].content,_=G+W[0].end;if(!C2(z)){let j=s("While",`Unsafe expression in @while: ${z}`,u.UNSAFE_EXPRESSION);Y=Y.substring(0,G)+j+Y.substring(_),Q=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),O=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(H,V)=>{return`\${${V}}`});O=y2(O);let L=Function(...j,`
2479
2482
  let result = '';
2480
2483
  let maxIterations = ${J}; // Configurable safety limit
2481
2484
  let counter = 0;
@@ -2487,8 +2490,8 @@ ${Q}`)}function K2($,Z,J,Y){let Q=$,X=Y.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!X?
2487
2490
  result += '<!-- [While Error [1104]]: Maximum iterations (${J}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
2488
2491
  }
2489
2492
  return result;
2490
- `)(...B);Y=Y.substring(0,G)+L+Y.substring(_),Q=!0}catch(j){let B=s("While",`Error in @while(${z}): ${j instanceof Error?j.message:String(j)}`,p.EVALUATION_ERROR);Y=Y.substring(0,G)+B+Y.substring(_),Q=!0}}return Y}var EG=1000,kG=!1,O9="<!--__STX_BREAK__-->",H9="<!--__STX_CONTINUE__-->";var K4=C(()=>{z9();n0();t0();r$();R0()});import K0 from"path";function q4($,Z){let J=0;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(Q==="("||Q==="["||Q==="{")J++;else if(Q===")"||Q==="]"||Q==="}")J--;else if(Q===","&&J===0)return Y}return-1}function gG($,Z,J){let Y=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),X=Q.exec(Y);while(X){let G=X.index,K=G+X[0].length-1,q=1,z=K+1;while(z<Y.length&&q>0){if(Y[z]==="(")q++;else if(Y[z]===")")q--;z++}if(q!==0)break;let W=Y.substring(K+1,z-1),U=`${J}(${W})`;Y=Y.substring(0,G)+U+Y.substring(z),Q.lastIndex=G+U.length,X=Q.exec(Y)}return Y}function hG($){return/\b(state|derived|effect)\s*\(/.test($)}function dG($){let Z=$,J=[],Y=new Set,Q=0,X=0,G=Z.length,K=(U)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===U){X++;return}X++}},q=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let U=1;while(X<G&&U>0)if(Z[X]==="{")U++;else if(Z[X]==="}")U--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},z=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
2491
- `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},W=()=>{if(Q!==0)return;let U=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!Y.has(B))J.push(B),Y.add(B);return}let _=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))J.push(B),Y.add(B);return}let j=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))J.push(B),Y.add(B)}};while(X<G){if(z())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){Q++,X++;continue}if(Z[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))W();X++}return J.join(", ")}function mG($,Z){let J=dG($);return`
2493
+ `)(...B);Y=Y.substring(0,G)+L+Y.substring(_),Q=!0}catch(j){let B=s("While",`Error in @while(${z}): ${j instanceof Error?j.message:String(j)}`,u.EVALUATION_ERROR);Y=Y.substring(0,G)+B+Y.substring(_),Q=!0}}return Y}var bG=1000,SG=!1,O9="<!--__STX_BREAK__-->",H9="<!--__STX_CONTINUE__-->";var K4=C(()=>{z9();o0();n0();r$();R0()});import K0 from"path";function q4($,Z){let J=0;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(Q==="("||Q==="["||Q==="{")J++;else if(Q===")"||Q==="]"||Q==="}")J--;else if(Q===","&&J===0)return Y}return-1}function dG($,Z,J){let Y=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),X=Q.exec(Y);while(X){let G=X.index,K=G+X[0].length-1,q=1,z=K+1;while(z<Y.length&&q>0){if(Y[z]==="(")q++;else if(Y[z]===")")q--;z++}if(q!==0)break;let W=Y.substring(K+1,z-1),U=`${J}(${W})`;Y=Y.substring(0,G)+U+Y.substring(z),Q.lastIndex=G+U.length,X=Q.exec(Y)}return Y}function mG($){return/\b(state|derived|effect)\s*\(/.test($)}function uG($){let Z=$,J=[],Y=new Set,Q=0,X=0,G=Z.length,K=(U)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===U){X++;return}X++}},q=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let U=1;while(X<G&&U>0)if(Z[X]==="{")U++;else if(Z[X]==="}")U--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},z=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
2494
+ `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},W=()=>{if(Q!==0)return;let U=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!Y.has(B))J.push(B),Y.add(B);return}let _=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))J.push(B),Y.add(B);return}let j=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))J.push(B),Y.add(B)}};while(X<G){if(z())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){Q++,X++;continue}if(Z[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))W();X++}return J.join(", ")}function pG($,Z){let J=uG($);return`
2492
2495
  (function() {
2493
2496
  var { state, derived, effect, batch, onMount, onDestroy, useFetch, useRef, useQuery, useMutation, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect } = window.stx;
2494
2497
  var __destroyHooks = [];
@@ -2501,25 +2504,25 @@ ${$}
2501
2504
  if (!window.stx._scopes) window.stx._scopes = {};
2502
2505
  window.stx._scopes['${Z}'] = { ${J}, __destroyCallbacks: __destroyHooks };
2503
2506
  })();
2504
- `}function uG($,Z){let J=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let Q=(J[2]+J[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let X=J[1],G=J[2],K=J[3];return{html:`${X}${G} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function cG($){if($.__onceStore instanceof Set)return $.__onceStore;return lG}async function W4($,Z,J,Y,Q,X=new Set){let G=Y.partialsDir||K0.join(K0.dirname(J),"partials");if(G&&!K0.isAbsolute(G)){let B=K0.resolve(__dirname,"..");G=K0.resolve(B,G)}let K=gG($,"@partial","@include"),q=cG(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,O,F)=>{let L=O.trim(),H=`${J}:${L}`;if(q.has(H))return"";return q.add(H),O});{let B=/@includeIf\s*\(/g,O;while((O=B.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")")H--;V++}if(H!==0)break;let A=K.substring(L+1,V-1),w=A.match(/^\s*['"]([^'"]+)['"]/);if(!w){B.lastIndex=V;continue}let N=w[1],R=z(N,G,J),T="";if(R&&await Bun.file(R).exists())Q.add(R),T=`@include(${A})`;K=K.substring(0,F)+T+K.substring(V),B.lastIndex=0}}for(let[B,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let F=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=F.exec(K))!==null){let H=L.index,V=H+L[0].length-1,A=1,w=V+1;while(w<K.length&&A>0){if(K[w]==="(")A++;else if(K[w]===")")A--;w++}if(A!==0)break;let N=K.substring(V+1,w-1),R=q4(N,0);if(R===-1){F.lastIndex=w;continue}let T=N.substring(0,R).trim(),I=N.substring(R+1).trim(),M=I.match(/^\s*['"]([^'"]+)['"]/);if(!M){F.lastIndex=w;continue}let E=M[1],k=I.substring(M[0].length),y,S=q4(k,0);if(S!==-1)y=k.substring(S+1).trim();try{let b=`Boolean(${T})`,D;if(t(b)){let i=e(b,Object.keys(Z));D=Boolean(i(...Object.values(Z)))}else D=Boolean(J0(b,Z));let x=O?!D:D,h="";if(x){let i=z(E,G,J);if(i&&await Bun.file(i).exists())Q.add(i);h=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,H)+h+K.substring(w),F.lastIndex=0}catch(b){let D=b instanceof Error?b.message:String(b),x=X0("Include",`Error evaluating ${B} condition: ${D}`,J,$,H);K=K.substring(0,H)+x+K.substring(w),F.lastIndex=0}}}{let B=/@each\s*\(/g,O;while((O=B.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let A=K.substring(L+1,V),w=K.substring(F,V+1),N=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){B.lastIndex=0,K=K.replace(w,"");continue}let[,R,T,I,M]=N;try{let E,k=T.trim();if(t(k))E=e(k,Object.keys(Z))(...Object.values(Z));else E=J0(k,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let b={...Z,[I]:S},D=await U(R,b,$,F);y+=D}else if(M)y=await U(M,{},$,F);K=K.substring(0,F)+y+K.substring(V+1),B.lastIndex=0}catch(E){let k=E instanceof Error?E.message:String(E);K=K.substring(0,F)+X0("Each",`Error in @each: ${k}`,J,$,F)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,O;while((O=B.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let A=K.substring(L+1,V),w=K.substring(F,V+1),N=A.match(/^\s*(\[[^\]]+\])/);if(!N){B.lastIndex=0,K=K.replace(w,"");continue}let R=N[1],T=A.slice(N[0].length),I,M=T.match(/^\s*,\s*\{/);if(M){T=T.slice(M[0].length-1);let y=1,S=1;while(S<T.length&&y>0){if(T[S]==="{")y++;else if(T[S]==="}"){if(y--,y===0)break}S++}I=T.substring(0,S+1),T=T.slice(S+1)}let E,k=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)E=k[1];try{let y=JSON.parse(R.replace(/'/g,'"')),S={};if(I)try{S=F0(I,Z)}catch(D){let x=D instanceof Error?D.message:String(D);if(Y.debug){let h=X0("Include",`Error parsing includeFirst variables: ${x}`,J,$,F,w);K=K.replace(w,()=>h)}else K=K.replace(w,()=>E||"");continue}let b=!1;for(let D of y){let x=z(D,G,J);if(!x)continue;if(await c(x)){let h=await U(D,S,$,F);K=K.replace(w,()=>h),b=!0;break}}if(!b)if(E!==void 0)K=K.replace(w,()=>E);else if(Y.debug){let D=X0("Include",`None of the includeFirst paths exist: ${R}`,J,$,F,w);K=K.replace(w,()=>D)}else K=K.replace(w,"")}catch(y){let S=y instanceof Error?y.message:String(y),b=X0("Include",`Error processing @includeFirst: ${S}`,J,$,F,w);K=K.replace(w,()=>b)}B.lastIndex=0}}function z(B,O,F){try{let L=B;if(!B.endsWith(".stx"))L=`${B}.stx`;let H=K0.resolve(O),V=K0.resolve(K0.dirname(F)),A;if(!L.startsWith("./")&&!L.startsWith("../"))A=K0.resolve(O,L);else A=K0.resolve(V,L);let w=K0.normalize(A),N=w.startsWith(H+K0.sep)||w===H,R=w.startsWith(V+K0.sep)||w===V,T=!1,I=K0.dirname(V);if(w.startsWith(I+K0.sep)){if(!K0.relative(I,w).split(K0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))T=!0}if(!N&&!R&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${w}`),console.error(` Allowed dirs: ${H}, ${V}`),null;return w}catch(L){return console.error(`Error resolving path ${B}: ${L}`),null}}let W=K0.resolve(J);X.add(W);async function U(B,O={},F,L){let H=z(B,G,J);if(!H)return X0("Include",`Could not resolve path for include: ${B}`,J,F,L);let V=K0.resolve(H);if(X.has(V)){let A=[...X,V].map((w)=>K0.basename(w)).join(" -> ");return X0("Include",`Circular include detected: ${A}`,J,F,L)}try{Q.add(H);let A;if(!A)try{A=await Bun.file(H).text()}catch(D){let x=D instanceof Error?D.message:String(D);return X0("Include",`Error loading include file ${B}: ${x}`,J,F,L)}let w=A,N=w.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(N)w=N[1].trim();let R=A.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(R)T=`<style${R[1]}>${R[2]}</style>`;w=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=w.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[D,x]of Object.entries(O))I[D]=x;let M=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...A.matchAll(M)],k="",y=null;for(let D of E){let x=D[1]||"",h=D[2]||"",i=x.includes("server");if(q1(x)&&h.trim())h=W1(h);let H0=hG(h);if(H0&&!i){y=`stx_scope_${K0.basename(H,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++pG}`;let _0=r0(h),C0=mG(_0,y);k+=`<script data-stx-scoped>${C0}</script>
2507
+ `}function lG($,Z){let J=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let Q=(J[2]+J[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let X=J[1],G=J[2],K=J[3];return{html:`${X}${G} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function nG($){if($.__onceStore instanceof Set)return $.__onceStore;return iG}async function W4($,Z,J,Y,Q,X=new Set){let G=Y.partialsDir||K0.join(K0.dirname(J),"partials");if(G&&!K0.isAbsolute(G)){let B=K0.resolve(__dirname,"..");G=K0.resolve(B,G)}let K=dG($,"@partial","@include"),q=nG(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,O,F)=>{let L=O.trim(),H=`${J}:${L}`;if(q.has(H))return"";return q.add(H),O});{let B=/@includeIf\s*\(/g,O;while((O=B.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")")H--;V++}if(H!==0)break;let A=K.substring(L+1,V-1),w=A.match(/^\s*['"]([^'"]+)['"]/);if(!w){B.lastIndex=V;continue}let N=w[1],R=z(N,G,J),T="";if(R&&await Bun.file(R).exists())Q.add(R),T=`@include(${A})`;K=K.substring(0,F)+T+K.substring(V),B.lastIndex=0}}for(let[B,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let F=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=F.exec(K))!==null){let H=L.index,V=H+L[0].length-1,A=1,w=V+1;while(w<K.length&&A>0){if(K[w]==="(")A++;else if(K[w]===")")A--;w++}if(A!==0)break;let N=K.substring(V+1,w-1),R=q4(N,0);if(R===-1){F.lastIndex=w;continue}let T=N.substring(0,R).trim(),I=N.substring(R+1).trim(),M=I.match(/^\s*['"]([^'"]+)['"]/);if(!M){F.lastIndex=w;continue}let E=M[1],k=I.substring(M[0].length),y,S=q4(k,0);if(S!==-1)y=k.substring(S+1).trim();try{let b=`Boolean(${T})`,D;if(t(b)){let i=e(b,Object.keys(Z));D=Boolean(i(...Object.values(Z)))}else D=Boolean(J0(b,Z));let x=O?!D:D,h="";if(x){let i=z(E,G,J);if(i&&await Bun.file(i).exists())Q.add(i);h=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,H)+h+K.substring(w),F.lastIndex=0}catch(b){let D=b instanceof Error?b.message:String(b),x=X0("Include",`Error evaluating ${B} condition: ${D}`,J,$,H);K=K.substring(0,H)+x+K.substring(w),F.lastIndex=0}}}{let B=/@each\s*\(/g,O;while((O=B.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let A=K.substring(L+1,V),w=K.substring(F,V+1),N=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){B.lastIndex=0,K=K.replace(w,"");continue}let[,R,T,I,M]=N;try{let E,k=T.trim();if(t(k))E=e(k,Object.keys(Z))(...Object.values(Z));else E=J0(k,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let b={...Z,[I]:S},D=await U(R,b,$,F);y+=D}else if(M)y=await U(M,{},$,F);K=K.substring(0,F)+y+K.substring(V+1),B.lastIndex=0}catch(E){let k=E instanceof Error?E.message:String(E);K=K.substring(0,F)+X0("Each",`Error in @each: ${k}`,J,$,F)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,O;while((O=B.exec(K))!==null){let F=O.index,L=F+O[0].length-1,H=1,V=L+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let A=K.substring(L+1,V),w=K.substring(F,V+1),N=A.match(/^\s*(\[[^\]]+\])/);if(!N){B.lastIndex=0,K=K.replace(w,"");continue}let R=N[1],T=A.slice(N[0].length),I,M=T.match(/^\s*,\s*\{/);if(M){T=T.slice(M[0].length-1);let y=1,S=1;while(S<T.length&&y>0){if(T[S]==="{")y++;else if(T[S]==="}"){if(y--,y===0)break}S++}I=T.substring(0,S+1),T=T.slice(S+1)}let E,k=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(k)E=k[1];try{let y=JSON.parse(R.replace(/'/g,'"')),S={};if(I)try{S=F0(I,Z)}catch(D){let x=D instanceof Error?D.message:String(D);if(Y.debug){let h=X0("Include",`Error parsing includeFirst variables: ${x}`,J,$,F,w);K=K.replace(w,()=>h)}else K=K.replace(w,()=>E||"");continue}let b=!1;for(let D of y){let x=z(D,G,J);if(!x)continue;if(await l(x)){let h=await U(D,S,$,F);K=K.replace(w,()=>h),b=!0;break}}if(!b)if(E!==void 0)K=K.replace(w,()=>E);else if(Y.debug){let D=X0("Include",`None of the includeFirst paths exist: ${R}`,J,$,F,w);K=K.replace(w,()=>D)}else K=K.replace(w,"")}catch(y){let S=y instanceof Error?y.message:String(y),b=X0("Include",`Error processing @includeFirst: ${S}`,J,$,F,w);K=K.replace(w,()=>b)}B.lastIndex=0}}function z(B,O,F){try{let L=B;if(!B.endsWith(".stx"))L=`${B}.stx`;let H=K0.resolve(O),V=K0.resolve(K0.dirname(F)),A;if(!L.startsWith("./")&&!L.startsWith("../"))A=K0.resolve(O,L);else A=K0.resolve(V,L);let w=K0.normalize(A),N=w.startsWith(H+K0.sep)||w===H,R=w.startsWith(V+K0.sep)||w===V,T=!1,I=K0.dirname(V);if(w.startsWith(I+K0.sep)){if(!K0.relative(I,w).split(K0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))T=!0}if(!N&&!R&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${w}`),console.error(` Allowed dirs: ${H}, ${V}`),null;return w}catch(L){return console.error(`Error resolving path ${B}: ${L}`),null}}let W=K0.resolve(J);X.add(W);async function U(B,O={},F,L){let H=z(B,G,J);if(!H)return X0("Include",`Could not resolve path for include: ${B}`,J,F,L);let V=K0.resolve(H);if(X.has(V)){let A=[...X,V].map((w)=>K0.basename(w)).join(" -> ");return X0("Include",`Circular include detected: ${A}`,J,F,L)}try{Q.add(H);let A;if(!A)try{A=await Bun.file(H).text()}catch(D){let x=D instanceof Error?D.message:String(D);return X0("Include",`Error loading include file ${B}: ${x}`,J,F,L)}let w=A,N=w.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(N)w=N[1].trim();let R=A.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(R)T=`<style${R[1]}>${R[2]}</style>`;w=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=w.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[D,x]of Object.entries(O))I[D]=x;let M=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...A.matchAll(M)],k="",y=null;for(let D of E){let x=D[1]||"",h=D[2]||"",i=x.includes("server");if(q1(x)&&h.trim())h=W1(h);let H0=mG(h);if(H0&&!i){y=`stx_scope_${K0.basename(H,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++cG}`;let _0=a0(h),P0=pG(_0,y);k+=`<script data-stx-scoped>${P0}</script>
2505
2508
  `;continue}if(i)try{let{extractVariables:_0}=await Promise.resolve().then(() => ($5(),D5));await _0(h,I,H)}catch(_0){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${H}:`,_0)}if(!i&&!H0){let _0=x.replace(/\bclient\b/i,"").trim();k+=`<script data-stx-scoped${_0?` ${_0}`:""}>${h}</script>
2506
- `}}if(y){let D=uG(w,y);if(w=D.html,D.mergedIntoExisting)k=k.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${D.mergedIntoExisting}']`),y=D.mergedIntoExisting}if(w.includes("@include")||w.includes("@partial"))w=await W4(w,I,H,Y,Q,X);let{processLoops:S}=await Promise.resolve().then(() => (K4(),C2)),b=S(w,I,H);if(b=V1(b,I,H),b=a0(b,I,H),T)b+=`
2509
+ `}}if(y){let D=lG(w,y);if(w=D.html,D.mergedIntoExisting)k=k.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${D.mergedIntoExisting}']`),y=D.mergedIntoExisting}if(w.includes("@include")||w.includes("@partial"))w=await W4(w,I,H,Y,Q,X);let{processLoops:S}=await Promise.resolve().then(() => (K4(),v2)),b=S(w,I,H);if(b=V1(b,I,H),b=t0(b,I,H),T)b+=`
2507
2510
  `+T;if(k)b+=`
2508
2511
  `+k;return b}catch(A){let w=A instanceof Error?A.message:String(A);return X0("Include",`Error processing include ${B}: ${w}`,J,F,L)}}let _=/@include\s*\(/g,j;while((j=_.exec(K))!==null){let B=j.index,O=B+j[0].length-1,F=1,L=O+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")")F--;L++}if(F!==0)break;let H=K.substring(B,L),V=K.substring(O+1,L-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){_.lastIndex=L;continue}let w=A[1],N,R=V.substring(A[0].length),T=q4(R,0);if(T!==-1)N=R.substring(T+1).trim();let I={};if(N)try{I=F0(N,Z)}catch(E){let k=E instanceof Error?E.message:String(E);K=K.replace(H,X0("Include",`Error parsing include variables for ${w}: ${k}`,J,$,B)),_.lastIndex=0;continue}let M=await U(w,I,$,B);K=K.substring(0,B)+M+K.substring(L),_.lastIndex=0}return K}function z4($,Z){let J=$;function Y(Q,X,G,K){let q=Q,z=!0;while(z){z=!1;let W=new RegExp(`@${X}\\(['"]([^'"]+)['"]\\)`),U=q.match(W);if(!U||U.index===void 0)break;let _=U.index,j=U[1],B=_+U[0].length,O=new RegExp(`@${X}\\(`),F=new RegExp(`@${G}(?![a-z])`),L=1,H=B,V=-1;while(L>0&&H<q.length){let w=q.slice(H),N=w.match(O),R=w.match(F),T=N?H+N.index:1/0,I=R?H+R.index:1/0;if(T<I)L++,H=T+(N[0].length||1);else if(I<1/0){if(L--,L===0){V=I;break}H=I+G.length+1}else break}if(V===-1)break;let A=q.slice(B,V);if(!Z[j])Z[j]=[];if(K)Z[j].unshift(A);else Z[j].push(A);q=q.substring(0,_)+q.substring(V+`@${G}`.length),z=!0}return q}return J=Y(J,"push","endpush",!1),J=Y(J,"prepend","endprepend",!0),J}function U4($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,Y)=>{if(!Z[Y]||Z[Y].length===0)return"";return Z[Y].join(`
2509
- `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",pG=0,qj,lG;var P2=C(()=>{z9();t0();E1();R0();A0();qj=new a1(500),lG=new Set});import*as _4 from"path";async function v2($,Z,J=""){if(_4.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return f2($,Z,J,"@js","@endjs")}async function x2($,Z,J=""){if(_4.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((X)=>({...X,displayName:`User ${X.id}: ${X.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return f2($,Z,J,"@ts","@endts")}async function f2($,Z,J,Y,Q){let X=$,G=D1(`${Y}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:z,content:W,index:U}of K)try{let _=Object.keys(Z),j=Object.values(Z),B=W.trim();if(Y==="@ts")B=B.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let F=(B.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((w)=>w.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",H=`
2512
+ `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",cG=0,Uj,iG;var x2=C(()=>{z9();n0();E1();R0();A0();Uj=new a1(500),iG=new Set});import*as _4 from"path";async function f2($,Z,J=""){if(_4.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return h2($,Z,J,"@js","@endjs")}async function g2($,Z,J=""){if(_4.basename(J)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((X)=>({...X,displayName:`User ${X.id}: ${X.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return h2($,Z,J,"@ts","@endts")}async function h2($,Z,J,Y,Q){let X=$,G=D1(`${Y}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:z,content:W,index:U}of K)try{let _=Object.keys(Z),j=Object.values(Z),B=W.trim();if(Y==="@ts")B=B.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let F=(B.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((w)=>w.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",H=`
2510
2513
  ${B}
2511
2514
  ${L}
2512
- `,A=Function(..._,H)(...j);if(A&&typeof A==="object")Object.assign(Z,A);X=X.replace(z,"")}catch(_){console.error(`Error executing ${Y} code block in ${J}:`,_);let j=_ instanceof Error?_.message:String(_),B=X0(`${Y} Directive`,`Error executing code: ${j}`,J,$,U,z);console.error(B),X=X.replace(z,"")}return X}var g2=C(()=>{E1();A0()});function iG($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function h2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,Y,Q,X)=>{return iG(Y,X||"_method")})}async function d2($,Z,J,Y,Q){if(!Y.middleware||Y.middleware.length===0)return $;let X=$,G=Y.middleware.filter((K)=>K.timing===Q);if(G.length===0)return X;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(X,Z,J,Y);if(typeof q==="string")X=q;else if(Y.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(Y.debug)console.error(`Error in middleware ${K.name}:`,q);if(Y.debug){let z=X0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,J,$);X=X.replace(/<body[^>]*>/,`$&
2515
+ `,A=Function(..._,H)(...j);if(A&&typeof A==="object")Object.assign(Z,A);X=X.replace(z,"")}catch(_){console.error(`Error executing ${Y} code block in ${J}:`,_);let j=_ instanceof Error?_.message:String(_),B=X0(`${Y} Directive`,`Error executing code: ${j}`,J,$,U,z);console.error(B),X=X.replace(z,"")}return X}var d2=C(()=>{E1();A0()});function oG($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function m2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,Y,Q,X)=>{return oG(Y,X||"_method")})}async function u2($,Z,J,Y,Q){if(!Y.middleware||Y.middleware.length===0)return $;let X=$,G=Y.middleware.filter((K)=>K.timing===Q);if(G.length===0)return X;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(X,Z,J,Y);if(typeof q==="string")X=q;else if(Y.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(Y.debug)console.error(`Error in middleware ${K.name}:`,q);if(Y.debug){let z=X0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,J,$);X=X.replace(/<body[^>]*>/,`$&
2513
2516
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${z1(z)}</div>
2514
- `)}}}return X}async function m2($,Z,J,Y){return d2($,Z,J,Y,"before")}async function u2($,Z,J,Y){return d2($,Z,J,Y,"after")}var p2=C(()=>{t0();A0()});import{defineRoute as Aj,defineRoutes as Nj,resetRoutes as Rj,route as Tj,setAppUrl as Mj}from"stx-router";import{route as nG}from"stx-router";function l2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,Y,Q,X)=>{try{let G=Q?F0(Q,{}):{};return nG(Y,G,X==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var c2=C(()=>{R0()});async function i2($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(U5.exact[$])for(let Y of U5.exact[$])await Promise.resolve(Y(Z,$));if(U5.exact[J])for(let Y of U5.exact[J])await Promise.resolve(Y(Z,$));for(let{pattern:Y,callback:Q}of U5.patterns)if(Y.test($)||Y.test(J))await Promise.resolve(Q(Z,$))}var U5;var n2=C(()=>{U5={patterns:[],exact:{}}});function o2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>o2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function s2($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],X;while((X=Y.exec($))!==null)Q.push([X.index,X.index+X[0].length]);function G(z){return Q.some(([W,U])=>z>=W&&z<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((X=K.exec(J))!==null){if(G(X.index))continue;let z=X[0],W=X[2];if(!W||!W.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,_,j=W,B=!1;while((_=U.exec(W))!==null){let O=_[1],F=_[2];if(F.includes("()")&&!F.includes(".get(")||F.includes("$store")||F.includes("$ref"))continue;try{let L=Object.keys(Z),H=Object.values(Z),V=F.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!L.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let w=Function(...L,`return (${F})`)(...H);if(O==="class"){let N=o2(w);if(N){let R=j.match(/\sclass="([^"]*)"/);if(R)j=j.replace(R[0],` class="${R[1]} ${N}"`);else j=j.replace(_[0],` class="${N}"`)}else j=j.replace(_[0],"");B=!0;continue}if(oG.has(O)){if(w)j=j.replace(_[0],` ${O}`);else j=j.replace(_[0],"");B=!0;continue}if(w===null||w===void 0||w===!1)j=j.replace(_[0],"");else{let N=String(w).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(_[0],` ${O}="${N}"`)}B=!0}catch{continue}}if(B){let O=z.endsWith("/>")?" /":"",L=`<${X[1]}${j}${O}>`;q.push({start:X.index,end:X.index+z.length,replacement:L})}}for(let z=q.length-1;z>=0;z--){let{start:W,end:U,replacement:_}=q[z];J=J.slice(0,W)+_+J.slice(U)}return J}var oG;var r2=C(()=>{oG=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function w1($,Z){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=Z;let Y=J.exec($);if(!Y)return null;return{full:Y[0],tag:Y[1],attrs:Y[2],selfClosing:Y[3].includes("/")||sG.has(Y[1].toLowerCase()),start:Y.index,end:Y.index+Y[0].length}}function aG($,Z,J){let Y=1,Q=J,X=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(Y>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q;let K=X.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)Y++,Q=K.index+K[0].length;else{if(Y--,Y===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function h0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=aG($,Z.tag,Z.end);if(J===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:J,innerHTML:$.slice(Z.end,J-`</${Z.tag}>`.length)}}function a2($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function x1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return Y?Y[1]:null}function X1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function Q1($,Z,J){let Y=Z.selfClosing?" /":"",Q=`<${Z.tag}${J}${Y}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function tG($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function eG($){let Z=$,J=0;while(J<Z.length){let Y=w1(Z,J);if(!Y)break;let Q=x1(Y.attrs,"v-for");if(Q===null){J=Y.end;continue}let X=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!X){J=Y.end;continue}let G=X[1].trim(),K=X[2].trim(),q;if(G.includes(",")){let F=G.split(",").map((V)=>V.trim()),L=F[0],H=F[1];q=`${K} as ${H} => ${L}`}else q=`${K} as ${G}`;let z=X1(Y.attrs,"v-for"),W=X1(z,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=h0(Z,Y),_=Z.slice(U.outerStart,U.outerEnd),j=Q1(_,{...Y,start:0,end:Y.end-Y.start},W),B=`@foreach(${q})
2517
+ `)}}}return X}async function p2($,Z,J,Y){return u2($,Z,J,Y,"before")}async function l2($,Z,J,Y){return u2($,Z,J,Y,"after")}var c2=C(()=>{n0();A0()});import{defineRoute as Tj,defineRoutes as Mj,resetRoutes as Ij,route as Dj,setAppUrl as Ej}from"stx-router";import{route as sG}from"stx-router";function i2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,Y,Q,X)=>{try{let G=Q?F0(Q,{}):{};return sG(Y,G,X==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var n2=C(()=>{R0()});async function o2($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(U5.exact[$])for(let Y of U5.exact[$])await Promise.resolve(Y(Z,$));if(U5.exact[J])for(let Y of U5.exact[J])await Promise.resolve(Y(Z,$));for(let{pattern:Y,callback:Q}of U5.patterns)if(Y.test($)||Y.test(J))await Promise.resolve(Q(Z,$))}var U5;var s2=C(()=>{U5={patterns:[],exact:{}}});function r2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>r2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function a2($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],X;while((X=Y.exec($))!==null)Q.push([X.index,X.index+X[0].length]);function G(z){return Q.some(([W,U])=>z>=W&&z<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((X=K.exec(J))!==null){if(G(X.index))continue;let z=X[0],W=X[2];if(!W||!W.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,_,j=W,B=!1;while((_=U.exec(W))!==null){let O=_[1],F=_[2];if(F.includes("()")&&!F.includes(".get(")||F.includes("$store")||F.includes("$ref"))continue;try{let L=Object.keys(Z),H=Object.values(Z),V=F.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!L.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let w=Function(...L,`return (${F})`)(...H);if(O==="class"){let N=r2(w);if(N){let R=j.match(/\sclass="([^"]*)"/);if(R)j=j.replace(R[0],` class="${R[1]} ${N}"`);else j=j.replace(_[0],` class="${N}"`)}else j=j.replace(_[0],"");B=!0;continue}if(rG.has(O)){if(w)j=j.replace(_[0],` ${O}`);else j=j.replace(_[0],"");B=!0;continue}if(w===null||w===void 0||w===!1)j=j.replace(_[0],"");else{let N=String(w).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(_[0],` ${O}="${N}"`)}B=!0}catch{continue}}if(B){let O=z.endsWith("/>")?" /":"",L=`<${X[1]}${j}${O}>`;q.push({start:X.index,end:X.index+z.length,replacement:L})}}for(let z=q.length-1;z>=0;z--){let{start:W,end:U,replacement:_}=q[z];J=J.slice(0,W)+_+J.slice(U)}return J}var rG;var t2=C(()=>{rG=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function w1($,Z){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=Z;let Y=J.exec($);if(!Y)return null;return{full:Y[0],tag:Y[1],attrs:Y[2],selfClosing:Y[3].includes("/")||aG.has(Y[1].toLowerCase()),start:Y.index,end:Y.index+Y[0].length}}function eG($,Z,J){let Y=1,Q=J,X=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(Y>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q;let K=X.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)Y++,Q=K.index+K[0].length;else{if(Y--,Y===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function d0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=eG($,Z.tag,Z.end);if(J===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:J,innerHTML:$.slice(Z.end,J-`</${Z.tag}>`.length)}}function e2($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function x1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return Y?Y[1]:null}function X1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function Q1($,Z,J){let Y=Z.selfClosing?" /":"",Q=`<${Z.tag}${J}${Y}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function $K($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function ZK($){let Z=$,J=0;while(J<Z.length){let Y=w1(Z,J);if(!Y)break;let Q=x1(Y.attrs,"v-for");if(Q===null){J=Y.end;continue}let X=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!X){J=Y.end;continue}let G=X[1].trim(),K=X[2].trim(),q;if(G.includes(",")){let F=G.split(",").map((V)=>V.trim()),L=F[0],H=F[1];q=`${K} as ${H} => ${L}`}else q=`${K} as ${G}`;let z=X1(Y.attrs,"v-for"),W=X1(z,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=d0(Z,Y),_=Z.slice(U.outerStart,U.outerEnd),j=Q1(_,{...Y,start:0,end:Y.end-Y.start},W),B=`@foreach(${q})
2515
2518
  `,O=`${B}${j}
2516
- @endforeach`;Z=Z.slice(0,U.outerStart)+O+Z.slice(U.outerEnd),J=U.outerStart+B.length}return Z}function $K($){let Z=$,J=0;while(J<Z.length){let Y=w1(Z,J);if(!Y)break;let Q=x1(Y.attrs,"v-if");if(Q===null){J=Y.end;continue}let X=[],G=h0(Z,Y),K=X1(Y.attrs,"v-if"),q=Q1(Z.slice(G.outerStart,G.outerEnd),{...Y,start:0,end:Y.end-Y.start},K);X.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:Y});let z=G.outerEnd,W=!0;while(W){let O=Z.slice(z).match(/^\s*/),F=O?O[0].length:0,L=w1(Z,z+F);if(!L){W=!1;break}let H=x1(L.attrs,"v-else-if"),V=a2(L.attrs,"v-else");if(H!==null){let A=h0(Z,L),w=X1(L.attrs,"v-else-if"),N=Q1(Z.slice(A.outerStart,A.outerEnd),{...L,start:0,end:L.end-L.start},w);X.push({type:"else-if",expr:H,outerStart:z,outerEnd:A.outerEnd,element:N,parsedTag:L}),z=A.outerEnd}else if(V){let A=h0(Z,L),w=X1(L.attrs,"v-else"),N=Q1(Z.slice(A.outerStart,A.outerEnd),{...L,start:0,end:L.end-L.start},w);X.push({type:"else",outerStart:z,outerEnd:A.outerEnd,element:N,parsedTag:L}),W=!1}else W=!1}let U=[];for(let O of X)if(O.type==="if")U.push(`@if(${O.expr})
2519
+ @endforeach`;Z=Z.slice(0,U.outerStart)+O+Z.slice(U.outerEnd),J=U.outerStart+B.length}return Z}function YK($){let Z=$,J=0;while(J<Z.length){let Y=w1(Z,J);if(!Y)break;let Q=x1(Y.attrs,"v-if");if(Q===null){J=Y.end;continue}let X=[],G=d0(Z,Y),K=X1(Y.attrs,"v-if"),q=Q1(Z.slice(G.outerStart,G.outerEnd),{...Y,start:0,end:Y.end-Y.start},K);X.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:Y});let z=G.outerEnd,W=!0;while(W){let O=Z.slice(z).match(/^\s*/),F=O?O[0].length:0,L=w1(Z,z+F);if(!L){W=!1;break}let H=x1(L.attrs,"v-else-if"),V=e2(L.attrs,"v-else");if(H!==null){let A=d0(Z,L),w=X1(L.attrs,"v-else-if"),N=Q1(Z.slice(A.outerStart,A.outerEnd),{...L,start:0,end:L.end-L.start},w);X.push({type:"else-if",expr:H,outerStart:z,outerEnd:A.outerEnd,element:N,parsedTag:L}),z=A.outerEnd}else if(V){let A=d0(Z,L),w=X1(L.attrs,"v-else"),N=Q1(Z.slice(A.outerStart,A.outerEnd),{...L,start:0,end:L.end-L.start},w);X.push({type:"else",outerStart:z,outerEnd:A.outerEnd,element:N,parsedTag:L}),W=!1}else W=!1}let U=[];for(let O of X)if(O.type==="if")U.push(`@if(${O.expr})
2517
2520
  ${O.element}`);else if(O.type==="else-if")U.push(`@elseif(${O.expr})
2518
2521
  ${O.element}`);else U.push(`@else
2519
2522
  ${O.element}`);U.push("@endif");let _=U.join(`
2520
- `),j=X[0].outerStart,B=X[X.length-1].outerEnd;Z=Z.slice(0,j)+_+Z.slice(B),J=j+_.length}return Z}function ZK($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function YK($){let Z=$,J=0;while(J<Z.length){let Y=w1(Z,J);if(!Y)break;let Q=Y.attrs,X=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){X=!0;let W=K[1],U=K[2],_=K[3];Q=Q.replace(K[0],""),Q+=` :${W}="${_}" @update:${W}="${_} = $event"`,K=Q.match(G)}if(X){let W=h0(Z,Y),U=Z.slice(W.outerStart,W.outerEnd),_=Q1(U,{...Y,start:0,end:Y.end-Y.start},Q);Z=Z.slice(0,W.outerStart)+_+Z.slice(W.outerEnd),J=W.outerStart+_.length;continue}let q=x1(Y.attrs,"v-model");if(q===null){J=Y.end;continue}if(rG.has(Y.tag.toLowerCase())){let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=h0(Z,Y),_=Z.slice(U.outerStart,U.outerEnd),j=Q1(_,{...Y,start:0,end:Y.end-Y.start},W);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),J=U.outerStart+j.length}else{let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=h0(Z,Y),_=Z.slice(U.outerStart,U.outerEnd),j=Q1(_,{...Y,start:0,end:Y.end-Y.start},W);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),J=U.outerStart+j.length}}return Z}function JK($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function XK($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function QK($){let Z=$,J=0;while(J<Z.length){let Y=w1(Z,J);if(!Y)break;let Q=x1(Y.attrs,"v-html");if(Q===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let X=h0(Z,Y),G=X1(Y.attrs,"v-html"),K=Y.selfClosing?" /":"",q=`<${Y.tag}${G}${K}>{!! ${Q} !!}</${Y.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function GK($){let Z=$,J=0;while(J<Z.length){let Y=w1(Z,J);if(!Y)break;let Q=x1(Y.attrs,"v-text");if(Q===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let X=h0(Z,Y),G=X1(Y.attrs,"v-text"),K=Y.selfClosing?" /":"",q=`<${Y.tag}${G}${K}>{{ ${Q} }}</${Y.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function KK($){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 qK($){let Z=$,J=0;while(J<Z.length){let Y=w1(Z,J);if(!Y)break;if(!a2(Y.attrs,"v-once")){J=Y.end;continue}let Q=X1(Y.attrs,"v-once"),X=h0(Z,Y),G=Z.slice(X.outerStart,X.outerEnd),q=`@once
2523
+ `),j=X[0].outerStart,B=X[X.length-1].outerEnd;Z=Z.slice(0,j)+_+Z.slice(B),J=j+_.length}return Z}function JK($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function XK($){let Z=$,J=0;while(J<Z.length){let Y=w1(Z,J);if(!Y)break;let Q=Y.attrs,X=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){X=!0;let W=K[1],U=K[2],_=K[3];Q=Q.replace(K[0],""),Q+=` :${W}="${_}" @update:${W}="${_} = $event"`,K=Q.match(G)}if(X){let W=d0(Z,Y),U=Z.slice(W.outerStart,W.outerEnd),_=Q1(U,{...Y,start:0,end:Y.end-Y.start},Q);Z=Z.slice(0,W.outerStart)+_+Z.slice(W.outerEnd),J=W.outerStart+_.length;continue}let q=x1(Y.attrs,"v-model");if(q===null){J=Y.end;continue}if(tG.has(Y.tag.toLowerCase())){let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=d0(Z,Y),_=Z.slice(U.outerStart,U.outerEnd),j=Q1(_,{...Y,start:0,end:Y.end-Y.start},W);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),J=U.outerStart+j.length}else{let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=d0(Z,Y),_=Z.slice(U.outerStart,U.outerEnd),j=Q1(_,{...Y,start:0,end:Y.end-Y.start},W);Z=Z.slice(0,U.outerStart)+j+Z.slice(U.outerEnd),J=U.outerStart+j.length}}return Z}function QK($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function GK($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function KK($){let Z=$,J=0;while(J<Z.length){let Y=w1(Z,J);if(!Y)break;let Q=x1(Y.attrs,"v-html");if(Q===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let X=d0(Z,Y),G=X1(Y.attrs,"v-html"),K=Y.selfClosing?" /":"",q=`<${Y.tag}${G}${K}>{!! ${Q} !!}</${Y.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function qK($){let Z=$,J=0;while(J<Z.length){let Y=w1(Z,J);if(!Y)break;let Q=x1(Y.attrs,"v-text");if(Q===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let X=d0(Z,Y),G=X1(Y.attrs,"v-text"),K=Y.selfClosing?" /":"",q=`<${Y.tag}${G}${K}>{{ ${Q} }}</${Y.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function WK($){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 zK($){let Z=$,J=0;while(J<Z.length){let Y=w1(Z,J);if(!Y)break;if(!e2(Y.attrs,"v-once")){J=Y.end;continue}let Q=X1(Y.attrs,"v-once"),X=d0(Z,Y),G=Z.slice(X.outerStart,X.outerEnd),q=`@once
2521
2524
  ${Q1(G,{...Y,start:0,end:Y.end-Y.start},Q)}
2522
- @endonce`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function WK($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function zK($){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 t2($){if(!tG($))return $;let Z=$;return Z=eG(Z),Z=$K(Z),Z=qK(Z),Z=JK(Z),Z=XK(Z),Z=YK(Z),Z=ZK(Z),Z=zK(Z),Z=QK(Z),Z=GK(Z),Z=KK(Z),Z=WK(Z),Z}var sG,rG;var e2=C(()=>{sG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),rG=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"])});async function $8($,Z,J,Y,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let z=K.length-1;z>=0;z--){let W=K[z];try{let U=J0(W.expr,Z);if(!U||typeof U!=="string"){let H=`<!-- dynamic component: could not resolve "${W.expr}" -->`;X=X.slice(0,W.index)+H+X.slice(W.index+W.full.length);continue}let _=W.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,O;while((O=B.exec(_))!==null){let H=O[1]||O[2],V=O[3];if(O[1])try{j[H]=J0(V,Z)}catch{j[H]=V}else j[H]=V}let F=Y.componentsDir||"components",L=await B1(U,j,W.slotContent,F,Z,J,Y,new Set,Q??new Set);X=X.slice(0,W.index)+L+X.slice(W.index+W.full.length)}catch(U){let j=`<!-- dynamic component error: ${U instanceof Error?U.message:String(U)} -->`;X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length)}}return X=await UK(X,Z,J,Y,Q),X}async function UK($,Z,J,Y,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let z=K.length-1;z>=0;z--){let W=K[z];try{let U=J0(W.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${W.expr}" -->`;X=X.slice(0,W.index)+B+X.slice(W.index+W.full.length);continue}let _=Y.componentsDir||"components",j=await B1(U,{},"",_,Z,J,Y,new Set,Q??new Set);X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length)}catch(U){let j=`<!-- dynamic component error: ${U instanceof Error?U.message:String(U)} -->`;X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length)}}return X}var Z8=C(()=>{A0();R0()});function _K($,Z={},J={}){let{title:Y="stx App",lang:Q="en",meta:X=[],link:G=[],script:K=[],headRaw:q="",bodyClass:z="",bodyAttrs:W={}}=Z,U=J.title||Y,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...X].map((w)=>{return` <meta ${Object.entries(w).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
2525
+ @endonce`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),J=X.outerStart+q.length}return Z}function UK($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function _K($){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 $8($){if(!$K($))return $;let Z=$;return Z=ZK(Z),Z=YK(Z),Z=zK(Z),Z=QK(Z),Z=GK(Z),Z=XK(Z),Z=JK(Z),Z=_K(Z),Z=KK(Z),Z=qK(Z),Z=WK(Z),Z=UK(Z),Z}var aG,tG;var Z8=C(()=>{aG=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),tG=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"])});async function Y8($,Z,J,Y,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let z=K.length-1;z>=0;z--){let W=K[z];try{let U=J0(W.expr,Z);if(!U||typeof U!=="string"){let H=`<!-- dynamic component: could not resolve "${W.expr}" -->`;X=X.slice(0,W.index)+H+X.slice(W.index+W.full.length);continue}let _=W.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,O;while((O=B.exec(_))!==null){let H=O[1]||O[2],V=O[3];if(O[1])try{j[H]=J0(V,Z)}catch{j[H]=V}else j[H]=V}let F=Y.componentsDir||"components",L=await B1(U,j,W.slotContent,F,Z,J,Y,new Set,Q??new Set);X=X.slice(0,W.index)+L+X.slice(W.index+W.full.length)}catch(U){let j=`<!-- dynamic component error: ${U instanceof Error?U.message:String(U)} -->`;X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length)}}return X=await BK(X,Z,J,Y,Q),X}async function BK($,Z,J,Y,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let z=K.length-1;z>=0;z--){let W=K[z];try{let U=J0(W.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${W.expr}" -->`;X=X.slice(0,W.index)+B+X.slice(W.index+W.full.length);continue}let _=Y.componentsDir||"components",j=await B1(U,{},"",_,Z,J,Y,new Set,Q??new Set);X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length)}catch(U){let j=`<!-- dynamic component error: ${U instanceof Error?U.message:String(U)} -->`;X=X.slice(0,W.index)+j+X.slice(W.index+W.full.length)}}return X}var J8=C(()=>{A0();R0()});function jK($,Z={},J={}){let{title:Y="stx App",lang:Q="en",meta:X=[],link:G=[],script:K=[],headRaw:q="",bodyClass:z="",bodyAttrs:W={}}=Z,U=J.title||Y,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...X].map((w)=>{return` <meta ${Object.entries(w).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
2523
2526
  `),O=G.map((w)=>{return` <link ${Object.entries(w).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
2524
2527
  `),F=K.map((w)=>{if(w.src)return` <script ${Object.entries(w).filter(([R])=>R!=="content").map(([R,T])=>`${R}="${T}"`).join(" ")}></script>`;if(w.content)return` <script>${w.content}</script>`;return""}).filter(Boolean).join(`
2525
2528
  `),L=Object.entries(W).map(([w,N])=>` ${w}="${N}"`).join(""),H=z?` class="${z}"`:"",V=[B,` <title>${U}</title>`,O,F,q?` ${q}`:"",...(J.styles||[]).map((w)=>` ${w}`),...(J.headScripts||[]).map((w)=>` ${w}`),J.headStack||""].filter(Boolean),A=[$,...(J.bodyScripts||[]).map((w)=>w),J.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
@@ -2532,7 +2535,7 @@ ${V.join(`
2532
2535
  ${A.join(`
2533
2536
  `)}
2534
2537
  </body>
2535
- </html>`}function BK($){let Z=$.trim();while(Z.startsWith("<!--")){let J=Z.indexOf("-->");if(J===-1)break;Z=Z.slice(J+3).trim()}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}function Y8($,Z={},J={}){if(BK($))return $;return _K($,Z,J)}function B4($){let Z=$,J=new Set,Y=new Set,Q=()=>{if(S0)Y.add(S0);return Z};return Q.set=(X)=>{if(!Object.is(X,Z)){let G=Z;if(Z=X,J.forEach((K)=>K(Z,G)),_5)Y.forEach((K)=>F9.add(K));else Y.forEach((K)=>K())}},Q.update=(X)=>{Q.set(X(Z))},Q.subscribe=(X)=>{return J.add(X),()=>J.delete(X)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function j4($){let Z,J=!0,Y=new Set,Q=()=>{if(!J)if(J=!0,_5)Y.forEach((G)=>F9.add(G));else Y.forEach((G)=>G())},X=()=>{if(S0)Y.add(S0);if(J){let G=S0;S0=Q,L9.push(Q);try{Z=$()}finally{L9.pop(),S0=G}J=!1}return Z};return Object.defineProperty(X,"_isDerived",{value:!0,writable:!1}),X}function O4($,Z={}){let J,Y=!1,Q=()=>{if(Y)return;if(J)J(),J=void 0;let X=S0;S0=Q,L9.push(Q);try{J=$()}finally{L9.pop(),S0=X}};if(Z.immediate!==!1)Q();return()=>{if(Y=!0,J)J()}}function H4($){if(_5){$();return}_5=!0;try{$()}finally{_5=!1,F9.forEach((Z)=>Z()),F9.clear()}}function L4($){jK.push($)}function F4($){OK.push($)}function V9($){return typeof $==="function"&&$._isSignal===!0}function w9($){return typeof $==="function"&&$._isDerived===!0}function V4($){if(V9($)||w9($))return $();return $}function w4($){let Z=S0;S0=null;try{return $()}finally{S0=Z}}var S0=null,L9,_5=!1,F9,jK,OK;var A4=C(()=>{L9=[],F9=new Set,jK=[],OK=[]});var N4={};r(N4,{untrack:()=>V4,state:()=>B4,peek:()=>w4,onMount:()=>L4,onDestroy:()=>F4,isSignal:()=>V9,isDerived:()=>w9,generateSignalsRuntimeDev:()=>A9,generateSignalsRuntime:()=>J8,effect:()=>O4,derived:()=>j4,default:()=>HK,batch:()=>H4});function J8(){try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(A9());return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return A9()}}function A9(){return`
2538
+ </html>`}function OK($){let Z=$.trim();while(Z.startsWith("<!--")){let J=Z.indexOf("-->");if(J===-1)break;Z=Z.slice(J+3).trim()}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}function X8($,Z={},J={}){if(OK($))return $;return jK($,Z,J)}function B4($){let Z=$,J=new Set,Y=new Set,Q=()=>{if(S0)Y.add(S0);return Z};return Q.set=(X)=>{if(!Object.is(X,Z)){let G=Z;if(Z=X,J.forEach((K)=>K(Z,G)),_5)Y.forEach((K)=>F9.add(K));else Y.forEach((K)=>K())}},Q.update=(X)=>{Q.set(X(Z))},Q.subscribe=(X)=>{return J.add(X),()=>J.delete(X)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function j4($){let Z,J=!0,Y=new Set,Q=()=>{if(!J)if(J=!0,_5)Y.forEach((G)=>F9.add(G));else Y.forEach((G)=>G())},X=()=>{if(S0)Y.add(S0);if(J){let G=S0;S0=Q,L9.push(Q);try{Z=$()}finally{L9.pop(),S0=G}J=!1}return Z};return Object.defineProperty(X,"_isDerived",{value:!0,writable:!1}),X}function O4($,Z={}){let J,Y=!1,Q=()=>{if(Y)return;if(J)J(),J=void 0;let X=S0;S0=Q,L9.push(Q);try{J=$()}finally{L9.pop(),S0=X}};if(Z.immediate!==!1)Q();return()=>{if(Y=!0,J)J()}}function H4($){if(_5){$();return}_5=!0;try{$()}finally{_5=!1,F9.forEach((Z)=>Z()),F9.clear()}}function L4($){HK.push($)}function F4($){LK.push($)}function V9($){return typeof $==="function"&&$._isSignal===!0}function w9($){return typeof $==="function"&&$._isDerived===!0}function V4($){if(V9($)||w9($))return $();return $}function w4($){let Z=S0;S0=null;try{return $()}finally{S0=Z}}var S0=null,L9,_5=!1,F9,HK,LK;var A4=C(()=>{L9=[],F9=new Set,HK=[],LK=[]});var N4={};r(N4,{untrack:()=>V4,state:()=>B4,peek:()=>w4,onMount:()=>L4,onDestroy:()=>F4,isSignal:()=>V9,isDerived:()=>w9,generateSignalsRuntimeDev:()=>A9,generateSignalsRuntime:()=>Q8,effect:()=>O4,derived:()=>j4,default:()=>FK,batch:()=>H4});function Q8(){try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(A9());return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return A9()}}function A9(){return`
2536
2539
  // STX Signals Runtime (Development Build)
2537
2540
  console.log('[stx] signals runtime loading');
2538
2541
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -4026,7 +4029,7 @@ catch (e2) {
4026
4029
  // :attr still works for backward compat but is reserved for structural directives.
4027
4030
  // x-text, x-html, x-model, x-show, x-if, x-for, x-cloak, x-ref, x-data are
4028
4031
  // handled by their own code paths below \u2014 exclude them here.
4029
- var X_HANDLED = {'x-text':1,'x-html':1,'x-model':1,'x-show':1,'x-if':1,'x-for':1,'x-cloak':1,'x-ref':1,'x-data':1,'x-bind':1,'x-class':1,'x-style':1};
4032
+ var X_HANDLED = {'x-text':1,'x-html':1,'x-model':1,'x-show':1,'x-if':1,'x-for':1,'x-cloak':1,'x-ref':1,'x-data':1,'x-bind':1,'x-class':1,'x-style':1,'x-tooltip':1,'x-tooltip-position':1};
4030
4033
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
4031
4034
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
4032
4035
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
@@ -6515,6 +6518,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
6515
6518
  var routerOpts = window.STX_ROUTER_OPTIONS || window.__stxRouterConfig || {};
6516
6519
  var container = document.querySelector('[data-stx-content]')
6517
6520
  || (routerOpts.container ? document.querySelector(routerOpts.container) : null)
6521
+ || document.querySelector('main')
6518
6522
  || document.querySelector('#main-content')
6519
6523
  || document.body;
6520
6524
 
@@ -6650,7 +6654,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
6650
6654
  }
6651
6655
  }
6652
6656
  })();
6653
- `}var HK;var R4=C(()=>{A4();A4();HK={state:B4,derived:j4,effect:O4,batch:H4,onMount:L4,onDestroy:F4,isSignal:V9,isDerived:w9,untrack:V4,peek:w4,generateSignalsRuntime:J8,generateSignalsRuntimeDev:A9}});var T4={};r(T4,{templateCache:()=>X8,readFileCached:()=>LK,invalidateFileCacheByDir:()=>VK,invalidateFileCache:()=>FK,hashFilePath:()=>B5,getCachedSignalsRuntime:()=>AK,getCachedRouterScript:()=>NK,clearDevCaches:()=>RK,checkCache:()=>TK,cacheTemplate:()=>MK});import G1 from"fs";import f1 from"path";async function LK($){let J;for(let Y=0;Y<3;Y++)try{let X=(await G1.promises.stat($)).mtime.getTime(),G=A1.get($);if(G&&G.mtime===X)return G.content;let K=await Bun.file($).text(),z=(await G1.promises.stat($)).mtime.getTime();if(z!==X)continue;return A1.set($,{content:K,mtime:z}),K}catch(Q){J=Q;break}throw A1.delete($),Error(`File not found: ${$}${J?` (${J.message})`:""}`)}function FK($){A1.delete($)}function VK($){for(let Z of A1.keys())if(Z.startsWith($))A1.delete(Z)}async function AK($=!1){if($){let{generateSignalsRuntimeDev:Z}=await Promise.resolve().then(() => (R4(),N4));return Z()}if(N9===null){let{generateSignalsRuntime:Z}=await Promise.resolve().then(() => (R4(),N4));N9=Z()}return N9}async function NK(){if(R9===null){let{getRouterScript:$}=await import("stx-router");R9=$()}return R9}function RK(){A1.clear(),N9=null,wK=null,R9=null}async function TK($,Z){try{if(!Z.cachePath)return null;let J=f1.resolve(Z.cachePath),Y=f1.join(J,`${B5($)}.html`),Q=f1.join(J,`${B5($)}.meta.json`);if(!await c(Y)||!await c(Q))return null;let X=await Bun.file(Q).text(),G=JSON.parse(X);if(G.cacheVersion!==Z.cacheVersion)return null;if((await G1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await G1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(Y).text()}catch(J){return console.warn(`Cache error for ${$}:`,J),null}}async function MK($,Z,J,Y){try{if(!Y.cachePath)return;let Q=f1.resolve(Y.cachePath);await G1.promises.mkdir(Q,{recursive:!0});let X=f1.join(Q,`${B5($)}.html`),G=f1.join(Q,`${B5($)}.meta.json`),K=await G1.promises.stat($);await Bun.write(X,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(J),cacheVersion:Y.cacheVersion,generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),X8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:J})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function B5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,IK)}var X8,A1,N9=null,wK=null,R9=null,IK=16;var M4=C(()=>{A0();X8=new Map,A1=new Map});function Q8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,J="",Y;while((Y=Z.exec($))!==null)J+=Y[1]+`
6657
+ `}var FK;var R4=C(()=>{A4();A4();FK={state:B4,derived:j4,effect:O4,batch:H4,onMount:L4,onDestroy:F4,isSignal:V9,isDerived:w9,untrack:V4,peek:w4,generateSignalsRuntime:Q8,generateSignalsRuntimeDev:A9}});var T4={};r(T4,{templateCache:()=>G8,readFileCached:()=>VK,invalidateFileCacheByDir:()=>AK,invalidateFileCache:()=>wK,hashFilePath:()=>B5,getCachedSignalsRuntime:()=>RK,getCachedRouterScript:()=>TK,clearDevCaches:()=>MK,checkCache:()=>IK,cacheTemplate:()=>DK});import G1 from"fs";import f1 from"path";async function VK($){let J;for(let Y=0;Y<3;Y++)try{let X=(await G1.promises.stat($)).mtime.getTime(),G=A1.get($);if(G&&G.mtime===X)return G.content;let K=await Bun.file($).text(),z=(await G1.promises.stat($)).mtime.getTime();if(z!==X)continue;return A1.set($,{content:K,mtime:z}),K}catch(Q){J=Q;break}throw A1.delete($),Error(`File not found: ${$}${J?` (${J.message})`:""}`)}function wK($){A1.delete($)}function AK($){for(let Z of A1.keys())if(Z.startsWith($))A1.delete(Z)}async function RK($=!1){if($){let{generateSignalsRuntimeDev:Z}=await Promise.resolve().then(() => (R4(),N4));return Z()}if(N9===null){let{generateSignalsRuntime:Z}=await Promise.resolve().then(() => (R4(),N4));N9=Z()}return N9}async function TK(){if(R9===null){let{getRouterScript:$}=await import("stx-router");R9=$()}return R9}function MK(){A1.clear(),N9=null,NK=null,R9=null}async function IK($,Z){try{if(!Z.cachePath)return null;let J=f1.resolve(Z.cachePath),Y=f1.join(J,`${B5($)}.html`),Q=f1.join(J,`${B5($)}.meta.json`);if(!await l(Y)||!await l(Q))return null;let X=await Bun.file(Q).text(),G=JSON.parse(X);if(G.cacheVersion!==Z.cacheVersion)return null;if((await G1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await l(q)){if((await G1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(Y).text()}catch(J){return console.warn(`Cache error for ${$}:`,J),null}}async function DK($,Z,J,Y){try{if(!Y.cachePath)return;let Q=f1.resolve(Y.cachePath);await G1.promises.mkdir(Q,{recursive:!0});let X=f1.join(Q,`${B5($)}.html`),G=f1.join(Q,`${B5($)}.meta.json`),K=await G1.promises.stat($);await Bun.write(X,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(J),cacheVersion:Y.cacheVersion,generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),G8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:J})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function B5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,EK)}var G8,A1,N9=null,NK=null,R9=null,EK=16;var M4=C(()=>{A0();G8=new Map,A1=new Map});function K8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,J="",Y;while((Y=Z.exec($))!==null)J+=Y[1]+`
6654
6658
  `;let Q=/\{\{([\s\S]*?)\}\}/g;while((Y=Q.exec($))!==null)J+=Y[1]+`
6655
6659
  `;if(!J.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((_)=>{return new RegExp(`\\b${_}\\b`).test(J)}),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,z,W=!1;while((z=q.exec(J))!==null)if(!K.has(z[1])){W=!0;break}if(!G&&!W)return $;let U=`<script type="module">
6656
6660
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -6659,7 +6663,7 @@ import '@stacksjs/browser'
6659
6663
  `+$.slice(B);return $.replace("</head>",`${U}
6660
6664
  </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
6661
6665
  ${U}`);return U+`
6662
- `+$}async function G8($,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>
6666
+ `+$}async function q8($,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>
6663
6667
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
6664
6668
  `+$.slice(q)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
6665
6669
  `+$}let{getCachedSignalsRuntime:J}=await Promise.resolve().then(() => (M4(),T4)),Q=`<script data-stx-scoped>${await J(Z.debug)}</script>`,X=$.indexOf("<script");if(X!==-1)return $.slice(0,X)+Q+`
@@ -6668,12 +6672,12 @@ ${U}`);return U+`
6668
6672
  `+Q+$.slice(K+1)}return Q+`
6669
6673
  `+$}async function I4($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let J=Z?.router,Y="";if(J){let K={};if(J.container)K.container=J.container;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight;if(Object.keys(K).length>0)Y=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
6670
6674
  `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (M4(),T4)),X=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+Y+X+`
6671
- </body>`+$.slice(G+7)}var B8={};r(B8,{scanScriptTags:()=>W8,processSignals:()=>k4,processScriptSetup:()=>U8,parseLoopExpression:()=>z8,hasSignalsSyntax:()=>M9,extractExports:()=>_8,convertSignalLoopsToAttributes:()=>E4,convertSignalDirectivesToAttributes:()=>D4});function W8($,Z={}){let J=[];T9.lastIndex=0;let Y;while((Y=T9.exec($))!==null){let Q=Y[1],X=Y.index+Y[0].length,G=$.toLowerCase().indexOf("</script>",X);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(Q)){T9.lastIndex=K;continue}J.push({fullMatch:$.slice(Y.index,K),attrs:Q,body:$.slice(X,G),start:Y.index,end:K}),T9.lastIndex=K}return J}function z8($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Q=J[1].trim(),X=J[2].trim(),{itemVar:G,indexVar:K}=K8(X);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let Y=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let Q=Y[1].trim(),X=Y[2].trim(),{itemVar:G,indexVar:K}=K8(Q);if(G)return{style:"in",iterable:X,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function K8($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let Y=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let X=Z.match(/^(\w+)$/);if(X)return{itemVar:X[1],indexVar:null};return{itemVar:null,indexVar:null}}function M9($){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((J)=>J.test($))}function EK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(Q.startsWith("if"))J++;else if(Q==="endif")J--;else if(J===0)return!0}return!1}function D4($){let Z=$,J=/@if\s*\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let X=Y.index,G=X+Y[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 z=Z.substring(G,q-1).trim(),W=q,U=1,_=W,j=/@(if\s*\(|endif)/g;j.lastIndex=W;let B;while((B=j.exec(Z))!==null)if(B[1].startsWith("if"))U++;else if(B[1]==="endif"){if(U--,U===0){_=B.index+B[0].length;break}}if(U!==0)continue;let O=Z.substring(W,_-6).trim();if(EK(O))continue;let F=O.match(q8),L;if(F){let[,H,V,A]=F,w=z.replace(/"/g,"&quot;");L=`<${H}${V} @if="${w}">${A}</${H}>`}else L=`<template @if="${z.replace(/"/g,"&quot;")}">${O}</template>`;Q.push({start:X,end:_,replacement:L})}for(let X=Q.length-1;X>=0;X--){let{start:G,end:K,replacement:q}=Q[X];Z=Z.substring(0,G)+q+Z.substring(K)}return Z}function E4($,Z){let J=$,Y=/@(for|foreach)\s*\(/g,Q,X=[];while((Q=Y.exec(J))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,z=1,W=q;while(W<J.length&&z>0){if(J[W]==="(")z++;else if(J[W]===")")z--;W++}if(z!==0)continue;let U=J.substring(q,W-1).trim(),_=W,j=z8(U);if(j.iterable){let N=j.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(j.style==="as")U=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let B=G==="for"?"@endfor":"@endforeach",O=1,F=_,L=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");L.lastIndex=_;let H;while((H=L.exec(J))!==null)if(H[1].startsWith(G))O++;else if(O--,O===0){F=H.index+H[0].length;break}if(O!==0)continue;let V=J.substring(_,F-B.length).trim(),A=V.match(q8),w;if(A){let[,N,R,T]=A;w=`<${N}${R} @for="${U}">${T}</${N}>`}else w=`<template @for="${U}">${V}</template>`;X.push({start:K,end:F,replacement:w})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:z}=X[G];J=J.substring(0,K)+z+J.substring(q)}return J}function kK($){let Z=new Set,J=[],Y=0,Q=0,X=$.length,G=(W)=>{let U=Y+1;while(U<X){let _=$[U];if(_==="\\"){U+=2;continue}if(_===W)return U+1;U++}return X},K=()=>{let W=Y+2;while(W<X&&$[W]!==`
6675
+ </body>`+$.slice(G+7)}var O8={};r(O8,{scanScriptTags:()=>U8,processSignals:()=>k4,processScriptSetup:()=>B8,parseLoopExpression:()=>_8,hasSignalsSyntax:()=>M9,extractExports:()=>j8,convertSignalLoopsToAttributes:()=>E4,convertSignalDirectivesToAttributes:()=>D4});function U8($,Z={}){let J=[];T9.lastIndex=0;let Y;while((Y=T9.exec($))!==null){let Q=Y[1],X=Y.index+Y[0].length,G=$.toLowerCase().indexOf("</script>",X);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(Q)){T9.lastIndex=K;continue}J.push({fullMatch:$.slice(Y.index,K),attrs:Q,body:$.slice(X,G),start:Y.index,end:K}),T9.lastIndex=K}return J}function _8($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let Q=J[1].trim(),X=J[2].trim(),{itemVar:G,indexVar:K}=W8(X);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let Y=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let Q=Y[1].trim(),X=Y[2].trim(),{itemVar:G,indexVar:K}=W8(Q);if(G)return{style:"in",iterable:X,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function W8($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let Y=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let X=Z.match(/^(\w+)$/);if(X)return{itemVar:X[1],indexVar:null};return{itemVar:null,indexVar:null}}function M9($){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((J)=>J.test($))}function bK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(Q.startsWith("if"))J++;else if(Q==="endif")J--;else if(J===0)return!0}return!1}function D4($){let Z=$,J=/@if\s*\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let X=Y.index,G=X+Y[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 z=Z.substring(G,q-1).trim(),W=q,U=1,_=W,j=/@(if\s*\(|endif)/g;j.lastIndex=W;let B;while((B=j.exec(Z))!==null)if(B[1].startsWith("if"))U++;else if(B[1]==="endif"){if(U--,U===0){_=B.index+B[0].length;break}}if(U!==0)continue;let O=Z.substring(W,_-6).trim();if(bK(O))continue;let F=O.match(z8),L;if(F){let[,H,V,A]=F,w=z.replace(/"/g,"&quot;");L=`<${H}${V} @if="${w}">${A}</${H}>`}else L=`<template @if="${z.replace(/"/g,"&quot;")}">${O}</template>`;Q.push({start:X,end:_,replacement:L})}for(let X=Q.length-1;X>=0;X--){let{start:G,end:K,replacement:q}=Q[X];Z=Z.substring(0,G)+q+Z.substring(K)}return Z}function E4($,Z){let J=$,Y=/@(for|foreach)\s*\(/g,Q,X=[];while((Q=Y.exec(J))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,z=1,W=q;while(W<J.length&&z>0){if(J[W]==="(")z++;else if(J[W]===")")z--;W++}if(z!==0)continue;let U=J.substring(q,W-1).trim(),_=W,j=_8(U);if(j.iterable){let N=j.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(j.style==="as")U=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let B=G==="for"?"@endfor":"@endforeach",O=1,F=_,L=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");L.lastIndex=_;let H;while((H=L.exec(J))!==null)if(H[1].startsWith(G))O++;else if(O--,O===0){F=H.index+H[0].length;break}if(O!==0)continue;let V=J.substring(_,F-B.length).trim(),A=V.match(z8),w;if(A){let[,N,R,T]=A;w=`<${N}${R} @for="${U}">${T}</${N}>`}else w=`<template @for="${U}">${V}</template>`;X.push({start:K,end:F,replacement:w})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:z}=X[G];J=J.substring(0,K)+z+J.substring(q)}return J}function SK($){let Z=new Set,J=[],Y=0,Q=0,X=$.length,G=(W)=>{let U=Y+1;while(U<X){let _=$[U];if(_==="\\"){U+=2;continue}if(_===W)return U+1;U++}return X},K=()=>{let W=Y+2;while(W<X&&$[W]!==`
6672
6676
  `)W++;return W},q=()=>{let W=Y+2;while(W<X-1){if($[W]==="*"&&$[W+1]==="/")return W+2;W++}return X},z=(W)=>{let U=W,_=0;while(U<X){let j=$[U];if(j==="/"&&$[U+1]==="/"){let B=U+2;while(B<X&&$[B]!==`
6673
- `)B++;U=B;continue}if(j==="/"&&$[U+1]==="*"){let B=U+2;while(B<X-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=U+1;while(B<X){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}U=B;continue}if(j==="("||j==="["||j==="{"){_++,U++;continue}if(j===")"||j==="]"||j==="}"){_--,U++;continue}if(j===";"&&_===0)return U+1;U++}return X};while(Y<X){let W=$[Y];if(W==="/"&&$[Y+1]==="/"){let U=K();J.push($.slice(Y,U)),Y=U;continue}if(W==="/"&&$[Y+1]==="*"){let U=q();J.push($.slice(Y,U)),Y=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);J.push($.slice(Y,U)),Y=U;continue}if(W==="{"){Q++,J.push(W),Y++;continue}if(W==="}"){Q--,J.push(W),Y++;continue}if(Q===0){let U=Y>0?$[Y-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let j=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],O=z(Y+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),Y=O;continue}Z.add(B),J.push($.slice(Y,O)),Y=O;continue}}}J.push(W),Y++}return J.join("")}async function U8($,Z){let J=W8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let j of J){let B=j.body;if(q1(j.attrs))B=W1(B);if(Y.test(B))Q.push({fullMatch:j.fullMatch,attrs:j.attrs,content:B})}if(Q.length===0)return{output:$,setupCode:null};let X=`__stx_setup_${Date.now()}_${DK++}`,{hasUserImports:G,bundleClientScript:K}=await Promise.resolve().then(() => (d9(),h9)),q=[];for(let j=0;j<Q.length;j++){let B=Q[j].content;if(G(B))console.log("[stx:bundler] bundling signal script imports"),B=await K(B,Z||"",{projectRoot:process.cwd()});B=B.replace(/^\s*import\s+(?:type\s+)?\{[^}]*\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,"// [stx import stripped \u2014 resolved via window.stx in __stx_setup]");let O=r0(B);q.push(`// \u2500\u2500 merged signal script #${j+1} \u2500\u2500
6677
+ `)B++;U=B;continue}if(j==="/"&&$[U+1]==="*"){let B=U+2;while(B<X-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=U+1;while(B<X){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}U=B;continue}if(j==="("||j==="["||j==="{"){_++,U++;continue}if(j===")"||j==="]"||j==="}"){_--,U++;continue}if(j===";"&&_===0)return U+1;U++}return X};while(Y<X){let W=$[Y];if(W==="/"&&$[Y+1]==="/"){let U=K();J.push($.slice(Y,U)),Y=U;continue}if(W==="/"&&$[Y+1]==="*"){let U=q();J.push($.slice(Y,U)),Y=U;continue}if(W==='"'||W==="'"||W==="`"){let U=G(W);J.push($.slice(Y,U)),Y=U;continue}if(W==="{"){Q++,J.push(W),Y++;continue}if(W==="}"){Q--,J.push(W),Y++;continue}if(Q===0){let U=Y>0?$[Y-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let j=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],O=z(Y+j[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),Y=O;continue}Z.add(B),J.push($.slice(Y,O)),Y=O;continue}}}J.push(W),Y++}return J.join("")}async function B8($,Z){let J=U8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let j of J){let B=j.body;if(q1(j.attrs))B=W1(B);if(Y.test(B))Q.push({fullMatch:j.fullMatch,attrs:j.attrs,content:B})}if(Q.length===0)return{output:$,setupCode:null};let X=`__stx_setup_${Date.now()}_${kK++}`,{hasUserImports:G,bundleClientScript:K}=await Promise.resolve().then(() => (d9(),h9)),q=[];for(let j=0;j<Q.length;j++){let B=Q[j].content;if(G(B))console.log("[stx:bundler] bundling signal script imports"),B=await K(B,Z||"",{projectRoot:process.cwd()});B=B.replace(/^\s*import\s+(?:type\s+)?\{[^}]*\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,"// [stx import stripped \u2014 resolved via window.stx in __stx_setup]");let O=a0(B);q.push(`// \u2500\u2500 merged signal script #${j+1} \u2500\u2500
6674
6678
  ${O}`)}let z=q.join(`
6675
6679
 
6676
- `);z=kK(z);let W=_8(z),U=`
6680
+ `);z=SK(z);let W=j8(z),U=`
6677
6681
  <script data-stx-scoped>
6678
6682
  function ${X}() {
6679
6683
  const { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect } = window.stx;
@@ -6681,11 +6685,11 @@ ${z}
6681
6685
  return { ${W} };
6682
6686
  }
6683
6687
  if(window.stx)window.stx._latestSetup=${X};
6684
- </script>`,_=$;for(let j of Q)_=_.split(j.fullMatch).join("");if(_.includes("<body"))_=_.replace(/<body([^>]*)>/,`<body$1 data-stx="${X}">`);else{let j=["script","style","html","head","meta","link","title","!doctype"];_=_.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(B,O,F)=>{if(j.includes(O.toLowerCase()))return B;return`<${O}${F} data-stx="${X}">`})}return{output:_,setupCode:U}}function _8($){let Z=$,J=[],Y=new Set,Q=0,X=0,G=Z.length,K=(U)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===U){X++;return}X++}},q=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let U=1;while(X<G&&U>0)if(Z[X]==="{")U++;else if(Z[X]==="}")U--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},z=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
6685
- `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},W=()=>{if(Q!==0)return;let U=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let F=U[2];if(!Y.has(F))J.push(F),Y.add(F);return}let _=Z.slice(X).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((F)=>{let L=F.trim();if(!L)return;let H=L.indexOf(":"),A=(H>=0?L.slice(H+1).trim():L).split(/[\s=]/)[0];if(A&&!Y.has(A))J.push(A),Y.add(A)});return}let j=Z.slice(X).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){j[1].split(",").forEach((F)=>{let L=F.trim().replace(/^\.\.\./,"");if(!L)return;let H=L.split(/[\s=]/)[0];if(H&&!Y.has(H))J.push(H),Y.add(H)});return}let B=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let F=B[1];if(!Y.has(F))J.push(F),Y.add(F);return}let O=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!Y.has(F))J.push(F),Y.add(F)}};while(X<G){if(z())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){Q++,X++;continue}if(Z[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))W();X++}return J.join(", ")}async function k4($,Z,J){if(!M9($))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:X}=await U8(Y,J);if(Y=Q,Y=await G8(Y,Z),Y=Q8(Y),X)if(Y.includes("</head>"))Y=Y.replace("</head>",`${X}
6688
+ </script>`,_=$;for(let j of Q)_=_.split(j.fullMatch).join("");if(_.includes("<body"))_=_.replace(/<body([^>]*)>/,`<body$1 data-stx="${X}">`);else{let j=["script","style","html","head","meta","link","title","!doctype"];_=_.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(B,O,F)=>{if(j.includes(O.toLowerCase()))return B;return`<${O}${F} data-stx="${X}">`})}return{output:_,setupCode:U}}function j8($){let Z=$,J=[],Y=new Set,Q=0,X=0,G=Z.length,K=(U)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===U){X++;return}X++}},q=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let U=1;while(X<G&&U>0)if(Z[X]==="{")U++;else if(Z[X]==="}")U--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},z=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
6689
+ `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},W=()=>{if(Q!==0)return;let U=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let F=U[2];if(!Y.has(F))J.push(F),Y.add(F);return}let _=Z.slice(X).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((F)=>{let L=F.trim();if(!L)return;let H=L.indexOf(":"),A=(H>=0?L.slice(H+1).trim():L).split(/[\s=]/)[0];if(A&&!Y.has(A))J.push(A),Y.add(A)});return}let j=Z.slice(X).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){j[1].split(",").forEach((F)=>{let L=F.trim().replace(/^\.\.\./,"");if(!L)return;let H=L.split(/[\s=]/)[0];if(H&&!Y.has(H))J.push(H),Y.add(H)});return}let B=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let F=B[1];if(!Y.has(F))J.push(F),Y.add(F);return}let O=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!Y.has(F))J.push(F),Y.add(F)}};while(X<G){if(z())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){Q++,X++;continue}if(Z[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))W();X++}return J.join(", ")}async function k4($,Z,J){if(!M9($))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:X}=await B8(Y,J);if(Y=Q,Y=await q8(Y,Z),Y=K8(Y),X)if(Y.includes("</head>"))Y=Y.replace("</head>",`${X}
6686
6690
  </head>`);else if(Y.includes("<body"))Y=Y.replace(/<body([^>]*)>/,`<body$1>
6687
6691
  ${X}`);else Y=Y+`
6688
- `+X;let G=Y.match(/<body([^>]*)>/i),K=G&&/data-stx/.test(G[1]);if(!X&&!K){if(Y.includes("<body")&&G&&!/data-stx-auto/.test(G[1]))Y=Y.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return Y}var DK=0,T9,q8;var b4=C(()=>{A0();T9=/<script\b([^>]*)>/gi,q8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s});import y0 from"path";import S4 from"fs";function j8($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function O8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class H8{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,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,X=Y?.__importedComponents;if(X){let j=[Q,Q.toLowerCase(),j8(Q),O8(Q)];for(let B of j)if(X.has(B))return X.get(B)}let G=[...new Set([`${Q}.stx`,`${j8(Q)}.stx`,`${O8(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=y0.resolve(y0.dirname(Z),`${Q}.stx`);if(await c(j))return j;return null}let K=[],q=J.componentsDir||"",z=Y?.__originalFilePath;if(z)K.push(y0.join(y0.dirname(z),"components"));if(q)K.push(q);let W=y0.join(y0.dirname(Z),"components");if(!K.includes(W))K.push(W);let U=process.cwd(),_=[y0.resolve(U,"src/components"),y0.resolve(U,"components"),y0.resolve(import.meta.dir,"components")];for(let j of _)if(!K.includes(j))K.push(j);for(let j of K){if(!j)continue;for(let B of G){let O=y0.join(j,B);if(await c(O))return O}try{if(!S4.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let O=S4.readdirSync(j,{withFileTypes:!0});for(let F of O)if(F.isDirectory()){let L=y0.join(j,F.name);for(let H of G){let V=y0.join(L,H);if(await c(V))return V}}}catch{}}return null}}var d0;var y4=C(()=>{A0();d0=new H8});function m0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bK($){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 C4;var P4=C(()=>{C4={name:"StxLink",aliases:["stx-link"],render($,Z,J){let Y=bK($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),X=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(Y.reactive)q.push(`:href="${m0(Y.value)}"`);else q.push(`href="${m0(Y.value)}"`);if(Q)q.push(`class="${m0(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${m0(X)}"`),q.push(`data-stx-exact-active-class="${m0(G)}"`),K)q.push("data-stx-prefetch");for(let[W,U]of Object.entries($.events))q.push(`@${m0(W)}="${m0(U)}"`);let z=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[W,U]of Object.entries($.static)){if(z.has(W))continue;if(typeof U==="boolean"){if(U)q.push(m0(W))}else q.push(`${m0(W)}="${m0(U)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function I0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function x4($,Z,J=!1){let Y=$.serverDynamic[Z];if(Y!==void 0)return Y!==!1&&Y!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return J}function L8($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let Y of Z)if(Y.includes(":")){let[Q,X]=Y.split(":"),G=SK[Q];if(G)J.push(`(max-width: ${G}px) ${X}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))J.push(`(max-width: ${K}px) ${X}`)}}else J.push(Y);return J.join(", ")}function f4($,Z,J,Y){return Z.map((Q)=>`${j5($,Q,void 0,J,Y)} ${Q}w`).join(", ")}function yK($,Z,J,Y,Q){return Z.map((X)=>{let G=J?J*X:void 0;return`${j5($,G,void 0,Y,Q)} ${X}x`}).join(", ")}function j5($,Z,J,Y,Q){if(!Y||Y==="local"||Y==="static")return $;if(Y==="cloudinary"){let X=[];if(Z)X.push(`w_${Z}`);if(J)X.push(`h_${J}`);if(Q)X.push(`f_${Q}`);X.push("q_auto");let G=X.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(Y==="imgix"){let X=new URLSearchParams;if(Z)X.set("w",String(Z));if(J)X.set("h",String(J));if(Q)X.set("fm",Q);X.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}if(Y==="bunny"){let X=new URLSearchParams;if(Z)X.set("width",String(Z));if(J)X.set("height",String(J));if(Q)X.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}return $}function CK($,Z,J="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var SK,v4,g4;var h4=C(()=>{SK={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},v4=[320,640,768,1024,1280,1536,1920];g4={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,J){let Y=I0($,"src")||"",Q=I0($,"alt")||"",X=I0($,"width"),G=I0($,"height"),K=I0($,"sizes"),q=I0($,"srcset"),z=I0($,"densities"),W=I0($,"format"),U=I0($,"placeholder"),_=I0($,"placeholderColor")||"#e5e7eb",j=I0($,"provider"),B=I0($,"class")||I0($,"className")||"",O=I0($,"style")||"",F=I0($,"quality"),L=x4($,"lazy",!0),H=x4($,"preload",!1),V=x4($,"picture",!1)||!!W,A=X?Number.parseInt(X):void 0,w=G?Number.parseInt(G):void 0,N=q||"",R="";if(!N&&K)N=f4(Y,v4,j,W),R=L8(K);else if(!N&&z){let S=z.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));N=yK(Y,S,A,j,W)}else if(K)R=L8(K);let T=[];if(O)T.push(O);if(A&&w)T.push(`aspect-ratio:${A}/${w}`);if(U==="blur"||U==="color"){let S=CK(A||16,w||9,_);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${B0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let I=j5(Y,A,w,j,W),M=[];if(M.push(`src="${B0(I)}"`),M.push(`alt="${B0(Q)}"`),X)M.push(`width="${B0(X)}"`);if(G)M.push(`height="${B0(G)}"`);if(L)M.push('loading="lazy"');if(M.push('decoding="async"'),B)M.push(`class="${B0(B)}"`);if(T.length>0)M.push(`style="${B0(T.join(";"))}"`);if(N)M.push(`srcset="${B0(N)}"`);if(R)M.push(`sizes="${B0(R)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,b]of Object.entries($.static)){if(E.has(S))continue;if(typeof b==="boolean"){if(b)M.push(B0(S))}else M.push(`${B0(S)}="${B0(b)}"`)}let k=`<img ${M.join(" ")} />`,y="";if(H){let b=W==="webp"?"image/webp":W==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${B0(I)}"${b?` type="${b}"`:""}${N?` imagesrcset="${B0(N)}"`:""}${R?` imagesizes="${B0(R)}"`:""} />
6692
+ `+X;let G=Y.match(/<body([^>]*)>/i),K=G&&/data-stx/.test(G[1]);if(!X&&!K){if(Y.includes("<body")&&G&&!/data-stx-auto/.test(G[1]))Y=Y.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return Y}var kK=0,T9,z8;var b4=C(()=>{A0();T9=/<script\b([^>]*)>/gi,z8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s});import C0 from"path";import S4 from"fs";function H8($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function L8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class F8{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,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,X=Y?.__importedComponents;if(X){let j=[Q,Q.toLowerCase(),H8(Q),L8(Q)];for(let B of j)if(X.has(B))return X.get(B)}let G=[...new Set([`${Q}.stx`,`${H8(Q)}.stx`,`${L8(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=C0.resolve(C0.dirname(Z),`${Q}.stx`);if(await l(j))return j;return null}let K=[],q=J.componentsDir||"",z=Y?.__originalFilePath;if(z)K.push(C0.join(C0.dirname(z),"components"));if(q)K.push(q);let W=C0.join(C0.dirname(Z),"components");if(!K.includes(W))K.push(W);let U=process.cwd(),_=[C0.resolve(U,"src/components"),C0.resolve(U,"components"),C0.resolve(import.meta.dir,"components")];for(let j of _)if(!K.includes(j))K.push(j);for(let j of K){if(!j)continue;for(let B of G){let O=C0.join(j,B);if(await l(O))return O}try{if(!S4.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let O=S4.readdirSync(j,{withFileTypes:!0});for(let F of O)if(F.isDirectory()){let L=C0.join(j,F.name);for(let H of G){let V=C0.join(L,H);if(await l(V))return V}}}catch{}}return null}}var m0;var y4=C(()=>{A0();m0=new F8});function u0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function yK($){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 C4;var P4=C(()=>{C4={name:"StxLink",aliases:["stx-link"],render($,Z,J){let Y=yK($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),X=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(Y.reactive)q.push(`:href="${u0(Y.value)}"`);else q.push(`href="${u0(Y.value)}"`);if(Q)q.push(`class="${u0(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${u0(X)}"`),q.push(`data-stx-exact-active-class="${u0(G)}"`),K)q.push("data-stx-prefetch");for(let[W,U]of Object.entries($.events))q.push(`@${u0(W)}="${u0(U)}"`);let z=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[W,U]of Object.entries($.static)){if(z.has(W))continue;if(typeof U==="boolean"){if(U)q.push(u0(W))}else q.push(`${u0(W)}="${u0(U)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function I0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function x4($,Z,J=!1){let Y=$.serverDynamic[Z];if(Y!==void 0)return Y!==!1&&Y!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return J}function V8($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let Y of Z)if(Y.includes(":")){let[Q,X]=Y.split(":"),G=CK[Q];if(G)J.push(`(max-width: ${G}px) ${X}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))J.push(`(max-width: ${K}px) ${X}`)}}else J.push(Y);return J.join(", ")}function f4($,Z,J,Y){return Z.map((Q)=>`${j5($,Q,void 0,J,Y)} ${Q}w`).join(", ")}function PK($,Z,J,Y,Q){return Z.map((X)=>{let G=J?J*X:void 0;return`${j5($,G,void 0,Y,Q)} ${X}x`}).join(", ")}function j5($,Z,J,Y,Q){if(!Y||Y==="local"||Y==="static")return $;if(Y==="cloudinary"){let X=[];if(Z)X.push(`w_${Z}`);if(J)X.push(`h_${J}`);if(Q)X.push(`f_${Q}`);X.push("q_auto");let G=X.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(Y==="imgix"){let X=new URLSearchParams;if(Z)X.set("w",String(Z));if(J)X.set("h",String(J));if(Q)X.set("fm",Q);X.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}if(Y==="bunny"){let X=new URLSearchParams;if(Z)X.set("width",String(Z));if(J)X.set("height",String(J));if(Q)X.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}return $}function vK($,Z,J="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var CK,v4,g4;var h4=C(()=>{CK={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},v4=[320,640,768,1024,1280,1536,1920];g4={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,J){let Y=I0($,"src")||"",Q=I0($,"alt")||"",X=I0($,"width"),G=I0($,"height"),K=I0($,"sizes"),q=I0($,"srcset"),z=I0($,"densities"),W=I0($,"format"),U=I0($,"placeholder"),_=I0($,"placeholderColor")||"#e5e7eb",j=I0($,"provider"),B=I0($,"class")||I0($,"className")||"",O=I0($,"style")||"",F=I0($,"quality"),L=x4($,"lazy",!0),H=x4($,"preload",!1),V=x4($,"picture",!1)||!!W,A=X?Number.parseInt(X):void 0,w=G?Number.parseInt(G):void 0,N=q||"",R="";if(!N&&K)N=f4(Y,v4,j,W),R=V8(K);else if(!N&&z){let S=z.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));N=PK(Y,S,A,j,W)}else if(K)R=V8(K);let T=[];if(O)T.push(O);if(A&&w)T.push(`aspect-ratio:${A}/${w}`);if(U==="blur"||U==="color"){let S=vK(A||16,w||9,_);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${B0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let I=j5(Y,A,w,j,W),M=[];if(M.push(`src="${B0(I)}"`),M.push(`alt="${B0(Q)}"`),X)M.push(`width="${B0(X)}"`);if(G)M.push(`height="${B0(G)}"`);if(L)M.push('loading="lazy"');if(M.push('decoding="async"'),B)M.push(`class="${B0(B)}"`);if(T.length>0)M.push(`style="${B0(T.join(";"))}"`);if(N)M.push(`srcset="${B0(N)}"`);if(R)M.push(`sizes="${B0(R)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,b]of Object.entries($.static)){if(E.has(S))continue;if(typeof b==="boolean"){if(b)M.push(B0(S))}else M.push(`${B0(S)}="${B0(b)}"`)}let k=`<img ${M.join(" ")} />`,y="";if(H){let b=W==="webp"?"image/webp":W==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${B0(I)}"${b?` type="${b}"`:""}${N?` imagesrcset="${B0(N)}"`:""}${R?` imagesizes="${B0(R)}"`:""} />
6689
6693
  `}if(V){let S=[];if(W==="avif"||W==="auto"){let b=j5(Y,A,w,j,"avif"),D=N?f4(Y,v4,j,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${B0(D)}"${R?` sizes="${B0(R)}"`:""} />`)}if(W==="webp"||W==="auto"){let b=j5(Y,A,w,j,"webp"),D=N?f4(Y,v4,j,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${B0(D)}"${R?` sizes="${B0(R)}"`:""} />`)}return`${y}<picture>
6690
6694
  ${S.join(`
6691
6695
  `)}
@@ -6697,7 +6701,7 @@ ${k}
6697
6701
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
6698
6702
  <script>
6699
6703
  (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()})})();
6700
- </script>`}}});function V8($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function PK($,Z,J){let Y=V8($,Z);if(Y!==void 0){let Q=Number.parseInt(Y,10);if(!Number.isNaN(Q))return Q}return J}var F8,p4;var l4=C(()=>{F8={"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%)"},p4={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let Y=V8($,"position")||"top-right",Q=PK($,"max",5),X=F8[Y]||F8["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${Q}" style="position:fixed;${X};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
6704
+ </script>`}}});function A8($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function xK($,Z,J){let Y=A8($,Z);if(Y!==void 0){let Q=Number.parseInt(Y,10);if(!Number.isNaN(Q))return Q}return J}var w8,p4;var l4=C(()=>{w8={"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%)"},p4={name:"StxToast",aliases:["stx-toast"],render($,Z,J){let Y=A8($,"position")||"top-right",Q=xK($,"max",5),X=w8[Y]||w8["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${Q}" style="position:fixed;${X};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
6701
6705
  <style>
6702
6706
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
6703
6707
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -6705,7 +6709,7 @@ ${k}
6705
6709
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
6706
6710
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
6707
6711
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
6708
- </style>`}}});function D9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var w8,c4;var i4=C(()=>{w8={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)"},c4={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let Y=D9($,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=D9($,"size")||"md",X=D9($,"closeOnBackdrop")!=="false",G=D9($,"closeOnEscape")!=="false",K=w8[Q]||w8.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${X}" data-close-escape="${G}" 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">
6712
+ </style>`}}});function D9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var N8,c4;var i4=C(()=>{N8={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)"},c4={name:"StxModal",aliases:["stx-modal"],render($,Z,J){let Y=D9($,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=D9($,"size")||"md",X=D9($,"closeOnBackdrop")!=="false",G=D9($,"closeOnEscape")!=="false",K=N8[Q]||N8.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${X}" data-close-escape="${G}" 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">
6709
6713
  <div class="stx-modal-panel" style="${K};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)">
6710
6714
  <div style="padding:1.5rem">${Z}</div>
6711
6715
  </div>
@@ -6714,7 +6718,7 @@ ${k}
6714
6718
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
6715
6719
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
6716
6720
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
6717
- </style>`}}});function g1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var A8,n4;var o4=C(()=>{A8={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},n4={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let Y=g1($,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=g1($,"side")||"right",X=g1($,"size")||"md",G=g1($,"closeOnBackdrop")!=="false",K=g1($,"closeOnEscape")!=="false",q=g1($,"overlay")!=="false",z=A8[X]||A8.md,W=Q==="left",U=W?"left:0":"right:0",_=W?"translateX(-100%)":"translateX(100%)",j=W?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"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">
6721
+ </style>`}}});function g1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}var R8,n4;var o4=C(()=>{R8={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},n4={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,J){let Y=g1($,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=g1($,"side")||"right",X=g1($,"size")||"md",G=g1($,"closeOnBackdrop")!=="false",K=g1($,"closeOnEscape")!=="false",q=g1($,"overlay")!=="false",z=R8[X]||R8.md,W=Q==="left",U=W?"left:0":"right:0",_=W?"translateX(-100%)":"translateX(100%)",j=W?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"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">
6718
6722
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${U};width:${z};max-width:100vw;transform:${_};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">
6719
6723
  <div style="padding:1.5rem">${Z}</div>
6720
6724
  </div>
@@ -6723,24 +6727,24 @@ ${k}
6723
6727
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
6724
6728
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
6725
6729
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
6726
- </style>`}}});var T8={};r(T8,{preloadIconCollection:()=>R8,IconBuiltin:()=>E9});async function N8($){if(H5.has($))return H5.get($);try{let Z=Y0.resolve(`@iconify/json/json/${$}.json`),J=await Bun.file(Z).json();return H5.set($,J.icons),J.icons}catch{try{let J=`${process.cwd()}/node_modules/@iconify/json/json/${$}.json`,Y=Bun.file(J);if(await Y.exists()){let Q=await Y.json();return H5.set($,Q.icons),Q.icons}}catch{}}return null}function h1($,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 R8($="lucide"){await N8($)}var H5,E9;var k9=C(()=>{H5=new Map;E9={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let Y=h1($,"name")??h1($,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",X=Y;if(Y.includes(":")){let H=Y.split(":");Q=H[0],X=H[1]}let G=h1($,"size")||"24",K=h1($,"color")||"currentColor",q=h1($,"class")||"",z=h1($,"style")||"",W=H5.get(Q);if(!W)return N8(Q),`<!-- Icon: collection "${Q}" not loaded -->`;let U=W[X];if(!U)return`<!-- Icon: "${X}" not found in ${Q} -->`;let _=U.width||24,j=U.height||24,B=`0 0 ${_} ${j}`,O=U.body;if(K!=="currentColor")O=O.replace(/currentColor/g,K);let F=q?` class="${q}"`:"",L=z?` style="${z}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${L}>${O}</svg>`}}});function M8(){d0.registerBuiltin(C4),d0.registerBuiltin(g4),d0.registerBuiltin(m4),d0.registerBuiltin(p4),d0.registerBuiltin(c4),d0.registerBuiltin(n4),d0.registerBuiltin(E9)}var I8=C(()=>{P4();h4();u4();l4();i4();o4();k9();y4();P4();h4();u4();l4();i4();o4();k9()});function D8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function E8($,Z,J){let Y=[],Q=0;while(Q<$.length){let X=$.indexOf("<",Q);if(X===-1)break;let K=$.slice(X+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=X+1;continue}let q=K[1];if(J&&J.has(q.toLowerCase())){let O=X+1+q.length;while(O<$.length&&$[O]!==">")O++;Q=O+1;continue}let z=X+1+q.length,W=null,U=z,_=-1,j=!1;while(z<$.length){let O=$[z];if(W){if(O==="\\"&&z+1<$.length){z+=2;continue}if(O===W)W=null;z++;continue}if(O==='"'||O==="'"){W=O,z++;continue}if(O==="/"&&z+1<$.length&&$[z+1]===">"){_=z+2,j=!0;break}if(O===">"){_=z+1;break}z++}if(_===-1){Q=X+1;continue}let B=$.slice(U,j?_-2:_-1).trim();if(j)Y.push({fullMatch:$.slice(X,_),tagName:q,attributes:B,content:"",startIndex:X,endIndex:_,isSelfClosing:!0}),Q=_;else{let O=`<${q}`,F=`</${q}>`,L=1,H=_,V=-1;while(L>0&&H<$.length){let N=$.indexOf(O,H),R=$.indexOf(F,H);if(R===-1)break;if(N!==-1&&N<R){let T=$[N+O.length];if(T===" "||T===">"||T==="/"||T===`
6727
- `||T==="\t")L++;H=N+O.length}else{if(L--,L===0){V=R;break}H=R+F.length}}if(V===-1){Q=_;continue}let A=$.slice(_,V),w=V+F.length;Y.push({fullMatch:$.slice(X,w),tagName:q,attributes:B,content:A,startIndex:X,endIndex:w,isSelfClosing:!1}),Q=w}}return Y}var k8=C(()=>{R0();A0()});import d1 from"path";function xK($,Z,J){let Y={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=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"]),X=(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-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){Y.events[q]=K;continue}if(q.startsWith("__stx_")){let z=X(q.slice(6));try{let W=K.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");Y.serverDynamic[z]=JSON.parse(W)}catch(W){if(J.debug)console.error(`Error parsing __stx_${z}:`,W);Y.serverDynamic[z]=K}continue}if(q.startsWith(":")){let z=X(q.slice(1)),W=K==="true"?z:K;try{if(!t(W)){if(J.debug)console.error(`Unsafe expression in :${z} binding: ${W}`);Y.clientReactive[z]=W;continue}let U=Object.keys(Z),j=e(W,U)(...Object.values(Z));if(j===void 0){let B=W.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(B.some((L)=>!O.has(L)&&!U.includes(L))){Y.clientReactive[z]=W;continue}}Y.serverDynamic[z]=j}catch{Y.clientReactive[z]=W}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let z=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let W=z[1];if(t(W)){let _=e(W,Object.keys(Z))(...Object.values(Z));Y.static[q]=_!=null?String(_):""}else{if(J.debug)console.error(`Unsafe expression in ${q}: ${W}`);Y.static[q]=K}}catch(W){if(J.debug)console.error(`Error evaluating expression for ${q}:`,W);Y.static[q]=K}else{let W=K,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=U.exec(K))!==null)try{let j=_[1];if(!t(j)){if(J.debug)console.error(`Unsafe expression in ${q}: ${j}`);continue}let O=e(j,Object.keys(Z))(...Object.values(Z));W=W.replace(_[0],String(O??""))}catch(j){if(J.debug)console.error(`Error evaluating expression in ${q}:`,j)}Y.static[q]=W}continue}Y.static[q]=K}return Y}function fK($){let Z={},J=0,Y=$.length;while(J<Y){while(J<Y&&/\s/.test($[J]))J++;if(J>=Y)break;let Q="";while(J<Y&&!/[\s=]/.test($[J]))Q+=$[J],J++;if(!Q)break;while(J<Y&&/\s/.test($[J]))J++;if(J<Y&&$[J]==="="){J++;while(J<Y&&/\s/.test($[J]))J++;let X="";if(J<Y&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<Y){let K=$[J];if(K==="\\"&&J+1<Y){J++,X+=$[J],J++;continue}if(K===G){J++;break}X+=K,J++}}else while(J<Y&&!/\s/.test($[J]))X+=$[J],J++;Z[Q]=X}else Z[Q]="true"}return Z}async function gK($,Z,J,Y,Q){let X=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(X))!==null){let[z,W]=q,U=W.split(",").map((_)=>_.trim().replace(/^['"]|['"]$/g,"")).filter((_)=>_.length>0);for(let _ of U){let j=_.split("/"),O=j[j.length-1].replace(/\.stx$/,""),F=O.includes("-")?O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):O.charAt(0).toUpperCase()+O.slice(1),L=null,H=[d1.resolve(d1.dirname(J),`${_}.stx`),d1.resolve(d1.dirname(J),_),d1.resolve(Y.componentsDir||"components",`${_}.stx`),d1.resolve(Y.componentsDir||"components",_),_.endsWith(".stx")?_:`${_}.stx`];for(let V of H)try{if(await Bun.file(V).exists()){L=V;break}}catch{}if(L){G.set(F,L),G.set(O,L),G.set(O.toLowerCase(),L);let V=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,L),Q.add(L),Y.debug)console.log(`Imported component: ${F} -> ${L}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${_}`)}X=X.replace(z,""),K.lastIndex=0}return X}async function hK($,Z,J,Y,Q){let X=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,z;while((z=q.exec(X))!==null){let W=z.index,U=W+z[0].length-1,_=1,j=U+1;while(j<X.length&&_>0){if(X[j]==="(")_++;else if(X[j]===")"){if(_--,_===0)break}j++}if(_!==0)break;let B=X.substring(U+1,j),O=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){q.lastIndex=0;continue}let L=F[1],H,V=B.slice(F[0].length),A=V.match(/^\s*,\s*/);if(A)H=V.slice(A[0].length).trim();let w={};if(H)try{w=F0(H,Z)}catch(E){let k=E instanceof Error?E.message:String(E);X=X.replace(X.substring(W,O),`[Error parsing component props: ${k}]`);continue}let N="",R=O,I=X.substring(O).match(/^([\s\S]*?)@endcomponent/);if(I)N=I[1].trim(),R=O+I[0].length;let M=await B1(L,w,N,G,Z,J,Y,K,Q);X=X.substring(0,W)+M+X.substring(R),q.lastIndex=0}return X}async function dK($,Z,J,Y,Q){if(!$)return $;let X=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents;return X=await U(X,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),X=await U(X,/[A-Z][a-zA-Z0-9]*/,!0),X=await U(X,/[a-z][a-z0-9]*/,!1,vK),X;async function U(_,j,B,O){if(!_)return _;let F=_,L=E8(F,j,O);for(let H=L.length-1;H>=0;H--){let V=L[H],A=B?D8(V.tagName):V.tagName,w=fK(V.attributes),N=xK(w,Z,Y),R=d0.getBuiltin(V.tagName);if(R){let E={context:Z,filePath:J,options:Y,dependencies:Q},k=R.render(N,V.content,E);if(Object.keys(N.clientReactive).length>0)k=S8(k,N.clientReactive);if(Object.keys(N.events).length>0){let y=Object.entries(N.events).map(([S,b])=>`${S}="${b.replace(/"/g,"&quot;")}"`).join(" ");k=k.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}F=F.substring(0,V.startIndex)+k+F.substring(V.endIndex);continue}let T={};for(let[E,k]of Object.entries(N.static))T[E]=k;for(let[E,k]of Object.entries(N.serverDynamic))T[E]=k;let M=await B1(A,T,V.content,G,Z,J,Y,K,Q);if(Object.keys(N.clientReactive).length>0)M=S8(M,N.clientReactive);if(Object.keys(N.events).length>0){let E=M.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(E){let k=Object.entries(N.events).map(([S,b])=>`${S}="${b}"`).join(" "),y=E[1].length+E[2].length;M=M.substring(0,y)+" "+k+M.substring(y)}}F=F.substring(0,V.startIndex)+M+F.substring(V.endIndex)}return F}}function S8($,Z){let J=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!J)return $;let Y=Object.entries(Z).map(([X,G])=>`:${X}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=J[1].length+J[2].length;return $.substring(0,Q)+" "+Y+$.substring(Q)}async function s4($,Z,J,Y,Q){if(!b8)M8(),b8=!0;let X=await gK($,Z,J,Y,Q);X=await hK(X,Z,J,Y,Q);for(let G=0;G<3;G++){let K=X;if(X=await dK(X,Z,J,Y,Q),X===K)break}return X}var b8=!1,vK;var y8=C(()=>{y4();I8();k8();A0();R0();vK=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"])});import m1 from"path";function C8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function P8($,Z,J){try{let Y;if($.startsWith("/")){let Q=Z;for(let X=0;X<5;X++){let G=m1.join(Q,$);if(Y0("fs").existsSync(G))return G;Q=m1.dirname(Q)}Y=m1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))Y=m1.resolve(Z,$);else Y=m1.resolve(Z,$);if(Y0("fs").existsSync(Y))return Y;return null}catch{return null}}async function v8($,Z,J){let Y=$,Q=m1.dirname(Z),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=X.exec(Y))!==null){let[z,W,U,_]=G;if(C8(U))continue;let j=P8(U,Q,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),U.endsWith(".ts")||U.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:f0()});if(F.outputs.length>0)B=await F.outputs[0].text()}let O=`<script>
6730
+ </style>`}}});var I8={};r(I8,{preloadIconCollection:()=>M8,IconBuiltin:()=>E9});async function T8($){if(H5.has($))return H5.get($);try{let Z=Y0.resolve(`@iconify/json/json/${$}.json`),J=await Bun.file(Z).json();return H5.set($,J.icons),J.icons}catch{try{let J=`${process.cwd()}/node_modules/@iconify/json/json/${$}.json`,Y=Bun.file(J);if(await Y.exists()){let Q=await Y.json();return H5.set($,Q.icons),Q.icons}}catch{}}return null}function h1($,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 M8($="lucide"){await T8($)}var H5,E9;var k9=C(()=>{H5=new Map;E9={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let Y=h1($,"name")??h1($,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",X=Y;if(Y.includes(":")){let H=Y.split(":");Q=H[0],X=H[1]}let G=h1($,"size")||"24",K=h1($,"color")||"currentColor",q=h1($,"class")||"",z=h1($,"style")||"",W=H5.get(Q);if(!W)return T8(Q),`<!-- Icon: collection "${Q}" not loaded -->`;let U=W[X];if(!U)return`<!-- Icon: "${X}" not found in ${Q} -->`;let _=U.width||24,j=U.height||24,B=`0 0 ${_} ${j}`,O=U.body;if(K!=="currentColor")O=O.replace(/currentColor/g,K);let F=q?` class="${q}"`:"",L=z?` style="${z}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${F}${L}>${O}</svg>`}}});function D8(){m0.registerBuiltin(C4),m0.registerBuiltin(g4),m0.registerBuiltin(m4),m0.registerBuiltin(p4),m0.registerBuiltin(c4),m0.registerBuiltin(n4),m0.registerBuiltin(E9)}var E8=C(()=>{P4();h4();u4();l4();i4();o4();k9();y4();P4();h4();u4();l4();i4();o4();k9()});function k8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function b8($,Z,J){let Y=[],Q=0;while(Q<$.length){let X=$.indexOf("<",Q);if(X===-1)break;let K=$.slice(X+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=X+1;continue}let q=K[1];if(J&&J.has(q.toLowerCase())){let O=X+1+q.length;while(O<$.length&&$[O]!==">")O++;Q=O+1;continue}let z=X+1+q.length,W=null,U=z,_=-1,j=!1;while(z<$.length){let O=$[z];if(W){if(O==="\\"&&z+1<$.length){z+=2;continue}if(O===W)W=null;z++;continue}if(O==='"'||O==="'"){W=O,z++;continue}if(O==="/"&&z+1<$.length&&$[z+1]===">"){_=z+2,j=!0;break}if(O===">"){_=z+1;break}z++}if(_===-1){Q=X+1;continue}let B=$.slice(U,j?_-2:_-1).trim();if(j)Y.push({fullMatch:$.slice(X,_),tagName:q,attributes:B,content:"",startIndex:X,endIndex:_,isSelfClosing:!0}),Q=_;else{let O=`<${q}`,F=`</${q}>`,L=1,H=_,V=-1;while(L>0&&H<$.length){let N=$.indexOf(O,H),R=$.indexOf(F,H);if(R===-1)break;if(N!==-1&&N<R){let T=$[N+O.length];if(T===" "||T===">"||T==="/"||T===`
6731
+ `||T==="\t")L++;H=N+O.length}else{if(L--,L===0){V=R;break}H=R+F.length}}if(V===-1){Q=_;continue}let A=$.slice(_,V),w=V+F.length;Y.push({fullMatch:$.slice(X,w),tagName:q,attributes:B,content:A,startIndex:X,endIndex:w,isSelfClosing:!1}),Q=w}}return Y}var S8=C(()=>{R0();A0()});import d1 from"path";function gK($,Z,J){let Y={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=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"]),X=(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-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){Y.events[q]=K;continue}if(q.startsWith("__stx_")){let z=X(q.slice(6));try{let W=K.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");Y.serverDynamic[z]=JSON.parse(W)}catch(W){if(J.debug)console.error(`Error parsing __stx_${z}:`,W);Y.serverDynamic[z]=K}continue}if(q.startsWith(":")){let z=X(q.slice(1)),W=K==="true"?z:K;try{if(!t(W)){if(J.debug)console.error(`Unsafe expression in :${z} binding: ${W}`);Y.clientReactive[z]=W;continue}let U=Object.keys(Z),j=e(W,U)(...Object.values(Z));if(j===void 0){let B=W.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(B.some((L)=>!O.has(L)&&!U.includes(L))){Y.clientReactive[z]=W;continue}}Y.serverDynamic[z]=j}catch{Y.clientReactive[z]=W}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let z=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let W=z[1];if(t(W)){let _=e(W,Object.keys(Z))(...Object.values(Z));Y.static[q]=_!=null?String(_):""}else{if(J.debug)console.error(`Unsafe expression in ${q}: ${W}`);Y.static[q]=K}}catch(W){if(J.debug)console.error(`Error evaluating expression for ${q}:`,W);Y.static[q]=K}else{let W=K,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=U.exec(K))!==null)try{let j=_[1];if(!t(j)){if(J.debug)console.error(`Unsafe expression in ${q}: ${j}`);continue}let O=e(j,Object.keys(Z))(...Object.values(Z));W=W.replace(_[0],String(O??""))}catch(j){if(J.debug)console.error(`Error evaluating expression in ${q}:`,j)}Y.static[q]=W}continue}Y.static[q]=K}return Y}function hK($){let Z={},J=0,Y=$.length;while(J<Y){while(J<Y&&/\s/.test($[J]))J++;if(J>=Y)break;let Q="";while(J<Y&&!/[\s=]/.test($[J]))Q+=$[J],J++;if(!Q)break;while(J<Y&&/\s/.test($[J]))J++;if(J<Y&&$[J]==="="){J++;while(J<Y&&/\s/.test($[J]))J++;let X="";if(J<Y&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<Y){let K=$[J];if(K==="\\"&&J+1<Y){J++,X+=$[J],J++;continue}if(K===G){J++;break}X+=K,J++}}else while(J<Y&&!/\s/.test($[J]))X+=$[J],J++;Z[Q]=X}else Z[Q]="true"}return Z}async function dK($,Z,J,Y,Q){let X=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(X))!==null){let[z,W]=q,U=W.split(",").map((_)=>_.trim().replace(/^['"]|['"]$/g,"")).filter((_)=>_.length>0);for(let _ of U){let j=_.split("/"),O=j[j.length-1].replace(/\.stx$/,""),F=O.includes("-")?O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):O.charAt(0).toUpperCase()+O.slice(1),L=null,H=[d1.resolve(d1.dirname(J),`${_}.stx`),d1.resolve(d1.dirname(J),_),d1.resolve(Y.componentsDir||"components",`${_}.stx`),d1.resolve(Y.componentsDir||"components",_),_.endsWith(".stx")?_:`${_}.stx`];for(let V of H)try{if(await Bun.file(V).exists()){L=V;break}}catch{}if(L){G.set(F,L),G.set(O,L),G.set(O.toLowerCase(),L);let V=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,L),Q.add(L),Y.debug)console.log(`Imported component: ${F} -> ${L}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${_}`)}X=X.replace(z,""),K.lastIndex=0}return X}async function mK($,Z,J,Y,Q){let X=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,z;while((z=q.exec(X))!==null){let W=z.index,U=W+z[0].length-1,_=1,j=U+1;while(j<X.length&&_>0){if(X[j]==="(")_++;else if(X[j]===")"){if(_--,_===0)break}j++}if(_!==0)break;let B=X.substring(U+1,j),O=j+1,F=B.match(/^\s*['"]([^'"]+)['"]/);if(!F){q.lastIndex=0;continue}let L=F[1],H,V=B.slice(F[0].length),A=V.match(/^\s*,\s*/);if(A)H=V.slice(A[0].length).trim();let w={};if(H)try{w=F0(H,Z)}catch(E){let k=E instanceof Error?E.message:String(E);X=X.replace(X.substring(W,O),`[Error parsing component props: ${k}]`);continue}let N="",R=O,I=X.substring(O).match(/^([\s\S]*?)@endcomponent/);if(I)N=I[1].trim(),R=O+I[0].length;let M=await B1(L,w,N,G,Z,J,Y,K,Q);X=X.substring(0,W)+M+X.substring(R),q.lastIndex=0}return X}async function uK($,Z,J,Y,Q){if(!$)return $;let X=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents;return X=await U(X,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),X=await U(X,/[A-Z][a-zA-Z0-9]*/,!0),X=await U(X,/[a-z][a-z0-9]*/,!1,fK),X;async function U(_,j,B,O){if(!_)return _;let F=_,L=b8(F,j,O);for(let H=L.length-1;H>=0;H--){let V=L[H],A=B?k8(V.tagName):V.tagName,w=hK(V.attributes),N=gK(w,Z,Y),R=m0.getBuiltin(V.tagName);if(R){let E={context:Z,filePath:J,options:Y,dependencies:Q},k=R.render(N,V.content,E);if(Object.keys(N.clientReactive).length>0)k=C8(k,N.clientReactive);if(Object.keys(N.events).length>0){let y=Object.entries(N.events).map(([S,b])=>`${S}="${b.replace(/"/g,"&quot;")}"`).join(" ");k=k.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}F=F.substring(0,V.startIndex)+k+F.substring(V.endIndex);continue}let T={};for(let[E,k]of Object.entries(N.static))T[E]=k;for(let[E,k]of Object.entries(N.serverDynamic))T[E]=k;let M=await B1(A,T,V.content,G,Z,J,Y,K,Q);if(Object.keys(N.clientReactive).length>0)M=C8(M,N.clientReactive);if(Object.keys(N.events).length>0){let E=M.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(E){let k=Object.entries(N.events).map(([S,b])=>`${S}="${b}"`).join(" "),y=E[1].length+E[2].length;M=M.substring(0,y)+" "+k+M.substring(y)}}F=F.substring(0,V.startIndex)+M+F.substring(V.endIndex)}return F}}function C8($,Z){let J=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!J)return $;let Y=Object.entries(Z).map(([X,G])=>`:${X}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=J[1].length+J[2].length;return $.substring(0,Q)+" "+Y+$.substring(Q)}async function s4($,Z,J,Y,Q){if(!y8)D8(),y8=!0;let X=await dK($,Z,J,Y,Q);X=await mK(X,Z,J,Y,Q);for(let G=0;G<3;G++){let K=X;if(X=await uK(X,Z,J,Y,Q),X===K)break}return X}var y8=!1,fK;var P8=C(()=>{y4();E8();S8();A0();R0();fK=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"])});import m1 from"path";function v8($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function x8($,Z,J){try{let Y;if($.startsWith("/")){let Q=Z;for(let X=0;X<5;X++){let G=m1.join(Q,$);if(Y0("fs").existsSync(G))return G;Q=m1.dirname(Q)}Y=m1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))Y=m1.resolve(Z,$);else Y=m1.resolve(Z,$);if(Y0("fs").existsSync(Y))return Y;return null}catch{return null}}async function f8($,Z,J){let Y=$,Q=m1.dirname(Z),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=X.exec(Y))!==null){let[z,W,U,_]=G;if(v8(U))continue;let j=x8(U,Q,Z);if(j)try{let B=await Bun.file(j).text();if(J.add(j),U.endsWith(".ts")||U.endsWith(".tsx")){let F=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:g0()});if(F.outputs.length>0)B=await F.outputs[0].text()}let O=`<script>
6728
6732
  // Source: ${U}
6729
6733
  ${B}
6730
- </script>`;Y=Y.replace(z,O),X.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(Y))!==null){let[z,W,U,_]=q,j=W+_;if(C8(U))continue;if(/rel=["']stylesheet["']/.test(j)||U.endsWith(".css")){let O=P8(U,Q,Z);if(O)try{let F=await Bun.file(O).text();J.add(O);let L=`<style>
6734
+ </script>`;Y=Y.replace(z,O),X.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(Y))!==null){let[z,W,U,_]=q,j=W+_;if(v8(U))continue;if(/rel=["']stylesheet["']/.test(j)||U.endsWith(".css")){let O=x8(U,Q,Z);if(O)try{let F=await Bun.file(O).text();J.add(O);let L=`<style>
6731
6735
  /* Source: ${U} */
6732
6736
  ${F}
6733
- </style>`;Y=Y.replace(z,L),K.lastIndex=0}catch(F){}}}return Y}var x8=C(()=>{M1()});function r4($,Z){let J=$,Y=/@json\s*\(/g,Q;while((Q=Y.exec(J))!==null){let X=Q.index,G=X+Q[0].length-1,K=1,q=G+1,z=null,W=!1;while(q<J.length&&K>0){let V=J[q];if(W){W=!1,q++;continue}if(V==="\\"&&z){W=!0,q++;continue}if(z){if(V===z)z=null;q++;continue}if(V==='"'||V==="'"||V==="`"){z=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=J.substring(G+1,q).trim(),_=J.substring(X,q+1),j=-1,B=0,O=null,F=!1;for(let V=0;V<U.length;V++){let A=U[V];if(F){F=!1;continue}if(A==="\\"&&O){F=!0;continue}if(O){if(A===O)O=null;continue}if(A==='"'||A==="'"||A==="`"){O=A;continue}if(A==="("||A==="["||A==="{")B++;else if(A===")"||A==="]"||A==="}")B--;if(A===","&&B===0){j=V;break}}let L=j>=0?U.substring(0,j).trim():U,H=j>=0?U.substring(j+1).trim():void 0;try{let V=L.trim(),A;if(t(V))A=e(V,Object.keys(Z))(...Object.values(Z));else A=void 0;let w;if(H==="true")w=JSON.stringify(A,null,2);else w=JSON.stringify(A);let N=w.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,X)+N+J.substring(q+1),Y.lastIndex=X+N.length}catch(V){v0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),Y.lastIndex=X+_.length}}return J}function a4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function f8($){let Z=$,J=/@memo\s*\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let X=Y.index,G=X+Y[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 z=Z.slice(G,q-1).trim(),W=q,U=Z.slice(W),_=U.indexOf("@endmemo");if(_===-1)continue;let j=U.slice(0,_),B=W+_+8,O=j.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)/),F=O?O[0].length:0,L=j.slice(F),H=j.match(/(\s*)$/),V=H?H[0].length:0,A=L.slice(0,L.length-V),w=A.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(w){let[R,T,I="",M]=w,E=`<${T}${I} data-stx-memo="${z}"${M}>`;N=j.slice(0,F)+E+A.slice(R.length)+j.slice(F+A.length)}else N=`${j.slice(0,F)}<div data-stx-memo="${z}">${A}</div>${j.slice(F+A.length)}`;Q.push({start:X,end:B,replacement:N}),J.lastIndex=B}for(let X=Q.length-1;X>=0;X--){let G=Q[X];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function t4($){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 g8($){let J=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",Q=0,X;while((X=J.exec($))!==null){let G=X.index,K=G+X[0].length,q=!1,z=!1,W=-1;while(K<$.length){let O=$[K];if(q){if(O==="'")q=!1}else if(z){if(O==='"')z=!1}else if(O==="'")q=!0;else if(O==='"')z=!0;else if(O===">"){W=K;break}K++}if(W===-1)continue;if($.slice(G,W+1).includes("x-cloak"))continue;let _=$.slice(W+1),j=_.indexOf("</"),B=j>=0?_.slice(0,j):_.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))Y+=$.slice(Q,W)+" x-cloak>",Q=W+1}return Y+=$.slice(Q),Y}var e4=C(()=>{n0();R0()});function $7($,Z,J){let Y=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1},Q=Y.allowPatterns??[],X=[];for(let{pattern:G,message:K,suggestion:q}of mK){if(Q.some((W)=>K.includes(W)||G.source.includes(W)))continue;G.lastIndex=0;let z=$.match(G);if(z&&z.length>0){let W=$.split(`
6737
+ </style>`;Y=Y.replace(z,L),K.lastIndex=0}catch(F){}}}return Y}var g8=C(()=>{M1()});function r4($,Z){let J=$,Y=/@json\s*\(/g,Q;while((Q=Y.exec(J))!==null){let X=Q.index,G=X+Q[0].length-1,K=1,q=G+1,z=null,W=!1;while(q<J.length&&K>0){let V=J[q];if(W){W=!1,q++;continue}if(V==="\\"&&z){W=!0,q++;continue}if(z){if(V===z)z=null;q++;continue}if(V==='"'||V==="'"||V==="`"){z=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=J.substring(G+1,q).trim(),_=J.substring(X,q+1),j=-1,B=0,O=null,F=!1;for(let V=0;V<U.length;V++){let A=U[V];if(F){F=!1;continue}if(A==="\\"&&O){F=!0;continue}if(O){if(A===O)O=null;continue}if(A==='"'||A==="'"||A==="`"){O=A;continue}if(A==="("||A==="["||A==="{")B++;else if(A===")"||A==="]"||A==="}")B--;if(A===","&&B===0){j=V;break}}let L=j>=0?U.substring(0,j).trim():U,H=j>=0?U.substring(j+1).trim():void 0;try{let V=L.trim(),A;if(t(V))A=e(V,Object.keys(Z))(...Object.values(Z));else A=void 0;let w;if(H==="true")w=JSON.stringify(A,null,2);else w=JSON.stringify(A);let N=w.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,X)+N+J.substring(q+1),Y.lastIndex=X+N.length}catch(V){x0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),Y.lastIndex=X+_.length}}return J}function a4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function h8($){let Z=$,J=/@memo\s*\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let X=Y.index,G=X+Y[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 z=Z.slice(G,q-1).trim(),W=q,U=Z.slice(W),_=U.indexOf("@endmemo");if(_===-1)continue;let j=U.slice(0,_),B=W+_+8,O=j.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)/),F=O?O[0].length:0,L=j.slice(F),H=j.match(/(\s*)$/),V=H?H[0].length:0,A=L.slice(0,L.length-V),w=A.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(w){let[R,T,I="",M]=w,E=`<${T}${I} data-stx-memo="${z}"${M}>`;N=j.slice(0,F)+E+A.slice(R.length)+j.slice(F+A.length)}else N=`${j.slice(0,F)}<div data-stx-memo="${z}">${A}</div>${j.slice(F+A.length)}`;Q.push({start:X,end:B,replacement:N}),J.lastIndex=B}for(let X=Q.length-1;X>=0;X--){let G=Q[X];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function t4($){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 d8($){let J=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",Q=0,X;while((X=J.exec($))!==null){let G=X.index,K=G+X[0].length,q=!1,z=!1,W=-1;while(K<$.length){let O=$[K];if(q){if(O==="'")q=!1}else if(z){if(O==='"')z=!1}else if(O==="'")q=!0;else if(O==='"')z=!0;else if(O===">"){W=K;break}K++}if(W===-1)continue;if($.slice(G,W+1).includes("x-cloak"))continue;let _=$.slice(W+1),j=_.indexOf("</"),B=j>=0?_.slice(0,j):_.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))Y+=$.slice(Q,W)+" x-cloak>",Q=W+1}return Y+=$.slice(Q),Y}var e4=C(()=>{o0();R0()});function $7($,Z,J){let Y=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1},Q=Y.allowPatterns??[],X=[];for(let{pattern:G,message:K,suggestion:q}of pK){if(Q.some((W)=>K.includes(W)||G.source.includes(W)))continue;G.lastIndex=0;let z=$.match(G);if(z&&z.length>0){let W=$.split(`
6734
6738
  `),U=[];W.forEach((j,B)=>{if(G.lastIndex=0,G.test(j))U.push(B+1)});let _=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";X.push(` \u2717 ${K}${_}
6735
6739
  \u2192 ${q}`)}}if(X.length>0&&Y.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
6736
6740
  ${X.join(`
6737
6741
  `)}
6738
- Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var mK;var Z7=C(()=>{mK=[{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 h8={};r(h8,{getStoreScript:()=>uK,clearStoreCache:()=>pK});import b9 from"path";async function uK($){let Z;if($)Z=b9.resolve($);else{let W=await L1();Z=b9.resolve(W.root||process.cwd(),W.storesDir||"stores")}let J=u1.get(Z);if(J!==void 0)return J||null;let Y=new Bun.Glob("*.ts"),Q=[];try{for await(let W of Y.scan({cwd:Z,absolute:!0})){let U=b9.basename(W,".ts");if(["index","types"].includes(U))continue;if(W.includes(".d.ts"))continue;Q.push(W)}}catch{return u1.set(Z,""),null}if(Q.length===0)return u1.set(Z,""),null;let X=[];for(let W of Q){let U=await Bun.file(W).text();X.push({file:W,hasUseStore:/useStore\s*\(/.test(U)})}X.sort((W,U)=>{if(W.hasUseStore===U.hasUseStore)return 0;return W.hasUseStore?1:-1});let G=X.map((W)=>W.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:f0()});for(let W of G)try{let U=await Bun.file(W).text(),_=b9.basename(W,".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: ${_}
6742
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var pK;var Z7=C(()=>{pK=[{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 m8={};r(m8,{getStoreScript:()=>lK,clearStoreCache:()=>cK});import b9 from"path";async function lK($){let Z;if($)Z=b9.resolve($);else{let W=await L1();Z=b9.resolve(W.root||process.cwd(),W.storesDir||"stores")}let J=u1.get(Z);if(J!==void 0)return J||null;let Y=new Bun.Glob("*.ts"),Q=[];try{for await(let W of Y.scan({cwd:Z,absolute:!0})){let U=b9.basename(W,".ts");if(["index","types"].includes(U))continue;if(W.includes(".d.ts"))continue;Q.push(W)}}catch{return u1.set(Z,""),null}if(Q.length===0)return u1.set(Z,""),null;let X=[];for(let W of Q){let U=await Bun.file(W).text();X.push({file:W,hasUseStore:/useStore\s*\(/.test(U)})}X.sort((W,U)=>{if(W.hasUseStore===U.hasUseStore)return 0;return W.hasUseStore?1:-1});let G=X.map((W)=>W.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()});for(let W of G)try{let U=await Bun.file(W).text(),_=b9.basename(W,".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: ${_}
6739
6743
  ${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${W}:`,U)}if(K.length===0)return u1.set(Z,""),null;let z=`;(function(){
6740
6744
  ${K.join(`
6741
6745
 
6742
6746
  `)}
6743
- })();`;return u1.set(Z,z),z}function pK(){u1.clear()}var u1;var d8=C(()=>{Q5();M1();u1=new Map});var u8={};r(u8,{processDeferDirectives:()=>oK});function lK(){return`stx-defer-${++m8}`}function cK($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function iK($,Z,J){let{trigger:Y,value:Q}=cK(Z),X=J,G,K,q,z=J.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(z)G=z[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let W=J.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(W)K=W[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=J.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[2].trim(),X=X.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return X=X.trim(),{trigger:Y,triggerValue:Q,content:X,placeholder:G,loading:K,error:q}}function nK($,Z){let{trigger:J,triggerValue:Y}=Z,Q;switch(J){case"visible":Q=`
6747
+ })();`;return u1.set(Z,z),z}function cK(){u1.clear()}var u1;var u8=C(()=>{Q5();M1();u1=new Map});var l8={};r(l8,{processDeferDirectives:()=>rK});function iK(){return`stx-defer-${++p8}`}function nK($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function oK($,Z,J){let{trigger:Y,value:Q}=nK(Z),X=J,G,K,q,z=J.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(z)G=z[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let W=J.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(W)K=W[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=J.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[2].trim(),X=X.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return X=X.trim(),{trigger:Y,triggerValue:Q,content:X,placeholder:G,loading:K,error:q}}function sK($,Z){let{trigger:J,triggerValue:Y}=Z,Q;switch(J){case"visible":Q=`
6744
6748
  const observer = new IntersectionObserver((entries) => {
6745
6749
  if (entries[0].isIntersecting) {
6746
6750
  observer.disconnect();
@@ -6813,7 +6817,7 @@ else {
6813
6817
  ${Q}
6814
6818
  })();
6815
6819
  </script>
6816
- `}function oK($,Z,J){m8=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(Y,(Q,X,G)=>{let K=lK(),q=iK(Q,X,G),z=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",W=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>`,j=nK(K,q);return`
6820
+ `}function rK($,Z,J){p8=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(Y,(Q,X,G)=>{let K=iK(),q=oK(Q,X,G),z=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",W=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>`,j=sK(K,q);return`
6817
6821
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
6818
6822
  ${z}
6819
6823
  ${W}
@@ -6821,7 +6825,7 @@ else {
6821
6825
  ${U}
6822
6826
  </div>
6823
6827
  ${j}
6824
- `})}var m8=0;var l8={};r(l8,{processTeleportDirectives:()=>tK,ensureTeleportTargets:()=>eK});function sK(){return`stx-teleport-${++p8}`}function rK($){let Z=$.split(",").map((Q)=>Q.trim()),J=Z[0].replace(/['"]/g,""),Y;for(let Q=1;Q<Z.length;Q++){let X=Z[Q].match(/disabled:\s*(.+)/);if(X)Y=X[1].trim()}return{target:J,disabled:Y}}function aK($,Z){return`
6828
+ `})}var p8=0;var i8={};r(i8,{processTeleportDirectives:()=>$q,ensureTeleportTargets:()=>Zq});function aK(){return`stx-teleport-${++c8}`}function tK($){let Z=$.split(",").map((Q)=>Q.trim()),J=Z[0].replace(/['"]/g,""),Y;for(let Q=1;Q<Z.length;Q++){let X=Z[Q].match(/disabled:\s*(.+)/);if(X)Y=X[1].trim()}return{target:J,disabled:Y}}function eK($,Z){return`
6825
6829
  <script>
6826
6830
  (function() {
6827
6831
  const source = document.getElementById('${$}');
@@ -6857,12 +6861,12 @@ else {
6857
6861
  }));
6858
6862
  })();
6859
6863
  </script>
6860
- `}function tK($,Z,J){p8=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(Y,(Q,X,G)=>{let K=sK(),{target:q,disabled:z}=rK(X),W=G.trim();if(z)try{let _=!1;if(z==="true")_=!0;else if(z==="false")_=!1;else if(z in Z)_=Boolean(Z[z]);if(_)return`<div class="stx-teleport-inline" data-teleport-disabled>${W}</div>`}catch{}let U=aK(K,q);return`
6864
+ `}function $q($,Z,J){c8=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(Y,(Q,X,G)=>{let K=aK(),{target:q,disabled:z}=tK(X),W=G.trim();if(z)try{let _=!1;if(z==="true")_=!0;else if(z==="false")_=!1;else if(z in Z)_=Boolean(Z[z]);if(_)return`<div class="stx-teleport-inline" data-teleport-disabled>${W}</div>`}catch{}let U=eK(K,q);return`
6861
6865
  <div id="${K}" class="stx-teleport-source" style="display: none;">
6862
6866
  <template>${W}</template>
6863
6867
  </div>
6864
6868
  ${U}
6865
- `})}function eK(){return`
6869
+ `})}function Zq(){return`
6866
6870
  <script>
6867
6871
  (function() {
6868
6872
  // Common teleport targets
@@ -6879,7 +6883,7 @@ else {
6879
6883
  });
6880
6884
  })();
6881
6885
  </script>
6882
- `}var p8=0;var o8={};r(o8,{processTransitionDirectives:()=>Jq,processTransitionAttributes:()=>Kq,performLeave:()=>Yq,performEnter:()=>Zq,generateTransitionRuntime:()=>Gq,generateTransitionCSS:()=>Qq});function c8($,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 $q($){let Z=getComputedStyle($),J=Z.transitionDuration||"0s",Y=Z.animationDuration||"0s",Q=(X)=>{let G=X.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(J),Q(Y))}function i8($,Z){return new Promise((J)=>{let Y=Z??$q($);if(Y===0){J();return}let Q=!1,X=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),J()},G=(K)=>{if(K.target===$)X()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(X,Y+50)})}function n8($){$.offsetHeight}async function Zq($,Z={}){let J=Z.name||"stx",Y=c8(J,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(Y.enterFrom),$.classList.add(Y.enterActive),n8($),$.classList.remove(Y.enterFrom),$.classList.add(Y.enterTo),Z.onEnter)await new Promise((X)=>{Z.onEnter($,X)});else await i8($,Q);$.classList.remove(Y.enterActive),$.classList.remove(Y.enterTo),Z.onAfterEnter?.($)}async function Yq($,Z={}){let J=Z.name||"stx",Y=c8(J,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(Y.leaveFrom),$.classList.add(Y.leaveActive),n8($),$.classList.remove(Y.leaveFrom),$.classList.add(Y.leaveTo),Z.onLeave)await new Promise((X)=>{Z.onLeave($,X)});else await i8($,Q);$.classList.remove(Y.leaveActive),$.classList.remove(Y.leaveTo),Z.onAfterLeave?.($)}function Jq($,Z={},J){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(Y,(Q,X,G)=>{let K=Xq(X),q=K.name||"stx",z=K.duration||300,W=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
6886
+ `}var c8=0;var r8={};r(r8,{processTransitionDirectives:()=>Qq,processTransitionAttributes:()=>Wq,performLeave:()=>Xq,performEnter:()=>Jq,generateTransitionRuntime:()=>qq,generateTransitionCSS:()=>Kq});function n8($,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 Yq($){let Z=getComputedStyle($),J=Z.transitionDuration||"0s",Y=Z.animationDuration||"0s",Q=(X)=>{let G=X.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(J),Q(Y))}function o8($,Z){return new Promise((J)=>{let Y=Z??Yq($);if(Y===0){J();return}let Q=!1,X=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),J()},G=(K)=>{if(K.target===$)X()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(X,Y+50)})}function s8($){$.offsetHeight}async function Jq($,Z={}){let J=Z.name||"stx",Y=n8(J,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(Y.enterFrom),$.classList.add(Y.enterActive),s8($),$.classList.remove(Y.enterFrom),$.classList.add(Y.enterTo),Z.onEnter)await new Promise((X)=>{Z.onEnter($,X)});else await o8($,Q);$.classList.remove(Y.enterActive),$.classList.remove(Y.enterTo),Z.onAfterEnter?.($)}async function Xq($,Z={}){let J=Z.name||"stx",Y=n8(J,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(Y.leaveFrom),$.classList.add(Y.leaveActive),s8($),$.classList.remove(Y.leaveFrom),$.classList.add(Y.leaveTo),Z.onLeave)await new Promise((X)=>{Z.onLeave($,X)});else await o8($,Q);$.classList.remove(Y.leaveActive),$.classList.remove(Y.leaveTo),Z.onAfterLeave?.($)}function Qq($,Z={},J){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(Y,(Q,X,G)=>{let K=Gq(X),q=K.name||"stx",z=K.duration||300,W=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
6883
6887
  <div
6884
6888
  class="stx-transition-wrapper"
6885
6889
  data-transition="${q}"
@@ -6921,7 +6925,7 @@ else {
6921
6925
  });
6922
6926
  })();
6923
6927
  </script>
6924
- `})}function Xq($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3]||Y[4]||Y[5];switch(Q){case"name":Z.name=X;break;case"duration":Z.duration=parseInt(X,10);break;case"mode":Z.mode=X;break;case"easing":Z.easing=X;break}}return Z}function Qq(){return`
6928
+ `})}function Gq($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3]||Y[4]||Y[5];switch(Q){case"name":Z.name=X;break;case"duration":Z.duration=parseInt(X,10);break;case"mode":Z.mode=X;break;case"easing":Z.easing=X;break}}return Z}function Kq(){return`
6925
6929
  /* STX Transition Presets */
6926
6930
 
6927
6931
  /* Fade */
@@ -7108,7 +7112,7 @@ else {
7108
7112
  opacity: 1;
7109
7113
  max-height: 1000px;
7110
7114
  }
7111
- `}function Gq(){return`
7115
+ `}function qq(){return`
7112
7116
  // STX Transition Runtime
7113
7117
  (function() {
7114
7118
  if (typeof window === 'undefined') return;
@@ -7197,7 +7201,7 @@ else {
7197
7201
 
7198
7202
  console.log('[stx] Transition runtime initialized');
7199
7203
  })();
7200
- `}function Kq($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(J,Y,Q,X)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${G}" data-stx-transition-condition="${X}" data-stx-transition-id="${K}"`})}var r8={};r(r8,{withErrorBoundary:()=>s8,processErrorBoundaryDirectives:()=>zq,generateErrorBoundaryRuntime:()=>Oq,generateErrorBoundaryCSS:()=>jq,createErrorBoundary:()=>Bq});function Wq(){return`eb-${++qq}-${Date.now().toString(36)}`}function zq($,Z={},J){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(Y,(Q,X,G,K)=>{let q=Wq(),z=Uq(X||"");return _q(q,G.trim(),K.trim(),z)})}function Uq($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3]||Y[4];switch(Q){case"id":Z.id=X;break;case"logErrors":Z.logErrors=X==="true";break}}return Z}function _q($,Z,J,Y){let Q=Y.logErrors!==!1;return`
7204
+ `}function Wq($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(J,Y,Q,X)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${G}" data-stx-transition-condition="${X}" data-stx-transition-id="${K}"`})}var t8={};r(t8,{withErrorBoundary:()=>a8,processErrorBoundaryDirectives:()=>_q,generateErrorBoundaryRuntime:()=>Lq,generateErrorBoundaryCSS:()=>Hq,createErrorBoundary:()=>Oq});function Uq(){return`eb-${++zq}-${Date.now().toString(36)}`}function _q($,Z={},J){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(Y,(Q,X,G,K)=>{let q=Uq(),z=Bq(X||"");return jq(q,G.trim(),K.trim(),z)})}function Bq($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3]||Y[4];switch(Q){case"id":Z.id=X;break;case"logErrors":Z.logErrors=X==="true";break}}return Z}function jq($,Z,J,Y){let Q=Y.logErrors!==!1;return`
7201
7205
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
7202
7206
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
7203
7207
  ${Z}
@@ -7317,7 +7321,7 @@ else {
7317
7321
  };
7318
7322
  })();
7319
7323
  </script>
7320
- `}async function s8($,Z,J){try{return await $()}catch(Y){if(J)J(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return Z}}function Bq($,Z={}){let J=Z.onError?(Y)=>Z.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>s8(Y,$,J)}function jq(){return`
7324
+ `}async function a8($,Z,J){try{return await $()}catch(Y){if(J)J(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return Z}}function Oq($,Z={}){let J=Z.onError?(Y)=>Z.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>a8(Y,$,J)}function Hq(){return`
7321
7325
  /* STX Error Boundary Styles */
7322
7326
  .stx-error-boundary {
7323
7327
  position: relative;
@@ -7361,7 +7365,7 @@ else {
7361
7365
  color: #fecaca;
7362
7366
  }
7363
7367
  }
7364
- `}function Oq(){return`
7368
+ `}function Lq(){return`
7365
7369
  // STX Error Boundary Runtime
7366
7370
  (function() {
7367
7371
  if (typeof window === 'undefined') return;
@@ -7426,7 +7430,7 @@ else {
7426
7430
 
7427
7431
  console.log('[stx] Error boundary runtime initialized');
7428
7432
  })();
7429
- `}var qq=0;var a8={};r(a8,{renderSSRSuspense:()=>Nq,processSuspenseDirectives:()=>Fq,generateSuspenseRuntime:()=>Tq,generateSuspenseCSS:()=>Rq,createSSRSuspense:()=>Aq});function Lq(){return`suspense-${++Hq}-${Date.now().toString(36)}`}function Fq($,Z={},J){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(Y,(Q,X,G,K)=>{let q=Lq(),z=Vq(X||"");return wq(q,G.trim(),K.trim(),z)})}function Vq($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4];switch(Q){case"id":Z.id=X;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function wq($,Z,J,Y){let Q=Y.timeout||30000,X=Y.id||$;return`
7433
+ `}var zq=0;var e8={};r(e8,{renderSSRSuspense:()=>Tq,processSuspenseDirectives:()=>wq,generateSuspenseRuntime:()=>Iq,generateSuspenseCSS:()=>Mq,createSSRSuspense:()=>Rq});function Vq(){return`suspense-${++Fq}-${Date.now().toString(36)}`}function wq($,Z={},J){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(Y,(Q,X,G,K)=>{let q=Vq(),z=Aq(X||"");return Nq(q,G.trim(),K.trim(),z)})}function Aq($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4];switch(Q){case"id":Z.id=X;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function Nq($,Z,J,Y){let Q=Y.timeout||30000,X=Y.id||$;return`
7430
7434
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${X}" data-status="pending">
7431
7435
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
7432
7436
  ${J}
@@ -7616,7 +7620,7 @@ else {
7616
7620
  }, 0);
7617
7621
  })();
7618
7622
  </script>
7619
- `}function Aq($,Z,J){return{id:$,fallback:J,content:Z}}async function Nq($){let Z=$.map((Y)=>`
7623
+ `}function Rq($,Z,J){return{id:$,fallback:J,content:Z}}async function Tq($){let Z=$.map((Y)=>`
7620
7624
  <div id="stx-ssr-suspense-${Y.id}" class="stx-ssr-suspense">
7621
7625
  ${Y.fallback}
7622
7626
  </div>
@@ -7641,7 +7645,7 @@ else {
7641
7645
  }
7642
7646
  })();
7643
7647
  </script>
7644
- `}}return{initial:Z,streaming:J()}}function Rq(){return`
7648
+ `}}return{initial:Z,streaming:J()}}function Mq(){return`
7645
7649
  /* STX Suspense Styles */
7646
7650
  .stx-suspense {
7647
7651
  position: relative;
@@ -7697,7 +7701,7 @@ else {
7697
7701
  background-size: 200% 100%;
7698
7702
  }
7699
7703
  }
7700
- `}function Tq(){return`
7704
+ `}function Iq(){return`
7701
7705
  // STX Suspense Runtime
7702
7706
  (function() {
7703
7707
  if (typeof window === 'undefined') return;
@@ -7764,7 +7768,7 @@ else {
7764
7768
 
7765
7769
  console.log('[stx] Suspense runtime initialized');
7766
7770
  })();
7767
- `}var Hq=0;var ZZ={};r(ZZ,{processAsyncDirectives:()=>Iq,isAsyncComponent:()=>Eq,generateAsyncComponentRuntime:()=>bq,generateAsyncComponentCSS:()=>kq,defineAsyncComponent:()=>Dq});function t8(){return`async-${++Mq}-${Date.now().toString(36)}`}function Iq($,Z={},J){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,X=$;return X=X.replace(Y,(G,K,q,z)=>{let W=t8(),U=e8(K);return $Z(W,U,q.trim(),z.trim())}),X=X.replace(Q,(G,K,q)=>{let z=t8(),W=e8(K);return $Z(z,W,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function e8($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4],K=Y[5];switch(Q){case"component":Z.component=X||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=X||K;break;case"errorComponent":Z.errorComponent=X||K;break}}return Z}function $Z($,Z,J,Y){let{component:Q,timeout:X,delay:G,suspensible:K,retries:q}=Z;return`
7771
+ `}var Fq=0;var JZ={};r(JZ,{processAsyncDirectives:()=>Eq,isAsyncComponent:()=>bq,generateAsyncComponentRuntime:()=>yq,generateAsyncComponentCSS:()=>Sq,defineAsyncComponent:()=>kq});function $Z(){return`async-${++Dq}-${Date.now().toString(36)}`}function Eq($,Z={},J){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,X=$;return X=X.replace(Y,(G,K,q,z)=>{let W=$Z(),U=ZZ(K);return YZ(W,U,q.trim(),z.trim())}),X=X.replace(Q,(G,K,q)=>{let z=$Z(),W=ZZ(K);return YZ(z,W,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function ZZ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4],K=Y[5];switch(Q){case"component":Z.component=X||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=X||K;break;case"errorComponent":Z.errorComponent=X||K;break}}return Z}function YZ($,Z,J,Y){let{component:Q,timeout:X,delay:G,suspensible:K,retries:q}=Z;return`
7768
7772
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
7769
7773
  <div class="stx-async-loading" data-async-loading="${$}">
7770
7774
  ${J}
@@ -7949,7 +7953,7 @@ catch (error) {
7949
7953
  loadComponent();
7950
7954
  })();
7951
7955
  </script>
7952
- `}function Dq($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function Eq($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function kq(){return`
7956
+ `}function kq($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function bq($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function Sq(){return`
7953
7957
  /* STX Async Component Styles */
7954
7958
  .stx-async-component {
7955
7959
  position: relative;
@@ -8023,7 +8027,7 @@ catch (error) {
8023
8027
  background-size: 200% 100%;
8024
8028
  }
8025
8029
  }
8026
- `}function bq(){return`
8030
+ `}function yq(){return`
8027
8031
  // STX Async Component Runtime
8028
8032
  (function() {
8029
8033
  if (typeof window === 'undefined') return;
@@ -8077,7 +8081,7 @@ catch (error) {
8077
8081
 
8078
8082
  console.log('[stx] Async component runtime initialized');
8079
8083
  })();
8080
- `}var Mq=0;var JZ={};r(JZ,{shouldCacheComponent:()=>xq,processKeepAliveDirectives:()=>yq,onDeactivated:()=>dq,onActivated:()=>hq,generateKeepAliveRuntime:()=>gq,generateKeepAliveCSS:()=>fq,createKeepAliveCache:()=>vq});function YZ(){return`keep-alive-${++Sq}-${Date.now().toString(36)}`}function yq($,Z={},J){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(Y,(Q,X,G)=>{let K=YZ(),q=Cq(X||"");return Pq(K,G.trim(),q)})}function Cq($){let Z={max:10},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=X;break;case"exclude":Z.exclude=X;break;case"id":Z.id=X;break}}return Z}function Pq($,Z,J){let{max:Y,include:Q,exclude:X}=J,G=J.id||$;return`
8084
+ `}var Dq=0;var QZ={};r(QZ,{shouldCacheComponent:()=>gq,processKeepAliveDirectives:()=>Pq,onDeactivated:()=>uq,onActivated:()=>mq,generateKeepAliveRuntime:()=>dq,generateKeepAliveCSS:()=>hq,createKeepAliveCache:()=>fq});function XZ(){return`keep-alive-${++Cq}-${Date.now().toString(36)}`}function Pq($,Z={},J){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(Y,(Q,X,G)=>{let K=XZ(),q=vq(X||"");return xq(K,G.trim(),q)})}function vq($){let Z={max:10},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let Q=Y[1],X=Y[2]||Y[3],G=Y[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=X;break;case"exclude":Z.exclude=X;break;case"id":Z.id=X;break}}return Z}function xq($,Z,J){let{max:Y,include:Q,exclude:X}=J,G=J.id||$;return`
8081
8085
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
8082
8086
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
8083
8087
  ${Z}
@@ -8364,7 +8368,7 @@ else {
8364
8368
  });
8365
8369
  })();
8366
8370
  </script>
8367
- `}function vq($={}){return{id:$.id||YZ(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((J)=>J.trim()):null,exclude:$.exclude?$.exclude.split(",").map((J)=>J.trim()):null}}function xq($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function fq(){return`
8371
+ `}function fq($={}){return{id:$.id||XZ(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((J)=>J.trim()):null,exclude:$.exclude?$.exclude.split(",").map((J)=>J.trim()):null}}function gq($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function hq(){return`
8368
8372
  /* STX Keep-Alive Styles */
8369
8373
  .stx-keep-alive {
8370
8374
  position: relative;
@@ -8389,7 +8393,7 @@ else {
8389
8393
  .stx-keep-alive-content > [data-activated] {
8390
8394
  opacity: 1;
8391
8395
  }
8392
- `}function gq(){return`
8396
+ `}function dq(){return`
8393
8397
  // STX Keep-Alive Runtime
8394
8398
  (function() {
8395
8399
  if (typeof window === 'undefined') return;
@@ -8425,7 +8429,7 @@ else {
8425
8429
 
8426
8430
  console.log('[stx] Keep-alive runtime initialized');
8427
8431
  })();
8428
- `}function hq($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function dq($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var Sq=0;var qZ={};r(qZ,{useVirtualList:()=>QZ,processVirtualListDirectives:()=>J7,processVirtualGridDirectives:()=>KZ,processInfiniteListDirectives:()=>GZ,generateVirtualListCSS:()=>XZ,default:()=>mq,createVirtualList:()=>Y7});function Y7($,Z){let{itemHeight:J,containerHeight:Y,overscan:Q=3,keyProperty:X="id",dynamicHeight:G=!1,estimatedItemHeight:K=J,direction:q="vertical"}=Z,z=[...$],W=0,U=new Map;function _(){if(G)return j();let N=Math.max(0,Math.floor(W/J)-Q),R=Math.ceil(Y/J),T=Math.min(z.length-1,N+R+Q*2);return{startIndex:N,endIndex:T}}function j(){let N=0,R=0,T=z.length-1;for(let I=0;I<z.length;I++){let M=U.get(I)||K;if(N+M>W){R=Math.max(0,I-Q);break}N+=M}N=0;for(let I=0;I<z.length;I++){let M=U.get(I)||K;if(N+=M,N>W+Y){T=Math.min(z.length-1,I+Q);break}}return{startIndex:R,endIndex:T}}function B(){if(G){let N=0;for(let R=0;R<z.length;R++)N+=U.get(R)||K;return N}return z.length*J}function O(N){if(G){let R=0;for(let T=0;T<N;T++)R+=U.get(T)||K;return R}return N*J}function F(){let{startIndex:N,endIndex:R}=_();return{startIndex:N,endIndex:R,scrollTop:W,totalHeight:B(),visibleItems:z.slice(N,R+1),itemHeights:new Map(U)}}function L(N,R="auto"){let T=O(N);H(T,R)}function H(N,R="auto"){W=Math.max(0,Math.min(N,B()-Y))}function V(){_()}function A(N){z=[...N],U.clear(),V()}function w(){z=[],U.clear()}return{scrollToIndex:L,scrollToOffset:H,getState:F,refresh:V,setItems:A,destroy:w}}function J7($,Z={},J){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(Y,(Q,X,G,K)=>{let q=X.trim(),z=Z[q];if(!z||!Array.isArray(z))return`<!-- virtualList: items "${q}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let H=G.trim(),V=Function(`return ${H}`)();W={...W,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(W.containerHeight/W.itemHeight),j=W.overscan||3,B=0,O=Math.min(z.length-1,_+j),F="";for(let H=B;H<=O&&H<z.length;H++){let V=z[H],A=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(w,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(H));F+=`
8432
+ `}function mq($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function uq($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var Cq=0;var zZ={};r(zZ,{useVirtualList:()=>KZ,processVirtualListDirectives:()=>J7,processVirtualGridDirectives:()=>WZ,processInfiniteListDirectives:()=>qZ,generateVirtualListCSS:()=>GZ,default:()=>pq,createVirtualList:()=>Y7});function Y7($,Z){let{itemHeight:J,containerHeight:Y,overscan:Q=3,keyProperty:X="id",dynamicHeight:G=!1,estimatedItemHeight:K=J,direction:q="vertical"}=Z,z=[...$],W=0,U=new Map;function _(){if(G)return j();let N=Math.max(0,Math.floor(W/J)-Q),R=Math.ceil(Y/J),T=Math.min(z.length-1,N+R+Q*2);return{startIndex:N,endIndex:T}}function j(){let N=0,R=0,T=z.length-1;for(let I=0;I<z.length;I++){let M=U.get(I)||K;if(N+M>W){R=Math.max(0,I-Q);break}N+=M}N=0;for(let I=0;I<z.length;I++){let M=U.get(I)||K;if(N+=M,N>W+Y){T=Math.min(z.length-1,I+Q);break}}return{startIndex:R,endIndex:T}}function B(){if(G){let N=0;for(let R=0;R<z.length;R++)N+=U.get(R)||K;return N}return z.length*J}function O(N){if(G){let R=0;for(let T=0;T<N;T++)R+=U.get(T)||K;return R}return N*J}function F(){let{startIndex:N,endIndex:R}=_();return{startIndex:N,endIndex:R,scrollTop:W,totalHeight:B(),visibleItems:z.slice(N,R+1),itemHeights:new Map(U)}}function L(N,R="auto"){let T=O(N);H(T,R)}function H(N,R="auto"){W=Math.max(0,Math.min(N,B()-Y))}function V(){_()}function A(N){z=[...N],U.clear(),V()}function w(){z=[],U.clear()}return{scrollToIndex:L,scrollToOffset:H,getState:F,refresh:V,setItems:A,destroy:w}}function J7($,Z={},J){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(Y,(Q,X,G,K)=>{let q=X.trim(),z=Z[q];if(!z||!Array.isArray(z))return`<!-- virtualList: items "${q}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let H=G.trim(),V=Function(`return ${H}`)();W={...W,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(W.containerHeight/W.itemHeight),j=W.overscan||3,B=0,O=Math.min(z.length-1,_+j),F="";for(let H=B;H<=O&&H<z.length;H++){let V=z[H],A=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(w,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(H));F+=`
8429
8433
  <div class="virtual-item ${W.itemClass||""}"
8430
8434
  style="position: absolute; top: ${H*W.itemHeight}px; height: ${W.itemHeight}px; width: 100%;"
8431
8435
  data-index="${H}">
@@ -8502,7 +8506,7 @@ else {
8502
8506
  };
8503
8507
  })();
8504
8508
  </script>
8505
- `})}function XZ(){return`
8509
+ `})}function GZ(){return`
8506
8510
  .virtual-list-container {
8507
8511
  position: relative;
8508
8512
  overflow-y: auto;
@@ -8550,7 +8554,7 @@ else {
8550
8554
  0% { background-position: 200% 0; }
8551
8555
  100% { background-position: -200% 0; }
8552
8556
  }
8553
- `}function QZ($,Z){let J=null,Y=()=>{if(!J)J=Y7($(),Z);return J};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let X=Q.target;if(J)J.scrollToOffset(X.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{Y().scrollToIndex(Q)}}}function GZ($,Z={},J){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(Y,(Q,X,G,K,q)=>{let z=X.trim(),W=Z[z];if(!W||!Array.isArray(W))return`<!-- infiniteList: items "${z}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();U={...U,...B}}catch{}let _=`ilist-${Math.random().toString(36).substring(2,9)}`,j=J7(`@virtualList(${z}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return j=j.replace("</script>",`
8557
+ `}function KZ($,Z){let J=null,Y=()=>{if(!J)J=Y7($(),Z);return J};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let X=Q.target;if(J)J.scrollToOffset(X.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{Y().scrollToIndex(Q)}}}function qZ($,Z={},J){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(Y,(Q,X,G,K,q)=>{let z=X.trim(),W=Z[z];if(!W||!Array.isArray(W))return`<!-- infiniteList: items "${z}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();U={...U,...B}}catch{}let _=`ilist-${Math.random().toString(36).substring(2,9)}`,j=J7(`@virtualList(${z}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return j=j.replace("</script>",`
8554
8558
  // Infinite scroll detection
8555
8559
  container.addEventListener('scroll', function() {
8556
8560
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -8568,7 +8572,7 @@ else {
8568
8572
  ${q}
8569
8573
  </div>
8570
8574
  </div>
8571
- `})}function KZ($,Z={},J){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(Y,(Q,X,G,K)=>{let q=X.trim(),z=Z[q];if(!z||!Array.isArray(z))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let W={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();W={...W,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(z.length/W.columns),j=_*(W.rowHeight+(W.gap||0)),B=Math.ceil(W.containerHeight/(W.rowHeight+(W.gap||0))),O=W.overscan||2,F=0,L=Math.min(_-1,B+O),H="";for(let V=F;V<=L;V++)for(let A=0;A<W.columns;A++){let w=V*W.columns+A;if(w>=z.length)break;let N=z[w],R=A*(100/W.columns),T=V*(W.rowHeight+(W.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,E)=>{if(typeof N==="object"&&N!==null)return String(N[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(w));H+=`
8575
+ `})}function WZ($,Z={},J){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(Y,(Q,X,G,K)=>{let q=X.trim(),z=Z[q];if(!z||!Array.isArray(z))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let W={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();W={...W,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(z.length/W.columns),j=_*(W.rowHeight+(W.gap||0)),B=Math.ceil(W.containerHeight/(W.rowHeight+(W.gap||0))),O=W.overscan||2,F=0,L=Math.min(_-1,B+O),H="";for(let V=F;V<=L;V++)for(let A=0;A<W.columns;A++){let w=V*W.columns+A;if(w>=z.length)break;let N=z[w],R=A*(100/W.columns),T=V*(W.rowHeight+(W.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,E)=>{if(typeof N==="object"&&N!==null)return String(N[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(w));H+=`
8572
8576
  <div class="virtual-grid-item"
8573
8577
  style="position: absolute; top: ${T}px; left: ${R}%; width: calc(${100/W.columns}% - ${W.gap||0}px); height: ${W.rowHeight}px;"
8574
8578
  data-index="${w}">
@@ -8638,7 +8642,7 @@ else {
8638
8642
  });
8639
8643
  })();
8640
8644
  </script>
8641
- `})}var mq;var WZ=C(()=>{mq={createVirtualList:Y7,processVirtualListDirectives:J7,processInfiniteListDirectives:GZ,processVirtualGridDirectives:KZ,generateVirtualListCSS:XZ,useVirtualList:QZ}});function zZ(){return`<script data-stx-hydration-runtime>
8645
+ `})}var pq;var UZ=C(()=>{pq={createVirtualList:Y7,processVirtualListDirectives:J7,processInfiniteListDirectives:qZ,processVirtualGridDirectives:WZ,generateVirtualListCSS:GZ,useVirtualList:KZ}});function _Z(){return`<script data-stx-hydration-runtime>
8642
8646
  (function() {
8643
8647
  'use strict';
8644
8648
 
@@ -8798,7 +8802,7 @@ else {
8798
8802
  stxIslands.initIslands();
8799
8803
  }
8800
8804
  })();
8801
- </script>`}function UZ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let J=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(J)return J[1];return null}function _Z($,Z){let J={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=Y.exec($))!==null){let X=Q[1],G=Q[2];if(G in Z)J[X]=Z[G];else J[X]=G}return J}var RZ={};r(RZ,{processStaticDirectives:()=>AZ,processPartialHydrationDirectives:()=>jZ,onHydrated:()=>wZ,isHydrated:()=>VZ,hydrateIsland:()=>HZ,hydrateByStrategy:()=>LZ,hydrateAll:()=>FZ,generatePartialHydrationCSS:()=>OZ,generateIslandManifest:()=>NZ,default:()=>sq,createIslandRegistry:()=>BZ});function BZ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let J=$.get(Z);if(!J||J.hydrated)return;if(J.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:J.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((J)=>!J.hydrated).map((J)=>this.hydrate(J.id));await Promise.all(Z)}}}function uq($){return`
8805
+ </script>`}function BZ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let J=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(J)return J[1];return null}function jZ($,Z){let J={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=Y.exec($))!==null){let X=Q[1],G=Q[2];if(G in Z)J[X]=Z[G];else J[X]=G}return J}var MZ={};r(MZ,{processStaticDirectives:()=>RZ,processPartialHydrationDirectives:()=>HZ,onHydrated:()=>NZ,isHydrated:()=>AZ,hydrateIsland:()=>FZ,hydrateByStrategy:()=>VZ,hydrateAll:()=>wZ,generatePartialHydrationCSS:()=>LZ,generateIslandManifest:()=>TZ,default:()=>aq,createIslandRegistry:()=>OZ});function OZ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let J=$.get(Z);if(!J||J.hydrated)return;if(J.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:J.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((J)=>!J.hydrated).map((J)=>this.hydrate(J.id));await Promise.all(Z)}}}function lq($){return`
8802
8806
  <script data-hydrate="${$}">
8803
8807
  (function() {
8804
8808
  const island = document.querySelector('[data-island="${$}"]');
@@ -8809,7 +8813,7 @@ else {
8809
8813
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
8810
8814
  })();
8811
8815
  </script>
8812
- `}function pq($,Z){let J=Z.timeout||2000,Y=Z.priority||"low";return`
8816
+ `}function cq($,Z){let J=Z.timeout||2000,Y=Z.priority||"low";return`
8813
8817
  <script data-hydrate="${$}">
8814
8818
  (function() {
8815
8819
  const island = document.querySelector('[data-island="${$}"]');
@@ -8845,7 +8849,7 @@ else {
8845
8849
  }
8846
8850
  })();
8847
8851
  </script>
8848
- `}function lq($,Z){let J=Z.rootMargin||"0px",Y=Z.threshold||0;return`
8852
+ `}function iq($,Z){let J=Z.rootMargin||"0px",Y=Z.threshold||0;return`
8849
8853
  <script data-hydrate="${$}">
8850
8854
  (function() {
8851
8855
  const island = document.querySelector('[data-island="${$}"]');
@@ -8878,7 +8882,7 @@ else {
8878
8882
  }
8879
8883
  })();
8880
8884
  </script>
8881
- `}function cq($,Z){let J=Z.media||"(min-width: 768px)";return`
8885
+ `}function nq($,Z){let J=Z.media||"(min-width: 768px)";return`
8882
8886
  <script data-hydrate="${$}">
8883
8887
  (function() {
8884
8888
  const island = document.querySelector('[data-island="${$}"]');
@@ -8907,7 +8911,7 @@ else {
8907
8911
  }
8908
8912
  })();
8909
8913
  </script>
8910
- `}function iq($){return`
8914
+ `}function oq($){return`
8911
8915
  <script data-hydrate="${$}">
8912
8916
  (function() {
8913
8917
  const island = document.querySelector('[data-island="${$}"]');
@@ -8929,7 +8933,7 @@ else {
8929
8933
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
8930
8934
  })();
8931
8935
  </script>
8932
- `}function nq($,Z){let J=Z.event||"stx:activate";return`
8936
+ `}function sq($,Z){let J=Z.event||"stx:activate";return`
8933
8937
  <script data-hydrate="${$}">
8934
8938
  (function() {
8935
8939
  const island = document.querySelector('[data-island="${$}"]');
@@ -8950,9 +8954,9 @@ else {
8950
8954
  });
8951
8955
  })();
8952
8956
  </script>
8953
- `}function jZ($,Z={},J){let Y=$,Q=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(Y=p1(Y,"load",Z),Y=p1(Y,"idle",Z),Y=p1(Y,"visible",Z),Y=p1(Y,"media",Z),Y=oq(Y),Y=p1(Y,"hover",Z),Y=p1(Y,"event",Z),Q=X&&Y!==$,Q)Y+=`
8954
- `+zZ();return Y}function p1($,Z,J){let Y=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(Y,(Q,X,G)=>{let K={strategy:Z};if(X)try{let O=X.split(",").map((F)=>F.trim());for(let F of O){let[L,H]=F.split(":").map((V)=>V.trim());if(L&&H){let V=H.replace(/^['"]|['"]$/g,"");K[L]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,z=UZ(G.trim()),W=_Z(G.trim(),J),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(z)U.push(`data-component="${z}"`);let j=Object.keys(W).length>0?`
8955
- <script type="application/json" data-island-props="${q}">${JSON.stringify(W)}</script>`:"",B="";switch(Z){case"load":B=uq(q);break;case"idle":B=pq(q,K);break;case"visible":B=lq(q,K);break;case"media":B=cq(q,K);break;case"hover":B=iq(q);break;case"event":B=nq(q,K);break}return`
8957
+ `}function HZ($,Z={},J){let Y=$,Q=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(Y=p1(Y,"load",Z),Y=p1(Y,"idle",Z),Y=p1(Y,"visible",Z),Y=p1(Y,"media",Z),Y=rq(Y),Y=p1(Y,"hover",Z),Y=p1(Y,"event",Z),Q=X&&Y!==$,Q)Y+=`
8958
+ `+_Z();return Y}function p1($,Z,J){let Y=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(Y,(Q,X,G)=>{let K={strategy:Z};if(X)try{let O=X.split(",").map((F)=>F.trim());for(let F of O){let[L,H]=F.split(":").map((V)=>V.trim());if(L&&H){let V=H.replace(/^['"]|['"]$/g,"");K[L]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,z=BZ(G.trim()),W=jZ(G.trim(),J),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(z)U.push(`data-component="${z}"`);let j=Object.keys(W).length>0?`
8959
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(W)}</script>`:"",B="";switch(Z){case"load":B=lq(q);break;case"idle":B=cq(q,K);break;case"visible":B=iq(q,K);break;case"media":B=nq(q,K);break;case"hover":B=oq(q);break;case"event":B=sq(q,K);break}return`
8956
8960
  <div data-island="${q}"
8957
8961
  data-strategy="${Z}"
8958
8962
  ${U.join(`
@@ -8962,7 +8966,7 @@ else {
8962
8966
  ${G.trim()}${j}
8963
8967
  </div>
8964
8968
  ${B}
8965
- `})}function oq($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(J,Y)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
8969
+ `})}function rq($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(J,Y)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
8966
8970
  <div data-island="${Q}"
8967
8971
  data-strategy="only"
8968
8972
  class="stx-island stx-client-only">
@@ -8981,7 +8985,7 @@ else {
8981
8985
  }
8982
8986
  })();
8983
8987
  </script>
8984
- `})}function OZ(){return`
8988
+ `})}function LZ(){return`
8985
8989
  /* Island base styles */
8986
8990
  .stx-island {
8987
8991
  display: contents;
@@ -9022,11 +9026,11 @@ else {
9022
9026
  .stx-island.hydrated {
9023
9027
  opacity: 1;
9024
9028
  }
9025
- `}function HZ($){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 LZ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((J)=>{J.classList.add("hydrated"),J.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function FZ(){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 VZ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function wZ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let J=document.querySelector(`[data-island="${$}"]`);if(!J){Z();return}if(J.classList.contains("hydrated")){Z();return}J.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function AZ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,J)=>{return`<div class="stx-static">${J.trim()}</div>`})}function NZ($){let Z=$.map((J)=>({id:J.id,component:J.component,strategy:J.options.strategy,props:J.props}));return`
9029
+ `}function FZ($){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 VZ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((J)=>{J.classList.add("hydrated"),J.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function wZ(){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 AZ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function NZ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let J=document.querySelector(`[data-island="${$}"]`);if(!J){Z();return}if(J.classList.contains("hydrated")){Z();return}J.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function RZ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,J)=>{return`<div class="stx-static">${J.trim()}</div>`})}function TZ($){let Z=$.map((J)=>({id:J.id,component:J.component,strategy:J.options.strategy,props:J.props}));return`
9026
9030
  <script type="application/json" id="stx-island-manifest">
9027
9031
  ${JSON.stringify(Z)}
9028
9032
  </script>
9029
- `}var sq;var TZ=C(()=>{sq={processPartialHydrationDirectives:jZ,processStaticDirectives:AZ,generatePartialHydrationCSS:OZ,generateIslandManifest:NZ,createIslandRegistry:BZ,hydrateIsland:HZ,hydrateByStrategy:LZ,hydrateAll:FZ,isHydrated:VZ,onHydrated:wZ}});var vZ={};r(vZ,{watchMultiple:()=>kZ,watchEffect:()=>bZ,watch:()=>EZ,unref:()=>MZ,toRefs:()=>IZ,throttledComputed:()=>PZ,stxWatchMultiple:()=>kZ,stxWatchEffect:()=>bZ,stxWatch:()=>EZ,stxUnref:()=>MZ,stxToRefs:()=>IZ,stxThrottledComputed:()=>PZ,stxShallowRef:()=>DZ,stxRef:()=>l1,stxIsRef:()=>K1,stxDebouncedComputed:()=>CZ,stxComputed:()=>F5,shallowRef:()=>DZ,ref:()=>l1,processWatchDirectives:()=>yZ,processComputedDirectives:()=>SZ,isRef:()=>K1,default:()=>rq,debouncedComputed:()=>CZ,computed:()=>F5});function l1($){let Z=$,J=new Set,Y={get value(){if(u0){let Q=L5.get(Y);if(!Q)Q=new Set,L5.set(Y,Q);Q.add(u0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,J.forEach((G)=>G(Q));let X=L5.get(Y);if(X)X.forEach((G)=>G())}},subscribe(Q){return J.add(Q),()=>J.delete(Q)},peek(){return Z}};return Y}function K1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function MZ($){return K1($)?$.value:$}function IZ($){let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=l1($[J]);return Z}function DZ($){return l1($)}function F5($){let Z=typeof $==="function",J=Z?$:$.get,Y=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,X,G=!0,K=new Set,q=new Set,z=()=>{if(G=!0,q.size>0){let _=U.value;q.forEach((j)=>j(_))}};function W(){K.clear();let _=u0;u0=z,S9.push(z);try{return J()}finally{S9.pop(),u0=_}}let U={get value(){if(u0){let _=L5.get(U);if(!_)_=new Set,L5.set(U,_);_.add(u0)}if(G){let _=W();if(!Q(X,_))X=_;G=!1}return X},set value(_){if(Y)Y(_);else console.warn("Computed property is readonly")},subscribe(_){return q.add(_),()=>q.delete(_)},peek(){if(G)X=J(),G=!1;return X},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function EZ($,Z,J={}){let{immediate:Y=!1,deep:Q=!1,flush:X="pre",once:G=!1}=J,K,q=!0,z=!1,W=()=>{if(K1($))return Q?N1($.value):$.value;return $()},U=()=>{if(!q||z)return;let B=W();if(K!==void 0&&Object.is(K,B)&&!Q)return;let O=()=>{if(Z(B,K),K=Q?N1(B):B,G)j()};if(X==="sync")O();else if(X==="post")queueMicrotask(O);else Promise.resolve().then(O)},_=null;if(K1($))_=$.subscribe(()=>U());else _=F5($).subscribe(()=>U());if(Y)K=void 0,U();else K=W();let j=()=>{if(q=!1,_)_(),_=null};return j.pause=()=>{z=!0},j.resume=()=>{z=!1},j}function kZ($,Z,J={}){let{immediate:Y=!1,once:Q=!1}=J,X=$.map((U)=>K1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((_)=>K1(_)?_.value:void 0);if(Z(U,X),X=[...U],Q)W()},z=$.map((U)=>{if(K1(U))return U.subscribe(()=>q());return()=>{}});if(Y)q();let W=()=>{G=!1,z.forEach((U)=>U())};return W.pause=()=>{K=!0},W.resume=()=>{K=!1},W}function bZ($,Z={}){let{flush:J="pre"}=Z,Y,Q=!0,X=!1,G=()=>{if(!Q||X)return;if(Y)Y();let q=u0;u0=G,S9.push(G);try{Y=$()}finally{S9.pop(),u0=q}};if(J==="sync")G();else if(J==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,Y)Y()};return K.pause=()=>{X=!0},K.resume=()=>{X=!1},K}function SZ($,Z={},J){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(Y,(Q,X,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[X]=q,`<!-- computed: ${X} = ${q} -->`}catch(K){return`<!-- computed error: ${X} - ${K} -->`}})}function yZ($,Z={},J){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(Y,(Q,X,G)=>{return`
9033
+ `}var aq;var IZ=C(()=>{aq={processPartialHydrationDirectives:HZ,processStaticDirectives:RZ,generatePartialHydrationCSS:LZ,generateIslandManifest:TZ,createIslandRegistry:OZ,hydrateIsland:FZ,hydrateByStrategy:VZ,hydrateAll:wZ,isHydrated:AZ,onHydrated:NZ}});var fZ={};r(fZ,{watchMultiple:()=>SZ,watchEffect:()=>yZ,watch:()=>bZ,unref:()=>DZ,toRefs:()=>EZ,throttledComputed:()=>xZ,stxWatchMultiple:()=>SZ,stxWatchEffect:()=>yZ,stxWatch:()=>bZ,stxUnref:()=>DZ,stxToRefs:()=>EZ,stxThrottledComputed:()=>xZ,stxShallowRef:()=>kZ,stxRef:()=>l1,stxIsRef:()=>K1,stxDebouncedComputed:()=>vZ,stxComputed:()=>F5,shallowRef:()=>kZ,ref:()=>l1,processWatchDirectives:()=>PZ,processComputedDirectives:()=>CZ,isRef:()=>K1,default:()=>tq,debouncedComputed:()=>vZ,computed:()=>F5});function l1($){let Z=$,J=new Set,Y={get value(){if(p0){let Q=L5.get(Y);if(!Q)Q=new Set,L5.set(Y,Q);Q.add(p0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,J.forEach((G)=>G(Q));let X=L5.get(Y);if(X)X.forEach((G)=>G())}},subscribe(Q){return J.add(Q),()=>J.delete(Q)},peek(){return Z}};return Y}function K1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function DZ($){return K1($)?$.value:$}function EZ($){let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=l1($[J]);return Z}function kZ($){return l1($)}function F5($){let Z=typeof $==="function",J=Z?$:$.get,Y=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,X,G=!0,K=new Set,q=new Set,z=()=>{if(G=!0,q.size>0){let _=U.value;q.forEach((j)=>j(_))}};function W(){K.clear();let _=p0;p0=z,S9.push(z);try{return J()}finally{S9.pop(),p0=_}}let U={get value(){if(p0){let _=L5.get(U);if(!_)_=new Set,L5.set(U,_);_.add(p0)}if(G){let _=W();if(!Q(X,_))X=_;G=!1}return X},set value(_){if(Y)Y(_);else console.warn("Computed property is readonly")},subscribe(_){return q.add(_),()=>q.delete(_)},peek(){if(G)X=J(),G=!1;return X},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function bZ($,Z,J={}){let{immediate:Y=!1,deep:Q=!1,flush:X="pre",once:G=!1}=J,K,q=!0,z=!1,W=()=>{if(K1($))return Q?N1($.value):$.value;return $()},U=()=>{if(!q||z)return;let B=W();if(K!==void 0&&Object.is(K,B)&&!Q)return;let O=()=>{if(Z(B,K),K=Q?N1(B):B,G)j()};if(X==="sync")O();else if(X==="post")queueMicrotask(O);else Promise.resolve().then(O)},_=null;if(K1($))_=$.subscribe(()=>U());else _=F5($).subscribe(()=>U());if(Y)K=void 0,U();else K=W();let j=()=>{if(q=!1,_)_(),_=null};return j.pause=()=>{z=!0},j.resume=()=>{z=!1},j}function SZ($,Z,J={}){let{immediate:Y=!1,once:Q=!1}=J,X=$.map((U)=>K1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((_)=>K1(_)?_.value:void 0);if(Z(U,X),X=[...U],Q)W()},z=$.map((U)=>{if(K1(U))return U.subscribe(()=>q());return()=>{}});if(Y)q();let W=()=>{G=!1,z.forEach((U)=>U())};return W.pause=()=>{K=!0},W.resume=()=>{K=!1},W}function yZ($,Z={}){let{flush:J="pre"}=Z,Y,Q=!0,X=!1,G=()=>{if(!Q||X)return;if(Y)Y();let q=p0;p0=G,S9.push(G);try{Y=$()}finally{S9.pop(),p0=q}};if(J==="sync")G();else if(J==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,Y)Y()};return K.pause=()=>{X=!0},K.resume=()=>{X=!1},K}function CZ($,Z={},J){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(Y,(Q,X,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[X]=q,`<!-- computed: ${X} = ${q} -->`}catch(K){return`<!-- computed error: ${X} - ${K} -->`}})}function PZ($,Z={},J){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(Y,(Q,X,G)=>{return`
9030
9034
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
9031
9035
  (function() {
9032
9036
  // Watch implementation for ${X}
@@ -9038,9 +9042,9 @@ else {
9038
9042
  }
9039
9043
  })();
9040
9044
  </script>
9041
- `})}function N1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>N1(J));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let J=new Map;return $.forEach((Y,Q)=>J.set(N1(Q),N1(Y))),J}if($ instanceof Set){let J=new Set;return $.forEach((Y)=>J.add(N1(Y))),J}let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=N1($[J]);return Z}function CZ($,Z=100){let J=l1($()),Y=null,Q=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{J.value=$()},Z)};return F5($).subscribe(()=>Q()),{get value(){return J.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function PZ($,Z=100){let J=l1($()),Y=0,Q=()=>{let G=Date.now();if(G-Y>=Z)Y=G,J.value=$()};return F5($).subscribe(()=>Q()),{get value(){return J.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var u0=null,S9,L5,rq;var xZ=C(()=>{S9=[],L5=new WeakMap;rq={ref:l1,computed:F5,watch:EZ,watchMultiple:kZ,watchEffect:bZ,isRef:K1,unref:MZ,toRefs:IZ,shallowRef:DZ,debouncedComputed:CZ,throttledComputed:PZ,processComputedDirectives:SZ,processWatchDirectives:yZ}});var dZ={};r(dZ,{v:()=>aq,processHasErrorsDirective:()=>hZ,processFormValidationDirectives:()=>eq,processErrorsDirective:()=>gZ,processErrorDirective:()=>fZ,defineForm:()=>tq,Validator:()=>c1});class c1{rules=[];defaultValue="";addRule($){let Z=new c1;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 J=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=$||J}})}max($,Z){let J=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=$||J}})}length($,Z,J){let Y=J||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:Y,validate:(Q)=>{if(!Q)return!0;let X=String(Q).length;return X>=$&&X<=Z||Y}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(J)=>{if(!J)return!0;return $.test(String(J))||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:(J)=>{if(!J&&J!==0)return!0;return!Number.isNaN(Number(J))||$}});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 J=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=$||J}})}maxValue($,Z){let J=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=$||J}})}between($,Z,J){let Y=J||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:Y,validate:(Q)=>{if(!Q&&Q!==0)return!0;let X=Number(Q);return X>=$&&X<=Z||Y}})}matches($,Z){let J=Z||`Must match ${$}`;return this.addRule({name:"matches",message:J,validate:(Y,Q)=>{if(!Q)return!0;return Y===Q[$]||J}})}oneOf($,Z){let J=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:J,validate:(Y)=>{if(!Y)return!0;return $.includes(Y)||J}})}notOneOf($,Z){let J=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:J,validate:(Y)=>{if(!Y)return!0;return!$.includes(Y)||J}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let J=new Date(String(Z));return!Number.isNaN(J.getTime())||$}})}before($,Z){let J=new Date($),Y=Z||`Must be before ${J.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<J||Y}})}after($,Z){let J=new Date($),Y=Z||`Must be after ${J.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>J||Y}})}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 J=new c1;J.rules=[...this.rules],J.defaultValue=this.defaultValue;for(let Y of Z.getRules())J.rules.push({...Y,validate:(Q,X)=>{if(!$(Q,X||{}))return!0;return Y.validate(Q,X)}});return J}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new c1;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let J=[];for(let Y of this.rules){let Q=await Y.validate($,Z);if(Q!==!0)J.push(Q)}return J}validateSync($,Z){let J=[];for(let Y of this.rules){if(Y.async)continue;let Q=Y.validate($,Z);if(Q!==!0)J.push(Q)}return J}}function tq($,Z){let J=Object.keys($),Y={},Q={},X={},G={},K={};for(let H of J)Y[H]=Z?.[H]??$[H].getDefaultValue(),Q[H]=[],X[H]=!1,G[H]=!1,K[H]=!1;let q=!1;async function z(H){K[H]=!0;let V=await $[H].validate(Y[H],Y);return Q[H]=V,K[H]=!1,V.length===0}async function W(){q=!0;let H=await Promise.all(J.map(z));return q=!1,H.every(Boolean)}function U(){for(let H of J)Y[H]=Z?.[H]??$[H].getDefaultValue(),Q[H]=[],X[H]=!1,G[H]=!1}function _(H){for(let V of J)if(V in H)Y[V]=H[V],G[V]=!0}function j(H,V){Y[H]=V,G[H]=!0}function B(H,V=!0){if(X[H]=V,V)z(H)}function O(H){return{value:Y[H],errors:Q[H],touched:X[H],dirty:G[H],valid:Q[H].length===0,validating:K[H]}}function F(H){return async(V)=>{V?.preventDefault?.();for(let w of J)X[w]=!0;if(await W())await H(Y)}}return{values:Y,errors:Q,touched:X,dirty:G,get isValid(){return J.every((H)=>Q[H].length===0)},get isValidating(){return q||J.some((H)=>K[H])},get isDirty(){return J.some((H)=>G[H])},validate:W,validateField:z,reset:U,setValues:_,setFieldValue:j,setFieldTouched:B,getFieldState:O,handleSubmit:F}}function fZ($,Z,J){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let z=q;if(!z||!Array.isArray(z)||z.length===0)return"";return z.map((W)=>{return G.replace(/\{\{\s*message\s*\}\}/g,W)}).join(`
9042
- `)}catch{return""}})}function gZ($,Z,J){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let z=q;if(!z||!Array.isArray(z)||z.length===0)return"";return z.map((W)=>G.replace(/\{\{\s*message\s*\}\}/g,W)).join(`
9043
- `)}catch{return""}})}function hZ($,Z,J){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let z=q;if(!z||!Array.isArray(z)||z.length===0)return"";return G}catch{return""}})}function eq($,Z,J){let Y=$;return Y=fZ(Y,Z,J),Y=gZ(Y,Z,J),Y=hZ(Y,Z,J),Y}var aq;var mZ=C(()=>{aq=new c1});var lZ={};r(lZ,{processXElementDirectives:()=>$W,hasXElementDirectives:()=>pZ,generateXElementRuntime:()=>uZ});function uZ(){return`<script data-stx-scoped>
9045
+ `})}function N1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>N1(J));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let J=new Map;return $.forEach((Y,Q)=>J.set(N1(Q),N1(Y))),J}if($ instanceof Set){let J=new Set;return $.forEach((Y)=>J.add(N1(Y))),J}let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=N1($[J]);return Z}function vZ($,Z=100){let J=l1($()),Y=null,Q=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{J.value=$()},Z)};return F5($).subscribe(()=>Q()),{get value(){return J.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function xZ($,Z=100){let J=l1($()),Y=0,Q=()=>{let G=Date.now();if(G-Y>=Z)Y=G,J.value=$()};return F5($).subscribe(()=>Q()),{get value(){return J.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var p0=null,S9,L5,tq;var gZ=C(()=>{S9=[],L5=new WeakMap;tq={ref:l1,computed:F5,watch:bZ,watchMultiple:SZ,watchEffect:yZ,isRef:K1,unref:DZ,toRefs:EZ,shallowRef:kZ,debouncedComputed:vZ,throttledComputed:xZ,processComputedDirectives:CZ,processWatchDirectives:PZ}});var uZ={};r(uZ,{v:()=>eq,processHasErrorsDirective:()=>mZ,processFormValidationDirectives:()=>ZW,processErrorsDirective:()=>dZ,processErrorDirective:()=>hZ,defineForm:()=>$W,Validator:()=>c1});class c1{rules=[];defaultValue="";addRule($){let Z=new c1;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 J=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=$||J}})}max($,Z){let J=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=$||J}})}length($,Z,J){let Y=J||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:Y,validate:(Q)=>{if(!Q)return!0;let X=String(Q).length;return X>=$&&X<=Z||Y}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(J)=>{if(!J)return!0;return $.test(String(J))||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:(J)=>{if(!J&&J!==0)return!0;return!Number.isNaN(Number(J))||$}});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 J=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=$||J}})}maxValue($,Z){let J=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=$||J}})}between($,Z,J){let Y=J||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:Y,validate:(Q)=>{if(!Q&&Q!==0)return!0;let X=Number(Q);return X>=$&&X<=Z||Y}})}matches($,Z){let J=Z||`Must match ${$}`;return this.addRule({name:"matches",message:J,validate:(Y,Q)=>{if(!Q)return!0;return Y===Q[$]||J}})}oneOf($,Z){let J=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:J,validate:(Y)=>{if(!Y)return!0;return $.includes(Y)||J}})}notOneOf($,Z){let J=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:J,validate:(Y)=>{if(!Y)return!0;return!$.includes(Y)||J}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let J=new Date(String(Z));return!Number.isNaN(J.getTime())||$}})}before($,Z){let J=new Date($),Y=Z||`Must be before ${J.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<J||Y}})}after($,Z){let J=new Date($),Y=Z||`Must be after ${J.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>J||Y}})}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 J=new c1;J.rules=[...this.rules],J.defaultValue=this.defaultValue;for(let Y of Z.getRules())J.rules.push({...Y,validate:(Q,X)=>{if(!$(Q,X||{}))return!0;return Y.validate(Q,X)}});return J}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new c1;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let J=[];for(let Y of this.rules){let Q=await Y.validate($,Z);if(Q!==!0)J.push(Q)}return J}validateSync($,Z){let J=[];for(let Y of this.rules){if(Y.async)continue;let Q=Y.validate($,Z);if(Q!==!0)J.push(Q)}return J}}function $W($,Z){let J=Object.keys($),Y={},Q={},X={},G={},K={};for(let H of J)Y[H]=Z?.[H]??$[H].getDefaultValue(),Q[H]=[],X[H]=!1,G[H]=!1,K[H]=!1;let q=!1;async function z(H){K[H]=!0;let V=await $[H].validate(Y[H],Y);return Q[H]=V,K[H]=!1,V.length===0}async function W(){q=!0;let H=await Promise.all(J.map(z));return q=!1,H.every(Boolean)}function U(){for(let H of J)Y[H]=Z?.[H]??$[H].getDefaultValue(),Q[H]=[],X[H]=!1,G[H]=!1}function _(H){for(let V of J)if(V in H)Y[V]=H[V],G[V]=!0}function j(H,V){Y[H]=V,G[H]=!0}function B(H,V=!0){if(X[H]=V,V)z(H)}function O(H){return{value:Y[H],errors:Q[H],touched:X[H],dirty:G[H],valid:Q[H].length===0,validating:K[H]}}function F(H){return async(V)=>{V?.preventDefault?.();for(let w of J)X[w]=!0;if(await W())await H(Y)}}return{values:Y,errors:Q,touched:X,dirty:G,get isValid(){return J.every((H)=>Q[H].length===0)},get isValidating(){return q||J.some((H)=>K[H])},get isDirty(){return J.some((H)=>G[H])},validate:W,validateField:z,reset:U,setValues:_,setFieldValue:j,setFieldTouched:B,getFieldState:O,handleSubmit:F}}function hZ($,Z,J){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let z=q;if(!z||!Array.isArray(z)||z.length===0)return"";return z.map((W)=>{return G.replace(/\{\{\s*message\s*\}\}/g,W)}).join(`
9046
+ `)}catch{return""}})}function dZ($,Z,J){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let z=q;if(!z||!Array.isArray(z)||z.length===0)return"";return z.map((W)=>G.replace(/\{\{\s*message\s*\}\}/g,W)).join(`
9047
+ `)}catch{return""}})}function mZ($,Z,J){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(Y,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let z=q;if(!z||!Array.isArray(z)||z.length===0)return"";return G}catch{return""}})}function ZW($,Z,J){let Y=$;return Y=hZ(Y,Z,J),Y=dZ(Y,Z,J),Y=mZ(Y,Z,J),Y}var eq;var pZ=C(()=>{eq=new c1});var iZ={};r(iZ,{processXElementDirectives:()=>YW,hasXElementDirectives:()=>cZ,generateXElementRuntime:()=>lZ});function lZ(){return`<script data-stx-scoped>
9044
9048
  (function() {
9045
9049
  'use strict';
9046
9050
 
@@ -9324,9 +9328,9 @@ else {
9324
9328
  // Expose for manual initialization
9325
9329
  window.XElement = XElement;
9326
9330
  })();
9327
- </script>`}function pZ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function $W($){if(!pZ($))return $;let Z=uZ(),J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+`
9331
+ </script>`}function cZ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function YW($){if(!cZ($))return $;let Z=lZ(),J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+`
9328
9332
  `+$.slice(J);return $+`
9329
- `+Z}var cZ=()=>{};function X7($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var iZ=C(()=>{cZ()});var nZ={};r(nZ,{injectPwaTags:()=>ZW,generateThemeColorMeta:()=>XW,generateSwRegistrationScript:()=>YW,generatePwaTags:()=>y9,generateManifestLink:()=>JW});function y9($){let Z=$.pwa;if(!Z?.enabled)return"";let J=Z.manifest,Y=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=X7($),X=`
9333
+ `+Z}var nZ=()=>{};function X7($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var oZ=C(()=>{nZ()});var sZ={};r(sZ,{injectPwaTags:()=>JW,generateThemeColorMeta:()=>GW,generateSwRegistrationScript:()=>XW,generatePwaTags:()=>y9,generateManifestLink:()=>QW});function y9($){let Z=$.pwa;if(!Z?.enabled)return"";let J=Z.manifest,Y=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=X7($),X=`
9330
9334
  <!-- stx PWA Meta Tags -->
9331
9335
  <link rel="manifest" href="/manifest.json">
9332
9336
  <meta name="theme-color" content="${Q7(J?.themeColor||"#000000")}">
@@ -9370,9 +9374,9 @@ if ('serviceWorker' in navigator) {
9370
9374
  });
9371
9375
  }
9372
9376
  </script>
9373
- <!-- End stx PWA -->`,X}function ZW($,Z){let J=Z.pwa;if(!J?.enabled||J.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let X=y9(Z);return $.slice(0,Q)+X+`
9377
+ <!-- End stx PWA -->`,X}function JW($,Z){let J=Z.pwa;if(!J?.enabled||J.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let X=y9(Z);return $.slice(0,Q)+X+`
9374
9378
  `+$.slice(Q)}return $+y9(Z)}let Y=y9(Z);return $.replace("</head>",`${Y}
9375
- </head>`)}function YW($){if(!$.pwa?.enabled)return"";return`<script>
9379
+ </head>`)}function XW($){if(!$.pwa?.enabled)return"";return`<script>
9376
9380
  if ('serviceWorker' in navigator) {
9377
9381
  window.addEventListener('load', function() {
9378
9382
  navigator.serviceWorker.register('/${X7($)}')
@@ -9384,70 +9388,70 @@ if ('serviceWorker' in navigator) {
9384
9388
  });
9385
9389
  });
9386
9390
  }
9387
- </script>`}function JW(){return'<link rel="manifest" href="/manifest.json">'}function XW($){return`<meta name="theme-color" content="${Q7($)}">`}function Q7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var oZ=C(()=>{iZ()});import E0 from"path";function QW($,Z){let J=$.length,Y=Z,Q=!0,X=[],G=(K)=>K+9<=J&&$[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(Y<J){let K=$[Y];if(G(Y))return Y;if(K==="/"&&$[Y+1]==="/"){if(Y=$.indexOf(`
9391
+ </script>`}function QW(){return'<link rel="manifest" href="/manifest.json">'}function GW($){return`<meta name="theme-color" content="${Q7($)}">`}function Q7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var rZ=C(()=>{oZ()});import E0 from"path";function KW($,Z){let J=$.length,Y=Z,Q=!0,X=[],G=(K)=>K+9<=J&&$[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(Y<J){let K=$[Y];if(G(Y))return Y;if(K==="/"&&$[Y+1]==="/"){if(Y=$.indexOf(`
9388
9392
  `,Y+2),Y===-1)return-1;Y+=1,Q=!0;continue}if(K==="/"&&$[Y+1]==="*"){let q=$.indexOf("*/",Y+2);if(q===-1)return-1;Y=q+2,Q=!0;continue}if(K==="/"&&Q){let q=Y+1,z=!1;while(q<J){let W=$[q];if(W==="\\"){q+=2;continue}if(W==="[")z=!0;else if(W==="]")z=!1;else if(W==="/"&&!z){q++;break}else if(W===`
9389
9393
  `){q=-1;break}q++}if(q===-1){Y++,Q=!1;continue}while(q<J&&/[a-z]/.test($[q]))q++;Y=q,Q=!1;continue}if(K==="'"||K==='"'){let q=K;Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]===q){Y++;break}if($[Y]===`
9390
- `)break;Y++}Q=!1;continue}if(K==="`"){Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;break}if($[Y]==="$"&&$[Y+1]==="{"){X.push(!0),Y+=2,Q=!0;break}Y++}if(X.length===0)Q=!1;continue}if(K==="}"&&X.length>0){X.pop(),Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++,Q=!1;break}if($[Y]==="$"&&$[Y+1]==="{"){X.push(!0),Y+=2,Q=!0;break}Y++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;Y++}return-1}async function $1($,Z,J,Y,Q){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return $;let X=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;try{return await g7.timeAsync("template-processing",async()=>{let G=await GW($,Z,J,Y,Q);if(X)G=t4(G);if(X&&Y.autoShell&&Y.buildMode!=="compile"){let K=Y.app?.head||{},z=(Z.__stx_runtime_head||null)??t1(),W={...K,...z.title&&{title:z.title},meta:[...K.meta||[],...z.meta||[]],link:[...K.link||[],...z.link||[]],script:[...K.script||[],...z.script||[]],...z.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...z.htmlAttrs}},...z.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...z.bodyAttrs}}};G=Y8(G,W);let U=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(U&&G.includes("<head")){let j=U[1];G=G.replace("<head>",`<head>
9391
- <meta name="stx-layout" content="${j}">`)}let _=G.match(/function (__stx_setup_\d+_\d+)\(/);if(_&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${_[1]}">`);let j=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${_[1]}"`,"i");G=G.replace(j,"$1")}}if(X)try{let{getStoreScript:K}=await Promise.resolve().then(() => (d8(),h8)),q=Y.storesDir,z=await K(q);if(z){let W=`<script data-stx-stores>${z}</script>`,U=G.indexOf("<script data-stx-scoped>");if(U!==-1){let _=G.indexOf("</script>",U+24);if(_!==-1){let j=_+9;G=G.slice(0,j)+`
9392
- `+W+G.slice(j)}}}}catch{}if(X&&Z.__stx_inject_css!==!1)G=await K5(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Z9)throw G;let K=G instanceof Error?G.message:String(G),q=new H1(`Template processing failed: ${K}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(v0.log(q,{filePath:J,context:Z}),x$.logDetailedError(q,{filePath:J,template:$.substring(0,500)}),Y.debug)throw q;return P$.createFallbackContent("Template Processing",q)}}async function GW($,Z,J,Y,Q){let X=process.cwd(),G={...Y,partialsDir:Y.partialsDir&&!E0.isAbsolute(Y.partialsDir)?E0.resolve(X,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!E0.isAbsolute(Y.componentsDir)?E0.resolve(X,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!E0.isAbsolute(Y.layoutsDir)?E0.resolve(X,Y.layoutsDir):Y.layoutsDir},K=G,q=$;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let z="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,z),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,F)=>{return`{{ ${F} }}`}),q=t2(q),q=await v8(q,J,Q);let W={};q=z4(q,W);let U={...Z.__sections||{}},_="",j=/@nolayout\b/.test(q);if(j)q=q.replace(/@nolayout\b\s*/g,"");let B=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B)_=B[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!_&&!j&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),F=/@section\s*\(/.test(q);if(!O||F){let L="",H=E0.dirname(J),V=K.layoutsDir?E0.dirname(K.layoutsDir):process.cwd();for(let A=0;A<20;A++){let w=E0.join(H,"_layout.stx");if(await c(w)){L=w;break}let N=E0.dirname(H);if(N===H||N.length<V.length)break;H=N}if(L)_=L;else if(K.layoutsDir){let A=E0.isAbsolute(K.layoutsDir)?K.layoutsDir:E0.resolve(process.cwd(),K.layoutsDir),w=E0.join(A,`${K.defaultLayout}.stx`);if(await c(w))_=w}if(_&&!F)q=`@section('content')
9394
+ `)break;Y++}Q=!1;continue}if(K==="`"){Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;break}if($[Y]==="$"&&$[Y+1]==="{"){X.push(!0),Y+=2,Q=!0;break}Y++}if(X.length===0)Q=!1;continue}if(K==="}"&&X.length>0){X.pop(),Y++;while(Y<J){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++,Q=!1;break}if($[Y]==="$"&&$[Y+1]==="{"){X.push(!0),Y+=2,Q=!0;break}Y++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;Y++}return-1}async function $1($,Z,J,Y,Q){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return $;let X=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;try{return await g7.timeAsync("template-processing",async()=>{let G=await qW($,Z,J,Y,Q);if(X)G=t4(G);if(X&&Y.autoShell&&Y.buildMode!=="compile"){let K=Y.app?.head||{},z=(Z.__stx_runtime_head||null)??t1(),W={...K,...z.title&&{title:z.title},meta:[...K.meta||[],...z.meta||[]],link:[...K.link||[],...z.link||[]],script:[...K.script||[],...z.script||[]],...z.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...z.htmlAttrs}},...z.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...z.bodyAttrs}}};G=X8(G,W);let U=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(U&&G.includes("<head")){let j=U[1];G=G.replace("<head>",`<head>
9395
+ <meta name="stx-layout" content="${j}">`)}let _=G.match(/function (__stx_setup_\d+_\d+)\(/);if(_&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${_[1]}">`);let j=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${_[1]}"`,"i");G=G.replace(j,"$1")}}if(X)try{let{getStoreScript:K}=await Promise.resolve().then(() => (u8(),m8)),q=Y.storesDir,z=await K(q);if(z){let W=`<script data-stx-stores>${z}</script>`,U=G.indexOf("<script data-stx-scoped>");if(U!==-1){let _=G.indexOf("</script>",U+24);if(_!==-1){let j=_+9;G=G.slice(0,j)+`
9396
+ `+W+G.slice(j)}}}}catch{}if(X&&Z.__stx_inject_css!==!1)G=await K5(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Z9)throw G;let K=G instanceof Error?G.message:String(G),q=new H1(`Template processing failed: ${K}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(x0.log(q,{filePath:J,context:Z}),x$.logDetailedError(q,{filePath:J,template:$.substring(0,500)}),Y.debug)throw q;return P$.createFallbackContent("Template Processing",q)}}async function qW($,Z,J,Y,Q){let X=process.cwd(),G={...Y,partialsDir:Y.partialsDir&&!E0.isAbsolute(Y.partialsDir)?E0.resolve(X,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!E0.isAbsolute(Y.componentsDir)?E0.resolve(X,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!E0.isAbsolute(Y.layoutsDir)?E0.resolve(X,Y.layoutsDir):Y.layoutsDir},K=G,q=$;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let z="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,z),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,F)=>{return`{{ ${F} }}`}),q=$8(q),q=await f8(q,J,Q);let W={};q=z4(q,W);let U={...Z.__sections||{}},_="",j=/@nolayout\b/.test(q);if(j)q=q.replace(/@nolayout\b\s*/g,"");let B=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B)_=B[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!_&&!j&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),F=/@section\s*\(/.test(q);if(!O||F){let L="",H=E0.dirname(J),V=K.layoutsDir?E0.dirname(K.layoutsDir):process.cwd();for(let A=0;A<20;A++){let w=E0.join(H,"_layout.stx");if(await l(w)){L=w;break}let N=E0.dirname(H);if(N===H||N.length<V.length)break;H=N}if(L)_=L;else if(K.layoutsDir){let A=E0.isAbsolute(K.layoutsDir)?K.layoutsDir:E0.resolve(process.cwd(),K.layoutsDir),w=E0.join(A,`${K.defaultLayout}.stx`);if(await l(w))_=w}if(_&&!F)q=`@section('content')
9393
9397
  ${q.trim()}
9394
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,F,L)=>{return U[F]=L,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,F,L)=>{if(L.includes("@parent"))U[F]=L.replace("@parent",R1);else U[F]=L.trim();return""}),Z.__sections=U,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,F,L)=>{return U[F]||L||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return U.content||""});if(q=U4(q,W),_)try{let O=E0.isAbsolute(_)?_:await y1(()=>t9(_,J,G,Q),null,()=>{throw new H1(`Failed to resolve layout path: ${_}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!O){let w=`Layout not found: ${_} (referenced from ${J})`;if(v0.log(Error(w),{layoutPath:_,filePath:J},"warning"),G.debug)throw new H1(w,J);return q}let F=await y1(()=>Bun.file(O).text(),"",()=>{throw new H1(`Failed to read layout file: ${O}`,J,void 0,void 0,"Layout content could not be loaded")}),L=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L){if(G.debug)console.log(`Found nested layout: ${L[1]} in ${O}`);let w={},N=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,M,E)=>{return w[M]=E.trim(),""});for(let[I,M]of Object.entries(w))if(U[I]&&U[I].includes(R1)){let E=U[I].indexOf(R1);U[I]=U[I].slice(0,E)+M+U[I].slice(E+R1.length)}else if(!U[I])U[I]=M;let R={...Z,__sections:U},T=`@layout('${L[1]}')${N}`;return await $1(T,R,O,G,Q)}let H=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),V=z4(H,W),A={};return V=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(w,N,R)=>{return A[N]=R.trim(),`@slot('${N}')`}),V=V.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,N,R)=>{if(U[N]){let T=U[N];if(T.includes(R1)){let I=A[N]||"",M=T.indexOf(R1);T=T.slice(0,M)+I+T.slice(M+R1.length)}return T}return R||""}),V=V.replace(/\{\{\s*slot\s*\}\}/g,()=>{return U.content||""}),V=U4(V,W),Z.__originalFilePath=J,q=await sZ(V,Z,O,G,Q),q=`<!-- stx-layout: ${_} -->
9395
- ${q}`,q}catch(O){return v0.log(O instanceof Error?O:Error(String(O)),{layoutPath:_,filePath:J},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return await sZ(q,Z,J,G,Q)}async function sZ($,Z,J,Y,Q){let X=$;Z.__stx_sfc_mode=!0;let G=Y;if(await y1(()=>i2(J,Z),void 0,(g)=>{v0.log(g,{filePath:J,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${J}: ${g.message}`)}),Z.__stx_options=G,G.buildMode)Z.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",q={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(K)&&n!==void 0)q[g]=n;Z.$env=q,X=await y1(()=>m2(X,Z,J,G),X,(g)=>{v0.log(g,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${g.message}`)});let z=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,W;while((W=z.exec(X))!==null){let g=W[1],n=W[2];if(/\bserver\b/.test(g)&&n.trim())try{let{extractVariables:Z0}=await Promise.resolve().then(() => ($5(),D5));await Z0(n,Z,J)}catch(Z0){let z0=Z0 instanceof Error?Z0:Error(String(Z0));v0.log(z0,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${z0.message}`)}}try{let{interpolateScriptsInTemplate:g}=await Promise.resolve().then(() => (t0(),v7));X=g(X,Z,{skipServer:!0})}catch(g){let n=g instanceof Error?g:Error(String(g));v0.log(n,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${n.message}`)}if(X=await v2(X,Z,J),X=await x2(X,Z,J),X=await _2(X,Z,J,G),R5(X))X=D4(X),X=E4(X,Z);X=G4(X,Z,J,G),X=await s4(X,Z,J,G,Q),X=await $8(X,Z,J,G,Q),X=O7(X,Z,J,G);let{processDeferDirectives:U}=await Promise.resolve().then(() => u8);X=U(X,Z,J);let{processTeleportDirectives:_}=await Promise.resolve().then(() => l8);X=_(X,Z,J);let{processTransitionDirectives:j,processTransitionAttributes:B}=await Promise.resolve().then(() => o8);X=j(X,Z,J),X=B(X);let{processErrorBoundaryDirectives:O}=await Promise.resolve().then(() => r8);X=O(X,Z,J);let{processSuspenseDirectives:F}=await Promise.resolve().then(() => a8);X=F(X,Z,J);let{processAsyncDirectives:L}=await Promise.resolve().then(() => ZZ);X=L(X,Z,J);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => JZ);X=H(X,Z,J);let{processVirtualListDirectives:V,processVirtualGridDirectives:A,processInfiniteListDirectives:w}=await Promise.resolve().then(() => (WZ(),qZ));X=V(X,Z,J),X=A(X,Z,J),X=w(X,Z,J);let{processPartialHydrationDirectives:N,processStaticDirectives:R}=await Promise.resolve().then(() => (TZ(),RZ));X=N(X,Z,J),X=R(X);let{processComputedDirectives:T,processWatchDirectives:I}=await Promise.resolve().then(() => (xZ(),vZ));X=T(X,Z,J),X=I(X,Z,J);let{processFormValidationDirectives:M}=await Promise.resolve().then(() => (mZ(),dZ));X=M(X,Z,J);let{processHeadDirective:E,processTitleDirective:k,processMetaDirective:y,resetHead:S}=await Promise.resolve().then(() => (e1(),n9));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)S();let b=E(X);if(X=b.content,X=k(X,Z),X=y(X,Z),X=l2(X),X=a$(X,Z),X=z2(X),X=h2(X),X=await W4(X,Z,J,G,Q),X=await s4(X,Z,J,G,Q),X=t4(X),X=V1(X,Z,J),X=t$(X,Z),X=e$(X,Z),X=B9(X,Z),X=L2(X,Z),X=F2(X,Z),X=await r6(X,Z,J,G),X=await G3(X,Z,J),X=await M2(X,Z,J,G),X=q7(X,Z,J,G),X=j6(X,Z,J,G),X=O6(X,Z,J),X=H6(X,Z,J,G),X=K2(X,Z,J,G),X=r4(X,Z),X=a4(X),X=f8(X),!G.skipEventDirectives)X=c6(X,Z,J);if(X=s6(X,Z,J),G.debug){let g=/\bx-data\s*=/.test(X),n=M9($);if(g&&n)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
9398
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,F,L)=>{return U[F]=L,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,F,L)=>{if(L.includes("@parent"))U[F]=L.replace("@parent",R1);else U[F]=L.trim();return""}),Z.__sections=U,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,F,L)=>{return U[F]||L||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return U.content||""});if(q=U4(q,W),_)try{let O=E0.isAbsolute(_)?_:await y1(()=>t9(_,J,G,Q),null,()=>{throw new H1(`Failed to resolve layout path: ${_}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!O){let w=`Layout not found: ${_} (referenced from ${J})`;if(x0.log(Error(w),{layoutPath:_,filePath:J},"warning"),G.debug)throw new H1(w,J);return q}let F=await y1(()=>Bun.file(O).text(),"",()=>{throw new H1(`Failed to read layout file: ${O}`,J,void 0,void 0,"Layout content could not be loaded")}),L=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L){if(G.debug)console.log(`Found nested layout: ${L[1]} in ${O}`);let w={},N=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,M,E)=>{return w[M]=E.trim(),""});for(let[I,M]of Object.entries(w))if(U[I]&&U[I].includes(R1)){let E=U[I].indexOf(R1);U[I]=U[I].slice(0,E)+M+U[I].slice(E+R1.length)}else if(!U[I])U[I]=M;let R={...Z,__sections:U},T=`@layout('${L[1]}')${N}`;return await $1(T,R,O,G,Q)}let H=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),V=z4(H,W),A={};return V=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(w,N,R)=>{return A[N]=R.trim(),`@slot('${N}')`}),V=V.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,N,R)=>{if(U[N]){let T=U[N];if(T.includes(R1)){let I=A[N]||"",M=T.indexOf(R1);T=T.slice(0,M)+I+T.slice(M+R1.length)}return T}return R||""}),V=V.replace(/\{\{\s*slot\s*\}\}/g,()=>{return U.content||""}),V=U4(V,W),Z.__originalFilePath=J,q=await aZ(V,Z,O,G,Q),q=`<!-- stx-layout: ${_} -->
9399
+ ${q}`,q}catch(O){return x0.log(O instanceof Error?O:Error(String(O)),{layoutPath:_,filePath:J},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return await aZ(q,Z,J,G,Q)}async function aZ($,Z,J,Y,Q){let X=$;Z.__stx_sfc_mode=!0;let G=Y;if(await y1(()=>o2(J,Z),void 0,(g)=>{x0.log(g,{filePath:J,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${J}: ${g.message}`)}),Z.__stx_options=G,G.buildMode)Z.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",q={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(K)&&n!==void 0)q[g]=n;Z.$env=q,X=await y1(()=>p2(X,Z,J,G),X,(g)=>{x0.log(g,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${g.message}`)});let z=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,W;while((W=z.exec(X))!==null){let g=W[1],n=W[2];if(/\bserver\b/.test(g)&&n.trim())try{let{extractVariables:Z0}=await Promise.resolve().then(() => ($5(),D5));await Z0(n,Z,J)}catch(Z0){let z0=Z0 instanceof Error?Z0:Error(String(Z0));x0.log(z0,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${z0.message}`)}}try{let{interpolateScriptsInTemplate:g}=await Promise.resolve().then(() => (n0(),v7));X=g(X,Z,{skipServer:!0})}catch(g){let n=g instanceof Error?g:Error(String(g));x0.log(n,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${n.message}`)}if(X=await f2(X,Z,J),X=await g2(X,Z,J),X=await j2(X,Z,J,G),R5(X))X=D4(X),X=E4(X,Z);X=G4(X,Z,J,G),X=await s4(X,Z,J,G,Q),X=await Y8(X,Z,J,G,Q),X=O7(X,Z,J,G);let{processDeferDirectives:U}=await Promise.resolve().then(() => l8);X=U(X,Z,J);let{processTeleportDirectives:_}=await Promise.resolve().then(() => i8);X=_(X,Z,J);let{processTransitionDirectives:j,processTransitionAttributes:B}=await Promise.resolve().then(() => r8);X=j(X,Z,J),X=B(X);let{processErrorBoundaryDirectives:O}=await Promise.resolve().then(() => t8);X=O(X,Z,J);let{processSuspenseDirectives:F}=await Promise.resolve().then(() => e8);X=F(X,Z,J);let{processAsyncDirectives:L}=await Promise.resolve().then(() => JZ);X=L(X,Z,J);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => QZ);X=H(X,Z,J);let{processVirtualListDirectives:V,processVirtualGridDirectives:A,processInfiniteListDirectives:w}=await Promise.resolve().then(() => (UZ(),zZ));X=V(X,Z,J),X=A(X,Z,J),X=w(X,Z,J);let{processPartialHydrationDirectives:N,processStaticDirectives:R}=await Promise.resolve().then(() => (IZ(),MZ));X=N(X,Z,J),X=R(X);let{processComputedDirectives:T,processWatchDirectives:I}=await Promise.resolve().then(() => (gZ(),fZ));X=T(X,Z,J),X=I(X,Z,J);let{processFormValidationDirectives:M}=await Promise.resolve().then(() => (pZ(),uZ));X=M(X,Z,J);let{processHeadDirective:E,processTitleDirective:k,processMetaDirective:y,resetHead:S}=await Promise.resolve().then(() => (e1(),n9));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)S();let b=E(X);if(X=b.content,X=k(X,Z),X=y(X,Z),X=i2(X),X=a$(X,Z),X=_2(X),X=m2(X),X=await W4(X,Z,J,G,Q),X=await s4(X,Z,J,G,Q),X=t4(X),X=V1(X,Z,J),X=t$(X,Z),X=e$(X,Z),X=B9(X,Z),X=V2(X,Z),X=w2(X,Z),X=await t6(X,Z,J,G),X=await G3(X,Z,J),X=await D2(X,Z,J,G),X=q7(X,Z,J,G),X=j6(X,Z,J,G),X=O6(X,Z,J),X=H6(X,Z,J,G),X=W2(X,Z,J,G),X=r4(X,Z),X=a4(X),X=h8(X),!G.skipEventDirectives)X=c6(X,Z,J);if(X=r6(X,Z,J),G.debug){let g=/\bx-data\s*=/.test(X),n=M9($);if(g&&n)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
9396
9400
  Both work on the same page, but they manage separate scopes.
9397
- Prefer signals (state/derived/effect) for new components.`)}X=s2(X,Z),X=await a0(X,Z,J),X=g8(X),X=x6(X);let{processXElementDirectives:D}=await Promise.resolve().then(() => lZ);X=D(X);let x=Z.__originalFilePath||J;if(X=await k4(X,G,x),X=await u2(X,Z,J,G),G.seo?.enabled)X=L6(X,Z,G);let{renderHead:h,getHead:i}=await Promise.resolve().then(() => (e1(),n9)),U0=Z.__stx_runtime_head,H0=U0&&(U0.title||U0.meta?.length||U0.link?.length)?U0:i();if(H0.title||H0.meta?.length||H0.link?.length){let g=h(H0);if(g){if(X.includes("</head>"))X=X.replace("</head>",`${g}
9401
+ Prefer signals (state/derived/effect) for new components.`)}X=a2(X,Z),X=await t0(X,Z,J),X=d8(X),X=x6(X);let{processXElementDirectives:D}=await Promise.resolve().then(() => iZ);X=D(X);let x=Z.__originalFilePath||J;if(X=await k4(X,G,x),X=await l2(X,Z,J,G),G.seo?.enabled)X=L6(X,Z,G);let{renderHead:h,getHead:i}=await Promise.resolve().then(() => (e1(),n9)),U0=Z.__stx_runtime_head,H0=U0&&(U0.title||U0.meta?.length||U0.link?.length)?U0:i();if(H0.title||H0.meta?.length||H0.link?.length){let g=h(H0);if(g){if(X.includes("</head>"))X=X.replace("</head>",`${g}
9398
9402
  </head>`);else if(X.includes("<head>"))X=X.replace("<head>",`<head>
9399
9403
  ${g}`)}}if(b.headContent){if(X.includes("</head>"))X=X.replace("</head>",`${b.headContent}
9400
9404
  </head>`);else if(X.includes("<head>"))X=X.replace("<head>",`<head>
9401
- ${b.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)X=G2(X,G.csp,Z);if(G.analytics?.enabled)X=g6(X,G);if(G.heatmap?.enabled)X=w7(X,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:g}=await Promise.resolve().then(() => (oZ(),nZ));X=g(X,G)}let _0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),C0=/\bSTX\.\w+/.test(X),p0=/window\.STX\s*=/.test(X);if(_0&&C0&&!p0){let n=`<script data-stx-scoped>
9405
+ ${b.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)X=q2(X,G.csp,Z);if(G.analytics?.enabled)X=g6(X,G);if(G.heatmap?.enabled)X=w7(X,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:g}=await Promise.resolve().then(() => (rZ(),sZ));X=g(X,G)}let _0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),P0=/\bSTX\.\w+/.test(X),l0=/window\.STX\s*=/.test(X);if(_0&&P0&&!l0){let n=`<script data-stx-scoped>
9402
9406
  ${y6()}
9403
- </script>`;if(X.includes("</head>")){let G0=X.indexOf("</head>"),z0=X.slice(0,G0).indexOf("<script");if(z0!==-1){let k0=X.slice(0,z0),o0=X.slice(z0);X=k0+n+`
9404
- `+o0}else X=X.replace("</head>",`${n}
9407
+ </script>`;if(X.includes("</head>")){let G0=X.indexOf("</head>"),z0=X.slice(0,G0).indexOf("<script");if(z0!==-1){let k0=X.slice(0,z0),s0=X.slice(z0);X=k0+n+`
9408
+ `+s0}else X=X.replace("</head>",`${n}
9405
9409
  </head>`)}else if(X.includes("<body"))X=X.replace(/<body([^>]*)>/,`<body$1>
9406
9410
  ${n}`);else X=n+`
9407
- `+X}{let g=/<script\s+server\b[^>]*>/gi,n,G0=[];while((n=g.exec(X))!==null){let Z0=n.index+n[0].length,z0=QW(X,Z0);if(z0===-1)continue;let k0=z0+9;while(k0<X.length&&/\s/.test(X[k0]))k0++;G0.push({start:n.index,end:k0})}for(let Z0=G0.length-1;Z0>=0;Z0--){let{start:z0,end:k0}=G0[Z0];X=X.substring(0,z0)+X.substring(k0)}}let L0=T5(X,J);if(L0.hasScoped)X=L0.html;let P=Z.__stx_event_bindings||[],v=!1,f=[],l=/\s:[a-z][\w.-]*\s*=/.test(X),{scanScriptTags:q0}=await Promise.resolve().then(() => (b4(),B8));for(let g of q0(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))f.push({match:g.fullMatch,attrs:g.attrs,content:g.body});for(let{match:g,attrs:n,content:G0}of f){v=!0;let Z0=G0;$7(G0,J,Y.strict);let z0=await w5(G0,{eventBindings:P,attrs:n,hasColonDirectives:l,templateContent:$,filePath:J,projectRoot:process.cwd(),production:Y.buildMode==="compile"});X=X.replace(g,()=>z0)}if(v)Z.__stx_event_bindings=[];return X}var R1="<!--PARENT_CONTENT_PLACEHOLDER-->";var e9=C(()=>{G9();v9();C6();f6();h6();g9();x9();i6();m9();a6();z9();q2();U2();j2();n0();e1();t0();V2();I2();P2();g2();K4();$$();p2();E1();c2();f$();A0();n2();r2();e2();Z8();i9();b4();y8();x8();e4();Z7();e4();Z7()});import O0 from"fs";import $0 from"path";import{matchRoute as TW,Router as WY}from"stx-router";import{findErrorPage as DW,formatRoutes as EW,generateRouteManifest as kW,generateRouteTypes as bW,matchRoute as SW}from"stx-router";function P9($,Z={}){return new WY($,Z).routes}e9();Q5();G9();import{abortNavigation as lH,clearMiddleware as rZ,createClientCookieManager as cH,createMiddlewareContext as aZ,createRouteLocation as tZ,createServerCookieManager as iH,createStorageManager as nH,defineMiddleware as oH,getMiddleware as sH,getMiddlewareNames as eZ,hasMiddleware as rH,loadMiddlewareFromDirectory as $Y,navigateTo as aH,registerMiddleware as tH,runMiddleware as ZY}from"stx-router";class YY{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=$0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[J,Y]of Object.entries(Z))this.cache.set(J,Y)}catch{}this.loaded=!0}async save(){await O0.promises.mkdir(this.cacheDir,{recursive:!0});let $=$0.join(this.cacheDir,"build-cache.json"),Z={};for(let[J,Y]of this.cache)Z[J]=Y;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let J=O0.statSync($),Y=`${$}:${J.mtimeMs}`;for(let X of Z)if(O0.existsSync(X)){let G=O0.statSync(X);Y+=`:${X}:${G.mtimeMs}`}let Q=0;for(let X=0;X<Y.length;X++){let G=Y.charCodeAt(X);Q=(Q<<5)-Q+G,Q=Q&Q}return Math.abs(Q).toString(36)}get($,Z,J){let Y=this.cache.get($);if(!Y)return null;let Q=this.getHash(Z,J);if(Y.hash!==Q)return this.cache.delete($),null;return Y.html}set($,Z,J,Y){let Q=this.getHash(Z,J);this.cache.set($,{hash:Q,html:Y,generatedAt:Date.now(),dependencies:J})}}class JY{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return $0.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 J=this.getFilePath($);await O0.promises.mkdir($0.dirname(J),{recursive:!0}),await Bun.write(J,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await O0.promises.unlink(Z)}async invalidatePattern($){let Z=$0.join(this.cacheDir,"isr");if(!O0.existsSync(Z))return;let J=await O0.promises.readdir(Z);for(let Y of J){let Q=Y.replace(/_/g,"/").replace(".json","");if($.test(Q))await O0.promises.unlink($0.join(Z,Y))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function KW($){try{let J=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let Y=J[1];if(!Y.includes("getStaticPaths"))return null;let Q=Y.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!Q)return null;return await Function(`
9411
+ `+X}{let g=/<script\s+server\b[^>]*>/gi,n,G0=[];while((n=g.exec(X))!==null){let Z0=n.index+n[0].length,z0=KW(X,Z0);if(z0===-1)continue;let k0=z0+9;while(k0<X.length&&/\s/.test(X[k0]))k0++;G0.push({start:n.index,end:k0})}for(let Z0=G0.length-1;Z0>=0;Z0--){let{start:z0,end:k0}=G0[Z0];X=X.substring(0,z0)+X.substring(k0)}}let L0=T5(X,J);if(L0.hasScoped)X=L0.html;let P=Z.__stx_event_bindings||[],v=!1,f=[],p=/\s:[a-z][\w.-]*\s*=/.test(X),{scanScriptTags:q0}=await Promise.resolve().then(() => (b4(),O8));for(let g of q0(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))f.push({match:g.fullMatch,attrs:g.attrs,content:g.body});for(let{match:g,attrs:n,content:G0}of f){v=!0;let Z0=G0;$7(G0,J,Y.strict);let z0=await w5(G0,{eventBindings:P,attrs:n,hasColonDirectives:p,templateContent:$,filePath:J,projectRoot:process.cwd(),production:Y.buildMode==="compile"});X=X.replace(g,()=>z0)}if(v)Z.__stx_event_bindings=[];return X}var R1="<!--PARENT_CONTENT_PLACEHOLDER-->";var e9=C(()=>{G9();v9();C6();f6();h6();g9();x9();i6();m9();a6();e6();z9();z2();B2();H2();o0();e1();n0();A2();E2();x2();d2();K4();$$();c2();E1();n2();f$();A0();s2();t2();Z8();J8();i9();b4();P8();g8();e4();Z7();e4();Z7()});import O0 from"fs";import $0 from"path";import{matchRoute as IW,Router as UY}from"stx-router";import{findErrorPage as kW,formatRoutes as bW,generateRouteManifest as SW,generateRouteTypes as yW,matchRoute as CW}from"stx-router";function P9($,Z={}){return new UY($,Z).routes}e9();Q5();G9();import{abortNavigation as nH,clearMiddleware as tZ,createClientCookieManager as oH,createMiddlewareContext as eZ,createRouteLocation as $Y,createServerCookieManager as sH,createStorageManager as rH,defineMiddleware as aH,getMiddleware as tH,getMiddlewareNames as ZY,hasMiddleware as eH,loadMiddlewareFromDirectory as YY,navigateTo as $L,registerMiddleware as ZL,runMiddleware as JY}from"stx-router";class XY{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=$0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[J,Y]of Object.entries(Z))this.cache.set(J,Y)}catch{}this.loaded=!0}async save(){await O0.promises.mkdir(this.cacheDir,{recursive:!0});let $=$0.join(this.cacheDir,"build-cache.json"),Z={};for(let[J,Y]of this.cache)Z[J]=Y;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let J=O0.statSync($),Y=`${$}:${J.mtimeMs}`;for(let X of Z)if(O0.existsSync(X)){let G=O0.statSync(X);Y+=`:${X}:${G.mtimeMs}`}let Q=0;for(let X=0;X<Y.length;X++){let G=Y.charCodeAt(X);Q=(Q<<5)-Q+G,Q=Q&Q}return Math.abs(Q).toString(36)}get($,Z,J){let Y=this.cache.get($);if(!Y)return null;let Q=this.getHash(Z,J);if(Y.hash!==Q)return this.cache.delete($),null;return Y.html}set($,Z,J,Y){let Q=this.getHash(Z,J);this.cache.set($,{hash:Q,html:Y,generatedAt:Date.now(),dependencies:J})}}class QY{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return $0.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 J=this.getFilePath($);await O0.promises.mkdir($0.dirname(J),{recursive:!0}),await Bun.write(J,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await O0.promises.unlink(Z)}async invalidatePattern($){let Z=$0.join(this.cacheDir,"isr");if(!O0.existsSync(Z))return;let J=await O0.promises.readdir(Z);for(let Y of J){let Q=Y.replace(/_/g,"/").replace(".json","");if($.test(Q))await O0.promises.unlink($0.join(Z,Y))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function WW($){try{let J=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let Y=J[1];if(!Y.includes("getStaticPaths"))return null;let Q=Y.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!Q)return null;return await Function(`
9408
9412
  return (async function getStaticPaths() {
9409
9413
  ${Q[1]}
9410
9414
  })()
9411
- `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function qW($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let J=await KW($.filePath);if(!J||J.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let Y of J.paths){let Q=$.pattern;for(let[X,G]of Object.entries(Y.params))Q=Q.replace(`:${X}`,G).replace(`:${X}*`,G);Z.push({url:Q,params:Y.params,props:Y.props,revalidate:Y.revalidate})}}return Z}async function WW($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let J of Z)if(await Bun.file(J).exists())try{let Y=await import(J);if(typeof Y.default==="function")return await Y.default();else if(typeof Y.default==="object")return Y.default;else if(typeof Y.getData==="function")return await Y.getData();else{let{default:Q,...X}=Y;return X}}catch(Y){console.error(`Error loading data file ${J}:`,Y)}return null}async function zW($,Z,J){let Y=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let Q=Y[1];if(!Q.includes("getStaticProps"))return null;try{let X=Q.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!X)return null;return await Function("params",`
9415
+ `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function zW($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let J=await WW($.filePath);if(!J||J.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let Y of J.paths){let Q=$.pattern;for(let[X,G]of Object.entries(Y.params))Q=Q.replace(`:${X}`,G).replace(`:${X}*`,G);Z.push({url:Q,params:Y.params,props:Y.props,revalidate:Y.revalidate})}}return Z}async function UW($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let J of Z)if(await Bun.file(J).exists())try{let Y=await import(J);if(typeof Y.default==="function")return await Y.default();else if(typeof Y.default==="object")return Y.default;else if(typeof Y.getData==="function")return await Y.getData();else{let{default:Q,...X}=Y;return X}}catch(Y){console.error(`Error loading data file ${J}:`,Y)}return null}async function _W($,Z,J){let Y=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let Q=Y[1];if(!Q.includes("getStaticProps"))return null;try{let X=Q.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!X)return null;return await Function("params",`
9412
9416
  return (async function getStaticProps() {
9413
9417
  ${X[1]}
9414
9418
  })()
9415
- `)(Z)}catch(X){return console.error(`Error executing getStaticProps in ${J}:`,X),null}}async function XY($,Z,J={},Y,Q){let X=await Bun.file($.filePath).text(),G=await WW($.filePath),K=await zW(X,Z,$.filePath),q={...G||{},...K||{},...J,params:Z,$route:{path:$.pattern,params:Z}},z=new Set,W={...Q,debug:!1,cache:!1,autoShell:!0},U=await $1(X,q,$.filePath,W,z);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>",`${_}
9419
+ `)(Z)}catch(X){return console.error(`Error executing getStaticProps in ${J}:`,X),null}}async function GY($,Z,J={},Y,Q){let X=await Bun.file($.filePath).text(),G=await UW($.filePath),K=await _W(X,Z,$.filePath),q={...G||{},...K||{},...J,params:Z,$route:{path:$.pattern,params:Z}},z=new Set,W={...Q,debug:!1,cache:!1,autoShell:!0},U=await $1(X,q,$.filePath,W,z);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>",`${_}
9416
9420
  </head>`);else U=`${_}
9417
- ${U}`}if(U=await I4(U),U=await K5(U),Y.minify!==!1)return UW(U);return U}function UW($){let Z=[],J=0,Y=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,Q;while((Q=Y.exec($))!==null){let G=$.slice(J,Q.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=Q[1],q=Q[2],z=Q[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+q+z),J=Q.index+Q[0].length}let X=$.slice(J);return Z.push(X.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function _W($){let Z=0;for(let J=0;J<$.length;J++){let Y=$.charCodeAt(J);Z=(Z<<5)-Z+Y,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function BW($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
9421
+ ${U}`}if(U=await I4(U),U=await K5(U),Y.minify!==!1)return BW(U);return U}function BW($){let Z=[],J=0,Y=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,Q;while((Q=Y.exec($))!==null){let G=$.slice(J,Q.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=Q[1],q=Q[2],z=Q[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+q+z),J=Q.index+Q[0].length}let X=$.slice(J);return Z.push(X.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function jW($){let Z=0;for(let J=0;J<$.length;J++){let Y=$.charCodeAt(J);Z=(Z<<5)-Z+Y,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function OW($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
9418
9422
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
9419
9423
  ${$.map((Y)=>{let Q=new URL(Y.loc,Z).href,X=` <url>
9420
- <loc>${x0(Q)}</loc>`;if(Y.lastmod)X+=`
9424
+ <loc>${f0(Q)}</loc>`;if(Y.lastmod)X+=`
9421
9425
  <lastmod>${Y.lastmod}</lastmod>`;if(Y.changefreq)X+=`
9422
9426
  <changefreq>${Y.changefreq}</changefreq>`;if(Y.priority!==void 0)X+=`
9423
9427
  <priority>${Y.priority}</priority>`;return X+=`
9424
9428
  </url>`,X}).join(`
9425
9429
  `)}
9426
- </urlset>`}function x0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function jW($,Z){let J=Z.map((Y)=>{let Q=" <item>";if(Q+=`
9427
- <title>${x0(Y.title)}</title>`,Q+=`
9428
- <link>${x0(Y.link)}</link>`,Y.description)Q+=`
9429
- <description>${x0(Y.description)}</description>`;if(Y.pubDate)Q+=`
9430
+ </urlset>`}function f0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function HW($,Z){let J=Z.map((Y)=>{let Q=" <item>";if(Q+=`
9431
+ <title>${f0(Y.title)}</title>`,Q+=`
9432
+ <link>${f0(Y.link)}</link>`,Y.description)Q+=`
9433
+ <description>${f0(Y.description)}</description>`;if(Y.pubDate)Q+=`
9430
9434
  <pubDate>${Y.pubDate.toUTCString()}</pubDate>`;if(Y.author)Q+=`
9431
- <author>${x0(Y.author)}</author>`;if(Y.categories)for(let X of Y.categories)Q+=`
9432
- <category>${x0(X)}</category>`;if(Y.guid)Q+=`
9433
- <guid>${x0(Y.guid)}</guid>`;return Q+=`
9435
+ <author>${f0(Y.author)}</author>`;if(Y.categories)for(let X of Y.categories)Q+=`
9436
+ <category>${f0(X)}</category>`;if(Y.guid)Q+=`
9437
+ <guid>${f0(Y.guid)}</guid>`;return Q+=`
9434
9438
  </item>`,Q});return`<?xml version="1.0" encoding="UTF-8"?>
9435
9439
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
9436
9440
  <channel>
9437
- <title>${x0($.title)}</title>
9438
- <link>${x0($.link)}</link>
9439
- <description>${x0($.description)}</description>
9441
+ <title>${f0($.title)}</title>
9442
+ <link>${f0($.link)}</link>
9443
+ <description>${f0($.description)}</description>
9440
9444
  ${$.language?`<language>${$.language}</language>`:""}
9441
- ${$.copyright?`<copyright>${x0($.copyright)}</copyright>`:""}
9445
+ ${$.copyright?`<copyright>${f0($.copyright)}</copyright>`:""}
9442
9446
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
9443
9447
  <atom:link href="${$.link}/rss.xml" rel="self" type="application/rss+xml"/>
9444
9448
  ${J.join(`
9445
9449
  `)}
9446
9450
  </channel>
9447
- </rss>`}async function OW($={}){let Z=Date.now(),J=await L1(),Y={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||".stx/ssg-cache",contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0},Q={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]};await Y.hooks.onBuildStart?.();try{if(Y.cleanOutput&&O0.existsSync(Y.outputDir))await O0.promises.rm(Y.outputDir,{recursive:!0});await O0.promises.mkdir(Y.outputDir,{recursive:!0});let X=new YY(Y.cacheDir);if(Y.cache)await X.load();try{let{preloadIconCollection:B}=await Promise.resolve().then(() => (k9(),T8));await B("lucide")}catch{}try{let{generateCrosswindCSS:B}=await Promise.resolve().then(() => (G9(),S6));await B('<div class="bg-black"></div>')}catch{}rZ();let G=J?.routeMiddleware?.dir||"middleware";await $Y(process.cwd(),G);let K=eZ();if(K.length>0)console.log(`Loaded ${K.length} middleware: ${K.join(", ")}`);let q=J?.routeMiddleware?.global||[],z=P9(".",{pagesDir:Y.pagesDir});console.log(`Found ${z.length} routes`);let W=[];for(let B of z){let O=await qW(B);for(let F of O)W.push({route:B,url:F.url,params:F.params,props:F.props,revalidate:F.revalidate??Y.revalidate})}Q.totalPages=W.length,console.log(`Generating ${Q.totalPages} pages...`);let U=[],_=[];for(let B=0;B<W.length;B+=Y.concurrency)_.push(W.slice(B,B+Y.concurrency));for(let B of _)await Promise.all(B.map(async(O)=>{let{route:F,url:L,params:H,props:V,revalidate:A}=O;try{await Y.hooks.onPageStart?.(L);let w=await Bun.file(F.filePath).text(),N=VW(w),R=N?.middleware?Array.isArray(N.middleware)?N.middleware:[N.middleware]:[],T=[...q,...R];if(T.length>0){let S=tZ(L,H,N||{}),b=aZ(S,null),D=await ZY(T,b);if(D.redirect){let x=typeof D.redirect==="string"?D.redirect:D.redirect.path||D.redirect,h=wW(String(x),L),i=AW(L,Y);await O0.promises.mkdir($0.dirname(i),{recursive:!0}),await Bun.write(i,h),Q.successCount++,Q.pages.push({route:L,outputPath:i,size:Buffer.byteLength(h),cached:!1}),U.push({loc:L,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${L} \u2192 redirect to ${x}`);return}if(D.abort){let x=typeof D.abort==="string"?D.abort:D.abort?.error?.message||"aborted";console.warn(` \u21B3 ${L} \u2014 middleware aborted: ${x}`);return}}let I=w.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(I)try{if(!await Function("route",`
9451
+ </rss>`}async function LW($={}){let Z=Date.now(),J=await L1(),Y={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||".stx/ssg-cache",contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0},Q={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]};await Y.hooks.onBuildStart?.();try{if(Y.cleanOutput&&O0.existsSync(Y.outputDir))await O0.promises.rm(Y.outputDir,{recursive:!0});await O0.promises.mkdir(Y.outputDir,{recursive:!0});let X=new XY(Y.cacheDir);if(Y.cache)await X.load();try{let{preloadIconCollection:B}=await Promise.resolve().then(() => (k9(),I8));await B("lucide")}catch{}try{let{generateCrosswindCSS:B}=await Promise.resolve().then(() => (G9(),S6));await B('<div class="bg-black"></div>')}catch{}tZ();let G=J?.routeMiddleware?.dir||"middleware";await YY(process.cwd(),G);let K=ZY();if(K.length>0)console.log(`Loaded ${K.length} middleware: ${K.join(", ")}`);let q=J?.routeMiddleware?.global||[],z=P9(".",{pagesDir:Y.pagesDir});console.log(`Found ${z.length} routes`);let W=[];for(let B of z){let O=await zW(B);for(let F of O)W.push({route:B,url:F.url,params:F.params,props:F.props,revalidate:F.revalidate??Y.revalidate})}Q.totalPages=W.length,console.log(`Generating ${Q.totalPages} pages...`);let U=[],_=[];for(let B=0;B<W.length;B+=Y.concurrency)_.push(W.slice(B,B+Y.concurrency));for(let B of _)await Promise.all(B.map(async(O)=>{let{route:F,url:L,params:H,props:V,revalidate:A}=O;try{await Y.hooks.onPageStart?.(L);let w=await Bun.file(F.filePath).text(),N=AW(w),R=N?.middleware?Array.isArray(N.middleware)?N.middleware:[N.middleware]:[],T=[...q,...R];if(T.length>0){let S=$Y(L,H,N||{}),b=eZ(S,null),D=await JY(T,b);if(D.redirect){let x=typeof D.redirect==="string"?D.redirect:D.redirect.path||D.redirect,h=NW(String(x),L),i=RW(L,Y);await O0.promises.mkdir($0.dirname(i),{recursive:!0}),await Bun.write(i,h),Q.successCount++,Q.pages.push({route:L,outputPath:i,size:Buffer.byteLength(h),cached:!1}),U.push({loc:L,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${L} \u2192 redirect to ${x}`);return}if(D.abort){let x=typeof D.abort==="string"?D.abort:D.abort?.error?.message||"aborted";console.warn(` \u21B3 ${L} \u2014 middleware aborted: ${x}`);return}}let I=w.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(I)try{if(!await Function("route",`
9448
9452
  const validate = ${I[1]};
9449
9453
  return validate(route);
9450
- `)({params:H})){console.warn(`Validation failed for ${L}, skipping...`);return}}catch{}let M=null,E=!1;if(Y.cache){if(M=X.get(L,F.filePath,[]),M)E=!0,Q.cachedCount++}if(!M){if(M=await XY(F,H,V,Y,J),Y.cache)X.set(L,F.filePath,[],M)}let k;if(Y.trailingSlash)k=$0.join(Y.outputDir,L,"index.html");else k=L==="/"?$0.join(Y.outputDir,"index.html"):$0.join(Y.outputDir,`${L}.html`);await O0.promises.mkdir($0.dirname(k),{recursive:!0}),await Bun.write(k,M),U.push({loc:L,lastmod:new Date().toISOString().split("T")[0],priority:L==="/"?1:0.8});let y={route:L,outputPath:k,size:Buffer.byteLength(M,"utf8"),cached:E};if(A!==!1)y.revalidateAt=Date.now()+A*1000;Q.pages.push(y),Q.successCount++,await Y.hooks.onPageEnd?.(L,M)}catch(w){Q.failedCount++,Q.errors.push({route:L,error:w}),await Y.hooks.onError?.(w,L),console.error(`Error generating ${L}:`,w)}}));if(Y.cache)await X.save();if(Y.generate404){let B=$0.join(Y.pagesDir,"404.stx");if(await Bun.file(B).exists()){let O=new Set,F={...J,debug:!1,cache:!1},L=await $1(await Bun.file(B).text(),{},B,F,O);await Bun.write($0.join(Y.outputDir,"404.html"),L)}else await Bun.write($0.join(Y.outputDir,"404.html"),`<!DOCTYPE html>
9454
+ `)({params:H})){console.warn(`Validation failed for ${L}, skipping...`);return}}catch{}let M=null,E=!1;if(Y.cache){if(M=X.get(L,F.filePath,[]),M)E=!0,Q.cachedCount++}if(!M){if(M=await GY(F,H,V,Y,J),Y.cache)X.set(L,F.filePath,[],M)}let k;if(Y.trailingSlash)k=$0.join(Y.outputDir,L,"index.html");else k=L==="/"?$0.join(Y.outputDir,"index.html"):$0.join(Y.outputDir,`${L}.html`);await O0.promises.mkdir($0.dirname(k),{recursive:!0}),await Bun.write(k,M),U.push({loc:L,lastmod:new Date().toISOString().split("T")[0],priority:L==="/"?1:0.8});let y={route:L,outputPath:k,size:Buffer.byteLength(M,"utf8"),cached:E};if(A!==!1)y.revalidateAt=Date.now()+A*1000;Q.pages.push(y),Q.successCount++,await Y.hooks.onPageEnd?.(L,M)}catch(w){Q.failedCount++,Q.errors.push({route:L,error:w}),await Y.hooks.onError?.(w,L),console.error(`Error generating ${L}:`,w)}}));if(Y.cache)await X.save();if(Y.generate404){let B=$0.join(Y.pagesDir,"404.stx");if(await Bun.file(B).exists()){let O=new Set,F={...J,debug:!1,cache:!1},L=await $1(await Bun.file(B).text(),{},B,F,O);await Bun.write($0.join(Y.outputDir,"404.html"),L)}else await Bun.write($0.join(Y.outputDir,"404.html"),`<!DOCTYPE html>
9451
9455
  <html lang="en">
9452
9456
  <head>
9453
9457
  <meta charset="UTF-8">
@@ -9468,15 +9472,15 @@ ${J.join(`
9468
9472
  <a href="/">Go home</a>
9469
9473
  </div>
9470
9474
  </body>
9471
- </html>`)}for(let B of[500]){let O=$0.join(Y.pagesDir,`${B}.stx`);if(await Bun.file(O).exists()){let F=new Set,L={...J,debug:!1,cache:!1},H=await $1(await Bun.file(O).text(),{},O,L,F);await Bun.write($0.join(Y.outputDir,`${B}.html`),H)}}let j=$0.join(Y.pagesDir,"error.stx");if(await Bun.file(j).exists()){let B=new Set,O={...J,debug:!1,cache:!1},F=await $1(await Bun.file(j).text(),{},j,O,B);await Bun.write($0.join(Y.outputDir,"error.html"),F)}if(Y.sitemap&&U.length>0){let B=BW(U,Y.domain),O=$0.join(Y.outputDir,"sitemap.xml");await Bun.write(O,B),Q.sitemapPath=O,console.log(`Generated sitemap.xml with ${U.length} URLs`)}if(Y.rss){let B=typeof Y.rss==="object"?Y.rss:{title:"Site Feed",description:"Latest updates",link:Y.domain},O=[];if(B.getItems)O=await B.getItems();let F=jW(B,O),L=$0.join(Y.outputDir,"rss.xml");await Bun.write(L,F),Q.rssPath=L,console.log(`Generated rss.xml with ${O.length} items`)}if(Y.publicDir&&O0.existsSync(Y.publicDir))await QY(Y.publicDir,Y.outputDir),console.log(`Copied public assets from ${Y.publicDir}`)}catch(X){throw await Y.hooks.onError?.(X),X}return Q.buildTime=Date.now()-Z,await Y.hooks.onBuildEnd?.(Q),console.log(`
9475
+ </html>`)}for(let B of[500]){let O=$0.join(Y.pagesDir,`${B}.stx`);if(await Bun.file(O).exists()){let F=new Set,L={...J,debug:!1,cache:!1},H=await $1(await Bun.file(O).text(),{},O,L,F);await Bun.write($0.join(Y.outputDir,`${B}.html`),H)}}let j=$0.join(Y.pagesDir,"error.stx");if(await Bun.file(j).exists()){let B=new Set,O={...J,debug:!1,cache:!1},F=await $1(await Bun.file(j).text(),{},j,O,B);await Bun.write($0.join(Y.outputDir,"error.html"),F)}if(Y.sitemap&&U.length>0){let B=OW(U,Y.domain),O=$0.join(Y.outputDir,"sitemap.xml");await Bun.write(O,B),Q.sitemapPath=O,console.log(`Generated sitemap.xml with ${U.length} URLs`)}if(Y.rss){let B=typeof Y.rss==="object"?Y.rss:{title:"Site Feed",description:"Latest updates",link:Y.domain},O=[];if(B.getItems)O=await B.getItems();let F=HW(B,O),L=$0.join(Y.outputDir,"rss.xml");await Bun.write(L,F),Q.rssPath=L,console.log(`Generated rss.xml with ${O.length} items`)}if(Y.publicDir&&O0.existsSync(Y.publicDir))await KY(Y.publicDir,Y.outputDir),console.log(`Copied public assets from ${Y.publicDir}`)}catch(X){throw await Y.hooks.onError?.(X),X}return Q.buildTime=Date.now()-Z,await Y.hooks.onBuildEnd?.(Q),console.log(`
9472
9476
  Build complete!
9473
9477
  Total: ${Q.totalPages} pages
9474
9478
  Success: ${Q.successCount}
9475
9479
  Cached: ${Q.cachedCount}
9476
9480
  Failed: ${Q.failedCount}
9477
9481
  Time: ${Q.buildTime}ms
9478
- `),Q}async function QY($,Z){let J=await O0.promises.readdir($,{withFileTypes:!0});for(let Y of J){let Q=$0.join($,Y.name),X=$0.join(Z,Y.name);if(Y.isDirectory())await O0.promises.mkdir(X,{recursive:!0}),await QY(Q,X);else await O0.promises.copyFile(Q,X)}}function HW($={}){let Z=$.cacheDir||".stx/ssg-cache",J=new JY(Z),Y=$.revalidate||3600;return{async get(Q){let X=await J.get(Q);if(!X)return null;if(Date.now()>X.revalidateAfter)this.revalidate(Q).catch(console.error);return{html:X.html,headers:{"Cache-Control":`public, max-age=${Y}, stale-while-revalidate=${Y*2}`,ETag:X.etag,"X-ISR-Generated":new Date(X.generatedAt).toISOString(),...X.headers}}},async revalidate(Q){let G=P9(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return Q.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${Q}`);return}let K=Q.match(G.regex),q={};if(K)G.params.forEach((U,_)=>{q[U]=K[_+1]});let z=await L1(),W=await XY(G,q,{},$,z);await J.set(Q,{html:W,generatedAt:Date.now(),revalidateAfter:Date.now()+Y*1000,etag:_W(W)}),console.log(`Revalidated: ${Q}`)},async invalidate(Q){if(typeof Q==="string")await J.invalidate(Q);else await J.invalidatePattern(Q)}}}function LW($){return async()=>{return{paths:await $(),fallback:!1}}}function FW(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),J=Z.match(/^---\n([\s\S]*?)\n---/),Y={},Q=Z;if(J){let z=J[1];Q=Z.slice(J[0].length).trim();for(let W of z.split(`
9479
- `)){let U=W.indexOf(":");if(U>0){let _=W.slice(0,U).trim(),j=W.slice(U+1).trim();if(j==="true")j=!0;else if(j==="false")j=!1;else if(/^\d+$/.test(j))j=parseInt(j,10);else if(/^\d+\.\d+$/.test(j))j=parseFloat(j);else if(j.startsWith("[")&&j.endsWith("]"))j=j.slice(1,-1).split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,""));Y[_]=j}}}let X=Q.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(X))!==null){let z=parseInt(q[1],10),W=q[2],U=W.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:W,level:z})}return{content:X,data:Y,toc:G}}}}function VW($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function wW($,Z){return`<!DOCTYPE html>
9482
+ `),Q}async function KY($,Z){let J=await O0.promises.readdir($,{withFileTypes:!0});for(let Y of J){let Q=$0.join($,Y.name),X=$0.join(Z,Y.name);if(Y.isDirectory())await O0.promises.mkdir(X,{recursive:!0}),await KY(Q,X);else await O0.promises.copyFile(Q,X)}}function FW($={}){let Z=$.cacheDir||".stx/ssg-cache",J=new QY(Z),Y=$.revalidate||3600;return{async get(Q){let X=await J.get(Q);if(!X)return null;if(Date.now()>X.revalidateAfter)this.revalidate(Q).catch(console.error);return{html:X.html,headers:{"Cache-Control":`public, max-age=${Y}, stale-while-revalidate=${Y*2}`,ETag:X.etag,"X-ISR-Generated":new Date(X.generatedAt).toISOString(),...X.headers}}},async revalidate(Q){let G=P9(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return Q.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${Q}`);return}let K=Q.match(G.regex),q={};if(K)G.params.forEach((U,_)=>{q[U]=K[_+1]});let z=await L1(),W=await GY(G,q,{},$,z);await J.set(Q,{html:W,generatedAt:Date.now(),revalidateAfter:Date.now()+Y*1000,etag:jW(W)}),console.log(`Revalidated: ${Q}`)},async invalidate(Q){if(typeof Q==="string")await J.invalidate(Q);else await J.invalidatePattern(Q)}}}function VW($){return async()=>{return{paths:await $(),fallback:!1}}}function wW(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),J=Z.match(/^---\n([\s\S]*?)\n---/),Y={},Q=Z;if(J){let z=J[1];Q=Z.slice(J[0].length).trim();for(let W of z.split(`
9483
+ `)){let U=W.indexOf(":");if(U>0){let _=W.slice(0,U).trim(),j=W.slice(U+1).trim();if(j==="true")j=!0;else if(j==="false")j=!1;else if(/^\d+$/.test(j))j=parseInt(j,10);else if(/^\d+\.\d+$/.test(j))j=parseFloat(j);else if(j.startsWith("[")&&j.endsWith("]"))j=j.slice(1,-1).split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,""));Y[_]=j}}}let X=Q.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(X))!==null){let z=parseInt(q[1],10),W=q[2],U=W.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:W,level:z})}return{content:X,data:Y,toc:G}}}}function AW($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function NW($,Z){return`<!DOCTYPE html>
9480
9484
  <html>
9481
9485
  <head>
9482
9486
  <meta charset="utf-8">
@@ -9488,4 +9492,4 @@ Build complete!
9488
9492
  <p>Redirecting to <a href="${$}">${$}</a>...</p>
9489
9493
  <script>window.location.replace('${$}')</script>
9490
9494
  </body>
9491
- </html>`}function AW($,Z){if($==="/"||$==="")return $0.join(Z.outputDir,"index.html");let J=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return $0.join(Z.outputDir,J,"index.html");return $0.join(Z.outputDir,`${J}.html`)}var GL={generateStaticSite:OW,createISRHandler:HW,defineStaticPaths:LW,createMarkdownLoader:FW};export{OW as generateStaticSite,LW as defineStaticPaths,GL as default,FW as createMarkdownLoader,HW as createISRHandler};
9495
+ </html>`}function RW($,Z){if($==="/"||$==="")return $0.join(Z.outputDir,"index.html");let J=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return $0.join(Z.outputDir,J,"index.html");return $0.join(Z.outputDir,`${J}.html`)}var WL={generateStaticSite:LW,createISRHandler:FW,defineStaticPaths:VW,createMarkdownLoader:wW};export{LW as generateStaticSite,VW as defineStaticPaths,WL as default,wW as createMarkdownLoader,FW as createISRHandler};