@stacksjs/stx 0.2.151 → 0.2.153

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/app-shell.js +28 -1
  2. package/dist/browser-composables.d.ts +24 -9
  3. package/dist/build-id.d.ts +49 -0
  4. package/dist/build-id.js +20 -0
  5. package/dist/cli.js +897 -659
  6. package/dist/client-script.js +2 -2
  7. package/dist/color-mode-boot.d.ts +15 -10
  8. package/dist/color-mode-boot.js +12 -8
  9. package/dist/component-client-factories.js +3 -2
  10. package/dist/component-processing.d.ts +16 -0
  11. package/dist/component-processing.js +4 -1
  12. package/dist/component-renderer.js +2 -2
  13. package/dist/composables/index.d.ts +6 -1
  14. package/dist/composables/use-color-mode.d.ts +19 -4
  15. package/dist/composables/use-color-mode.js +37 -24
  16. package/dist/composables/use-device-orientation.d.ts +8 -1
  17. package/dist/composables/use-event-source.d.ts +14 -1
  18. package/dist/composables/use-eye-dropper.d.ts +10 -1
  19. package/dist/composables/use-idle.d.ts +21 -3
  20. package/dist/composables/use-storage.d.ts +15 -10
  21. package/dist/composables/use-storage.js +63 -2
  22. package/dist/composables/use-text-selection.d.ts +27 -3
  23. package/dist/composables/use-wake-lock.d.ts +2 -2
  24. package/dist/craft.js +625 -387
  25. package/dist/dev-server/serve-app.js +9 -5
  26. package/dist/dev-server/types.d.ts +8 -1
  27. package/dist/document-shell.d.ts +55 -0
  28. package/dist/document-shell.js +103 -3
  29. package/dist/edge-runtime.d.ts +1 -1
  30. package/dist/head.js +5 -1
  31. package/dist/includes.js +4 -2
  32. package/dist/index.d.ts +17 -0
  33. package/dist/index.js +9 -0
  34. package/dist/process.js +7 -3
  35. package/dist/production-builder.js +3 -1
  36. package/dist/pwa.js +591 -353
  37. package/dist/render.d.ts +1 -1
  38. package/dist/render.js +2 -2
  39. package/dist/signals.js +280 -44
  40. package/dist/ssg.js +603 -365
  41. package/dist/ssr.d.ts +17 -1
  42. package/dist/stx.d.ts +14 -6
  43. package/dist/types/config-types.d.ts +1 -0
  44. package/dist/utils.js +1 -8
  45. package/dist/variable-extractor.d.ts +8 -0
  46. package/dist/variable-extractor.js +24 -9
  47. package/dist/visual-testing.d.ts +26 -3
  48. package/package.json +5 -5
  49. package/stx.d.ts +14 -6
package/dist/ssg.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var NQ=Object.defineProperty;var MQ=($)=>$;function TQ($,Z){this[$]=MQ.bind(null,Z)}var a=($,Z)=>{for(var Y in Z)NQ($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:TQ.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var _0=import.meta.require;import C5 from"path";function Q9($){X9=$?.trim()||null}function v5(){return process.env[DQ]?.trim()||X9||Q5}function L1($=process.cwd(),...Z){let Y=v5();return C5.isAbsolute(Y)?C5.join(Y,...Z):C5.join($,Y,...Z)}function x5($){if(!$||C5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==Q5&&!Z.startsWith(`${Q5}/`))return $;let Y=Z.slice(Q5.length+1);return Y?C5.join(v5(),Y):v5()}var Q5=".stx",DQ="STX_DIR",X9=null;var f5=()=>{};var O0;var G9=b(()=>{O0={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 K9($,Z,Y,J){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let z={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${W||z} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return X=X.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),X=X.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,W)=>{return`<span id="${`desc-${K}`}" class="sr-only">${W}</span>`}),X}var W9,q9;var j7=b(()=>{W9={name:"a11y",handler:($,Z,Y,J)=>{if(!Z.length)return $;let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[X]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},q9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function EQ($,Z={}){let{duration:Y,delay:J,ease:X,direction:Q,custom:G}={...z1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
2
+ var yQ=Object.defineProperty;var PQ=($)=>$;function CQ($,Z){this[$]=PQ.bind(null,Z)}var a=($,Z)=>{for(var Y in Z)yQ($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:CQ.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var B0=import.meta.require;import v5 from"path";function W9($){K9=$?.trim()||null}function x5(){return process.env[xQ]?.trim()||K9||Q5}function L1($=process.cwd(),...Z){let Y=x5();return v5.isAbsolute(Y)?v5.join(Y,...Z):v5.join($,Y,...Z)}function f5($){if(!$||v5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==Q5&&!Z.startsWith(`${Q5}/`))return $;let Y=Z.slice(Q5.length+1);return Y?v5.join(x5(),Y):x5()}var Q5=".stx",xQ="STX_DIR",K9=null;var g5=()=>{};var O0;var q9=b(()=>{O0={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 z9($,Z,Y,J){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let z={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${W||z} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return X=X.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),X=X.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,W)=>{return`<span id="${`desc-${K}`}" class="sr-only">${W}</span>`}),X}var U9,j9;var H7=b(()=>{U9={name:"a11y",handler:($,Z,Y,J)=>{if(!Z.length)return $;let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[X]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},j9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function fQ($,Z={}){let{duration:Y,delay:J,ease:X,direction:Q,custom:G}={...z1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
3
3
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4
4
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
5
5
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -9,7 +9,7 @@ var NQ=Object.defineProperty;var MQ=($)=>$;function TQ($,Z){this[$]=MQ.bind(null
9
9
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
10
10
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${Q==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
11
11
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
12
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function kQ(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function gQ(){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 bQ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function SQ($=0.1,Z="0px"){return`
40
+ `}function hQ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function dQ($=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 yQ(){return`
83
+ `}function uQ(){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 PQ($,Z,Y={}){let{staggerDelay:J=50,sequence:X=!1}=Y;return`
198
+ `}function mQ($,Z,Y={}){let{staggerDelay:J=50,sequence:X=!1}=Y;return`
199
199
  <script data-stx-scoped>
200
200
  // Animation Group: ${$}
201
201
  (function() {
@@ -232,11 +232,11 @@ else {
232
232
  }
233
233
  })();
234
234
  </script>
235
- `}function B9($,Z,Y,J){let X=$;if(J.animation?.enabled===!1)return X;let Q=Y.includes("test")&&Y.includes("animation");if(!bQ(X)&&!Q)return X;if(!X.includes('<style id="stx-animation-base">')){let K=yQ();X=X.replace("</head>",`${K}
236
- </head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let W=SQ(),q=X.lastIndexOf("</body>");if(q!==-1)X=X.slice(0,q)+W+`
237
- `+X.slice(q)}}return X}var z1,z9,U9,j9,_9;var _7=b(()=>{z1={duration:300,delay:0,ease:"ease",direction:"both"};z9={name:"transition",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||z1.duration:z1.duration,G=Z.length>2?Z[2]||z1.ease:z1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||z1.delay:z1.delay,W=Z.length>4?Z[4]||z1.direction:z1.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=EQ(X,{duration:Q,delay:K,ease:G,direction:W}),U="stx-transition",j="";if(X==="fade")j="stx-fade";else if(X==="slide")j="stx-slide";else if(X==="scale")j="stx-scale";else if(X==="flip")j="stx-flip";else if(X==="rotate")j="stx-rotate";return`<div id="${q}" class="${U} ${j} ${W==="out"?"stx-out":""}"
238
- style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},U9={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,W=Z.length>4?Number.parseInt(Z[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,z=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(X==="fade")U+=" stx-fade";else if(X==="slide-up"||X==="slide")U+=" stx-from-bottom";else if(X==="slide-down")U+=" stx-from-top";else if(X==="slide-left")U+=" stx-from-right";else if(X==="slide-right")U+=" stx-from-left";else if(X==="scale")U+=" stx-scale";else if(X.includes("-"))U+=` stx-${X}`;else U+=` stx-${X}`;return`<div id="${q}" class="${U}" style="${z}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},j9={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let X=Z[0],Q=Z.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),G=Y.staggerDelay||50,K=Y.sequence||!0,W=PQ(X,Q,{staggerDelay:G,sequence:K});return`${$}
239
- ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},_9={name:"motion",handler:($,Z,Y,J)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=kQ();return`<div data-animate="${X?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as H9}from"stx-router";var O9=b(()=>{B7()});async function CQ($,Z,Y,J){let X=Z[0]?.replace(/['"]/g,"")||"main",Q=H9();if(X!=="main")Q=Q.replace("container:'main'",`container:'${X}'`);return`<script data-stx-router>${Q}</script>`}var L9;var B7=b(()=>{O9();L9={name:"stxRouter",handler:CQ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function F9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...vQ,...Z};return`
235
+ `}function L9($,Z,Y,J){let X=$;if(J.animation?.enabled===!1)return X;let Q=Y.includes("test")&&Y.includes("animation");if(!hQ(X)&&!Q)return X;if(!X.includes('<style id="stx-animation-base">')){let K=uQ();X=X.replace("</head>",`${K}
236
+ </head>`)}if(X.includes("stx-observe")){if(!X.includes("Intersection Observer for scroll animations")){let W=dQ(),q=X.lastIndexOf("</body>");if(q!==-1)X=X.slice(0,q)+W+`
237
+ `+X.slice(q)}}return X}var z1,B9,_9,H9,O9;var O7=b(()=>{z1={duration:300,delay:0,ease:"ease",direction:"both"};B9={name:"transition",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||z1.duration:z1.duration,G=Z.length>2?Z[2]||z1.ease:z1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||z1.delay:z1.delay,W=Z.length>4?Z[4]||z1.direction:z1.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=fQ(X,{duration:Q,delay:K,ease:G,direction:W}),U="stx-transition",j="";if(X==="fade")j="stx-fade";else if(X==="slide")j="stx-slide";else if(X==="scale")j="stx-scale";else if(X==="flip")j="stx-flip";else if(X==="rotate")j="stx-rotate";return`<div id="${q}" class="${U} ${j} ${W==="out"?"stx-out":""}"
238
+ style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},_9={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let X=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,W=Z.length>4?Number.parseInt(Z[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,z=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(X==="fade")U+=" stx-fade";else if(X==="slide-up"||X==="slide")U+=" stx-from-bottom";else if(X==="slide-down")U+=" stx-from-top";else if(X==="slide-left")U+=" stx-from-right";else if(X==="slide-right")U+=" stx-from-left";else if(X==="scale")U+=" stx-scale";else if(X.includes("-"))U+=` stx-${X}`;else U+=` stx-${X}`;return`<div id="${q}" class="${U}" style="${z}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},H9={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let X=Z[0],Q=Z.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),G=Y.staggerDelay||50,K=Y.sequence||!0,W=mQ(X,Q,{staggerDelay:G,sequence:K});return`${$}
239
+ ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},O9={name:"motion",handler:($,Z,Y,J)=>{let X=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=gQ();return`<div data-animate="${X?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as F9}from"stx-router";var V9=b(()=>{L7()});async function pQ($,Z,Y,J){let X=Z[0]?.replace(/['"]/g,"")||"main",Q=F9();if(X!=="main")Q=Q.replace("container:'main'",`container:'${X}'`);return`<script data-stx-router>${Q}</script>`}var w9;var L7=b(()=>{V9();w9={name:"stxRouter",handler:pQ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function A9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...lQ,...Z};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
241
241
  <script>
242
242
  (function() {
@@ -619,13 +619,13 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function V9($,Z){let Y=F9(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function xQ($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[X,Q]=J.split("="),G=Q?.replace(/["']/g,"");switch(X){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var vQ,w9;var H7=b(()=>{vQ={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};w9={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let X=Y.__stx_config||{};if(Z.length>0){let Q=xQ(Z.join(" "));X.heatmap={...X.heatmap,...Q,enabled:!0}}return F9(X)}}});function F1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function A9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function R9($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],X=$.slice(Y[0].length),Q={};for(let G of J.split(`
623
- `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let W=K.indexOf(":");if(W===-1)continue;let q=K.slice(0,W).trim(),z=K.slice(W+1).trim();if(typeof z==="string"){if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))z=z.slice(1,-1);else if(z.startsWith("[")&&z.endsWith("]"))try{z=JSON.parse(z)}catch{}else if(z==="true")z=!0;else if(z==="false")z=!1;else if(/^-?\d+(?:\.\d+)?$/.test(z))z=Number(z)}Q[q]=z}return{data:Q,content:X.trim()}}function g5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,X=$,Q=[];if(X=X.replace(/```(\w*)\n([\s\S]*?)```/g,(z,U,j)=>{let _=Q.length,B=U?` class="language-${F1(U)}"`:"";return Q.push(`<pre><code${B}>${F1(j.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),X=X.replace(/`([^`]*)`/g,(z,U)=>`<code>${F1(U)}</code>`),X=X.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),X=X.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),X=X.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),X=X.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),X=X.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),X=X.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),X=X.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),X=X.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),X=X.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),X=X.replace(/__(.+?)__/g,"<strong>$1</strong>"),X=X.replace(/\*(.+?)\*/g,"<em>$1</em>"),X=X.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)X=X.replace(/~~(.+?)~~/g,"<del>$1</del>");if(X=X.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(z,U,j)=>{return`<img src="${A9(j)?F1(j):""}" alt="${F1(U)}" />`}),X=X.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(z,U,j)=>{return`<a href="${A9(j)?F1(j):""}">${U}</a>`}),X=X.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),X=X.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),X=X.replace(/<\/blockquote>\n<blockquote>/g,`
624
- `),X=X.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),X=X.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),X=X.replace(/<\/ul>\n<ul>/g,""),X=X.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),X=X.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),X=X.replace(/<\/ol>\n<ol>/g,""),X=X.replace(/<li data-ul>/g,"<li>"),X=X.replace(/<li data-ol>/g,"<li>"),Y)X=X.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(z,U,j)=>{let B=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${F1(L)}</th>`).join("")}</tr>`,H=j.trim().split(`
622
+ `}function R9($,Z){let Y=A9(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function cQ($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[X,Q]=J.split("="),G=Q?.replace(/["']/g,"");switch(X){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var lQ,N9;var F7=b(()=>{lQ={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};N9={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let X=Y.__stx_config||{};if(Z.length>0){let Q=cQ(Z.join(" "));X.heatmap={...X.heatmap,...Q,enabled:!0}}return A9(X)}}});function F1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function M9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function T9($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],X=$.slice(Y[0].length),Q={};for(let G of J.split(`
623
+ `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let W=K.indexOf(":");if(W===-1)continue;let q=K.slice(0,W).trim(),z=K.slice(W+1).trim();if(typeof z==="string"){if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))z=z.slice(1,-1);else if(z.startsWith("[")&&z.endsWith("]"))try{z=JSON.parse(z)}catch{}else if(z==="true")z=!0;else if(z==="false")z=!1;else if(/^-?\d+(?:\.\d+)?$/.test(z))z=Number(z)}Q[q]=z}return{data:Q,content:X.trim()}}function h5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,X=$,Q=[];if(X=X.replace(/```(\w*)\n([\s\S]*?)```/g,(z,U,j)=>{let B=Q.length,_=U?` class="language-${F1(U)}"`:"";return Q.push(`<pre><code${_}>${F1(j.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),X=X.replace(/`([^`]*)`/g,(z,U)=>`<code>${F1(U)}</code>`),X=X.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),X=X.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),X=X.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),X=X.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),X=X.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),X=X.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),X=X.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),X=X.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),X=X.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),X=X.replace(/__(.+?)__/g,"<strong>$1</strong>"),X=X.replace(/\*(.+?)\*/g,"<em>$1</em>"),X=X.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)X=X.replace(/~~(.+?)~~/g,"<del>$1</del>");if(X=X.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(z,U,j)=>{return`<img src="${M9(j)?F1(j):""}" alt="${F1(U)}" />`}),X=X.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(z,U,j)=>{return`<a href="${M9(j)?F1(j):""}">${U}</a>`}),X=X.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),X=X.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),X=X.replace(/<\/blockquote>\n<blockquote>/g,`
624
+ `),X=X.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),X=X.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),X=X.replace(/<\/ul>\n<ul>/g,""),X=X.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),X=X.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),X=X.replace(/<\/ol>\n<ol>/g,""),X=X.replace(/<li data-ul>/g,"<li>"),X=X.replace(/<li data-ol>/g,"<li>"),Y)X=X.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(z,U,j)=>{let _=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${F1(L)}</th>`).join("")}</tr>`,H=j.trim().split(`
625
625
  `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${F1(O)}</td>`).join("")}</tr>`}).join(`
626
626
  `);return`<table>
627
627
  <thead>
628
- ${B}
628
+ ${_}
629
629
  </thead>
630
630
  <tbody>
631
631
  ${H}
@@ -639,35 +639,35 @@ ${H}
639
639
  `),J)X=X.replace(/\n/g,`<br />
640
640
  `);for(let z=0;z<Q.length;z++)X=X.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function r0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
641
641
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(J,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
642
- `}),$}function fQ(){let $=globalThis;return $[N9]??=new Map,$[N9]}function t($,Z){let Y=fQ(),J=`${import.meta.url}\x00${$}`,X=Y.get(J);if(X)return X;let Q=Z();return Y.set(J,Q),Q.catch(()=>{if(Y.get(J)===Q)Y.delete(J)}),Q}var N9;var h5=b(()=>{N9=Symbol.for("stx.lazy-module-promises")});import gQ from"process";function c0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(gQ.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var P1=()=>{};var d5={};a(d5,{shouldLogBundlerDiagnostics:()=>D9,queueClientBundleBuild:()=>E9,hasUserImports:()=>dQ,bundleClientScript:()=>mQ});import F0 from"path";import x0 from"fs";function D9($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function C1(...$){if(D9())console.log("[stx:bundler]",...$)}function dQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(!M9.some((G)=>G.test(X)))return C1("detected user import:",X),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=J.exec($))!==null){let X=Y[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!M9.some((G)=>G.test(X)))return C1("detected side-effect import:",X),!0}return!1}function uQ($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:F0.dirname(Q),W=F0.resolve(K,G),q=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,F0.join(W,"index.ts"),F0.join(W,"index.tsx"),F0.join(W,"index.js"),F0.join(W,"index.mjs")];for(let z of q)try{if(x0.existsSync(z)&&x0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(x0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=X(G.importer,G.path);return J.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=F0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,F0.join(K,"index.ts"),F0.join(K,"index.tsx"),F0.join(K,"index.js"),F0.join(K,"index.mjs")];for(let q of W)if(x0.existsSync(q)&&x0.statSync(q,{throwIfNoEntry:!1})?.isFile())return C1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",q),J.add(q),{path:q};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=F0.extname(G.path).toLowerCase(),W=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)J.add(G.path);return{contents:x0.readFileSync(G.path,"utf8"),loader:W}})}}}function E9($){let Z=globalThis,J=(Z[T9]??Promise.resolve()).then($,$);return Z[T9]=J.then(()=>{return},()=>{return}),J}async function mQ($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||L1(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${hQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=F0.join(Q,`${K}.js`),q=F0.join(Q,`${K}.deps.json`),z=Bun.file(W);if(await z.exists()){let _=Bun.file(q),B=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==I9||!Array.isArray(H.files))B=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(x0.statSync(L.path).mtimeMs!==L.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return C1("cache hit:",K),await z.text();C1("cache invalidated by dep change:",K)}let U=O7.get(K);if(U)return await U;let j=E9(()=>pQ($,Z,{projectRoot:J,minify:X,cacheDir:Q,hash:K,cachePath:W,depsPath:q}));O7.set(K,j);try{return await j}finally{O7.delete(K)}}async function pQ($,Z,Y){let{projectRoot:J,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=Y,q=L1(J,"bundle-tmp"),z=F0.join(q,`${G}.ts`),U=F0.join(q,"out",G);x0.mkdirSync(q,{recursive:!0}),x0.mkdirSync(U,{recursive:!0});let j=F0.dirname(Z),_=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=B.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)_.push(w)});else if(L[3])_.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;_.push(L[2])}let F=_.length>0?`
643
- export { ${_.join(", ")} }`:"";await Bun.write(z,$+F),C1("bundling:",G,"from:",F0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:X,plugins:[uQ(J,j,z,O)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...c0()},root:J});if(!V.success){let D=V.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of V.outputs){w=await D.text();break}let A=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of D[1].split(",")){let S=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let k=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(k))A.push([k,k])}let R=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${G}`,M=A.map(([D,y])=>`${JSON.stringify(D)}: ${y}`).join(", "),T=A.map(([D])=>`var ${D} = undefined;`).join(`
642
+ `}),$}function iQ(){let $=globalThis;return $[I9]??=new Map,$[I9]}function t($,Z){let Y=iQ(),J=`${import.meta.url}\x00${$}`,X=Y.get(J);if(X)return X;let Q=Z();return Y.set(J,Q),Q.catch(()=>{if(Y.get(J)===Q)Y.delete(J)}),Q}var I9;var d5=b(()=>{I9=Symbol.for("stx.lazy-module-promises")});import nQ from"process";function c0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,X]of Object.entries(nQ.env)){if(!J.startsWith($)||X===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(X),Y[J]=X}return Z["import.meta.env"]=JSON.stringify(Y),Z}var P1=()=>{};var u5={};a(u5,{shouldLogBundlerDiagnostics:()=>b9,queueClientBundleBuild:()=>S9,hasUserImports:()=>sQ,bundleClientScript:()=>aQ});import F0 from"path";import x0 from"fs";function b9($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function C1(...$){if(b9())console.log("[stx:bundler]",...$)}function sQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(!D9.some((G)=>G.test(X)))return C1("detected user import:",X),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=J.exec($))!==null){let X=Y[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!D9.some((G)=>G.test(X)))return C1("detected side-effect import:",X),!0}return!1}function rQ($,Z,Y,J){let X=(Q,G)=>{let K=Q===Y?Z:F0.dirname(Q),W=F0.resolve(K,G),q=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,F0.join(W,"index.ts"),F0.join(W,"index.tsx"),F0.join(W,"index.js"),F0.join(W,"index.mjs")];for(let z of q)try{if(x0.existsSync(z)&&x0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(x0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=X(G.importer,G.path);return J.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=F0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,F0.join(K,"index.ts"),F0.join(K,"index.tsx"),F0.join(K,"index.js"),F0.join(K,"index.mjs")];for(let q of W)if(x0.existsSync(q)&&x0.statSync(q,{throwIfNoEntry:!1})?.isFile())return C1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",q),J.add(q),{path:q};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=F0.extname(G.path).toLowerCase(),W=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)J.add(G.path);return{contents:x0.readFileSync(G.path,"utf8"),loader:W}})}}}function S9($){let Z=globalThis,J=(Z[E9]??Promise.resolve()).then($,$);return Z[E9]=J.then(()=>{return},()=>{return}),J}async function aQ($,Z,Y={}){let J=Y.projectRoot||process.cwd(),X=Y.minify??!1,Q=Y.cacheDir||L1(J,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${oQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=F0.join(Q,`${K}.js`),q=F0.join(Q,`${K}.deps.json`),z=Bun.file(W);if(await z.exists()){let B=Bun.file(q),_=!0;if(await B.exists())try{let H=JSON.parse(await B.text());if(H.metadataVersion!==k9||!Array.isArray(H.files))_=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(x0.statSync(L.path).mtimeMs!==L.mtimeMs){_=!1;break}}catch{_=!1;break}}catch{_=!1}if(_)return C1("cache hit:",K),await z.text();C1("cache invalidated by dep change:",K)}let U=V7.get(K);if(U)return await U;let j=S9(()=>tQ($,Z,{projectRoot:J,minify:X,cacheDir:Q,hash:K,cachePath:W,depsPath:q}));V7.set(K,j);try{return await j}finally{V7.delete(K)}}async function tQ($,Z,Y){let{projectRoot:J,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=Y,q=L1(J,"bundle-tmp"),z=F0.join(q,`${G}.ts`),U=F0.join(q,"out",G);x0.mkdirSync(q,{recursive:!0}),x0.mkdirSync(U,{recursive:!0});let j=F0.dirname(Z),B=[],_=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=_.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((F)=>{let w=F.split(":")[0].trim();if(w)B.push(w)});else if(L[3])B.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;B.push(L[2])}let V=B.length>0?`
643
+ export { ${B.join(", ")} }`:"";await Bun.write(z,$+V),C1("bundling:",G,"from:",F0.basename(Z));let O=new Set;try{let F=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:X,plugins:[rQ(J,j,z,O)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...c0()},root:J});if(!F.success){let D=F.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of F.outputs){w=await D.text();break}let A=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of D[1].split(",")){let S=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let k=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(k))A.push([k,k])}let R=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${G}`,T=A.map(([D,y])=>`${JSON.stringify(D)}: ${y}`).join(", "),M=A.map(([D])=>`var ${D} = undefined;`).join(`
644
644
  `),I=A.map(([D])=>`${D} = ${N}[${JSON.stringify(D)}];`).join(`
645
645
  `);if(w=`${R.join(`
646
646
  `)}
647
- ${T}
647
+ ${M}
648
648
  var ${N} = (function() {
649
649
  ${w}
650
- return { ${M} };
650
+ return { ${T} };
651
651
  })();
652
- ${I}`.trim(),C1("bundled:",G,"output:",w.length,"bytes"),_.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${F0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;x0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let E=Array.from(O).map((D)=>{try{return{path:D,mtimeMs:x0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({metadataVersion:I9,files:E})),w}catch(V){let w=V instanceof Error?V.message:String(V),A=V?.errors,R=Array.isArray(A)&&A.length>0?`
652
+ ${I}`.trim(),C1("bundled:",G,"output:",w.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${F0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;x0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let E=Array.from(O).map((D)=>{try{return{path:D,mtimeMs:x0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({metadataVersion:k9,files:E})),w}catch(F){let w=F instanceof Error?F.message:String(F),A=F?.errors,R=Array.isArray(A)&&A.length>0?`
653
653
  ${A.map((N)=>`- ${N?.message??N}`).join(`
654
- `)}`:"";return console.warn(`[stx:bundler] error: ${w}${R}`),$}finally{try{x0.rmSync(z,{force:!0}),x0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var hQ=5,I9=1,M9,O7,T9;var u5=b(()=>{P1();f5();M9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];O7=new Map,T9=Symbol.for("stx.client-bundle-build-queue")});var v9={};a(v9,{stripCommentsAndLiterals:()=>y9,renderVendorStyleTags:()=>I$,processClientScript:()=>l5,injectBrowserCoreAutoImports:()=>G5,generateServerDataBridge:()=>D$,generateBrowserAutoImportDestructuring:()=>eQ,generateAutoImportDestructuring:()=>L7,extractBridgeData:()=>p5,extractAndStripCssImports:()=>T$});import v1 from"path";import m5 from"fs";function cQ($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function iQ($,Z){let Y=Z;while(!0){let J=v1.join(Y,"node_modules",$,"package.json");if(m5.existsSync(J))return v1.dirname(J);let X=v1.dirname(Y);if(X===Y)return null;Y=X}}function nQ($,Z){if(!$||typeof $!=="object")return null;let Y=(X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"){if(typeof X.import==="string")return X.import;if(typeof X.default==="string")return X.default;if(typeof X.import==="object")return Y(X.import);if(typeof X.default==="object")return Y(X.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=null;for(let X of Object.keys($)){let Q=X.indexOf("*");if(Q===-1)continue;let G=X.slice(0,Q),K=X.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!J||G.length>J.prefix.length)J={pattern:X,prefix:G,suffix:K}}if(J){let X=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=Y($[J.pattern]);if(Q)return Q.replace("*",X)}return null}function oQ($,Z){let Y=cQ($);if(!Y||!Y.subpath)return null;let J=iQ(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(m5.readFileSync(v1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=nQ(X.exports,Q);if(!G)return null;let K=v1.resolve(J,G);return m5.existsSync(K)?K:null}function T$($,Z){let Y=Z.filePath?v1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(lQ,(K,W)=>{let q;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(q=W.startsWith("/")?W:v1.resolve(Y,W),!m5.existsSync(q))throw Error(`file not found: ${q}`)}else{let z=null;try{z=Bun.resolveSync(W,J)}catch{z=oQ(W,J)}if(!z)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);q=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(X.has(q))return"";X.add(q);try{let z=m5.readFileSync(q,"utf8");Q.push({source:W,resolvedPath:q,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${q}: ${z?.message||z}`)}return""}),styles:Q}}function sQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function I$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${sQ(Z.source)}" data-stx-layer="vendor">
654
+ `)}`:"";return console.warn(`[stx:bundler] error: ${w}${R}`),$}finally{try{x0.rmSync(z,{force:!0}),x0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var oQ=5,k9=1,D9,V7,E9;var m5=b(()=>{P1();g5();D9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];V7=new Map,E9=Symbol.for("stx.client-bundle-build-queue")});var g9={};a(g9,{stripCommentsAndLiterals:()=>v9,renderVendorStyleTags:()=>D$,processClientScript:()=>c5,injectBrowserCoreAutoImports:()=>G5,generateServerDataBridge:()=>E$,generateBrowserAutoImportDestructuring:()=>WG,generateAutoImportDestructuring:()=>w7,extractBridgeData:()=>l5,extractAndStripCssImports:()=>I$});import v1 from"path";import p5 from"fs";function $G($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function ZG($,Z){let Y=Z;while(!0){let J=v1.join(Y,"node_modules",$,"package.json");if(p5.existsSync(J))return v1.dirname(J);let X=v1.dirname(Y);if(X===Y)return null;Y=X}}function YG($,Z){if(!$||typeof $!=="object")return null;let Y=(X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"){if(typeof X.import==="string")return X.import;if(typeof X.default==="string")return X.default;if(typeof X.import==="object")return Y(X.import);if(typeof X.default==="object")return Y(X.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=null;for(let X of Object.keys($)){let Q=X.indexOf("*");if(Q===-1)continue;let G=X.slice(0,Q),K=X.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!J||G.length>J.prefix.length)J={pattern:X,prefix:G,suffix:K}}if(J){let X=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=Y($[J.pattern]);if(Q)return Q.replace("*",X)}return null}function JG($,Z){let Y=$G($);if(!Y||!Y.subpath)return null;let J=ZG(Y.pkg,Z);if(!J)return null;let X;try{X=JSON.parse(p5.readFileSync(v1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=YG(X.exports,Q);if(!G)return null;let K=v1.resolve(J,G);return p5.existsSync(K)?K:null}function I$($,Z){let Y=Z.filePath?v1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace(eQ,(K,W)=>{let q;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(q=W.startsWith("/")?W:v1.resolve(Y,W),!p5.existsSync(q))throw Error(`file not found: ${q}`)}else{let z=null;try{z=Bun.resolveSync(W,J)}catch{z=JG(W,J)}if(!z)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);q=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(X.has(q))return"";X.add(q);try{let z=p5.readFileSync(q,"utf8");Q.push({source:W,resolvedPath:q,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${q}: ${z?.message||z}`)}return""}),styles:Q}}function XG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${XG(Z.source)}" data-stx-layer="vendor">
655
655
  @layer vendor {
656
656
  ${Z.contents}
657
657
  }
658
658
  </style>`}).join(`
659
659
  `)}
660
- `}function G5($){let Z=y9($),Y=new Set;for(let K of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let W of K[1].split(",")){let q=W.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)Y.add(q)}let J=new Set;for(let K of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(K[1]);for(let K of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let W of K[1].split(",")){let q=W.trim().split(/[:=]/).pop()?.trim();if(q)J.add(q)}let X=S9.filter((K)=>{if(Y.has(K)||J.has(K))return!1;return new RegExp(`\\b${K}\\s*\\(`).test(Z)}),Q=P9(Z).filter((K)=>!Y.has(K)&&!J.has(K));if(X.length===0&&Q.length===0)return{code:$,imports:X,models:Q};return{code:`${[X.length>0?`import { ${X.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
660
+ `}function G5($){let Z=v9($),Y=new Set;for(let K of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let W of K[1].split(",")){let q=W.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)Y.add(q)}let J=new Set;for(let K of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(K[1]);for(let K of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let W of K[1].split(",")){let q=W.trim().split(/[:=]/).pop()?.trim();if(q)J.add(q)}let X=C9.filter((K)=>{if(Y.has(K)||J.has(K))return!1;return new RegExp(`\\b${K}\\s*\\(`).test(Z)}),Q=x9(Z).filter((K)=>!Y.has(K)&&!J.has(K));if(X.length===0&&Q.length===0)return{code:$,imports:X,models:Q};return{code:`${[X.length>0?`import { ${X.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
661
661
  `)}
662
- ${$}`,imports:X,models:Q}}function y9($){let Z="",Y=0;while(Y<$.length){let J=$.slice(Y,Y+2);if(J==="//"){while(Y<$.length&&$[Y]!==`
662
+ ${$}`,imports:X,models:Q}}function v9($){let Z="",Y=0;while(Y<$.length){let J=$.slice(Y,Y+2);if(J==="//"){while(Y<$.length&&$[Y]!==`
663
663
  `)Z+=" ",Y++;continue}if(J==="/*"){while(Y<$.length&&$.slice(Y,Y+2)!=="*/")Z+=$[Y]===`
664
664
  `?`
665
665
  `:" ",Y++;Z+=" ",Y+=2;continue}let X=$[Y];if(X==='"'||X==="'"||X==="`"){let Q=X;Z+=" ",Y++;while(Y<$.length&&$[Y]!==Q){if($[Y]==="\\"){Z+=" ",Y+=2;continue}Z+=$[Y]===`
666
666
  `?`
667
- `:" ",Y++}Z+=" ",Y++;continue}Z+=X,Y++}return Z}function P9($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=Y.exec($))!==null)if(!aQ.has(J[1]))Z.add(J[1]);return Array.from(Z)}function tQ($){let Z=new Set;for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of Y[1].split(",")){let X=J.trim().split(/[:=]/).pop()?.trim();if(X&&/^[A-Za-z_$][\w$]*$/.test(X))Z.add(X)}return Z}function C9($){let Z=new Set,Y=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let X=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let q=G[1],z=G[2];if(G[0].includes("import type"))continue;let U=[];for(let _ of q.split(",")){let B=_.trim();if(!B||B.startsWith("type "))continue;let H=B.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!H)continue;let L=H[1],F=H[2]||L;if(X.add(L),X.add(F),z==="stx"||z==="@stacksjs/stx")Z.add(L);else Y.add(L);if(F!==L)U.push(`${F} = ${L}`)}let j=U.length>0?`var ${U.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(G[0],j)}let K=tQ(J);for(let q of rQ){if(X.has(q)||K.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(J))Z.add(q)}for(let q of S9){if(X.has(q)||K.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let W=P9(J);for(let q of W)if(!X.has(q)&&!K.has(q))Y.add(q);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function L7($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
667
+ `:" ",Y++}Z+=" ",Y++;continue}Z+=X,Y++}return Z}function x9($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=Y.exec($))!==null)if(!GG.has(J[1]))Z.add(J[1]);return Array.from(Z)}function KG($){let Z=new Set;for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of Y[1].split(",")){let X=J.trim().split(/[:=]/).pop()?.trim();if(X&&/^[A-Za-z_$][\w$]*$/.test(X))Z.add(X)}return Z}function f9($){let Z=new Set,Y=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let X=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let q=G[1],z=G[2];if(G[0].includes("import type"))continue;let U=[];for(let B of q.split(",")){let _=B.trim();if(!_||_.startsWith("type "))continue;let H=_.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!H)continue;let L=H[1],V=H[2]||L;if(X.add(L),X.add(V),z==="stx"||z==="@stacksjs/stx")Z.add(L);else Y.add(L);if(V!==L)U.push(`${V} = ${L}`)}let j=U.length>0?`var ${U.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(G[0],j)}let K=KG(J);for(let q of QG){if(X.has(q)||K.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(J))Z.add(q)}for(let q of C9){if(X.has(q)||K.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let W=x9(J);for(let q of W)if(!X.has(q)&&!K.has(q))Y.add(q);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function w7($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
668
668
  ${Y.join(`
669
669
  `)}
670
- ${$G($,Z)}`;return""}function eQ($,Z=[]){let{browserImports:Y}=C9($),J=new Set(Z);return L7([],Y.filter((X)=>!J.has(X)))}function $G($,Z){let Y=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
670
+ ${qG($,Z)}`;return""}function WG($,Z=[]){let{browserImports:Y}=f9($),J=new Set(Z);return w7([],Y.filter((X)=>!J.has(X)))}function qG($,Z){let Y=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
671
671
  [${Y.join(", ")}].forEach(function (e) {
672
672
  if (e[1] !== 'undefined') return;
673
673
  console.error(
@@ -676,18 +676,18 @@ ${$G($,Z)}`;return""}function eQ($,Z=[]){let{browserImports:Y}=C9($),J=new Set(Z
676
676
  + 'or it should be imported from a relative path so the bundler includes it.'
677
677
  );
678
678
  });
679
- `}function p5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function k9($,Z){let Y=new Set;for(let J of $.split(",")){let X=J.trim().replace(/^\.\.\./,"").trim();if(!X)continue;if(Z){let Q=X.lastIndexOf(":");if(Q!==-1)X=X.slice(Q+1).trim()}if(X=X.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(X))Y.add(X)}return Y}function ZG($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(k9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(k9(Y[1],!1).has(Z))return!0;return!1}function D$($,Z){if(!Z)return"";let Y=[];for(let[J,X]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(J))continue;if(!new RegExp(`\\b${J}\\b`).test($))continue;if(ZG($,J))continue;let Q;try{Q=JSON.stringify(X)}catch{continue}if(Q===void 0)continue;Y.push(` var ${J} = ${Q.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
679
+ `}function l5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function y9($,Z){let Y=new Set;for(let J of $.split(",")){let X=J.trim().replace(/^\.\.\./,"").trim();if(!X)continue;if(Z){let Q=X.lastIndexOf(":");if(Q!==-1)X=X.slice(Q+1).trim()}if(X=X.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(X))Y.add(X)}return Y}function zG($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(y9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(y9(Y[1],!1).has(Z))return!0;return!1}function E$($,Z){if(!Z)return"";let Y=[];for(let[J,X]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(J))continue;if(!new RegExp(`\\b${J}\\b`).test($))continue;if(zG($,J))continue;let Q;try{Q=JSON.stringify(X)}catch{continue}if(Q===void 0)continue;Y.push(` var ${J} = ${Q.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
680
680
  ${Y.join(`
681
681
  `)}
682
- `}function JG($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=YG[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function XG($,Z){let{elementId:Y,event:J,handler:X,modifiers:Q}=$,G=JG(Q),K=[];if(Q.once)K.push("once: true");if(Q.capture)K.push("capture: true");if(Q.passive)K.push("passive: true");let W=K.length>0?`, { ${K.join(", ")} }`:"",q="";if(G)q+=`${G}; `;let z=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
682
+ `}function jG($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=UG[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function BG($,Z){let{elementId:Y,event:J,handler:X,modifiers:Q}=$,G=jG(Q),K=[];if(Q.once)K.push("once: true");if(Q.capture)K.push("capture: true");if(Q.passive)K.push("passive: true");let W=K.length>0?`, { ${K.join(", ")} }`:"",q="";if(G)q+=`${G}; `;let z=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
683
683
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
684
- };`;function j(_){if(/\$emit\s*\(/.test(_))return`${U}
685
- ${_}`;return`var scope = $el.closest('[data-stx-scope]');
684
+ };`;function j(B){if(/\$emit\s*\(/.test(B))return`${U}
685
+ ${B}`;return`var scope = $el.closest('[data-stx-scope]');
686
686
  if (scope && scope.__stx_execute) {
687
687
  scope.__stx_execute('${z}', $event, $el);
688
688
  }
689
689
  else {
690
- ${_}
690
+ ${B}
691
691
  }`}if(Q.debounce!==null)return` ;(function() {
692
692
  // eslint-disable-next-line pickier/no-unused-vars
693
693
  var $el = document.getElementById('${Y}')
@@ -722,33 +722,34 @@ else {
722
722
  else {
723
723
  ${X}
724
724
  }
725
- }${W})`}function QG($){if($.length===0)return"";return`
725
+ }${W})`}function _G($){if($.length===0)return"";return`
726
726
  // STX: auto-generated event bindings
727
- ${$.map((Y,J)=>XG(Y,J)).join(`
728
- `)}`}function b9($){let Z=[],Y=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),X=0,Q=J.length,G=0;while(G<Q){let K=J[G];if(K==="'"||K==='"'||K==="`"){let W=K;if(G++,W==="`"){let q=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&q===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){q++,G+=2;continue}if(J[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===W){G++;break}G++}continue}if(K==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
729
- `)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let W=J.slice(G),q=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let j=q[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=q[0].length;continue}let z=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((j)=>{let _=j.trim(),B=_.indexOf(":"),H=B>=0?_.slice(B+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=z[0].length;continue}let U=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let j=U[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=U[0].length;continue}}G++}return Z}function KG($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(j){let _;while((_=Y.exec(j))!==null){let B=_[0];if(!GG.has(B))Z.add(B)}}let X=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=X.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);return Z}async function l5($,Z={}){let Y=$,J="",X=!1,Q=[],G=T$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=I$(G.styles),W=G5(Y);Y=W.code,Q=[...W.imports,...W.models];let{hasUserImports:q,bundleClientScript:z}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (u5(),d5)));if(q(Y))Y=await z(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let O=C9(Y);Y=O.code,J=L7(O.stxImports,O.browserImports.filter((V)=>!Q.includes(V)))}if(J=`${D$(Y,Z.serverData)}${J}`,Y=r0(Y),!X&&x1(Z.attrs||""))Y=f1(Y);let U=QG(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let O=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${V}>
727
+ ${$.map((Y,J)=>BG(Y,J)).join(`
728
+ `)}`}function P9($){let Z=[],Y=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),X=0,Q=J.length,G=0;while(G<Q){let K=J[G];if(K==="'"||K==='"'||K==="`"){let W=K;if(G++,W==="`"){let q=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&q===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){q++,G+=2;continue}if(J[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===W){G++;break}G++}continue}if(K==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
729
+ `)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let W=J.slice(G),q=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let j=q[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=q[0].length;continue}let z=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((j)=>{let B=j.trim(),_=B.indexOf(":"),H=_>=0?B.slice(_+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=z[0].length;continue}let U=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let j=U[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=U[0].length;continue}}G++}return Z}function OG($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(j){let B;while((B=Y.exec(j))!==null){let _=B[0];if(!HG.has(_))Z.add(_)}}let X=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=X.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)J(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)J(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)J(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);return Z}async function c5($,Z={}){let Y=$,J="",X=!1,Q=[],G=I$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=D$(G.styles),W=G5(Y);Y=W.code,Q=[...W.imports,...W.models];let{hasUserImports:q,bundleClientScript:z}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (m5(),u5)));if(q(Y))Y=await z(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let O=f9(Y);Y=O.code,J=w7(O.stxImports,O.browserImports.filter((F)=>!Q.includes(F)))}if(J=`${E$(Y,Z.serverData)}${J}`,Y=r0(Y),!X&&x1(Z.attrs||""))Y=f1(Y);let U=_G(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let O=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${F}>
730
730
  ${J}${Y}
731
731
  ${U}
732
- </script>`}let B=/\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|onMounted|onBeforeUnmount|onUnmounted|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),H=/function __stx_setup_/.test(Y),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(O){let V=O.length>0?`
733
- return { ${O.join(", ")} };`:"";return`${K}<script data-stx-scoped>
732
+ </script>`}let _=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|onMounted|onBeforeUnmount|onUnmounted|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),H=/function __stx_setup_/.test(Y),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(O){let F=O.length>0?`
733
+ return { ${O.join(", ")} };`:"";return`${K}<script data-stx-scoped data-stx-run="always">
734
734
  window.stx.mount(function() {
735
735
  'use strict';
736
736
  ${J}${Y}
737
- ${U}${V}
738
- })</script>`}if(!L&&!H){if(B)return F(b9($));if(Z.templateContent){let O=b9($);if(O.length>0){let V=KG(Z.templateContent);if(O.some((A)=>V.has(A)))return F(O)}}}return`${K}<script data-stx-scoped>
737
+ ${U}${F}
738
+ })</script>`}if(!L&&!H){if(_)return V(P9($));if(Z.templateContent){let O=P9($);if(O.length>0){let F=OG(Z.templateContent);if(O.some((A)=>F.has(A)))return V(O)}}}return`${K}<script data-stx-scoped data-stx-run="always">
739
739
  ;(function() {
740
740
  'use strict';
741
741
  ${J}${Y}
742
742
  ${U}
743
- })()</script>`}var lQ,rQ,S9,aQ,YG,GG;var c5=b(()=>{M0();h5();lQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;rQ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],S9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];aQ=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"]);YG={left:0,middle:1,right:2};GG=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});import{createHash as WG}from"crypto";function x9($){let Z=$[E$];return Z instanceof Map?Z:null}function f9($){$[E$]=new Map}function g9($,Z){let Y=x9($);if(!Y)return null;let J=WG("sha256").update(Z).digest("hex").slice(0,16),X=Y.get(J);if(X)X.instances++;else Y.set(J,{body:Z,instances:1});return J}function h9($,Z){let Y=x9(Z);if(!Y?.size)return $;let J=$;for(let[W,q]of Y){if(q.instances!==1)continue;let z=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(W)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(z,(U,j)=>`(${q.body})(${j});`)}let X=[...Y].filter(([,W])=>W.instances>1);if(X.length===0)return J;let G=`<script data-stx-scoped data-stx-component-factories>
743
+ })()</script>`}var eQ,QG,C9,GG,UG,HG;var i5=b(()=>{M0();d5();eQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;QG=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],C9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];GG=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"]);UG={left:0,middle:1,right:2};HG=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});import{createHash as LG}from"crypto";function h9($){let Z=$[k$];return Z instanceof Map?Z:null}function d9($){$[k$]=new Map}function u9($,Z){let Y=h9($);if(!Y)return null;let J=LG("sha256").update(Z).digest("hex").slice(0,16),X=Y.get(J);if(X)X.instances++;else Y.set(J,{body:Z,instances:1});return J}function m9($,Z){let Y=h9(Z);if(!Y?.size)return $;let J=$;for(let[W,q]of Y){if(q.instances!==1)continue;let z=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(W)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(z,(U,j)=>`(${q.body})(${j});`)}let X=[...Y].filter(([,W])=>W.instances>1);if(X.length===0)return J;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
744
744
  (function() {
745
745
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
746
- ${X.map(([W,q])=>` factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${q.body};`).join(`
746
+ ${X.map(([W,q])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${q.body}; }
747
+ catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(W)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
747
748
  `)}
748
749
  })();
749
750
  </script>`,K=J.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(K<0)return`${G}
750
751
  ${J}`;return`${J.slice(0,K)}${G}
751
- ${J.slice(K)}`}var E$="__stx_component_client_factories";var F7=()=>{};function jG($){let Z="",Y=null,J=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(J){J=!1;continue}if(Q==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&X+1<$.length&&$[X+1]==="{"){let G=1;X+=2;while(X<$.length&&G>0){if($[X]==="{")G++;else if($[X]==="}")G--;if(G>0)Z+=$[X],X++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function _G($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(zG.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&p9.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function BG($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!p9.has(J))continue;let X=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function k$($){let Z=$.trim(),Y=jG(Z);_G(Y,Z),BG(Z);for(let J of m9)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!u9.allowBracketNotation&&UG.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function HG($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||m9.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=V7(J);else Z[Y]=J}return Z}function V7($,Z=0){if(Z>=u9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>V7(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,X]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(X&&typeof X==="object")Y[J]=V7(X,Z+1);else Y[J]=X}return Y}function Z0($,Z){try{let Y=HG(Z),J=Object.keys(Y),X=Object.values(Y);return q0($,J)(...X)}catch{return}}function W0($){try{return k$($),!0}catch{return!1}}function T0($,Z){try{let Y=Z0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function q0($,Z){let Y=k$($),J=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let q=0;q<Z.length;q++){let z=Z[q];if(!J.test(z))continue;if(l9.has(z))continue;X.push(q),Q.push(z)}let G=(q)=>Function(...Q,...q,`
752
+ ${J.slice(K)}`}var k$="__stx_component_client_factories";var A7=()=>{};function AG($){let Z="",Y=null,J=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(J){J=!1;continue}if(Q==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&X+1<$.length&&$[X+1]==="{"){let G=1;X+=2;while(X<$.length&&G>0){if($[X]==="{")G++;else if($[X]==="}")G--;if(G>0)Z+=$[X],X++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function RG($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let X=J[0],Q=$[J.index-1];if(VG.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&i9.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function NG($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!i9.has(J))continue;let X=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function b$($){let Z=$.trim(),Y=AG(Z);RG(Y,Z),NG(Z);for(let J of c9)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!l9.allowBracketNotation&&wG.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function MG($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||c9.some((X)=>X.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=R7(J);else Z[Y]=J}return Z}function R7($,Z=0){if(Z>=l9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>R7(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,X]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(X&&typeof X==="object")Y[J]=R7(X,Z+1);else Y[J]=X}return Y}function Z0($,Z){try{let Y=MG(Z),J=Object.keys(Y),X=Object.values(Y);return q0($,J)(...X)}catch{return}}function W0($){try{return b$($),!0}catch{return!1}}function T0($,Z){try{let Y=Z0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function q0($,Z){let Y=b$($),J=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let q=0;q<Z.length;q++){let z=Z[q];if(!J.test(z))continue;if(n9.has(z))continue;X.push(q),Q.push(z)}let G=(q)=>Function(...Q,...q,`
752
753
  'use strict';
753
754
  try {
754
755
  return ${Y};
@@ -759,7 +760,7 @@ catch (e) {
759
760
  }
760
761
  throw e;
761
762
  }
762
- `),K=G([]);if(Q.length===Z.length)return d9(K,Q,G);return d9((...q)=>{let z=Array(X.length);for(let U=0;U<X.length;U++)z[U]=q[X[U]];return K(...z)},Q,G,(q)=>{K=G(q)})}function d9($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...q)=>{for(let z=0;z<=8;z++)try{return G(...q)}catch(U){let j=U instanceof Error?U.message:"",_=Q.exec(j);if(!(U instanceof ReferenceError)||!_)return;let B=_[1];if(W.has(B)||l9.has(B))return;W.add(B),K.push(B),G=Y(K),J?.(K)}return}}function b$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var qG,u9,m9,zG,p9,UG,l9;var A0=b(()=>{qG={maxSanitizeDepth:10,allowBracketNotation:!1},u9={...qG},m9=[/\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/],zG=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),p9=new Set(["__proto__","constructor","prototype"]),UG=/[\w)\]]\s*\[\s*['"]/;l9=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 S$($,Z){let Y=OG++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return LG.set(J,{type:$,expression:Z}),J}var OG=0,LG;var c9=b(()=>{LG=new Map});function r9($,Z,Y,J){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)return-1;J.lastIndex=Y.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function V1($,Z){return r9($,Z,i9,n9)}function K5($,Z){return r9($,Z,o9,s9)}function i5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function FG($,Z){if($.startsWith("<!--",Z)){let Y=i5($,Z);return Y===-1?$.length:Y}for(let[Y,J]of[[i9,n9],[o9,s9]]){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)continue;J.lastIndex=Y.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function w7($,Z){let Y=[],J=0,X=$.length,Q=!1,G=null;while(J<X){let K=$[J];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;J++;continue}if(K!=="<"){J++;continue}let W=Z($,J);if(W>J){Y.push({start:J,end:W,token:$.slice(J,W)}),J=W;continue}let q=FG($,J);if(q>J){J=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return Y}function J1($,Z,Y){let J=w7($,Z);if(J.length===0)return{output:$,tokens:[]};let X=J.map((K)=>K.token),Q="",G=0;for(let K=0;K<J.length;K++){let W=J[K];Q+=$.slice(G,W.start),Q+=Y(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function w1($){let{output:Z,tokens:Y}=J1($,V1,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function n5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var i9,n9,o9,s9;var g1=b(()=>{i9=/<script\b[^>]*>/iy,n9=/<\/script\s*>/ig,o9=/<style\b[^>]*>/iy,s9=/<\/style\s*>/ig});var Y8={};a(Y8,{usesSignalsInScript:()=>W5,unescapeHtml:()=>A7,registerFilters:()=>wG,registerFilter:()=>e9,processExpressions:()=>A1,interpolateScriptsInTemplate:()=>RG,interpolateScriptExpressions:()=>y$,getAllFilters:()=>$8,evaluateExpression:()=>i0,escapeHtml:()=>a0,defaultFilters:()=>s5,clearCustomFilters:()=>AG,applyFilters:()=>Z8});function VG($){let Z=a9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),a9.set($,Z)}return Z.lastIndex=0,Z}function e9($,Z){if($ in s5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);o5[$]=Z}function wG($){for(let[Z,Y]of Object.entries($))e9(Z,Y)}function $8(){return{...s5,...o5}}function AG(){for(let $ of Object.keys(o5))delete o5[$]}function a0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function W5($){let{scripts:Z}=w1($);for(let Y of Z){let J=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let X=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function t9($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let q=0;q<J.length;q++){let z=J[q];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&J[q+1]==="{"){G++,q++,X+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){X+=z;continue}continue}X+=z}J=X;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=K.exec(J))!==null){let q=W[1];if(!J.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(q)&&!(q in Z))return!1}}return!0}function y$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=i0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=i0(X,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function RG($,Z,Y={}){let{output:J,scripts:X}=w1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!K||!W||q===-1)return G;let z=K[1],U=K[2];if(/\bsrc\s*=/.test(z))return G;if(/\bdata-raw\b/.test(z))return G;if(/\btype\s*=\s*["']application\/json["']/.test(z))return G;if(Y.skipServer&&/\bserver\b/.test(z))return G;let j=y$(U,Z);return W[0]+j+G.slice(q)});return n5(J,Q)}function A1($,Z,Y,J){let X=$,Q=(j,_)=>{let B=K5(j,_);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(j.slice(_,B))?-1:B},G=(j,_,B,H)=>{let L=B.length,{output:F,tokens:O}=J1(j,_,(V,w)=>H(L+w));return B.push(...O),F},K=[];X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`);let W=[];X=G(X,V1,W,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`);let q=J?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||W5($),z=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(j,_,B)=>{try{let H=i0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return U0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,B,j)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(j,_,B)=>{try{let H=i0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return S$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return S$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return U0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,B,j)}}),X=G(X,V1,W,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`),X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(j,_,B)=>{let H=_.trim();if(U.has(H))return j;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],w=V&&((V in Z)||L.includes(V)),A=Boolean(V&&z.has(V)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(R),M=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let T=i0(_,Z);if(A)return j;if(q&&!t9(H,Z))return j;if(T===void 0&&Z.__stx_buildMode==="compile"&&!q)return S$("expr",H);return T!==void 0&&T!==null?a0(String(T)):""}catch(T){if(A)return j;if(q&&!t9(H,Z))return j;if(M)return j;let I=T instanceof Error?T.message:String(T);return U0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,B,j)}});for(let j=0;j<W.length;j++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${j}__-->`,()=>W[j]);for(let j=0;j<K.length;j++)X=X.replace(`<!--__STX_STYLE_${j}__-->`,()=>K[j]);return X}function Z8($,Z,Y){if(!Z.trim())return $;let J=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=o5[G]||s5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys($8()).join(", ")}`);let W=[];if(X.startsWith(":")){let q=X.match(/^:([^|\s]+)/);if(q){let z=q[1].trim();try{let U=Number(z);W=[Number.isNaN(U)?z:U]}catch{W=[z]}X=X.substring(q[0].length).trim()}}else if(X.startsWith("(")){let q=1,z=1;while(q>0&&z<X.length){if(X[z]==="(")q++;if(X[z]===")")q--;z++}if(q===0){let U=X.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[i0(`(${U})`,Y,!0)];else{let j=[],_="",B=null,H=0,L=0,F=0,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(B){if(_+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){j.push(_),_="";continue}_+=w}if(_)j.push(_);W=j.map((V)=>{let w=V.trim();return i0(w,Y,!0)})}}catch{W=[U]}X=X.substring(z).trim()}}try{J=K(J,Y,...W)}catch(q){let z=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${z}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function NG($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],q=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&q==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>0)K++}continue}if(Z)continue;if(W==="(")J++;else if(W===")")J--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&J===0&&X===0&&Q===0){if(q==="|"){K++;continue}if(q==="="){K++;continue}return K}}return-1}function i0($,Z,Y=!1){try{let J=$.trim(),X=NG(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=i0(Q,Z,!0);return Z8(K,G,Z)}if(!W0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return Z0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return q0(J,Q)(...G)}catch{return Z0(J,Z)}}catch(J){if(J instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(J.message);if(X){let Q=X[1],G=MG(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function MG($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=TG($,X);if(Y===null||Q<Y.dist)Y={key:X,dist:Q}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function TG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],X=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)X[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function A7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var o5,a9,s5;var X1=b(()=>{A0();M0();c9();g1();o5={},a9=new Map;s5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return a0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(Y).forEach(([W,q])=>{K=K.replace(VG(W),String(q))}),K},t:($,Z,Y={})=>{return s5.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=Y)return X;if(Y<=J.length)return J.substring(0,Y);return X.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return X.toISOString();return new Intl.DateTimeFormat(J,Q[Y]||Q.short).format(X)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(X)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let X=Number($);if(Number.isNaN(X))return Y;let Q=J||`${Y}s`;return X===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let X=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let X=10**Y;return Math.round(J*X)/X}}});function q5($="const",Z=[],Y){let J=Z.length?P$.filter((X)=>!Z.includes(X)):P$;if(Y!==void 0)J=J.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${J.join(", ")} } = window.stx;`}var P$,J8;var r5=b(()=>{P$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],J8=["onMount","onDestroy"]});class h1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function U5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!z5.has(Y)){if(z5.size>=IG){let J=z5.keys().next().value;if(J)z5.delete(J)}z5.set(Y,new RegExp($,Z))}return z5.get(Y)}class X8{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let q=`${Y}:${W}`,z=X.get(q);if(!z){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}z=Function(...Z,`
763
+ `),K=G([]);if(Q.length===Z.length)return p9(K,Q,G);return p9((...q)=>{let z=Array(X.length);for(let U=0;U<X.length;U++)z[U]=q[X[U]];return K(...z)},Q,G,(q)=>{K=G(q)})}function p9($,Z,Y,J){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...q)=>{for(let z=0;z<=8;z++)try{return G(...q)}catch(U){let j=U instanceof Error?U.message:"",B=Q.exec(j);if(!(U instanceof ReferenceError)||!B)return;let _=B[1];if(W.has(_)||n9.has(_))return;W.add(_),K.push(_),G=Y(K),J?.(K)}return}}function S$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var FG,l9,c9,VG,i9,wG,n9;var A0=b(()=>{FG={maxSanitizeDepth:10,allowBracketNotation:!1},l9={...FG},c9=[/\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/],VG=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),i9=new Set(["__proto__","constructor","prototype"]),wG=/[\w)\]]\s*\[\s*['"]/;n9=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 y$($,Z){let Y=TG++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return IG.set(J,{type:$,expression:Z}),J}var TG=0,IG;var o9=b(()=>{IG=new Map});function e9($,Z,Y,J){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)return-1;J.lastIndex=Y.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function V1($,Z){return e9($,Z,s9,r9)}function K5($,Z){return e9($,Z,a9,t9)}function n5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function DG($,Z){if($.startsWith("<!--",Z)){let Y=n5($,Z);return Y===-1?$.length:Y}for(let[Y,J]of[[s9,r9],[a9,t9]]){Y.lastIndex=Z;let X=Y.exec($);if(!X||X.index!==Z)continue;J.lastIndex=Y.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function N7($,Z){let Y=[],J=0,X=$.length,Q=!1,G=null;while(J<X){let K=$[J];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;J++;continue}if(K!=="<"){J++;continue}let W=Z($,J);if(W>J){Y.push({start:J,end:W,token:$.slice(J,W)}),J=W;continue}let q=DG($,J);if(q>J){J=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return Y}function J1($,Z,Y){let J=N7($,Z);if(J.length===0)return{output:$,tokens:[]};let X=J.map((K)=>K.token),Q="",G=0;for(let K=0;K<J.length;K++){let W=J[K];Q+=$.slice(G,W.start),Q+=Y(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function w1($){let{output:Z,tokens:Y}=J1($,V1,(J,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:Y}}function o5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var s9,r9,a9,t9;var g1=b(()=>{s9=/<script\b[^>]*>/iy,r9=/<\/script\s*>/ig,a9=/<style\b[^>]*>/iy,t9=/<\/style\s*>/ig});var Q8={};a(Q8,{usesSignalsInScript:()=>W5,unescapeHtml:()=>vG,registerFilters:()=>kG,registerFilter:()=>Y8,processExpressions:()=>A1,interpolateScriptsInTemplate:()=>SG,interpolateScriptExpressions:()=>P$,getAllFilters:()=>J8,evaluateExpression:()=>i0,escapeHtml:()=>a0,defaultFilters:()=>r5,clearCustomFilters:()=>bG,applyFilters:()=>X8});function EG($){let Z=$8.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),$8.set($,Z)}return Z.lastIndex=0,Z}function Y8($,Z){if($ in r5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);s5[$]=Z}function kG($){for(let[Z,Y]of Object.entries($))Y8(Z,Y)}function J8(){return{...r5,...s5}}function bG(){for(let $ of Object.keys(s5))delete s5[$]}function a0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function W5($){let{scripts:Z}=w1($);for(let Y of Z){let J=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let X=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function Z8($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let q=0;q<J.length;q++){let z=J[q];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&J[q+1]==="{"){G++,q++,X+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){X+=z;continue}continue}X+=z}J=X;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=K.exec(J))!==null){let q=W[1];if(!J.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(q)&&!(q in Z))return!1}}return!0}function P$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=i0(X,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=i0(X,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function SG($,Z,Y={}){let{output:J,scripts:X}=w1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!K||!W||q===-1)return G;let z=K[1],U=K[2];if(/\bsrc\s*=/.test(z))return G;if(/\bdata-raw\b/.test(z))return G;if(/\btype\s*=\s*["']application\/json["']/.test(z))return G;if(Y.skipServer&&/\bserver\b/.test(z))return G;let j=P$(U,Z);return W[0]+j+G.slice(q)});return o5(J,Q)}function A1($,Z,Y,J){let X=$,Q=(j,B)=>{let _=K5(j,B);if(_===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(j.slice(B,_))?-1:_},G=(j,B,_,H)=>{let L=_.length,{output:V,tokens:O}=J1(j,B,(F,w)=>H(L+w));return _.push(...O),V},K=[];X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`);let W=[];X=G(X,V1,W,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`);let q=J?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||W5($),z=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(j,B,_)=>{try{let H=i0(B,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return U0("Expression",`Error evaluating: {{{ ${B.trim()}}}}: ${L}`,Y,$,_,j)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(j,B,_)=>{try{let H=i0(B,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return y$("raw",B.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return y$("raw",B.trim());let L=H instanceof Error?H.message:String(H);return U0("Expression",`Error evaluating: {!! ${B.trim()} !!}: ${L}`,Y,$,_,j)}}),X=G(X,V1,W,(j)=>`<!--__STX_SCRIPT_EXPR_${j}__-->`),X=G(X,Q,K,(j)=>`<!--__STX_STYLE_${j}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(j,B,_)=>{let H=B.trim();if(U.has(H))return j;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=H.match(V)?.[1],w=F&&((F in Z)||L.includes(F)),A=Boolean(F&&z.has(F)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(R),T=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=i0(B,Z);if(A)return j;if(q&&!Z8(H,Z))return j;if(M===void 0&&Z.__stx_buildMode==="compile"&&!q)return y$("expr",H);return M!==void 0&&M!==null?a0(String(M)):""}catch(M){if(A)return j;if(q&&!Z8(H,Z))return j;if(T)return j;let I=M instanceof Error?M.message:String(M);return U0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,_,j)}});for(let j=0;j<W.length;j++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${j}__-->`,()=>W[j]);for(let j=0;j<K.length;j++)X=X.replace(`<!--__STX_STYLE_${j}__-->`,()=>K[j]);return X}function X8($,Z,Y){if(!Z.trim())return $;let J=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=s5[G]||r5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(J8()).join(", ")}`);let W=[];if(X.startsWith(":")){let q=X.match(/^:([^|\s]+)/);if(q){let z=q[1].trim();try{let U=Number(z);W=[Number.isNaN(U)?z:U]}catch{W=[z]}X=X.substring(q[0].length).trim()}}else if(X.startsWith("(")){let q=1,z=1;while(q>0&&z<X.length){if(X[z]==="(")q++;if(X[z]===")")q--;z++}if(q===0){let U=X.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[i0(`(${U})`,Y,!0)];else{let j=[],B="",_=null,H=0,L=0,V=0,O=!1;for(let F=0;F<U.length;F++){let w=U[F];if(O){B+=w,O=!1;continue}if(w==="\\"){B+=w,O=!0;continue}if(_){if(B+=w,w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w,B+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&H===0&&L===0&&V===0){j.push(B),B="";continue}B+=w}if(B)j.push(B);W=j.map((F)=>{let w=F.trim();return i0(w,Y,!0)})}}catch{W=[U]}X=X.substring(z).trim()}}try{J=K(J,Y,...W)}catch(q){let z=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${z}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return J}function yG($){let Z=!1,Y="",J=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],q=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&q==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>0)K++}continue}if(Z)continue;if(W==="(")J++;else if(W===")")J--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&J===0&&X===0&&Q===0){if(q==="|"){K++;continue}if(q==="="){K++;continue}return K}}return-1}function i0($,Z,Y=!1){try{let J=$.trim(),X=yG(J);if(X>0){let Q=J.substring(0,X).trim(),G=J.substring(X+1).trim(),K=i0(Q,Z,!0);return X8(K,G,Z)}if(!W0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return Z0(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return q0(J,Q)(...G)}catch{return Z0(J,Z)}}catch(J){if(J instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(J.message);if(X){let Q=X[1],G=PG(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function PG($,Z){let Y=null;for(let X of Z){if(X===$)continue;let Q=CG($,X);if(Y===null||Q<Y.dist)Y={key:X,dist:Q}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function CG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],X=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)X[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===J[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=Y.length;K++)X[K]=Q[K]}return X[Y.length]}function vG($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var s5,$8,r5;var X1=b(()=>{A0();M0();o9();g1();s5={},$8=new Map;r5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return a0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(Y).forEach(([W,q])=>{K=K.replace(EG(W),String(q))}),K},t:($,Z,Y={})=>{return r5.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=Y)return X;if(Y<=J.length)return J.substring(0,Y);return X.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return X.toISOString();return new Intl.DateTimeFormat(J,Q[Y]||Q.short).format(X)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(X)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let X=Number($);if(Number.isNaN(X))return Y;let Q=J||`${Y}s`;return X===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let X=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let X=10**Y;return Math.round(J*X)/X}}});function q5($="const",Z=[],Y){let J=Z.length?C$.filter((X)=>!Z.includes(X)):C$;if(Y!==void 0)J=J.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${J.join(", ")} } = window.stx;`}var C$,G8;var a5=b(()=>{C$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],G8=["onMount","onDestroy"]});class h1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function U5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!z5.has(Y)){if(z5.size>=xG){let J=z5.keys().next().value;if(J)z5.delete(J)}z5.set(Y,new RegExp($,Z))}return z5.get(Y)}class K8{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let q=`${Y}:${W}`,z=X.get(q);if(!z){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}z=Function(...Z,`
763
764
  'use strict';
764
765
  try {
765
766
  return ${W};
@@ -770,33 +771,33 @@ catch (e) {
770
771
  }
771
772
  throw e;
772
773
  }
773
- `),X.set(q,z)}return z(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class Q8{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,X=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:X};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(G)}catch{}let K=X?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let Z={};for(let[Y,J]of this.metrics.entries()){let X=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:X?.maxTime,budgetUtilization:X?J.totalTime/J.count/X.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function DG(){if(!R7)R7=new Q8;return R7}var z5,IG=500,EH,R7=null,G8;var j5=b(()=>{z5=new Map;EH=new X8;G8=new Proxy({},{get($,Z){return DG()[Z]}})});function K8($,Z=""){let Y=`${$}${Z}`,J=0;for(let X=0;X<Y.length;X++){let Q=Y.charCodeAt(X);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function W8($,Z,Y={}){let{prefix:J="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=N7($),W=[],q=new Map;if(Q)for(let z of K){let U=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let j=U[1],_=`${Z}_${j}`;q.set(j,_)}}for(let z of K){let U=q8(z,Z,J,X,q,G);W.push(U)}return W.join(`
774
+ `),X.set(q,z)}return z(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class W8{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),X=performance.now()-Y;return this.recordTime($,X),this.checkBudget($,X),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,X=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!X&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:X};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(G)}catch{}let K=X?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let Z={};for(let[Y,J]of this.metrics.entries()){let X=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:X?.maxTime,budgetUtilization:X?J.totalTime/J.count/X.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function fG(){if(!M7)M7=new W8;return M7}var z5,xG=500,uH,M7=null,q8;var j5=b(()=>{z5=new Map;uH=new K8;q8=new Proxy({},{get($,Z){return fG()[Z]}})});function z8($,Z=""){let Y=`${$}${Z}`,J=0;for(let X=0;X<Y.length;X++){let Q=Y.charCodeAt(X);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function U8($,Z,Y={}){let{prefix:J="",preserveHost:X=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=T7($),W=[],q=new Map;if(Q)for(let z of K){let U=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let j=U[1],B=`${Z}_${j}`;q.set(j,B)}}for(let z of K){let U=j8(z,Z,J,X,q,G);W.push(U)}return W.join(`
774
775
 
775
- `)}function N7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,X="",Q=!1,G="";for(let K=0;K<Y.length;K++){let W=Y[K];if(W==="@"&&J===0)Q=!0;if(W==="{")J++;else if(W==="}"){if(J--,J===0){if(Q){G+=W;let q=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(q){let[,z,U,j]=q;if(z==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:j.trim()});else if(z==="media"||z==="supports"||z==="container"){let _=N7(j);Z.push({selector:`@${z} ${U.trim()}`,declarations:_.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
776
- `)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(X.trim()){X+=W;let q=X.match(/([^{]+)\{([^}]*)\}/);if(q)Z.push({selector:q[1].trim(),declarations:q[2].trim()});X=""}continue}}if(Q)G+=W;else X+=W}return Z}function q8($,Z,Y,J,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=N7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>q8(j,Z,Y,J,X,Q)).join(`
776
+ `)}function T7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,X="",Q=!1,G="";for(let K=0;K<Y.length;K++){let W=Y[K];if(W==="@"&&J===0)Q=!0;if(W==="{")J++;else if(W==="}"){if(J--,J===0){if(Q){G+=W;let q=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(q){let[,z,U,j]=q;if(z==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:j.trim()});else if(z==="media"||z==="supports"||z==="container"){let B=T7(j);Z.push({selector:`@${z} ${U.trim()}`,declarations:B.map((_)=>`${_.selector} { ${_.declarations} }`).join(`
777
+ `)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(X.trim()){X+=W;let q=X.match(/([^{]+)\{([^}]*)\}/);if(q)Z.push({selector:q[1].trim(),declarations:q[2].trim()});X=""}continue}}if(Q)G+=W;else X+=W}return Z}function j8($,Z,Y,J,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=T7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>j8(j,Z,Y,J,X,Q)).join(`
777
778
  `);return`${G} {
778
779
  ${U}
779
- }`}return`${G} { ${K} }`}let W=EG(G,Z,Y,J),q=K;for(let[z,U]of X)q=q.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(Q)q=q.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${q} }`}function EG($,Z,Y,J){let X=$.split(",").map((G)=>G.trim()),Q=[];for(let G of X){if(G.startsWith(":host")){if(J)Q.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(q)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let W=kG(G,Z);if(W)Q.push(Y?`${Y} ${W}`:W)}return Q.join(", ")}function kG($,Z){let Y=0,J=$.length;for(let W=0;W<$.length;W++){let q=$[W];if(q==="["||q==="(")Y++;else if(q==="]"||q===")")Y--;else if(Y===0&&(q===" "||q===">"||q==="+"||q==="~")){J=W;break}}let X=$.slice(0,J),Q=$.slice(J);if(!X)return"";let G=X.length,K=0;for(let W=0;W<X.length;W++){let q=X[W];if(q==="["||q==="(")K++;else if(q==="]"||q===")")K--;else if(Y===0&&K===0&&q===":"){G=W;break}}return`${X.slice(0,G)}.${Z}${X.slice(G)}${Q}`}function U8($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let J=Y.trim();if(Z.has(J))return"";return Z.add(J),Y})}function C$($,Z){if(!bG.test($))return{html:$,hasScoped:!1};let Y=K8(Z),J=`data-v-${Y}`,X=$,Q=new RegExp(`<style\\s+([^>]*${M7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,W,q)=>{G=!0;let z=SG(q,J),U=W.replace(new RegExp(M7,"gi"),"").trim(),j=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${j}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return X=PG(X,J),{html:X,hasScoped:!0}}function SG($,Z){return W8($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function PG($,Z){let Y=J1($,(X,Q)=>{let G=V1(X,Q);return G>Q?G:K5(X,Q)},(X,Q)=>yG(Q)),J=CG(Y.output,Z);return z8.lastIndex=0,J.replace(z8,(X,Q)=>Y.tokens[Number(Q)])}function CG($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,X,Q)=>{if(Y.has(X.toLowerCase()))return J;if(J.includes(Z))return J;if(X.toLowerCase()==="style"||X.toLowerCase()==="script")return J;if(Q)return J.replace(`<${X}${Q}`,`<${X} ${Z}${Q}`);if(J.endsWith("/>"))return`<${X} ${Z} />`;return`<${X} ${Z}>`})}var M7,bG,yG=($)=>`\x00stx-scope-mask-${$}\x00`,z8;var T7=b(()=>{g1();M7=String.raw`(?<![\w-])scoped(?![\w-])`,bG=new RegExp(`<style\\s+[^>]*${M7}`,"i");z8=/\u0000stx-scope-mask-(\d+)\u0000/g});function xG($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return vG.test(Z)}function v$($){a5.lastIndex=0;let Z;while((Z=a5.exec($))!==null){if(Z[0].startsWith("</")||xG(Z[0]))continue;let Y=Z.index,J=a5.lastIndex,X=1,Q;while((Q=a5.exec($))!==null)if(Q[0].startsWith("</")){if(X--,X===0){let G=Q.index;return{start:Y,openEnd:J,closeStart:G,end:a5.lastIndex,content:$.slice(J,G)}}}else X++;return null}return null}var a5,vG;var I7=b(()=>{a5=/<\/?template\b[^>]*>/gi,vG=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var j8=()=>{};function f0($,Z,Y,J=0){let X=0,Q=J,G=null,K=0,W=!1;while(Q<$.length){let q=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&q==="\\"){W=!0,Q++;continue}if(W=!1,(q==='"'||q==="'"||q==="`")&&!G){G=q,Q++;continue}if(q===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&q==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&q==="}"){K--,Q++;continue}if(q==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(q===Z)X++;else if(q===Y){if(X--,X===0)return Q}Q++}return-1}var k7={};a(k7,{useTitle:()=>uG,useSeoMeta:()=>_8,usePageTitle:()=>uG,useHead:()=>E7,seoMetaToHeadConfig:()=>f$,resetHead:()=>hG,renderHtmlAttrs:()=>pG,renderHead:()=>mG,renderBodyAttrs:()=>lG,processTitleDirective:()=>nG,processMetaDirective:()=>oG,processHeadDirective:()=>iG,mergeHeadConfigs:()=>_5,getPageMeta:()=>gG,getHead:()=>D7,definePageMeta:()=>dG,applyHead:()=>cG});function D7(){return R1}function gG(){return x$}function hG(){R1={},fG.length=0,x$={}}function E7($){R1=_5(R1,$)}function _5($,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 _8($){E7(f$($))}function f$($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let W=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:W})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(J)Z.push({property:"og:description",content:J});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let X=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(X)Z.push({name:"twitter:title",content:X});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let W of $.articleTags)Z.push({property:"article:tag",content:W});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function dG($){if(x$={...x$,...$},$.title||$.description)_8({title:$.title,description:$.description})}function uG($){let Z=typeof $==="function"?$():$;E7({title:Z})}function mG($=R1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${d1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,X])=>`${J}="${d1(X)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>{return`${X==="httpEquiv"?"http-equiv":X}="${d1(String(Q))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>`${X}="${d1(String(Q))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...X}=Y,Q=Object.entries(X).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${d1(String(K))}"`}).filter(Boolean).join(" ");if(J)Z.push(`<script ${Q}>${J}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let J=Y.type?` type="${Y.type}"`:"";Z.push(`<style${J}>${Y.content}</style>`)}return Z.join(`
780
- `)}function pG($=R1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${d1(Y)}"`).join(" ")}function lG($=R1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${d1(Y)}"`).join(" ")}function d1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function cG($=R1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),Z.name)J.setAttribute("name",Z.name);if(Z.property)J.setAttribute("property",Z.property);document.head.appendChild(J)}J.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[X,Q]of Object.entries(Z))if(Q!==void 0)J.setAttribute(X,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function iG($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,X)=>{return Z+=X.trim()+`
781
- `,""}),headContent:Z.trim()}}function nG($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,X,Q)=>{let G=J?X:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=_5(K,{title:G}),""})}function oG($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,X,Q,G,K)=>{let W=Q?G:K,q=Q?W:Z[(W||"").trim()]??W,U=X.includes(":")?{property:X,content:q}:{name:X,content:q},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=_5(j,{meta:[U]}),""})}var R1,fG,x$;var t5=b(()=>{R1={},fG=[],x$={}});var g$={};a(g$,{stripTypeScript:()=>F8,splitDeclaration:()=>R8,isCompleteImport:()=>V8,hasVariables:()=>T8,extractVariables:()=>u1,extractScriptFromTemplate:()=>M8,convertToCommonJS:()=>S7});import N1 from"path";import B5 from"process";function sG($){let Z=[],Y=0,J=$.split(`
782
- `);for(let X of J){let Q=Y,G=null,K=!1;for(let W=0;W<X.length;W++){let q=X[W];if(K){K=!1;continue}if(q==="\\"){K=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&W+1<X.length&&X[W+1]==="/")break;if(q==="{")Y++;else if(q==="}")Y--}if(Q===0){let W=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let q=X.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let U=q[1].slice(1,-1).split(",").map((j)=>{let _=j.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...U)}}}}return[...new Set(Z)]}function F8($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(J){if(!J.includes(":"))return J;let X=[],Q="",G=0,K=0,W=null;for(let q=0;q<J.length;q++){let z=J[q];if(W){if(Q+=z,z===W)W=null;continue}if(z==='"'||z==="'"||z==="`"){W=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")K++;else if(z===")")K--;if(z===","&&G===0&&K===0){X.push(Q),Q="";continue}Q+=z}if(Q)X.push(Q);return X.map((q)=>{let z=q.trim(),U=z.startsWith("..."),j=U?z.slice(3):z,_=-1,B=0;for(let A=0;A<j.length;A++)if(j[A]==="<")B++;else if(j[A]===">")B--;else if(j[A]===":"&&B===0){_=A;break}if(_===-1)return q;let L=j.substring(0,_).trim().replace(/\?$/,""),F=j.substring(_+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,X,Q)=>{if(!Q.includes(":"))return J;return`${X}(${Y(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,X,Q=[];while((X=J.exec(Z))!==null){let G=X.index+X[0].length-1,K=1,W=G+1,q=0,z=null;while(W<Z.length&&K>0){let _=Z[W];if(z){if(_===z)z=null;W++;continue}if(_==='"'||_==="'"||_==="`"){z=_,W++;continue}if(_==="<")q++;else if(_===">"&&q>0)q--;else if(q===0){if(_==="(")K++;else if(_===")")K--}if(K>0)W++}if(K!==0)continue;let U=Z.substring(G+1,W);if(!U.includes(":"))continue;let j=Y(U);Q.push({start:G+1,end:W,replacement:j})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Z=Z.substring(0,K)+q+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,X)=>{if(!X.includes(":"))return J;if(X.includes("{")||X.includes("}"))return J;return`(${X.split(",").map((G)=>{let[K,...W]=G.split("="),q=K.split(":")[0].trim();if(W.length>0)return`${q} = ${W.join("=").trim()}`;return q}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
780
+ }`}return`${G} { ${K} }`}let W=gG(G,Z,Y,J),q=K;for(let[z,U]of X)q=q.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(Q)q=q.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${q} }`}function gG($,Z,Y,J){let X=$.split(",").map((G)=>G.trim()),Q=[];for(let G of X){if(G.startsWith(":host")){if(J)Q.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(q)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let W=hG(G,Z);if(W)Q.push(Y?`${Y} ${W}`:W)}return Q.join(", ")}function hG($,Z){let Y=0,J=$.length;for(let W=0;W<$.length;W++){let q=$[W];if(q==="["||q==="(")Y++;else if(q==="]"||q===")")Y--;else if(Y===0&&(q===" "||q===">"||q==="+"||q==="~")){J=W;break}}let X=$.slice(0,J),Q=$.slice(J);if(!X)return"";let G=X.length,K=0;for(let W=0;W<X.length;W++){let q=X[W];if(q==="["||q==="(")K++;else if(q==="]"||q===")")K--;else if(Y===0&&K===0&&q===":"){G=W;break}}return`${X.slice(0,G)}.${Z}${X.slice(G)}${Q}`}function _8($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let J=Y.trim();if(Z.has(J))return"";return Z.add(J),Y})}function v$($,Z){if(!dG.test($))return{html:$,hasScoped:!1};let Y=z8(Z),J=`data-v-${Y}`,X=$,Q=new RegExp(`<style\\s+([^>]*${I7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,W,q)=>{G=!0;let z=uG(q,J),U=W.replace(new RegExp(I7,"gi"),"").trim(),j=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${j}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return X=pG(X,J),{html:X,hasScoped:!0}}function uG($,Z){return U8($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function pG($,Z){let Y=J1($,(X,Q)=>{let G=V1(X,Q);return G>Q?G:K5(X,Q)},(X,Q)=>mG(Q)),J=lG(Y.output,Z);return B8.lastIndex=0,J.replace(B8,(X,Q)=>Y.tokens[Number(Q)])}function lG($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,X,Q)=>{if(Y.has(X.toLowerCase()))return J;if(J.includes(Z))return J;if(X.toLowerCase()==="style"||X.toLowerCase()==="script")return J;if(Q)return J.replace(`<${X}${Q}`,`<${X} ${Z}${Q}`);if(J.endsWith("/>"))return`<${X} ${Z} />`;return`<${X} ${Z}>`})}var I7,dG,mG=($)=>`\x00stx-scope-mask-${$}\x00`,B8;var D7=b(()=>{g1();I7=String.raw`(?<![\w-])scoped(?![\w-])`,dG=new RegExp(`<style\\s+[^>]*${I7}`,"i");B8=/\u0000stx-scope-mask-(\d+)\u0000/g});function iG($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return cG.test(Z)}function x$($){t5.lastIndex=0;let Z;while((Z=t5.exec($))!==null){if(Z[0].startsWith("</")||iG(Z[0]))continue;let Y=Z.index,J=t5.lastIndex,X=1,Q;while((Q=t5.exec($))!==null)if(Q[0].startsWith("</")){if(X--,X===0){let G=Q.index;return{start:Y,openEnd:J,closeStart:G,end:t5.lastIndex,content:$.slice(J,G)}}}else X++;return null}return null}var t5,cG;var E7=b(()=>{t5=/<\/?template\b[^>]*>/gi,cG=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var H8=()=>{};function f0($,Z,Y,J=0){let X=0,Q=J,G=null,K=0,W=!1;while(Q<$.length){let q=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&q==="\\"){W=!0,Q++;continue}if(W=!1,(q==='"'||q==="'"||q==="`")&&!G){G=q,Q++;continue}if(q===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&q==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&q==="}"){K--,Q++;continue}if(q==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(q===Z)X++;else if(q===Y){if(X--,X===0)return Q}Q++}return-1}var S7={};a(S7,{useTitle:()=>aG,useSeoMeta:()=>O8,usePageTitle:()=>aG,useHead:()=>b7,seoMetaToHeadConfig:()=>g$,resetHead:()=>sG,renderHtmlAttrs:()=>eG,renderHead:()=>tG,renderBodyAttrs:()=>$K,processTitleDirective:()=>JK,processMetaDirective:()=>XK,processHeadDirective:()=>YK,mergeHeadConfigs:()=>B5,getPageMeta:()=>oG,getHead:()=>k7,definePageMeta:()=>rG,applyHead:()=>ZK});function k7(){return R1}function oG(){return f$}function sG(){R1={},nG.length=0,f$={}}function b7($){R1=B5(R1,$)}function B5($,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 O8($){b7(g$($))}function g$($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let W=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:W})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(J)Z.push({property:"og:description",content:J});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let X=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(X)Z.push({name:"twitter:title",content:X});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let W of $.articleTags)Z.push({property:"article:tag",content:W});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function rG($){if(f$={...f$,...$},$.title||$.description)O8({title:$.title,description:$.description})}function aG($){let Z=typeof $==="function"?$():$;b7({title:Z})}function tG($=R1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${d1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,X])=>`${J}="${d1(X)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>{return`${X==="httpEquiv"?"http-equiv":X}="${d1(String(Q))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>`${X}="${d1(String(Q))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...X}=Y,Q=Object.entries(X).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${d1(String(K))}"`}).filter(Boolean).join(" ");if(J)Z.push(`<script ${Q}>${J}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let J=Y.type?` type="${Y.type}"`:"";Z.push(`<style${J}>${Y.content}</style>`)}return Z.join(`
781
+ `)}function eG($=R1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${d1(Y)}"`).join(" ")}function $K($=R1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${d1(Y)}"`).join(" ")}function d1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function ZK($=R1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),Z.name)J.setAttribute("name",Z.name);if(Z.property)J.setAttribute("property",Z.property);document.head.appendChild(J)}J.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[X,Q]of Object.entries(Z))if(Q!==void 0)J.setAttribute(X,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))if(Z==="class")for(let J of String(Y).split(/\s+/).filter(Boolean))document.documentElement.classList.add(J);else document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function YK($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,X)=>{return Z+=X.trim()+`
782
+ `,""}),headContent:Z.trim()}}function JK($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,X,Q)=>{let G=J?X:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=B5(K,{title:G}),""})}function XK($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,X,Q,G,K)=>{let W=Q?G:K,q=Q?W:Z[(W||"").trim()]??W,U=X.includes(":")?{property:X,content:q}:{name:X,content:q},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=B5(j,{meta:[U]}),""})}var R1,nG,f$;var e5=b(()=>{R1={},nG=[],f$={}});var h$={};a(h$,{stripTypeScript:()=>A8,splitDeclaration:()=>I8,isModuleResolutionFailure:()=>R8,isCompleteImport:()=>N8,hasVariables:()=>k8,extractVariables:()=>u1,extractScriptFromTemplate:()=>E8,convertToCommonJS:()=>P7});import N1 from"path";import _5 from"process";function QK($){let Z=[],Y=0,J=$.split(`
783
+ `);for(let X of J){let Q=Y,G=null,K=!1;for(let W=0;W<X.length;W++){let q=X[W];if(K){K=!1;continue}if(q==="\\"){K=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&W+1<X.length&&X[W+1]==="/")break;if(q==="{")Y++;else if(q==="}")Y--}if(Q===0){let W=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let q=X.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let U=q[1].slice(1,-1).split(",").map((j)=>{let B=j.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...U)}}}}return[...new Set(Z)]}function A8($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(J){if(!J.includes(":"))return J;let X=[],Q="",G=0,K=0,W=null;for(let q=0;q<J.length;q++){let z=J[q];if(W){if(Q+=z,z===W)W=null;continue}if(z==='"'||z==="'"||z==="`"){W=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")K++;else if(z===")")K--;if(z===","&&G===0&&K===0){X.push(Q),Q="";continue}Q+=z}if(Q)X.push(Q);return X.map((q)=>{let z=q.trim(),U=z.startsWith("..."),j=U?z.slice(3):z,B=-1,_=0;for(let A=0;A<j.length;A++)if(j[A]==="<")_++;else if(j[A]===">")_--;else if(j[A]===":"&&_===0){B=A;break}if(B===-1)return q;let L=j.substring(0,B).trim().replace(/\?$/,""),V=j.substring(B+1),O=-1,F=0;for(let A=0;A<V.length;A++)if(V[A]==="<")F++;else if(V[A]===">")F--;else if(V[A]==="="&&F===0){O=A;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${V.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,X,Q)=>{if(!Q.includes(":"))return J;return`${X}(${Y(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,X,Q=[];while((X=J.exec(Z))!==null){let G=X.index+X[0].length-1,K=1,W=G+1,q=0,z=null;while(W<Z.length&&K>0){let B=Z[W];if(z){if(B===z)z=null;W++;continue}if(B==='"'||B==="'"||B==="`"){z=B,W++;continue}if(B==="<")q++;else if(B===">"&&q>0)q--;else if(q===0){if(B==="(")K++;else if(B===")")K--}if(K>0)W++}if(K!==0)continue;let U=Z.substring(G+1,W);if(!U.includes(":"))continue;let j=Y(U);Q.push({start:G+1,end:W,replacement:j})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Z=Z.substring(0,K)+q+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,X)=>{if(!X.includes(":"))return J;if(X.includes("{")||X.includes("}"))return J;return`(${X.split(",").map((G)=>{let[K,...W]=G.split("="),q=K.split(":")[0].trim();if(W.length>0)return`${q} = ${W.join("=").trim()}`;return q}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
783
784
 
784
- `),Z}async function u1($,Z,Y,J={}){if(!$.trim())return;let X;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()}),P=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");P=P.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=C.transformSync(P)}catch{X=F8($)}let Q={exports:{}},G=Q.exports,K=B5.cwd(),W={},q=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of q)try{let P=N1.resolve(K,"node_modules",C),x=N1.join(P,"package.json"),m=JSON.parse(_0("fs").readFileSync(x,"utf8")),u=m.main||"index.js";if(m.exports){let j0=typeof m.exports==="string"?m.exports:m.exports["."];if(typeof j0==="string")u=j0;else if(j0?.bun)u=j0.bun;else if(j0?.import)u=j0.import;else if(j0?.default)u=j0.default}W[C]=await import(N1.resolve(P,u))}catch{}let z=(C)=>{if(W[C])return W[C];return _0(C)},U=Z.props||{},j=(C)=>{if(!C)return U;let P={};for(let[x,m]of Object.entries(C)){let u=U[x];if(u!==void 0)P[x]=u;else if(typeof m==="function")P[x]=m();else P[x]=m}return P};for(let[C,P]of Object.entries(U))Object.defineProperty(j,C,{value:P,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,C))continue;try{Object.defineProperty(j,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(C)=>{if(!C)return U;let P={...U};for(let[x,m]of Object.entries(C)){let u=m&&typeof m==="object"&&!Array.isArray(m)?m:{type:m};if(P[x]===void 0&&u.default!==void 0)P[x]=typeof u.default==="function"?u.default():u.default}return P},B=()=>Z.slots||{},H=(C,P)=>{let x={...C};for(let[m,u]of Object.entries(P))if(x[m]===void 0)if(typeof u==="function")x[m]=u();else x[m]=u;return x},L=(C)=>{let P=()=>C;return P.set=(x)=>{},P.update=(x)=>{},P},F=(C)=>{let P,x=!1;return()=>{if(!x)try{P=C(),x=!0}catch{P=void 0}return P}},O=(C)=>{},V=(C)=>C(),w=(C)=>{},A=(C)=>{},R=(C)=>{},N=()=>{let C=Z.__stxServeContext,P=Z.__stxServeSearch??C?.search??"",x=C?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(P)),path:x,name:"",fullPath:x+P,hash:"",matched:[]}},M=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),T=(C)=>{let P=Z.__stx_runtime_head||{};Z.__stx_runtime_head=_5(P,C||{})},I=(C)=>{T(f$(C||{}))},E=(C)=>({value:C}),D=(C)=>C,y=(C)=>({value:typeof C==="function"?C():C}),S=(C,P)=>{},k=(C)=>{},v=(C)=>{},g=(C)=>C?C():Promise.resolve(),f=(C)=>(P,...x)=>{},d=(C)=>{},p=(C,P)=>{},Q0=(C,P)=>P,Y0=()=>({value:"light"}),w0=()=>L(!1),s=(C)=>L(!1),G0=()=>L(!1),b0=()=>s("(prefers-color-scheme: dark)"),o0=()=>s("(prefers-color-scheme: light)"),H1=()=>s("(prefers-reduced-motion: reduce)"),Y5=()=>s("(prefers-contrast: more)"),n={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:{}},X0=new Proxy(n,{get(C,P){if(P in C)return C[P];return},set(C,P,x){return C[P]=x,!0}}),H0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},D0=console;try{let C=S7(X,Y),P=new Set(Object.keys(U)),x=(i)=>/^[a-z_$][\w$]*$/i.test(i),m=Object.keys(Z).filter((i)=>!P.has(i)&&i!=="props"&&x(i)),u=m.map((i)=>Z[i]),j0=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"]),N0=[],W1=[];for(let[i,d0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(j0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(C))continue;N0.push(i),W1.push(d0)}let v0=sG(C).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
785
+ `),Z}function R8($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}async function u1($,Z,Y,J={}){if(!$.trim())return;let X;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=P.transformSync(v)}catch{X=A8($)}let Q={exports:{}},G=Q.exports,K=_5.cwd(),W={},q=[...X.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=N1.resolve(K,"node_modules",P),x=N1.join(v,"package.json"),m=JSON.parse(B0("fs").readFileSync(x,"utf8")),u=m.main||"index.js";if(m.exports){let j0=typeof m.exports==="string"?m.exports:m.exports["."];if(typeof j0==="string")u=j0;else if(j0?.bun)u=j0.bun;else if(j0?.import)u=j0.import;else if(j0?.default)u=j0.default}W[P]=await import(N1.resolve(v,u))}catch{}let z=(P)=>{if(W[P])return W[P];return B0(P)},U=Z.props||{},j=(P)=>{if(!P)return U;let v={};for(let[x,m]of Object.entries(P)){let u=U[x];if(u!==void 0)v[x]=u;else if(typeof m==="function")v[x]=m();else v[x]=m}return v};for(let[P,v]of Object.entries(U))Object.defineProperty(j,P,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let P of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,P))continue;try{Object.defineProperty(j,P,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(P)=>{if(!P)return U;let v={...U};for(let[x,m]of Object.entries(P)){let u=m&&typeof m==="object"&&!Array.isArray(m)?m:{type:m};if(v[x]===void 0&&u.default!==void 0)v[x]=typeof u.default==="function"?u.default():u.default}return v},_=()=>Z.slots||{},H=(P,v)=>{let x={...P};for(let[m,u]of Object.entries(v))if(x[m]===void 0)if(typeof u==="function")x[m]=u();else x[m]=u;return x},L=(P)=>{let v=()=>P;return v.set=(x)=>{},v.update=(x)=>{},v},V=(P)=>{let v,x=!1;return()=>{if(!x)try{v=P(),x=!0}catch{v=void 0}return v}},O=(P)=>{},F=(P)=>P(),w=(P)=>{},A=(P)=>{},R=(P)=>{},N=()=>{let P=Z.__stxServeContext,v=Z.__stxServeSearch??P?.search??"",x=P?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(v)),path:x,name:"",fullPath:x+v,hash:"",matched:[]}},T=()=>({push:(P)=>{},replace:(P)=>{},back:()=>{},forward:()=>{},go:(P)=>{}}),M=(P)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=B5(v,P||{})},I=(P)=>{M(g$(P||{}))},E=(P)=>({value:P}),D=(P)=>P,y=(P)=>({value:typeof P==="function"?P():P}),S=(P,v)=>{},k=(P)=>{},C=(P)=>{},g=(P)=>P?P():Promise.resolve(),f=(P)=>(v,...x)=>{},d=(P)=>{},p=(P,v)=>{},Q0=(P,v)=>v,Y0=()=>({value:"light"}),w0=()=>L(!1),r=(P)=>L(!1),G0=()=>L(!1),b0=()=>r("(prefers-color-scheme: dark)"),o0=()=>r("(prefers-color-scheme: light)"),H1=()=>r("(prefers-reduced-motion: reduce)"),Y5=()=>r("(prefers-contrast: more)"),n={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:{}},X0=new Proxy(n,{get(P,v){if(v in P)return P[v];return},set(P,v,x){return P[v]=x,!0}}),H0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},D0=console;try{let P=P7(X,Y),v=new Set(Object.keys(U)),x=(i)=>/^[a-z_$][\w$]*$/i.test(i),m=Object.keys(Z).filter((i)=>!v.has(i)&&i!=="props"&&x(i)),u=m.map((i)=>Z[i]),j0=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"]),N0=[],W1=[];for(let[i,d0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(j0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(P))continue;N0.push(i),W1.push(d0)}let v0=QK(P).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
785
786
  `),s0=Z.params??{},y1=[],O1=[];for(let i=0;i<m.length;i++){if(m[i]==="params")continue;y1.push(m[i]),O1.push(u[i])}let z0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...N0,...y1,`return (async () => {
786
- ${C}
787
+ ${P}
787
788
  ${v0}
788
789
  return module.exports
789
- })()`)(Q,G,z,U,j,_,H,L,F,O,V,w,A,R,N,M,T,I,E,D,y,S,k,v,g,f,d,B,p,Q0,Y0,w0,s,G0,b0,o0,H1,Y5,X0,H0,D0,n.confirm,n.alert,n.fetch,s0,...W1,...O1);if(J.preserveExisting){for(let[i,d0]of Object.entries(z0))if(!(i in Z)||Z[i]===void 0)Z[i]=d0}else Object.assign(Z,z0);for(let[i,d0]of Object.entries(U))if(!(i in Z))Z[i]=d0}catch(C){if(B5.env.STX_DEBUG){let P=C instanceof Error?C.message:String(C);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${P}`)}try{await $K(X,Z,Y)}catch(P){if(B5.env.STX_DEBUG){let x=P instanceof Error?P.message:String(P);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function V8($){let Z=0,Y=null,J=!1,X=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G===Y){if(Y=null,J||Z===0)X=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return Y===null&&Z===0&&X}function S7($,Z){let Y=Z?N1.dirname(Z):B5.cwd(),J=B5.cwd(),X=$.split(`
790
- `),Q=[],G=0;while(G<X.length){let K=X[G].trim();if(K.startsWith("interface ")||K.startsWith("export interface ")||K.startsWith("type ")||K.startsWith("export type ")){if(K.includes("{")&&!K.includes("}")){let W=0;for(;G<X.length;G++){for(let q of X[G])if(q==="{")W++;else if(q==="}")W--;if(W<=0)break}}G++;continue}if(K.startsWith("definePageMeta(")){let W=0,q=!1;for(let z=G;z<X.length&&!q;z++){let U=null,j=!1,_=X[z];for(let B=0;B<_.length;B++){let H=_[B];if(j){j=!1;continue}if(H==="\\"){j=!0;continue}if(U){if(H===U)U=null;continue}if(H==='"'||H==="'"||H==="`"){U=H;continue}if(H==="(")W++;else if(H===")"){if(W--,W===0){G=z+1,q=!0;break}}}}if(!q)G=X.length;continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let W=K,q=0;while(!V8(W)&&G+q+1<X.length)q++,W=`${W} ${X[G+q].trim()}`;G+=q;let z=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),j=W.match(/^import\s+['"](.+?)['"]/),_=W,B=(H)=>{if(H.startsWith("."))return N1.resolve(Y,H);if(H.startsWith("~/")||H.startsWith("@/"))return N1.resolve(J,H.slice(2));return H};if(z){let[,H,L]=z,F=B(L);Q.push(`const ${H} = await import('${F}')`),Q.push(`module.exports.${H} = ${H};`)}else if(U){let[,H,L]=U,F=H.trim(),O=B(L);Q.push(`const { ${F} } = await import('${O}')`);for(let V of F.split(",")){let w=V.trim().split(/\s+as\s+/).pop()?.trim();if(w)Q.push(`module.exports.${w} = ${w};`)}}else if(j){let H=B(j[1]);Q.push(`await import('${H}')`)}else Q.push(_);G++;continue}if((K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")||K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var "))&&!K.includes("="))Q.push(X[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let W=B8(X,G),{type:q,name:z,value:U}=W;Q.push(`${q} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=W.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let W=b7(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let W=B8(X,G),{type:q,name:z,value:U}=W;Q.push(`${q} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=W.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let W=b7(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let W=X[G].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[G]=W;let z=b7(q,G);if(Q.push(z.functionCode),z.name)Q.push(`module.exports.default = ${z.name};`);G=z.nextIndex}else if(K.startsWith("export default ")){let W=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${W};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let W=K.match(/(?:export\s+)?class\s+(\w+)/);if(W){let q=W[1],z=X[G].replace(/^export\s+/,""),U=0,j=G;for(;j<X.length;j++){let _=X[j];for(let B of _)if(B==="{")U++;else if(B==="}")U--;if(j>G)z+=`
791
- `+_;if(U<=0&&j>=G)break}Q.push(z),Q.push(`module.exports.${q} = ${q};`),G=j+1}else Q.push(K),G++}else if(K.includes("module.exports"))Q.push(K),G++;else if(K.trim()&&!K.startsWith("//"))Q.push(K),G++;else G++}return rG(Q.join(`
792
- `),Y,J)}function rG($,Z,Y){let J=$.length,X="",Q=0,G=null,K=!1,W=!1,q=0;while(Q<J){let z=$[Q],U=$[Q+1];if(K){if(X+=z,z===`
793
- `)K=!1;Q++;continue}if(W){if(X+=z,z==="*"&&U==="/"){X+=U,Q+=2,W=!1;continue}Q++;continue}if(!G&&z==="/"&&U==="/"){K=!0,X+=z,Q++;continue}if(!G&&z==="/"&&U==="*"){W=!0,X+=z,Q++;continue}if(G){if(X+=z,z==="\\"){X+=U,Q+=2;continue}if(z===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(z==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(z==="`"){G=null,Q++;continue}}Q++;continue}if(q>0){if(z==="{")q++;else if(z==="}")q--}if(z==='"'||z==="'"||z==="`"){G=z,X+=z,Q++;continue}if(z==="a"&&$.startsWith("await",Q)){let j=aG($,Q);if(j){let{quote:_,path:B,end:H}=j;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let L=B.startsWith(".")?N1.resolve(Z,B):N1.resolve(Y,B.slice(2));X+=`await import(${_}${L}${_})`,Q=H;continue}}}X+=z,Q++}return X}function aG($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let J=$[Y];if(J!=="'"&&J!=='"')return null;Y++;let X=Y;while(Y<$.length&&$[Y]!==J)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let Q=$.slice(X,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:J,path:Q,end:Y+1}}function w8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let X=f0($,Y,Y==="{"?"}":"]",Z);if(X===-1)return null;return{pattern:$.slice(Z,X+1),endPos:X+1}}function A8($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,X=0,Q="";while(J<Y.length){let G=Y[J];if(G==="{"||G==="["){if(X++,X===1){let K=w8(Y,J);if(K){let W=A8(K.pattern);Z.push(...W),J=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")X--;if(X>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<Y.length&&Y[J]!==","&&X===0){if(Y[J]==="{"||Y[J]==="[")X++;else if(Y[J]==="}"||Y[J]==="]")X--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function R8($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,J=(X)=>X===" "||X==="\t";while(Y<$.length&&J($[Y]))Y++;if($[Y]===":"){let X=0,Q=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){X++;continue}if(G===")"||G==="]"||G==="}"||G===">"){X--;continue}if(G==="="&&X<=0){let K=$[Y+1],W=$[Y-1];if(K!=="="&&K!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&J($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function B8($,Z){let Y=$[Z].trim(),J=R8(Y),X=J?[Y,J.type,J.name,J.value]:null;if(!X){let z=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(z){let U=Y.slice(z[0].length),j=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let B=U.startsWith("{")?"}":"]",H=U;for(let L=Z+1;L<$.length;L++)if(H+=" "+$[L].trim(),j=L,$[L].includes(B))break;U=H}let _=w8(U,0);if(_){let B=z[1],H=_.pattern,L=U.slice(_.endPos).trim();if(L.startsWith("=")){let F=L.slice(1).trim(),O=F,V=Math.max(j,Z);if(H8(F)){let N=O8($,V,F);O=N.value,V=N.nextIndex}else V=V+1;O=O.trim().replace(/;$/,"");let w=A8(H),A=`__stx_src_${Z}`,R=w.map((N)=>`module.exports.${N} = ${N};`).join(`
794
- `);return{type:B,name:A,value:`${O}; ${B} ${H} = ${A};
795
- ${R}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,G,K]=X,W=K,q=Z;if(H8(K)){let z=O8($,Z,K);W=z.value,q=z.nextIndex}else q=Z+1;while(q<$.length){let z=$[q].trim();if(z.startsWith(".")||z.startsWith("?."))W+=`
796
- ${$[q]}`,q++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:q}}function b7($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,X]=J,Q=Y.replace(/^export\s+/,""),G=Z;if(tG(Y)){let K=eG($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function H8($){let Z=$.trim();if(Z.startsWith("{"))return f0(Z,"{","}",0)===-1;if(Z.startsWith("["))return f0(Z,"[","]",0)===-1;return!N8(Z)}function N8($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let X=0;X<$.length;X++){let Q=$[X];if((X>0?$[X-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[X+1]==="{"){J++,X++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(Y)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function tG($){let Z=$.indexOf("{");if(Z===-1)return!0;return f0($,"{","}",Z)===-1}function O8($,Z,Y){let J=Y,X=Z+1;while(X<$.length&&!N8(J)){let Q=$[X];J+=`
790
+ })()`)(Q,G,z,U,j,B,H,L,V,O,F,w,A,R,N,T,M,I,E,D,y,S,k,C,g,f,d,_,p,Q0,Y0,w0,r,G0,b0,o0,H1,Y5,X0,H0,D0,n.confirm,n.alert,n.fetch,s0,...W1,...O1);if(J.preserveExisting){for(let[i,d0]of Object.entries(z0))if(!(i in Z)||Z[i]===void 0)Z[i]=d0}else Object.assign(Z,z0);for(let[i,d0]of Object.entries(U))if(!(i in Z))Z[i]=d0}catch(P){let v=P instanceof Error?P.message:String(P);if(R8(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(_5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await zK(X,Z,Y)}catch(x){if(_5.env.STX_DEBUG){let m=x instanceof Error?x.message:String(x);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${m}`)}}}}function N8($){let Z=0,Y=null,J=!1,X=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G===Y){if(Y=null,J||Z===0)X=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return Y===null&&Z===0&&X}function P7($,Z){let Y=Z?N1.dirname(Z):_5.cwd(),J=_5.cwd(),X=$.split(`
791
+ `),Q=[],G=0;while(G<X.length){let K=X[G].trim();if(K.startsWith("interface ")||K.startsWith("export interface ")||K.startsWith("type ")||K.startsWith("export type ")){if(K.includes("{")&&!K.includes("}")){let W=0;for(;G<X.length;G++){for(let q of X[G])if(q==="{")W++;else if(q==="}")W--;if(W<=0)break}}G++;continue}if(K.startsWith("definePageMeta(")){let W=0,q=!1;for(let z=G;z<X.length&&!q;z++){let U=null,j=!1,B=X[z];for(let _=0;_<B.length;_++){let H=B[_];if(j){j=!1;continue}if(H==="\\"){j=!0;continue}if(U){if(H===U)U=null;continue}if(H==='"'||H==="'"||H==="`"){U=H;continue}if(H==="(")W++;else if(H===")"){if(W--,W===0){G=z+1,q=!0;break}}}}if(!q)G=X.length;continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let W=K,q=0;while(!N8(W)&&G+q+1<X.length)q++,W=`${W} ${X[G+q].trim()}`;G+=q;let z=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),j=W.match(/^import\s+['"](.+?)['"]/),B=W,_=(H)=>{if(H.startsWith("."))return N1.resolve(Y,H);if(H.startsWith("~/")||H.startsWith("@/"))return N1.resolve(J,H.slice(2));return H};if(z){let[,H,L]=z,V=_(L);Q.push(`const ${H} = await import('${V}')`),Q.push(`module.exports.${H} = ${H};`)}else if(U){let[,H,L]=U,V=_(L),O=[],F=[];for(let w of H.split(",")){let A=w.trim();if(!A)continue;let R=A.split(/\s+as\s+/);if(R.length===2){let[N,T]=[R[0].trim(),R[1].trim()];O.push(`${N}: ${T}`),F.push(T)}else O.push(A),F.push(A)}Q.push(`const { ${O.join(", ")} } = await import('${V}')`);for(let w of F)Q.push(`module.exports.${w} = ${w};`)}else if(j){let H=_(j[1]);Q.push(`await import('${H}')`)}else Q.push(B);G++;continue}if((K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")||K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var "))&&!K.includes("="))Q.push(X[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let W=L8(X,G),{type:q,name:z,value:U}=W;Q.push(`${q} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=W.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let W=y7(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let W=L8(X,G),{type:q,name:z,value:U}=W;Q.push(`${q} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=W.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let W=y7(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let W=X[G].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[G]=W;let z=y7(q,G);if(Q.push(z.functionCode),z.name)Q.push(`module.exports.default = ${z.name};`);G=z.nextIndex}else if(K.startsWith("export default ")){let W=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${W};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let W=K.match(/(?:export\s+)?class\s+(\w+)/);if(W){let q=W[1],z=X[G].replace(/^export\s+/,""),U=0,j=G;for(;j<X.length;j++){let B=X[j];for(let _ of B)if(_==="{")U++;else if(_==="}")U--;if(j>G)z+=`
792
+ `+B;if(U<=0&&j>=G)break}Q.push(z),Q.push(`module.exports.${q} = ${q};`),G=j+1}else Q.push(K),G++}else if(K.includes("module.exports"))Q.push(K),G++;else if(K.trim()&&!K.startsWith("//"))Q.push(K),G++;else G++}return GK(Q.join(`
793
+ `),Y,J)}function GK($,Z,Y){let J=$.length,X="",Q=0,G=null,K=!1,W=!1,q=0;while(Q<J){let z=$[Q],U=$[Q+1];if(K){if(X+=z,z===`
794
+ `)K=!1;Q++;continue}if(W){if(X+=z,z==="*"&&U==="/"){X+=U,Q+=2,W=!1;continue}Q++;continue}if(!G&&z==="/"&&U==="/"){K=!0,X+=z,Q++;continue}if(!G&&z==="/"&&U==="*"){W=!0,X+=z,Q++;continue}if(G){if(X+=z,z==="\\"){X+=U,Q+=2;continue}if(z===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(z==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(z==="`"){G=null,Q++;continue}}Q++;continue}if(q>0){if(z==="{")q++;else if(z==="}")q--}if(z==='"'||z==="'"||z==="`"){G=z,X+=z,Q++;continue}if(z==="a"&&$.startsWith("await",Q)){let j=KK($,Q);if(j){let{quote:B,path:_,end:H}=j;if(_.startsWith(".")||_.startsWith("~/")||_.startsWith("@/")){let L=_.startsWith(".")?N1.resolve(Z,_):N1.resolve(Y,_.slice(2));X+=`await import(${B}${L}${B})`,Q=H;continue}}}X+=z,Q++}return X}function KK($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let J=$[Y];if(J!=="'"&&J!=='"')return null;Y++;let X=Y;while(Y<$.length&&$[Y]!==J)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let Q=$.slice(X,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:J,path:Q,end:Y+1}}function M8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let X=f0($,Y,Y==="{"?"}":"]",Z);if(X===-1)return null;return{pattern:$.slice(Z,X+1),endPos:X+1}}function T8($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,X=0,Q="";while(J<Y.length){let G=Y[J];if(G==="{"||G==="["){if(X++,X===1){let K=M8(Y,J);if(K){let W=T8(K.pattern);Z.push(...W),J=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")X--;if(X>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<Y.length&&Y[J]!==","&&X===0){if(Y[J]==="{"||Y[J]==="[")X++;else if(Y[J]==="}"||Y[J]==="]")X--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function I8($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,J=(X)=>X===" "||X==="\t";while(Y<$.length&&J($[Y]))Y++;if($[Y]===":"){let X=0,Q=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){X++;continue}if(G===")"||G==="]"||G==="}"||G===">"){X--;continue}if(G==="="&&X<=0){let K=$[Y+1],W=$[Y-1];if(K!=="="&&K!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&J($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function L8($,Z){let Y=$[Z].trim(),J=I8(Y),X=J?[Y,J.type,J.name,J.value]:null;if(!X){let z=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(z){let U=Y.slice(z[0].length),j=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let _=U.startsWith("{")?"}":"]",H=U;for(let L=Z+1;L<$.length;L++)if(H+=" "+$[L].trim(),j=L,$[L].includes(_))break;U=H}let B=M8(U,0);if(B){let _=z[1],H=B.pattern,L=U.slice(B.endPos).trim();if(L.startsWith("=")){let V=L.slice(1).trim(),O=V,F=Math.max(j,Z);if(F8(V)){let N=V8($,F,V);O=N.value,F=N.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let w=T8(H),A=`__stx_src_${Z}`,R=w.map((N)=>`module.exports.${N} = ${N};`).join(`
795
+ `);return{type:_,name:A,value:`${O}; ${_} ${H} = ${A};
796
+ ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,G,K]=X,W=K,q=Z;if(F8(K)){let z=V8($,Z,K);W=z.value,q=z.nextIndex}else q=Z+1;while(q<$.length){let z=$[q].trim();if(z.startsWith(".")||z.startsWith("?."))W+=`
797
+ ${$[q]}`,q++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:q}}function y7($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,X]=J,Q=Y.replace(/^export\s+/,""),G=Z;if(WK(Y)){let K=qK($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function F8($){let Z=$.trim();if(Z.startsWith("{"))return f0(Z,"{","}",0)===-1;if(Z.startsWith("["))return f0(Z,"[","]",0)===-1;return!D8(Z)}function D8($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let X=0;X<$.length;X++){let Q=$[X];if((X>0?$[X-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[X+1]==="{"){J++,X++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(Y)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function WK($){let Z=$.indexOf("{");if(Z===-1)return!0;return f0($,"{","}",Z)===-1}function V8($,Z,Y){let J=Y,X=Z+1;while(X<$.length&&!D8(J)){let Q=$[X];J+=`
797
798
  ${Q}`,X++}while(X<$.length){let Q=$[X].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
798
- ${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function eG($,Z,Y){let J=Y,X=Z+1;while(X<$.length){let Q=J.indexOf("{");if(Q!==-1){if(f0(J,"{","}",Q)!==-1)break}let G=$[X];J+=`
799
- ${G}`,X++}return{functionCode:J,nextIndex:X}}function L8($,Z){let Y=Z0($,Z)??Z0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...B5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function $K($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),q=L8(W,Z);if(q!==void 0)Z[G]=q}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),q=L8(W,Z);if(q!==void 0)Z[G]=q}catch{}}}function M8($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function T8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var e5=b(()=>{t5();P1();A0()});var y7={};a(y7,{renderSlot:()=>D8,processSlots:()=>k8,parseSlots:()=>I8,parseSlotElement:()=>QK,extractSlotContent:()=>WK,applySlots:()=>qK});function ZK($,Z){let Y=1,J=Z,X="<template",Q="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(X,J)&&(J+X.length>=$.length||/[\s>\/]/.test($[J+X.length]))){Y++,J+=X.length;continue}if($.startsWith(Q,J)){let K=$.indexOf(">",J+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function JK($,Z){let Y=null;for(let J=Z;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"){Y=X;continue}if(X===">")return J+1}return-1}function XK($){let Z=[],Y=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=JK($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){X=G;continue}let q=W[1]==="/",z=W[2].toLowerCase();if(q){let j=Y.lastIndexOf(z);if(j!==-1)Y.splice(j);X=G;continue}if(z==="template"&&Y.length===0){let j=K.match(J);if(j){let _=ZK($,G);if(_!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:_,slotName:B,content:$.slice(G,_-11).trim(),propsBinding:j[4]||void 0}),X=_;continue}}}if(!/\/\s*>$/.test(K)&&!YK.has(z)){if(Y.push(z),z==="script"||z==="style"){let j=$.toLowerCase().indexOf(`</${z}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function I8($){let Z={default:"",named:new Map},Y=$,J=XK($);for(let W of J)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});J.sort((W,q)=>q.start-W.start);for(let W of J)Y=Y.slice(0,W.start)+Y.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[W,q,z,U,j,_]=G,B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(B+H).trim(),F=`<${q}${L?" "+L:""}>${_}</${q}>`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[W,q,z,U,j]=G,_=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+B).trim(),L=`<${q}${H?" "+H:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:L})}X.sort((W,q)=>q.start-W.start);for(let W of X){let q=Z.named.get(W.slotName);if(q)q.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function QK($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)J[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function D8($,Z,Y,J){if(!$)return Y;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...J};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[q,z]=W.split(":").map((j)=>j.trim()),U=z||q;if(Z[q]!==void 0)G[U]=Z[q]}}else G[Q]=Z;X=GK(X,G)}return X}function GK($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=E8(X,Z);return a0(String(Q??""))}catch{return`{{ ${J} }}`}})}function E8($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),X=Z;for(let Q of J)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,X,Q]=Y,G=Z[J],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!W0($))return;return q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function k8($,Z,Y){let J=$;J=await KK(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,q)=>{let z=Z.named.get(K),U=q?.trim()||"",j=W||"",_={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=B.exec(j))!==null){let L=H[1],F=H[2];_[L]=E8(F,Y)}return await D8(z,_,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),J}async function KK($,Z,Y){let J=[],X=[];$.replace(Z,(K,...W)=>{let q=W[W.length-2];return X.push({match:K,index:q}),J.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:q}=X[K];G=G.slice(0,q)+Q[K]+G.slice(q+W.length)}return G}function WK($){let Z=I8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function qK($,Z,Y,J){return await k8($,{default:Z,named:Y},J)}var YK;var P7=b(()=>{X1();A0();YK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function M1($,Z){let Y=zK($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function zK($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=f0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function UK($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function m1($,Z,Y,J){let X=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),q=K.exec($),z=W?W.index:1/0,U=q?q.index:1/0;if(z<U)X++,Q=z+W[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+q[0].length}else break}return-1}function b8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=M1($,J);if(!X)return null;let Q=X.endPos,G=m1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,z="if",U=X.expression,j=0,_=0;while(q<K.length){let B=K.indexOf("@",q);if(B===-1)break;q=B;let H=K.substring(B);if(UK(K,B)){q++;continue}if(/^@if\s*\(/.test(H)){_++,q++;continue}if(/^@endif(?![a-z])/.test(H)){_--,q+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){W.push({type:z,condition:U,content:K.substring(j,q),start:Q+j,end:Q+q});let F=q+L[0].length,O=M1(K,F);if(!O){q++;continue}z="elseif",U=O.expression,q=O.endPos,j=q;continue}else if(/^@else(?![a-z])/.test(H)){W.push({type:z,condition:U,content:K.substring(j,q),start:Q+j,end:Q+q}),z="else",U=void 0,q+=5,j=q;continue}}q++}return W.push({type:z,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function $$($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let Q=b8($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function h$($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,q=f0($,"(",")",W);if(q===-1){Q=X.exec($);continue}let z=$.slice(W+1,q),U=q+1,j=m1($,Z,Y,U);if(j===-1){Q=X.exec($);continue}let _=$.slice(U,j),B=j+`@${Y}`.length;J.push({fullMatch:$.slice(K,B),name:Z,params:z,content:_,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return J}function C7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=M1($,J);if(!X)return null;let Q=X.endPos,G=m1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,z=null,U=0;while(q<K.length){let j=K.slice(q),_=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(_){if(U++,z)z.content+=_[0];q+=_[0].length;continue}if(B){if(U--,z)z.content+=B[0];q+=B[0].length;continue}if(U>0){if(z)z.content+=K[q];q++;continue}let H=j.match(/^@case\s*/),L=j.match(/^@default(?![a-z])/),F=j.match(/^@break(?![a-z])/);if(H&&j.startsWith("@case")){if(z)W.push(z);let O=q+H[0].length,V=M1(K,O);if(!V){q++;continue}z={type:"case",value:V.expression,content:""},q=V.endPos}else if(L&&j.startsWith("@default")){if(z)W.push(z);z={type:"default",content:""},q+=L[0].length}else if(F&&j.startsWith("@break"))q+=F[0].length;else{if(z)z.content+=K[q];q++}}if(z)W.push(z);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var S8=()=>{};var y8=()=>{};var d$=b(()=>{S8();y8()});function p$($){let Z=$,Y=new Set,J=new Set,X=()=>{if(u0)J.add(u0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),Z$)J.forEach((K)=>m$.add(K));else J.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function l$($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,Z$)J.forEach((G)=>m$.add(G));else J.forEach((G)=>G())},Q=()=>{if(u0)J.add(u0);if(Y){let G=u0;u0=X,u$.push(X);try{Z=$()}finally{u$.pop(),u0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function c$($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=u0;u0=X,u$.push(X);try{Y=$()}finally{u$.pop(),u0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function v7($){if(Z$){$();return}Z$=!0;try{$()}finally{Z$=!1,m$.forEach((Z)=>Z()),m$.clear()}}function x7($){HK.push($)}function f7($){OK.push($)}function i$($){return typeof $==="function"&&$._isSignal===!0}function n$($){return typeof $==="function"&&$._isDerived===!0}function g7($){if(i$($)||n$($))return $();return $}function o$($){let Z=u0;u0=null;try{return $()}finally{u0=Z}}function LK($,Z){let Y=typeof $==="function"?$:()=>$,J=p$([]),X=l$(()=>J().reduce((K,W)=>Z(K,W.action),Y())),Q=!1;return c$(()=>{if(Y(),!Q){Q=!0;return}if(o$(()=>J().length))J.set([])}),[X,(K,W)=>{let q={action:K};J.set([...J(),q]);let z=()=>{let U=J().filter((j)=>j!==q);if(U.length!==J().length)J.set(U)};if(W&&typeof W.then==="function")Promise.resolve(W).then(z,z);return z}]}var u0=null,u$,Z$=!1,m$,HK,OK;var h7=b(()=>{u$=[],m$=new Set,HK=[],OK=[]});var C8={};a(C8,{useOptimistic:()=>LK,untrack:()=>g7,state:()=>p$,peek:()=>o$,onMount:()=>x7,onDestroy:()=>f7,isSignal:()=>i$,isDerived:()=>n$,generateSignalsRuntimeDev:()=>s$,generateSignalsRuntime:()=>P8,effect:()=>c$,derived:()=>l$,default:()=>VK,batch:()=>v7});function P8(){try{let $=FK(s$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return s$()}}function FK($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let X=$.indexOf(J,Y);if(X===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,X));let Q=1,G=X+J.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function s$(){return`
799
+ ${$[X]}`,X++;else break}return{value:J,nextIndex:X}}function qK($,Z,Y){let J=Y,X=Z+1;while(X<$.length){let Q=J.indexOf("{");if(Q!==-1){if(f0(J,"{","}",Q)!==-1)break}let G=$[X];J+=`
800
+ ${G}`,X++}return{functionCode:J,nextIndex:X}}function w8($,Z){let Y=Z0($,Z)??Z0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{..._5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function zK($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),q=w8(W,Z);if(q!==void 0)Z[G]=q}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),q=w8(W,Z);if(q!==void 0)Z[G]=q}catch{}}}function E8($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function k8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var $$=b(()=>{e5();P1();A0()});var C7={};a(C7,{renderSlot:()=>S8,processSlots:()=>P8,parseSlots:()=>b8,parseSlotElement:()=>HK,extractSlotContent:()=>FK,applySlots:()=>VK});function UK($,Z){let Y=1,J=Z,X="<template",Q="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(X,J)&&(J+X.length>=$.length||/[\s>\/]/.test($[J+X.length]))){Y++,J+=X.length;continue}if($.startsWith(Q,J)){let K=$.indexOf(">",J+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function BK($,Z){let Y=null;for(let J=Z;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"){Y=X;continue}if(X===">")return J+1}return-1}function _K($){let Z=[],Y=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=BK($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){X=G;continue}let q=W[1]==="/",z=W[2].toLowerCase();if(q){let j=Y.lastIndexOf(z);if(j!==-1)Y.splice(j);X=G;continue}if(z==="template"&&Y.length===0){let j=K.match(J);if(j){let B=UK($,G);if(B!==-1){let _=j[1]||j[2]||j[3];Z.push({start:Q,end:B,slotName:_,content:$.slice(G,B-11).trim(),propsBinding:j[4]||void 0}),X=B;continue}}}if(!/\/\s*>$/.test(K)&&!jK.has(z)){if(Y.push(z),z==="script"||z==="style"){let j=$.toLowerCase().indexOf(`</${z}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function b8($){let Z={default:"",named:new Map},Y=$,J=_K($);for(let W of J)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});J.sort((W,q)=>q.start-W.start);for(let W of J)Y=Y.slice(0,W.start)+Y.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[W,q,z,U,j,B]=G,_=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(_+H).trim(),V=`<${q}${L?" "+L:""}>${B}</${q}>`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:V})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[W,q,z,U,j]=G,B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(B+_).trim(),L=`<${q}${H?" "+H:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:L})}X.sort((W,q)=>q.start-W.start);for(let W of X){let q=Z.named.get(W.slotName);if(q)q.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function HK($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)J[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function S8($,Z,Y,J){if(!$)return Y;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...J};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[q,z]=W.split(":").map((j)=>j.trim()),U=z||q;if(Z[q]!==void 0)G[U]=Z[q]}}else G[Q]=Z;X=OK(X,G)}return X}function OK($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let X=J.trim(),Q=y8(X,Z);return a0(String(Q??""))}catch{return`{{ ${J} }}`}})}function y8($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),X=Z;for(let Q of J)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,X,Q]=Y,G=Z[J],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!W0($))return;return q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function P8($,Z,Y){let J=$;J=await LK(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,q)=>{let z=Z.named.get(K),U=q?.trim()||"",j=W||"",B={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=_.exec(j))!==null){let L=H[1],V=H[2];B[L]=y8(V,Y)}return await S8(z,B,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),J}async function LK($,Z,Y){let J=[],X=[];$.replace(Z,(K,...W)=>{let q=W[W.length-2];return X.push({match:K,index:q}),J.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(J),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:q}=X[K];G=G.slice(0,q)+Q[K]+G.slice(q+W.length)}return G}function FK($){let Z=b8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function VK($,Z,Y,J){return await P8($,{default:Z,named:Y},J)}var jK;var v7=b(()=>{X1();A0();jK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function M1($,Z){let Y=wK($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function wK($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=f0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function AK($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function m1($,Z,Y,J){let X=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),q=K.exec($),z=W?W.index:1/0,U=q?q.index:1/0;if(z<U)X++,Q=z+W[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+q[0].length}else break}return-1}function C8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,X=M1($,J);if(!X)return null;let Q=X.endPos,G=m1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,z="if",U=X.expression,j=0,B=0;while(q<K.length){let _=K.indexOf("@",q);if(_===-1)break;q=_;let H=K.substring(_);if(AK(K,_)){q++;continue}if(/^@if\s*\(/.test(H)){B++,q++;continue}if(/^@endif(?![a-z])/.test(H)){B--,q+=6;continue}if(B===0){let L=H.match(/^@elseif\s*/);if(L){W.push({type:z,condition:U,content:K.substring(j,q),start:Q+j,end:Q+q});let V=q+L[0].length,O=M1(K,V);if(!O){q++;continue}z="elseif",U=O.expression,q=O.endPos,j=q;continue}else if(/^@else(?![a-z])/.test(H)){W.push({type:z,condition:U,content:K.substring(j,q),start:Q+j,end:Q+q}),z="else",U=void 0,q+=5,j=q;continue}}q++}return W.push({type:z,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function Z$($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let Q=C8($,J.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;J=Y.exec($)}return Z}function d$($,Z,Y){let J=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(J.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,q=f0($,"(",")",W);if(q===-1){Q=X.exec($);continue}let z=$.slice(W+1,q),U=q+1,j=m1($,Z,Y,U);if(j===-1){Q=X.exec($);continue}let B=$.slice(U,j),_=j+`@${Y}`.length;J.push({fullMatch:$.slice(K,_),name:Z,params:z,content:B,start:K,end:_}),X.lastIndex=_,Q=X.exec($)}return J}function x7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,X=M1($,J);if(!X)return null;let Q=X.endPos,G=m1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,z=null,U=0;while(q<K.length){let j=K.slice(q),B=j.match(/^@switch\s*\(/),_=j.match(/^@endswitch(?![a-z])/);if(B){if(U++,z)z.content+=B[0];q+=B[0].length;continue}if(_){if(U--,z)z.content+=_[0];q+=_[0].length;continue}if(U>0){if(z)z.content+=K[q];q++;continue}let H=j.match(/^@case\s*/),L=j.match(/^@default(?![a-z])/),V=j.match(/^@break(?![a-z])/);if(H&&j.startsWith("@case")){if(z)W.push(z);let O=q+H[0].length,F=M1(K,O);if(!F){q++;continue}z={type:"case",value:F.expression,content:""},q=F.endPos}else if(L&&j.startsWith("@default")){if(z)W.push(z);z={type:"default",content:""},q+=L[0].length}else if(V&&j.startsWith("@break"))q+=V[0].length;else{if(z)z.content+=K[q];q++}}if(z)W.push(z);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var v8=()=>{};var x8=()=>{};var u$=b(()=>{v8();x8()});function l$($){let Z=$,Y=new Set,J=new Set,X=()=>{if(u0)J.add(u0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),Y$)J.forEach((K)=>p$.add(K));else J.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function c$($){let Z,Y=!0,J=new Set,X=()=>{if(!Y)if(Y=!0,Y$)J.forEach((G)=>p$.add(G));else J.forEach((G)=>G())},Q=()=>{if(u0)J.add(u0);if(Y){let G=u0;u0=X,m$.push(X);try{Z=$()}finally{m$.pop(),u0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function i$($,Z={}){let Y,J=!1,X=()=>{if(J)return;if(Y)Y(),Y=void 0;let Q=u0;u0=X,m$.push(X);try{Y=$()}finally{m$.pop(),u0=Q}};if(Z.immediate!==!1)X();return()=>{if(J=!0,Y)Y()}}function f7($){if(Y$){$();return}Y$=!0;try{$()}finally{Y$=!1,p$.forEach((Z)=>Z()),p$.clear()}}function g7($){TK.push($)}function h7($){IK.push($)}function n$($){return typeof $==="function"&&$._isSignal===!0}function o$($){return typeof $==="function"&&$._isDerived===!0}function d7($){if(n$($)||o$($))return $();return $}function s$($){let Z=u0;u0=null;try{return $()}finally{u0=Z}}function DK($,Z){let Y=typeof $==="function"?$:()=>$,J=l$([]),X=c$(()=>J().reduce((K,W)=>Z(K,W.action),Y())),Q=!1;return i$(()=>{if(Y(),!Q){Q=!0;return}if(s$(()=>J().length))J.set([])}),[X,(K,W)=>{let q={action:K};J.set([...J(),q]);let z=()=>{let U=J().filter((j)=>j!==q);if(U.length!==J().length)J.set(U)};if(W&&typeof W.then==="function")Promise.resolve(W).then(z,z);return z}]}var u0=null,m$,Y$=!1,p$,TK,IK;var u7=b(()=>{m$=[],p$=new Set,TK=[],IK=[]});var g8={};a(g8,{useOptimistic:()=>DK,untrack:()=>d7,state:()=>l$,peek:()=>s$,onMount:()=>g7,onDestroy:()=>h7,isSignal:()=>n$,isDerived:()=>o$,generateSignalsRuntimeDev:()=>r$,generateSignalsRuntime:()=>f8,effect:()=>i$,derived:()=>c$,default:()=>kK,batch:()=>f7});function f8(){try{let $=EK(r$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return r$()}}function EK($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let X=$.indexOf(J,Y);if(X===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,X));let Q=1,G=X+J.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function r$(){return`
800
801
  // STX Signals Runtime (Development Build)
801
802
  console.log('[stx] signals runtime loading');
802
803
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -2669,12 +2670,6 @@ catch (e) {
2669
2670
  }
2670
2671
 
2671
2672
  function processElement(el, scope = componentScope) {
2672
- // Debug: log every element with x-class or @click
2673
- if (el.nodeType === Node.ELEMENT_NODE && el.hasAttribute) {
2674
- if (el.hasAttribute('x-class') || el.hasAttribute('@click')) {
2675
- console.log('[stx] processElement:', el.tagName, 'x-class:', el.hasAttribute('x-class'), '@click:', el.hasAttribute('@click'));
2676
- }
2677
- }
2678
2673
  // Lazy hydration: if this element has stx-hydrate and hasn't been hydrated
2679
2674
  // yet, defer its subtree processing until the trigger fires.
2680
2675
  if (el.nodeType === Node.ELEMENT_NODE && el.hasAttribute && el.hasAttribute('stx-hydrate') && !el.__stx_hydrated) {
@@ -2885,23 +2880,36 @@ else if (part) {
2885
2880
  const pipeResult = parsePipeExpression(expr, activeScope);
2886
2881
  if (pipeResult) {
2887
2882
  const unwrapScope = createExpressionAutoUnwrapProxy(activeScope, expr);
2888
- return maybeUnwrapSignal(executePipeExpression(pipeResult.valueExpr, pipeResult.pipes, unwrapScope));
2883
+ var piped = maybeUnwrapSignal(executePipeExpression(pipeResult.valueExpr, pipeResult.pipes, unwrapScope));
2884
+ noteExprSuccess(expr);
2885
+ return piped;
2889
2886
  }
2890
2887
 
2891
2888
  // Use auto-unwrap proxy (Feature #1)
2892
2889
  const unwrapScope = createExpressionAutoUnwrapProxy(activeScope, expr);
2893
2890
  const fn = new Function('__scope__', 'with(__scope__) { return (' + expr + ') }');
2894
- return maybeUnwrapSignal(fn(unwrapScope));
2891
+ var value = maybeUnwrapSignal(fn(unwrapScope));
2892
+ noteExprSuccess(expr);
2893
+ return value;
2895
2894
  }
2896
2895
  catch (e) {
2897
2896
  // Auto-unwrap can break explicit signal calls like errorData().message
2898
2897
  // Retry without auto-unwrap so signal functions remain callable
2899
2898
  try {
2900
2899
  const fn = new Function('__scope__', 'with(__scope__) { return (' + expr + ') }');
2901
- return maybeUnwrapSignal(fn(activeScope));
2900
+ var retried = maybeUnwrapSignal(fn(activeScope));
2901
+ noteExprSuccess(expr);
2902
+ return retried;
2902
2903
  }
2903
2904
  catch (e2) {
2904
2905
  if (!(e2 instanceof ReferenceError) && !(e2 instanceof TypeError)) console.warn('[STX] Attribute expression error:', expr, e2);
2906
+ // ReferenceError/TypeError stay unlogged HERE on purpose: a signal
2907
+ // may not exist yet on an effect's first pass, and warning on every
2908
+ // one of those trains people to ignore the console. Instead the
2909
+ // failure is recorded and cleared the moment the same expression
2910
+ // evaluates successfully, so only expressions that are STILL broken
2911
+ // when hydration finishes get reported \u2014 by the audit (#1773).
2912
+ else noteExprFailure(expr, e2);
2905
2913
  return '';
2906
2914
  }
2907
2915
  }
@@ -2920,18 +2928,11 @@ catch (e2) {
2920
2928
  var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
2921
2929
 
2922
2930
  // Handle attributes
2923
- if (el.hasAttribute && (el.hasAttribute('x-class') || el.hasAttribute('@click'))) {
2924
- console.log('[stx] attr loop entry:', el.tagName, 'attrs:', getElementAttributes(el).map(a => a.name).join(', '));
2925
- }
2926
2931
  getElementAttributes(el).forEach(attr => {
2927
2932
  const name = attr.name;
2928
2933
  const value = attr.value;
2929
2934
  if (!name) return;
2930
2935
 
2931
- if (el.hasAttribute && (el.hasAttribute('x-class') || el.hasAttribute('@click'))) {
2932
- console.log('[stx] attr iter:', el.tagName, 'name:', name);
2933
- }
2934
-
2935
2936
  // Dynamic attribute binding: @bind:attr, x-bind:attr, :attr, OR x-attr
2936
2937
  // x-attr (e.g. x-class, x-style, x-href, x-src) is the canonical binding prefix.
2937
2938
  // :attr still works for backward compat but is reserved for structural directives.
@@ -3026,7 +3027,6 @@ else {
3026
3027
  el.removeAttribute(name);
3027
3028
  }
3028
3029
  else if (name === '@class' || name === ':class' || name === 'x-class') {
3029
- console.log('[stx] HIT x-class handler:', el.tagName);
3030
3030
  bindClass(el, value, scope);
3031
3031
  el.removeAttribute(name);
3032
3032
  }
@@ -3084,9 +3084,7 @@ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data
3084
3084
  ? { ...globalHelpers, ...el.__stx_parent_scope }
3085
3085
  : { ...globalHelpers, ...scope, ...(findElementScope(el) || {}) };
3086
3086
 
3087
- console.log('[stx] binding event:', eventName, 'on', el.tagName, 'expr:', value.substring(0, 40));
3088
3087
  el.addEventListener(eventName, (event) => {
3089
- console.log('[stx] event fired:', eventName, 'on', el.tagName);
3090
3088
  // Vue-style component listeners fall through to the rendered native
3091
3089
  // root unless the child emits the same event. Signal components use
3092
3090
  // a scope wrapper, so native events arrive here from a descendant.
@@ -3207,7 +3205,7 @@ catch (e) {
3207
3205
  // Skip script elements entirely
3208
3206
  if (child.tagName === 'SCRIPT') return;
3209
3207
  // Skip elements already processed by stx.mount() \u2014 they have their own scope and effects
3210
- if (child.__stx_scope) { console.log('[processElement] skip __stx_scope:', child.tagName); return; }
3208
+ if (child.__stx_scope) return;
3211
3209
  // Skip data-stx-scope elements \u2014 they are managed by the reactive (x-data) runtime
3212
3210
  if (child.hasAttribute && child.hasAttribute('data-stx-scope')) return;
3213
3211
  processElement(child, scope);
@@ -5158,16 +5156,34 @@ else if (timer === null) {
5158
5156
  // flash the boot script exists to prevent.
5159
5157
  var boot = null;
5160
5158
  try { boot = window.__STX_COLOR_MODE__ || null; } catch (e) {}
5161
- var storageKey = options.storageKey || (boot && boot.storageKey) || 'stx-color-mode';
5162
- var initialMode = options.initialMode || (boot && boot.initialMode) || 'auto';
5163
- var darkClass = options.darkClass || (boot && boot.darkClass) || 'dark';
5164
- var attribute = options.attribute || (boot && boot.attribute) || null;
5159
+ // Explicit-undefined checks rather than ||, so an explicit darkClass:null
5160
+ // or attribute:null opts out instead of falling through to the default.
5161
+ function pick(a, b, fallback) {
5162
+ if (a !== undefined) return a;
5163
+ if (b !== undefined && b !== null) return b;
5164
+ return fallback;
5165
+ }
5166
+ var storageKey = pick(options.storageKey, boot && boot.storageKey, 'stx-color-mode');
5167
+ var initialMode = pick(options.initialMode, boot && boot.initialMode, 'auto');
5168
+ var darkClass = pick(options.darkClass, boot && boot.darkClass, 'dark');
5169
+ var attribute = pick(options.attribute, boot && boot.attribute, null);
5170
+ var autoValueOption = pick(options.autoValue, boot && boot.autoValue, undefined);
5165
5171
  var disableTransitions = options.disableTransitions !== false;
5166
- var preference = initialMode;
5167
5172
  var resolved = 'light';
5168
5173
  var listeners = [];
5169
5174
  var cleanups = [];
5170
5175
 
5176
+ // Storage tokens meaning "follow the system". 'system' is a common spelling
5177
+ // for the same concept; rejecting it used to send the app down a silent
5178
+ // data-loss path \u2014 read 'system', fail to recognise it, fall back to
5179
+ // 'auto', then OVERWRITE the stored value with 'auto' (#1788).
5180
+ function normalizeMode(v) {
5181
+ if (v === 'light' || v === 'dark') return v;
5182
+ if (v === 'auto' || v === 'system') return 'auto';
5183
+ return null;
5184
+ }
5185
+ var preference = normalizeMode(initialMode) || 'auto';
5186
+
5171
5187
  function getSystem() {
5172
5188
  return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
5173
5189
  }
@@ -5175,27 +5191,42 @@ else if (timer === null) {
5175
5191
  function applyDOM(mode) {
5176
5192
  var el = document.documentElement;
5177
5193
  if (disableTransitions) el.style.setProperty('transition', 'none', 'important');
5178
- if (attribute) { el.setAttribute(attribute, mode); }
5179
- else { if (mode === 'dark') el.classList.add(darkClass); else el.classList.remove(darkClass); }
5194
+ // Both, when both are configured. The class drives the utility
5195
+ // framework's dark: variants, the attribute drives everything else \u2014
5196
+ // complements, not alternatives.
5197
+ if (attribute) el.setAttribute(attribute, mode);
5198
+ // Explicit add/remove, not toggle(cls, force) \u2014 very-happy-dom ignores
5199
+ // the force argument and plain-toggles, inverting every light-mode test.
5200
+ if (darkClass) { if (mode === 'dark') el.classList.add(darkClass); else el.classList.remove(darkClass); }
5180
5201
  if (disableTransitions) { el.offsetHeight; el.style.removeProperty('transition'); }
5181
5202
  }
5182
- function persist(pref) { try { localStorage.setItem(storageKey, pref); }
5183
- catch (e) {} }
5184
- function readPersisted() {
5185
- try { var v = localStorage.getItem(storageKey); if (v === 'light' || v === 'dark' || v === 'auto') return v; }
5186
- catch (e) {}
5187
- return null;
5203
+ function readRaw() {
5204
+ try { return localStorage.getItem(storageKey); }
5205
+ catch (e) { return null; }
5188
5206
  }
5189
- function update(pref) {
5190
- preference = pref;
5191
- resolved = resolve(pref);
5207
+ // The spelling written back for 'auto': an explicit option wins, else
5208
+ // whatever the app already stored, so its own pre-paint script keeps
5209
+ // reading a value it recognises.
5210
+ var storedRaw = readRaw();
5211
+ var autoValue = autoValueOption !== undefined
5212
+ ? autoValueOption
5213
+ : ((storedRaw === 'auto' || storedRaw === 'system') ? storedRaw : 'auto');
5214
+
5215
+ function persist(pref) {
5216
+ try { localStorage.setItem(storageKey, pref === 'auto' ? autoValue : pref); }
5217
+ catch (e) {} }
5218
+ // persistChoice: only an explicit user choice is written back. Persisting
5219
+ // on init would stamp the resolved default over a stored value this
5220
+ // composable didn't recognise, destroying it.
5221
+ function update(pref, persistChoice) {
5222
+ preference = normalizeMode(pref) || 'auto';
5223
+ resolved = resolve(preference);
5192
5224
  applyDOM(resolved);
5193
- persist(pref);
5225
+ if (persistChoice !== false) persist(preference);
5194
5226
  listeners.forEach(function(fn) { fn(resolved, preference); });
5195
5227
  }
5196
5228
 
5197
- var persisted = readPersisted();
5198
- update(persisted || initialMode);
5229
+ update(normalizeMode(storedRaw) || initialMode, false);
5199
5230
 
5200
5231
  var mql = window.matchMedia('(prefers-color-scheme: dark)');
5201
5232
  var onSystemChange = function() {
@@ -5210,8 +5241,11 @@ catch (e) {}
5210
5241
 
5211
5242
  var onStorage = function(e) {
5212
5243
  if (e.key !== storageKey) return;
5213
- var v = e.newValue;
5214
- if (v === 'light' || v === 'dark' || v === 'auto') {
5244
+ var v = normalizeMode(e.newValue);
5245
+ if (v) {
5246
+ // Track the other tab's spelling too, so a write from here doesn't
5247
+ // convert the key out from under it.
5248
+ if (v === 'auto' && (e.newValue === 'auto' || e.newValue === 'system')) autoValue = e.newValue;
5215
5249
  preference = v; resolved = resolve(v); applyDOM(resolved);
5216
5250
  listeners.forEach(function(fn) { fn(resolved, preference); });
5217
5251
  }
@@ -5635,9 +5669,22 @@ catch (e) {}
5635
5669
  if (config.bodyAttrs && config.bodyAttrs.class) {
5636
5670
  config.bodyAttrs.class.split(' ').forEach(function(cls) { if (cls) document.body.classList.add(cls); });
5637
5671
  }
5638
- // Html lang
5639
- if (config.htmlAttrs && config.htmlAttrs.lang) {
5640
- document.documentElement.setAttribute('lang', config.htmlAttrs.lang);
5672
+ // Html attributes. Every key, not just lang \u2014 the module impl
5673
+ // (head.ts updateHead) has always applied all of them, and a root-level
5674
+ // class is the main reason to reach for htmlAttrs at all (#1798).
5675
+ // class merges rather than replaces, matching bodyAttrs.class above:
5676
+ // the color-mode boot script owns a class on this same element.
5677
+ if (config.htmlAttrs) {
5678
+ for (var hk in config.htmlAttrs) {
5679
+ if (!config.htmlAttrs.hasOwnProperty(hk)) continue;
5680
+ var hv = config.htmlAttrs[hk];
5681
+ if (hv == null) continue;
5682
+ if (hk === 'class') {
5683
+ String(hv).split(' ').forEach(function(cls) { if (cls) document.documentElement.classList.add(cls); });
5684
+ } else {
5685
+ document.documentElement.setAttribute(hk, hv);
5686
+ }
5687
+ }
5641
5688
  }
5642
5689
  }
5643
5690
  // Apply immediately if DOM is ready, otherwise on mount
@@ -6643,6 +6690,12 @@ else {
6643
6690
  window.nextTick = nextTick;
6644
6691
  window.useAsync = useAsync;
6645
6692
  window.useLocalStorage = useLocalStorage;
6693
+ // Paired with the line above. Both are in STX_RUNTIME_GLOBALS, so a
6694
+ // <script client> block gets either via the setup destructure \u2014 but code
6695
+ // that reads the bare window global directly (a plain <script>, or a
6696
+ // bundled module that wasn't rewritten) found useLocalStorage defined and
6697
+ // useSessionStorage undefined.
6698
+ window.useSessionStorage = useSessionStorage;
6646
6699
  window.useEventListener = useEventListener;
6647
6700
  window.useWebSocket = useWebSocket;
6648
6701
  window.useColorMode = useColorMode;
@@ -7033,6 +7086,9 @@ catch (e) {
7033
7086
  }
7034
7087
  }
7035
7088
  });
7089
+
7090
+ // Everything that should have hydrated has now had its chance (#1773).
7091
+ auditHydration(document.body, 'DOMContentLoaded');
7036
7092
  };
7037
7093
  window.__stxDomReadyHandler = stxDomReadyHandler;
7038
7094
  console.log('[stx] registering DOMContentLoaded handler');
@@ -7124,6 +7180,184 @@ catch (e) {
7124
7180
  }
7125
7181
  }
7126
7182
 
7183
+ // ==========================================================================
7184
+ // Post-hydration invariant sweep (stacksjs/stx#1773)
7185
+ // ==========================================================================
7186
+ //
7187
+ // Preserved moustaches are the framework's de-facto error UI: ANY failure in
7188
+ // the detect \u2192 extract \u2192 bundle \u2192 ship \u2192 rebind relay collapses into the same
7189
+ // visible symptom, literal {{ }} on screen. Eight separate fixes each patched
7190
+ // one site's heuristic, and no invariant anywhere asserted the actual
7191
+ // requirement \u2014 zero unhydrated scopes after hydration. So every new upstream
7192
+ // miss reached users silently and had to be diagnosed from a screenshot.
7193
+ //
7194
+ // This is that invariant. It runs at the end of both hydration entry points
7195
+ // and turns a silent miss into one loud, self-healing event:
7196
+ //
7197
+ // - an element carrying data-stx-scope whose id isn't in the registry, or
7198
+ // that hydration reached but never processed, is reported AND processed
7199
+ // with the ambient scope, which is what the walk would have done had the
7200
+ // script arrived. That recovers the D2/D3 shapes (a silent early return
7201
+ // in the walk, a stale __stx_scope guard) rather than merely naming them.
7202
+ // - leftover {{ }} text is reported. Diagnostic only, never auto-fixed:
7203
+ // without a scope there is nothing to interpolate against, and a page may
7204
+ // legitimately print moustaches.
7205
+ //
7206
+ // Deliberately quiet in the normal case: nothing is logged when the page has
7207
+ // no signals at all, and containers that legitimately show template syntax
7208
+ // (<pre>, <code>, <template>, <script>, <style>, <textarea>, and anything
7209
+ // under [data-stx-ignore]) are skipped.
7210
+
7211
+ var AUDIT_SKIP_TAGS = { PRE: 1, CODE: 1, SCRIPT: 1, STYLE: 1, TEXTAREA: 1, TEMPLATE: 1 };
7212
+
7213
+ // Expressions whose evaluation threw a ReferenceError/TypeError and have not
7214
+ // since succeeded. evalAttrExpr swallows those two on purpose \u2014 a signal may
7215
+ // not exist yet on an effect's first pass \u2014 which is why a genuinely broken
7216
+ // binding produces no diagnostic at all today. The classic case is
7217
+ // :if="flag()" where flag is a signal: the auto-unwrap proxy returns the
7218
+ // VALUE, calling it throws TypeError, the directive suppresses it, and the
7219
+ // element silently stays hidden with no warning anywhere (see CLAUDE.md,
7220
+ // "Signals: scripts call, templates don't").
7221
+ //
7222
+ // Recording rather than warning immediately is what keeps this quiet on
7223
+ // working pages: a first-pass failure that later succeeds clears itself, so
7224
+ // only expressions still broken when hydration finishes are reported.
7225
+ var _exprFailures = {};
7226
+ var _exprFailureCount = 0;
7227
+
7228
+ function noteExprFailure(expr, err) {
7229
+ if (_exprFailures[expr] !== undefined) return;
7230
+ // Bounded: one runaway loop must not grow this without limit.
7231
+ if (_exprFailureCount >= 50) return;
7232
+ _exprFailureCount++;
7233
+ _exprFailures[expr] = (err && err.message) ? err.message : String(err);
7234
+ }
7235
+
7236
+ function noteExprSuccess(expr) {
7237
+ if (_exprFailures[expr] === undefined) return;
7238
+ delete _exprFailures[expr];
7239
+ _exprFailureCount--;
7240
+ }
7241
+
7242
+ function auditSkipped(node) {
7243
+ // Not rendered, not audited. Covers <template> content (a detached
7244
+ // DocumentFragment \u2014 which some DOM implementations still walk into) and
7245
+ // :if branches parked off-document, neither of which the user can see.
7246
+ if (node.isConnected === false) return true;
7247
+ for (var p = node.parentNode; p; p = p.parentNode) {
7248
+ if (p.nodeType === Node.DOCUMENT_FRAGMENT_NODE) return true;
7249
+ if (p.nodeType !== Node.ELEMENT_NODE) continue;
7250
+ if (AUDIT_SKIP_TAGS[p.tagName]) return true;
7251
+ if (p.hasAttribute && p.hasAttribute('data-stx-ignore')) return true;
7252
+ }
7253
+ return false;
7254
+ }
7255
+
7256
+ function findLiteralMoustaches(root) {
7257
+ var found = [];
7258
+ if (!root || typeof document.createTreeWalker !== 'function') return found;
7259
+ // Read NodeFilter off window, not the bare global: in a real browser they
7260
+ // are the same object, but some DOM implementations used for testing expose
7261
+ // it only on window, and a bare reference then throws inside the audit.
7262
+ var showText = (window.NodeFilter && window.NodeFilter.SHOW_TEXT) || 4;
7263
+ var walker = document.createTreeWalker(root, showText, null);
7264
+ var node;
7265
+ while ((node = walker.nextNode())) {
7266
+ var text = node.nodeValue || '';
7267
+ if (text.indexOf('{{') === -1 || text.indexOf('}}') === -1) continue;
7268
+ if (auditSkipped(node)) continue;
7269
+ found.push(text.trim().slice(0, 80));
7270
+ if (found.length >= 5) break;
7271
+ }
7272
+ return found;
7273
+ }
7274
+
7275
+ // A diagnostic that can break hydration is worse than no diagnostic, so the
7276
+ // whole sweep is wrapped and every DOM capability it uses is feature-checked.
7277
+ // Minimal document stubs (tests, non-browser embeddings) simply skip it.
7278
+ function auditHydration(container, phase) {
7279
+ try { auditHydrationUnsafe(container, phase); }
7280
+ catch (e) { console.warn('[stx] hydration audit skipped:', e && e.message ? e.message : e); }
7281
+ }
7282
+
7283
+ function auditHydrationUnsafe(container, phase) {
7284
+ if (!window.stx || !window.stx._scopes) return;
7285
+ var root = container && typeof container.querySelectorAll === 'function' ? container : document.body;
7286
+ if (!root || typeof root.querySelectorAll !== 'function') return;
7287
+
7288
+ // Unregistered / unprocessed scopes \u2014 the unambiguous failure, and the one
7289
+ // worth repairing.
7290
+ var stranded = [];
7291
+ root.querySelectorAll('[data-stx-scope]').forEach(function(el) {
7292
+ if (el.__stx_audit_recovered) return;
7293
+ // Deferred islands are unhydrated ON PURPOSE until their trigger fires.
7294
+ if (el.hasAttribute('stx-hydrate') || el.__stx_hydration_scheduled) return;
7295
+ var scopeId = el.getAttribute('data-stx-scope');
7296
+ var registered = window.stx._scopes[scopeId];
7297
+ if (registered && el.__stx_disposers) return;
7298
+ stranded.push({ el: el, id: scopeId, registered: !!registered });
7299
+ });
7300
+
7301
+ if (stranded.length) {
7302
+ console.error(
7303
+ '[stx] hydration invariant failed after ' + phase + ': '
7304
+ + stranded.length + ' scope(s) left unhydrated \u2014 '
7305
+ + stranded.map(function(s) {
7306
+ return s.id + (s.registered ? ' (registered, never processed)' : ' (not registered)');
7307
+ }).join(', ')
7308
+ + '. Recovering with the ambient scope; please report with the page that produced it (stacksjs/stx#1773).',
7309
+ );
7310
+ stranded.forEach(function(s) {
7311
+ // Once per element: a repair that itself fails must not loop on the
7312
+ // next navigation.
7313
+ s.el.__stx_audit_recovered = true;
7314
+ try {
7315
+ var vars = s.registered ? window.stx._scopes[s.id] : null;
7316
+ if (vars) Object.assign(componentScope, vars);
7317
+ s.el.__stx_disposers = trackEffects(function() { processElement(s.el, componentScope); });
7318
+ s.el.removeAttribute('x-cloak');
7319
+ s.el.querySelectorAll('[x-cloak]').forEach(function(c) { c.removeAttribute('x-cloak'); });
7320
+ }
7321
+ catch (e) {
7322
+ console.error('[stx] hydration recovery failed for scope ' + s.id + ':', e);
7323
+ }
7324
+ });
7325
+ }
7326
+
7327
+ var literals = findLiteralMoustaches(root);
7328
+ if (literals.length) {
7329
+ console.error(
7330
+ '[stx] hydration invariant failed after ' + phase + ': literal {{ }} left in the DOM \u2014 '
7331
+ + literals.join(' | ')
7332
+ + '. An expression did not bind; see stacksjs/stx#1773. Wrap intentional '
7333
+ + 'template syntax in <pre>/<code> or [data-stx-ignore] to exclude it.',
7334
+ );
7335
+ }
7336
+
7337
+ // Expressions that threw and never recovered. Reported here rather than at
7338
+ // throw time so a first-pass miss that later resolves stays silent.
7339
+ var brokenExprs = [];
7340
+ for (var expr in _exprFailures) {
7341
+ if (Object.prototype.hasOwnProperty.call(_exprFailures, expr))
7342
+ brokenExprs.push(expr + ' \u2192 ' + _exprFailures[expr]);
7343
+ }
7344
+ if (brokenExprs.length) {
7345
+ var hint = brokenExprs.some(function(m) { return m.indexOf('is not a function') !== -1; })
7346
+ ? ' If one of these calls a signal, drop the parentheses: templates read '
7347
+ + 'a signal by bare name (:if="flag"), scripts call it (flag()). Calling '
7348
+ + 'the unwrapped value is a TypeError, which directives suppress \u2014 the '
7349
+ + 'element just stays hidden.'
7350
+ : '';
7351
+ console.error(
7352
+ '[stx] hydration invariant failed after ' + phase + ': '
7353
+ + brokenExprs.length + ' expression(s) never evaluated \u2014 '
7354
+ + brokenExprs.slice(0, 5).join(' | ') + '.' + hint,
7355
+ );
7356
+ _exprFailures = {};
7357
+ _exprFailureCount = 0;
7358
+ }
7359
+ }
7360
+
7127
7361
  // ==========================================================================
7128
7362
  // Container Cleanup (for SPA navigation)
7129
7363
  // ==========================================================================
@@ -7365,6 +7599,9 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
7365
7599
  catch (e) { console.warn('[stx] mount callback error:', e); }
7366
7600
  });
7367
7601
  mountCallbacks.length = 0;
7602
+
7603
+ // Everything that should have hydrated has now had its chance (#1773).
7604
+ auditHydration(container, 'stx:load');
7368
7605
  }
7369
7606
 
7370
7607
  // Helper to process elements while skipping already-processed scoped containers
@@ -7406,45 +7643,45 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
7406
7643
  }
7407
7644
  }
7408
7645
  })();
7409
- `}var VK;var v8=b(()=>{h7();h7();VK={state:p$,derived:l$,effect:c$,batch:v7,onMount:x7,onDestroy:f7,isSignal:i$,isDerived:n$,untrack:g7,peek:o$,generateSignalsRuntime:P8,generateSignalsRuntimeDev:s$}});var d7={};a(d7,{templateCache:()=>x8,readFileCached:()=>wK,invalidateFileCacheByDir:()=>RK,invalidateFileCache:()=>AK,hashFilePath:()=>Y$,getCachedSignalsRuntime:()=>TK,getCachedRouterScript:()=>IK,clearDevCaches:()=>DK,checkCache:()=>EK,cacheTemplate:()=>kK,__setSignalsGeneratorsForTest:()=>MK});import T1 from"fs";import H5 from"path";async function wK($){let Y;for(let J=0;J<3;J++)try{let Q=(await T1.promises.stat($)).mtime.getTime(),G=p1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),q=(await T1.promises.stat($)).mtime.getTime();if(q!==Q)continue;return p1.set($,{content:K,mtime:q}),K}catch(X){Y=X;break}throw p1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function AK($){p1.delete($)}function RK($){for(let Z of p1.keys())if(Z.startsWith($))p1.delete(Z)}function MK($){f8=$}async function TK($=!1){let Z=f8??await Promise.resolve().then(() => (v8(),C8));if($)return Z.generateSignalsRuntimeDev();if(r$===null)r$=Z.generateSignalsRuntime();return r$}async function IK(){if(a$===null){let{getRouterScript:$}=await import("stx-router");a$=$()}return a$}function DK(){p1.clear(),h8(),r$=null,NK=null,a$=null}function g8($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function EK($,Z){try{if(!Z.cachePath)return null;let Y=H5.resolve(Z.cachePath),J=H5.join(Y,`${Y$($)}.html`),X=H5.join(Y,`${Y$($)}.meta.json`);if(!await c(J)||!await c(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==g8(Z))return null;if((await T1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await c(W)){if((await T1.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function kK($,Z,Y,J){try{if(!J.cachePath)return;let X=H5.resolve(J.cachePath);await T1.promises.mkdir(X,{recursive:!0});let Q=H5.join(X,`${Y$($)}.html`),G=H5.join(X,`${Y$($)}.meta.json`),K=await T1.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:g8(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),x8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function Y$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,bK)}var x8,p1,r$=null,NK=null,f8=null,a$=null,bK=16;var u7=b(()=>{M0();x8=new Map,p1=new Map});async function d8($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
7646
+ `}var kK;var h8=b(()=>{u7();u7();kK={state:l$,derived:c$,effect:i$,batch:f7,onMount:g7,onDestroy:h7,isSignal:n$,isDerived:o$,untrack:d7,peek:s$,generateSignalsRuntime:f8,generateSignalsRuntimeDev:r$}});var m7={};a(m7,{templateCache:()=>d8,readFileCached:()=>bK,invalidateFileCacheByDir:()=>yK,invalidateFileCache:()=>SK,hashFilePath:()=>J$,getCachedSignalsRuntime:()=>vK,getCachedRouterScript:()=>xK,clearDevCaches:()=>fK,checkCache:()=>gK,cacheTemplate:()=>hK,__setSignalsGeneratorsForTest:()=>CK});import T1 from"fs";import H5 from"path";async function bK($){let Y;for(let J=0;J<3;J++)try{let Q=(await T1.promises.stat($)).mtime.getTime(),G=p1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),q=(await T1.promises.stat($)).mtime.getTime();if(q!==Q)continue;return p1.set($,{content:K,mtime:q}),K}catch(X){Y=X;break}throw p1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function SK($){p1.delete($)}function yK($){for(let Z of p1.keys())if(Z.startsWith($))p1.delete(Z)}function CK($){u8=$}async function vK($=!1){let Z=u8??await Promise.resolve().then(() => (h8(),g8));if($)return Z.generateSignalsRuntimeDev();if(a$===null)a$=Z.generateSignalsRuntime();return a$}async function xK(){if(t$===null){let{getRouterScript:$}=await import("stx-router");t$=$()}return t$}function fK(){p1.clear(),p8(),a$=null,PK=null,t$=null}function m8($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function gK($,Z){try{if(!Z.cachePath)return null;let Y=H5.resolve(Z.cachePath),J=H5.join(Y,`${J$($)}.html`),X=H5.join(Y,`${J$($)}.meta.json`);if(!await c(J)||!await c(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==m8(Z))return null;if((await T1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await c(W)){if((await T1.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function hK($,Z,Y,J){try{if(!J.cachePath)return;let X=H5.resolve(J.cachePath);await T1.promises.mkdir(X,{recursive:!0});let Q=H5.join(X,`${J$($)}.html`),G=H5.join(X,`${J$($)}.meta.json`),K=await T1.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:m8(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),d8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function J$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,dK)}var d8,p1,a$=null,PK=null,u8=null,t$=null,dK=16;var p7=b(()=>{M0();d8=new Map,p1=new Map});async function l8($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
7410
7647
  `+$.slice(K);if($.includes("</head>")){let W=$.indexOf("</head>");return $.slice(0,W)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
7411
7648
  `+$.slice(W)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
7412
7649
  `+$}if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
7413
7650
  `+$.slice(K);if($.includes("</head>")){let W=$.indexOf("</head>");return $.slice(0,W)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
7414
7651
  `+$.slice(W)}return`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
7415
- `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (u7(),d7)),X=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,Q=$.indexOf("<script");if(Q!==-1)return $.slice(0,Q)+X+`
7652
+ `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (p7(),m7)),X=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,Q=$.indexOf("<script");if(Q!==-1)return $.slice(0,Q)+X+`
7416
7653
  `+$.slice(Q);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+X+`
7417
7654
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
7418
7655
  `+X+$.slice(K+1)}return X+`
7419
- `+$}async function m7($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
7420
- `}let{getCachedRouterScript:X}=await Promise.resolve().then(() => (u7(),d7)),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await X()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
7421
- </body>`+$.slice(G+7)}var Z4={};a(Z4,{scanScriptTags:()=>n8,rewriteStxImportSpecifiers:()=>a8,processSignals:()=>n7,processScriptSetup:()=>s8,preEvalLiteralReactiveIfs:()=>c7,parseLoopExpression:()=>o8,hasSignalsSyntax:()=>$4,findMarkupIndexOutsideScripts:()=>e$,extractExports:()=>r8,convertSignalLoopsToAttributes:()=>i7,convertSignalDirectivesToAttributes:()=>l7});function n8($,Z={}){let Y=[];for(let J of w7($,V1)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let G=X[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=X[0].length,W=J.token.length-Q[0].length;Y.push({fullMatch:J.token,attrs:G,body:J.token.slice(K,W),start:J.start,end:J.end})}return Y}function o8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=m8(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=m8(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function m8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let X=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(X)return{itemVar:X[1],indexVar:X[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function $4($){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*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function yK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let X=J[1];if(X.startsWith("if"))Y++;else if(X==="endif")Y--;else if(Y===0)return!0}return!1}function PK($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,X;while((X=Y.exec($))!==null){let Q=X[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function CK($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function l8($,Z,Y){if(!$)return!1;let J=CK($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,W;while((W=K.exec(J))!==null){let j=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(p8.has(j))continue;if(Z.has(j))X=!0;else if(Y&&j in Y)Q=!0}let q=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=q.exec(J))!==null){let j=z[1];if(J.slice(0,z.index).trimEnd().endsWith("."))continue;if(p8.has(j)||Y&&j in Y)continue;G=!0}return(X||G)&&!Q}function t$($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,X=$.trim(),Q=X.match(i8);if(Q&&vK(Q[3],Q[1])){let[,G,K,W]=Q;return`<${G}${K}${J}>${W}</${G}>`}return`<template${J}>${X}</template>`}function vK($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,X;while((X=Y.exec($))!==null)if(X[1]){if(J--,J<0)return!1}else J++;return!0}function l7($,Z){let Y=PK($);function J(X){let Q=X,G=/@if\s*\(/g,K,W=[];while((K=G.exec(Q))!==null){let q=K.index,z=q+K[0].length,U=1,j=z;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")")U--;j++}if(U!==0)continue;let _=Q.substring(z,j-1).trim(),B=j,H=1,L=B,F=/@(if\s*\(|endif)/g;F.lastIndex=B;let O;while((O=F.exec(Q))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=Q.substring(B,L-6).trim(),w;if(yK(V)){let A=$$(Q.substring(q,L));if(A.length===0)continue;let R=A[0].branches.filter((T)=>T.type!=="else");if(!(R.length>0&&R.every((T)=>l8(T.condition,Y,Z))))continue;w=A[0].branches.map((T)=>{let I=J(T.content);if(T.type==="elseif")return t$(I,"@else-if",T.condition??"");if(T.type==="else")return t$(I,"@else");return t$(I,"@if",T.condition??"")}).join(`
7422
- `)}else{if(!l8(_,Y,Z))continue;w=t$(J(V),"@if",_)}W.push({start:q,end:L,replacement:w}),G.lastIndex=L}for(let q=W.length-1;q>=0;q--){let{start:z,end:U,replacement:j}=W[q];Q=Q.substring(0,z)+j+Q.substring(U)}return Q}return J($)}function xK($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let X=Number(Z);return X!==0&&!Number.isNaN(X)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function fK($,Z,Y,J){if(p7.has(Y.toLowerCase()))return J;let X=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,W=J;while(W<G){let q=$.indexOf("<",W);if(q===-1)return-1;if(W=q,$.startsWith("<!--",W)){let _=$.indexOf("-->",W+4);if(_===-1)return-1;W=_+3;continue}let z=/^<(script|style)\b/i.exec($.slice(W,W+8));if(z){let _=$.indexOf(">",W);if(_===-1)return-1;if($[_-1]==="/"){W=_+1;continue}let B=Q.indexOf(`</${z[1].toLowerCase()}`,W);if(B===-1)return-1;let H=$.indexOf(">",B);if(H===-1)return-1;W=H+1;continue}if($[W+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!_){W++;continue}if(_[1].toLowerCase()===X){if(K--,W+=_[0].length,K===0)return W;continue}W+=_[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!U){W++;continue}let j=$.indexOf(">",W);if(j===-1)return-1;if(U[1].toLowerCase()===X){let _=$.slice(W,j+1);if(!(/\/\s*>$/.test(_)||p7.has(X)))K++}W=j+1}return-1}function hK($,Z){let Y=Z,J=$.length;for(;;){while(Y<J&&$[Y]!=="<")Y++;if(Y>=J)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let X=$.indexOf(">",Y);if(X===-1)return!1;let Q=$.slice(Y,X+1);return gK.test(Q)}function c7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let X=(U)=>Z.some(([j,_])=>U>=j&&U<_),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(X(K.index))continue;let[U,j,_,B,H,L,F]=K,O=xK(H);if(O===void 0)continue;let V=K.index,w=V+U.length,N=!!F||/\/\s*>$/.test(U)||p7.has(j.toLowerCase())?w:fK($,V,j,w);if(N===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&hK($,N)){Q.lastIndex=w;continue}if(O===!0){let T=`<${j}${_}${L}${F}>`;G.push({start:V,end:w,replacement:T});continue}G.push({start:V,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((U,j)=>U.start-j.start);let W=[],q=-1;for(let U of G){if(U.start<q)continue;W.push(U),q=U.end}let z=$;for(let U=W.length-1;U>=0;U--){let{start:j,end:_,replacement:B}=W[U];z=z.substring(0,j)+B+z.substring(_)}return z}function i7($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,X,Q=[];while((X=J.exec(Y))!==null){let G=X[1],K=X.index,W=K+X[0].length,q=1,z=W;while(z<Y.length&&q>0){if(Y[z]==="(")q++;else if(Y[z]===")")q--;z++}if(q!==0)continue;let U=Y.substring(W,z-1).trim(),j=z,_=o8(U);if(_.iterable){let R=_.iterable.trim();if(R.startsWith("[")||R.startsWith("{")||R.startsWith("'")||R.startsWith('"')||R.startsWith("`")||/^-?\d/.test(R))continue;if(Z){let N=R.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(_.style==="as")U=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let B=G==="for"?"@endfor":"@endforeach",H=1,L=j,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=j;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(j,L-B.length).trim(),w=V.match(i8),A;if(w){let[,R,N,M]=w;A=`<${R}${N} @for="${U}">${M}</${R}>`}else A=`<template @for="${U}">${V}</template>`;Q.push({start:K,end:L,replacement:A})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Y=Y.substring(0,K)+q+Y.substring(W)}return Y}function dK($){let Z=new Set,Y=[],J=0,X=0,Q=$.length,G=(z)=>{let U=J+1;while(U<Q){let j=$[U];if(j==="\\"){U+=2;continue}if(j===z)return U+1;U++}return Q},K=()=>{let z=J+2;while(z<Q&&$[z]!==`
7423
- `)z++;return z},W=()=>{let z=J+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},q=(z)=>{let U=z,j=0;while(U<Q){let _=$[U];if(_==="/"&&$[U+1]==="/"){let B=U+2;while(B<Q&&$[B]!==`
7424
- `)B++;U=B;continue}if(_==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(_==='"'||_==="'"||_==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===_){B++;break}B++}U=B;continue}if(_==="("||_==="["||_==="{"){j++,U++;continue}if(_===")"||_==="]"||_==="}"){j--,U++;continue}if(_===";"&&j===0)return U+1;U++}return Q};while(J<Q){let z=$[J];if(z==="/"&&$[J+1]==="/"){let U=K();Y.push($.slice(J,U)),J=U;continue}if(z==="/"&&$[J+1]==="*"){let U=W();Y.push($.slice(J,U)),J=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);Y.push($.slice(J,U)),J=U;continue}if(z==="{"){X++,Y.push(z),J++;continue}if(z==="}"){X--,Y.push(z),J++;continue}if(X===0){let U=J>0?$[J-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let _=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let B=_[2],H=q(J+_[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),J=H;continue}Z.add(B),Y.push($.slice(J,H)),J=H;continue}}}Y.push(z),J++}return Y.join("")}async function s8($,Z,Y){let J=n8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let L of J){let F=L.body;if(x1(L.attrs))F=f1(F);if(X.test(F))Q.push({fullMatch:L.fullMatch,attrs:L.attrs,content:F})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${SK++}`,{hasUserImports:K,bundleClientScript:W}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (u5(),d5))),q=[];for(let L=0;L<Q.length;L++){let F=Q[L].content;if(F=G5(F).code,K(F))F=await W(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>a8(w));let O=r0(F);q.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
7656
+ `+$}async function l7($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
7657
+ `}let{getCachedRouterScript:X}=await Promise.resolve().then(() => (p7(),m7)),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await X()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
7658
+ </body>`+$.slice(G+7)}var Y4={};a(Y4,{scanScriptTags:()=>a8,rewriteStxImportSpecifiers:()=>ZZ,processSignals:()=>s7,processScriptSetup:()=>e8,preEvalLiteralReactiveIfs:()=>n7,parseLoopExpression:()=>t8,hasSignalsSyntax:()=>Z4,findMarkupIndexOutsideScripts:()=>$4,extractExports:()=>$Z,convertSignalLoopsToAttributes:()=>o7,convertSignalDirectivesToAttributes:()=>i7});function a8($,Z={}){let Y=[];for(let J of N7($,V1)){let X=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let G=X[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=X[0].length,W=J.token.length-Q[0].length;Y.push({fullMatch:J.token,attrs:G,body:J.token.slice(K,W),start:J.start,end:J.end})}return Y}function t8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=i8(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=i8(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function i8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let X=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(X)return{itemVar:X[1],indexVar:X[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function Z4($){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*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function mK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let X=J[1];if(X.startsWith("if"))Y++;else if(X==="endif")Y--;else if(Y===0)return!0}return!1}function pK($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,X;while((X=Y.exec($))!==null){let Q=X[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function lK($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function o8($,Z,Y){if(!$)return!1;let J=lK($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,W;while((W=K.exec(J))!==null){let j=W[1];if(J.slice(0,W.index).trimEnd().endsWith("."))continue;if(n8.has(j))continue;if(Z.has(j))X=!0;else if(Y&&j in Y)Q=!0}let q=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=q.exec(J))!==null){let j=z[1];if(J.slice(0,z.index).trimEnd().endsWith("."))continue;if(n8.has(j)||Y&&j in Y)continue;G=!0}return(X||G)&&!Q}function e$($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,X=$.trim(),Q=X.match(r8);if(Q&&cK(Q[3],Q[1])){let[,G,K,W]=Q;return`<${G}${K}${J}>${W}</${G}>`}return`<template${J}>${X}</template>`}function cK($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,X;while((X=Y.exec($))!==null)if(X[1]){if(J--,J<0)return!1}else J++;return!0}function i7($,Z){let Y=pK($);function J(X){let Q=X,G=/@if\s*\(/g,K,W=[];while((K=G.exec(Q))!==null){let q=K.index,z=q+K[0].length,U=1,j=z;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")")U--;j++}if(U!==0)continue;let B=Q.substring(z,j-1).trim(),_=j,H=1,L=_,V=/@(if\s*\(|endif)/g;V.lastIndex=_;let O;while((O=V.exec(Q))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let F=Q.substring(_,L-6).trim(),w;if(mK(F)){let A=Z$(Q.substring(q,L));if(A.length===0)continue;let R=A[0].branches.filter((M)=>M.type!=="else");if(!(R.length>0&&R.every((M)=>o8(M.condition,Y,Z))))continue;w=A[0].branches.map((M)=>{let I=J(M.content);if(M.type==="elseif")return e$(I,"@else-if",M.condition??"");if(M.type==="else")return e$(I,"@else");return e$(I,"@if",M.condition??"")}).join(`
7659
+ `)}else{if(!o8(B,Y,Z))continue;w=e$(J(F),"@if",B)}W.push({start:q,end:L,replacement:w}),G.lastIndex=L}for(let q=W.length-1;q>=0;q--){let{start:z,end:U,replacement:j}=W[q];Q=Q.substring(0,z)+j+Q.substring(U)}return Q}return J($)}function iK($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let X=Number(Z);return X!==0&&!Number.isNaN(X)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function nK($,Z,Y,J){if(c7.has(Y.toLowerCase()))return J;let X=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,W=J;while(W<G){let q=$.indexOf("<",W);if(q===-1)return-1;if(W=q,$.startsWith("<!--",W)){let B=$.indexOf("-->",W+4);if(B===-1)return-1;W=B+3;continue}let z=/^<(script|style)\b/i.exec($.slice(W,W+8));if(z){let B=$.indexOf(">",W);if(B===-1)return-1;if($[B-1]==="/"){W=B+1;continue}let _=Q.indexOf(`</${z[1].toLowerCase()}`,W);if(_===-1)return-1;let H=$.indexOf(">",_);if(H===-1)return-1;W=H+1;continue}if($[W+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!B){W++;continue}if(B[1].toLowerCase()===X){if(K--,W+=B[0].length,K===0)return W;continue}W+=B[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!U){W++;continue}let j=$.indexOf(">",W);if(j===-1)return-1;if(U[1].toLowerCase()===X){let B=$.slice(W,j+1);if(!(/\/\s*>$/.test(B)||c7.has(X)))K++}W=j+1}return-1}function sK($,Z){let Y=Z,J=$.length;for(;;){while(Y<J&&$[Y]!=="<")Y++;if(Y>=J)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let X=$.indexOf(">",Y);if(X===-1)return!1;let Q=$.slice(Y,X+1);return oK.test(Q)}function n7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let X=(U)=>Z.some(([j,B])=>U>=j&&U<B),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(X(K.index))continue;let[U,j,B,_,H,L,V]=K,O=iK(H);if(O===void 0)continue;let F=K.index,w=F+U.length,N=!!V||/\/\s*>$/.test(U)||c7.has(j.toLowerCase())?w:nK($,F,j,w);if(N===-1)continue;if((_===":if"||_==="x-if"||_==="@if")&&sK($,N)){Q.lastIndex=w;continue}if(O===!0){let M=`<${j}${B}${L}${V}>`;G.push({start:F,end:w,replacement:M});continue}G.push({start:F,end:N,replacement:""}),Q.lastIndex=N}if(G.length===0)return $;G.sort((U,j)=>U.start-j.start);let W=[],q=-1;for(let U of G){if(U.start<q)continue;W.push(U),q=U.end}let z=$;for(let U=W.length-1;U>=0;U--){let{start:j,end:B,replacement:_}=W[U];z=z.substring(0,j)+_+z.substring(B)}return z}function o7($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,X,Q=[];while((X=J.exec(Y))!==null){let G=X[1],K=X.index,W=K+X[0].length,q=1,z=W;while(z<Y.length&&q>0){if(Y[z]==="(")q++;else if(Y[z]===")")q--;z++}if(q!==0)continue;let U=Y.substring(W,z-1).trim(),j=z,B=t8(U);if(B.iterable){let R=B.iterable.trim();if(R.startsWith("[")||R.startsWith("{")||R.startsWith("'")||R.startsWith('"')||R.startsWith("`")||/^-?\d/.test(R))continue;if(Z){let N=R.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let _=G==="for"?"@endfor":"@endforeach",H=1,L=j,V=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");V.lastIndex=j;let O;while((O=V.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let F=Y.substring(j,L-_.length).trim(),w=F.match(r8),A;if(w){let[,R,N,T]=w;A=`<${R}${N} @for="${U}">${T}</${R}>`}else A=`<template @for="${U}">${F}</template>`;Q.push({start:K,end:L,replacement:A})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Y=Y.substring(0,K)+q+Y.substring(W)}return Y}function rK($){let Z=new Set,Y=[],J=0,X=0,Q=$.length,G=(z)=>{let U=J+1;while(U<Q){let j=$[U];if(j==="\\"){U+=2;continue}if(j===z)return U+1;U++}return Q},K=()=>{let z=J+2;while(z<Q&&$[z]!==`
7660
+ `)z++;return z},W=()=>{let z=J+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},q=(z)=>{let U=z,j=0;while(U<Q){let B=$[U];if(B==="/"&&$[U+1]==="/"){let _=U+2;while(_<Q&&$[_]!==`
7661
+ `)_++;U=_;continue}if(B==="/"&&$[U+1]==="*"){let _=U+2;while(_<Q-1&&!($[_]==="*"&&$[_+1]==="/"))_++;U=_+2;continue}if(B==='"'||B==="'"||B==="`"){let _=U+1;while(_<Q){if($[_]==="\\"){_+=2;continue}if($[_]===B){_++;break}_++}U=_;continue}if(B==="("||B==="["||B==="{"){j++,U++;continue}if(B===")"||B==="]"||B==="}"){j--,U++;continue}if(B===";"&&j===0)return U+1;U++}return Q};while(J<Q){let z=$[J];if(z==="/"&&$[J+1]==="/"){let U=K();Y.push($.slice(J,U)),J=U;continue}if(z==="/"&&$[J+1]==="*"){let U=W();Y.push($.slice(J,U)),J=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);Y.push($.slice(J,U)),J=U;continue}if(z==="{"){X++,Y.push(z),J++;continue}if(z==="}"){X--,Y.push(z),J++;continue}if(X===0){let U=J>0?$[J-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let _=B[2],H=q(J+B[0].length);if(Z.has(_)){Y.push(`/* stx: deduped const ${_} */`),J=H;continue}Z.add(_),Y.push($.slice(J,H)),J=H;continue}}}Y.push(z),J++}return Y.join("")}async function e8($,Z,Y){let J=a8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let L of J){let V=L.body;if(x1(L.attrs))V=f1(V);if(X.test(V))Q.push({fullMatch:L.fullMatch,attrs:L.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${uK++}`,{hasUserImports:K,bundleClientScript:W}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (m5(),u5))),q=[];for(let L=0;L<Q.length;L++){let V=Q[L].content;if(V=G5(V).code,K(V))V=await W(V,Z||"",{projectRoot:process.cwd()});V=V.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,w)=>ZZ(w));let O=r0(V);q.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
7425
7662
  ${O}`)}let z=q.join(`
7426
7663
 
7427
- `);z=dK(z);let U=r8(z),j=U.split(",").map((L)=>L.trim()).filter(Boolean),_=D$(z,Y),B=`
7664
+ `);z=rK(z);let U=$Z(z),j=U.split(",").map((L)=>L.trim()).filter(Boolean),B=E$(z,Y),_=`
7428
7665
  <script data-stx-scoped>
7429
7666
  function ${G}() {
7430
7667
  ${q5("const",j)}
7431
- ${_}${z}
7668
+ ${B}${z}
7432
7669
  return { ${U} };
7433
7670
  }
7434
7671
  window.__stx_latestSetup=${G};
7435
7672
  if(window.stx)window.stx._latestSetup=${G};
7436
- </script>`,H=$;for(let L of Q)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${u8})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],F=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${u8})>`,"gi"),(O,V,w)=>{if(F||L.includes(V.toLowerCase()))return O;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:H,setupCode:B}}function r8($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K="",W=()=>{Q++;let B=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!B){B=!0,Q++;continue}if(H==="]"&&B){B=!1,Q++;continue}if(H==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
7437
- `)return;Q++}},q=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},z=(B)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===B){Q++;return}Q++}},U=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let B=1;while(Q<G&&B>0)if(Z[Q]==="{")B++,Q++;else if(Z[Q]==="}")B--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")U();else Q++;continue}Q++}},j=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
7438
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},_=()=>{if(X!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let V=B[2];if(!J.has(V))Y.push(V),J.add(V);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),N=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(N&&!J.has(N))Y.push(N),J.add(N)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!J.has(A))Y.push(A),J.add(A)});return}let F=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!J.has(V))Y.push(V),J.add(V);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!J.has(V))Y.push(V),J.add(V)}};while(Q<G){if(j())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){U(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){W(),K="/";continue}if(Z[Q]==="{"){X++,K="{",Q++;continue}if(Z[Q]==="}"){X--,K="}",Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))_();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function n7($,Z,Y,J){if(!$4($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await s8(X,Y,J);if(X=Q,X=await d8(X,Z),G){let z=e$(X,/<\/head>/i),U=z===-1?e$(X,/<body[^>]*>/i):-1;if(z!==-1)X=`${X.slice(0,z)}${G}
7439
- ${X.slice(z)}`;else if(U!==-1){let j=/<body[^>]*>/i.exec(X.slice(U))[0],_=U+j.length;X=`${X.slice(0,_)}
7440
- ${G}${X.slice(_)}`}else X=`${X}
7441
- ${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=W&&/data-stx/.test(W[1]);if(!G&&!q&&W&&!/data-stx-auto/.test(W[1])){let z=/<body[^>]*>/i,U=e$(X,z);if(U!==-1){let j=X.slice(0,U),_=X.slice(U).replace(z,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+_}}return X}function e$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],X;while((X=Y.exec($))!==null)J.push([X.index,X.index+X[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let W=G+K.index;if(!J.some(([z,U])=>W>=z&&W<U))return W;G=W+Math.max(K[0].length,1)}return-1}function a8($){let Z=[];for(let Y of $.split(",")){let J=Y.trim();if(!J||J.startsWith("type "))continue;let X=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X&&X[1]!==X[2])Z.push(`${X[2]} = ${X[1]}`)}if(Z.length===0)return c8;return`var ${Z.join(", ")}; ${c8}`}var SK=0,u8=`(?:"[^"]*"|'[^']*'|[^>"'])*`,i8,p8,p7,gK,c8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var J$=b(()=>{c5();d$();r5();M0();g1();h5();i8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;p8=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);p7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);gK=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import uK from"fs";import h from"path";function pK($){let Z=new WeakSet;try{let Y=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(Y);let X={};for(let Q of Object.keys(J).sort())X[Q]=Y(J[Q]);return X};return JSON.stringify(Y($))}catch{return null}}function t8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function x1($){return!lK($)}function f1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let X=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)X=X.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),X=X.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return X}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function cK($){let Z=[],Y=new Set,J=0,X=0,Q=$.length,G=(z)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===z){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let z=1;while(X<Q&&z>0)if($[X]==="{")z++,X++;else if($[X]==="}")z--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},W=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
7442
- `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},q=()=>{if(J!==0)return;let z=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let B=z[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of B)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let _=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){J++,X++;continue}if($[X]==="}"){J--,X++;continue}if(J===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))q();X++}return Z}function iK($){let Z=[],Y=0,J=0,X=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G==="\\"){Q++;continue}if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function nK($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function oK($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let X=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of iK(K)){let q=W.trim();if(!q||q.startsWith("..."))continue;let z=nK(q);if(z===-1)continue;let U=q.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=q.slice(z+1).trim();if(!j)continue;try{let _=Object.keys(Z),B=Function(..._,`"use strict"; return (${j});`);Z[U]=B(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function X4($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let L of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(L))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],z=typeof X.root==="string"?h.resolve(X.root):void 0,U=z??h.dirname(J),j=[],_=(L)=>{if(L&&!j.includes(L))j.push(L)},B=Y.__originalFilePath;if(B)_(h.join(h.dirname(B),"components"));_(Z),_(X._rootComponentsDir),_(h.join(h.dirname(J),"components")),_(X.componentsDir);let H=X._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(z)_(h.resolve(z,"resources/views/components")),_(h.resolve(z,"resources/components")),_(h.resolve(z,"src/components")),_(h.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(h.resolve(h.dirname(J),`${Q}.stx`));for(let L of j){let F=h.isAbsolute(L)?L:h.resolve(U,L);for(let O of q)if(await c(h.join(F,O)))return!0}return!1}function sK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function rK($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function aK($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let X;while((X=Y.exec(J))!==null)Z.add(X[1]);Y.lastIndex=0}return[...Z]}async function l1($,Z,Y,J,X,Q,G,K=new Set,W){let{extractVariables:q}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (e5(),g$))),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let U=new Set(z);U.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=j&&j!=="load"&&sK(j)?j:"";try{let B=(P)=>P.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=X.__importedComponents;if(O){let P=[L,L.toLowerCase(),B(L),H(L)];for(let x of P)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let P=[`${L}.stx`,`${B(L)}.stx`,`${H(L)}.stx`],x=[...new Set(P)],m=X.__originalFilePath,u=[];if(m){let z0=h.join(h.dirname(m),"components");u.push(z0)}if(J)u.push(J);let j0=G._rootComponentsDir;if(typeof j0==="string"&&!u.includes(j0))u.push(j0);let N0=h.join(h.dirname(Q),"components");if(!u.includes(N0))u.push(N0);if(G.componentsDir&&G.componentsDir!==J&&!u.includes(G.componentsDir))u.push(G.componentsDir);let W1=G._pluginComponentDirs;if(Array.isArray(W1)){for(let z0 of W1)if(typeof z0==="string"&&!u.includes(z0))u.push(z0)}let l0=typeof G.root==="string"?h.resolve(G.root):void 0,v0=l0??h.dirname(Q),s0=[];if(l0)s0.push(h.resolve(l0,"resources/views/components")),s0.push(h.resolve(l0,"resources/components")),s0.push(h.resolve(l0,"src/components")),s0.push(h.resolve(l0,"components"));s0.push(h.resolve(import.meta.dir,"components"));for(let z0 of s0)if(!u.includes(z0))u.push(z0);let y1=[...new Set(u.map((z0)=>{if(!z0)return z0;return h.isAbsolute(z0)?z0:h.resolve(v0,z0)}))];u.length=0,u.push(...y1);let O1=`${L}\x00${Q}\x00${y1.join("\x00")}`,J5=J4.get(O1);if(J5)if(await c(J5))F=J5;else J4.delete(O1);if(!F&&(L.startsWith("./")||L.startsWith("../")))F=h.resolve(h.dirname(Q),`${L}.stx`),V.push(F);else if(!F)for(let z0 of u){if(!z0)continue;for(let i of x){let d0=h.join(z0,i);if(V.push(d0),await c(d0)){F=d0;break}}if(F)break;if(!F)try{let i=await import("fs");if(!i.statSync(z0,{throwIfNoEntry:!1})?.isDirectory())continue;let P5=8,X5=[{path:z0,depth:0}];while(X5.length>0&&!F){let q1=X5.pop();if(q1.depth>=P5)continue;let N$;try{N$=i.readdirSync(q1.path,{withFileTypes:!0})}catch{continue}for(let M$ of N$){if(!M$.isDirectory())continue;if(M$.name==="node_modules"||M$.name.startsWith("."))continue;let J9=h.join(q1.path,M$.name);for(let RQ of x){let z7=h.join(J9,RQ);if(V.push(z7),await c(z7)){F=z7;break}}if(F)break;X5.push({path:J9,depth:q1.depth+1})}}}catch{}if(F)break}if(F)J4.set(O1,F)}if(!F||!await c(F)){let P=V.length>0?`
7673
+ </script>`,H=$;for(let L of Q)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${c8})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],V=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${c8})>`,"gi"),(O,F,w)=>{if(V||L.includes(F.toLowerCase()))return O;return V=!0,`<${F}${w} data-stx="${G}">`})}return{output:H,setupCode:_}}function $Z($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K="",W=()=>{Q++;let _=!1;while(Q<G){let H=Z[Q];if(H==="\\"){Q+=2;continue}if(H==="["&&!_){_=!0,Q++;continue}if(H==="]"&&_){_=!1,Q++;continue}if(H==="/"&&!_){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(H===`
7674
+ `)return;Q++}},q=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},z=(_)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===_){Q++;return}Q++}},U=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let _=1;while(Q<G&&_>0)if(Z[Q]==="{")_++,Q++;else if(Z[Q]==="}")_--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")U();else Q++;continue}Q++}},j=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
7675
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},B=()=>{if(X!==0)return;let _=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(_){let F=_[2];if(!J.has(F))Y.push(F),J.add(F);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((F)=>{let w=F.trim();if(!w)return;let A=w.indexOf(":"),N=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(N&&!J.has(N))Y.push(N),J.add(N)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((F)=>{let w=F.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!J.has(A))Y.push(A),J.add(A)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let F=V[1];if(!J.has(F))Y.push(F),J.add(F);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!J.has(F))Y.push(F),J.add(F)}};while(Q<G){if(j())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){U(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&q()){W(),K="/";continue}if(Z[Q]==="{"){X++,K="{",Q++;continue}if(Z[Q]==="}"){X--,K="}",Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))B();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function s7($,Z,Y,J){if(!Z4($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await e8(X,Y,J);if(X=Q,X=await l8(X,Z),G){let z=$4(X,/<\/head>/i),U=z===-1?$4(X,/<body[^>]*>/i):-1;if(z!==-1)X=`${X.slice(0,z)}${G}
7676
+ ${X.slice(z)}`;else if(U!==-1){let j=/<body[^>]*>/i.exec(X.slice(U))[0],B=U+j.length;X=`${X.slice(0,B)}
7677
+ ${G}${X.slice(B)}`}else X=`${X}
7678
+ ${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=W&&/data-stx/.test(W[1]);if(!G&&!q&&W&&!/data-stx-auto/.test(W[1])){let z=/<body[^>]*>/i,U=$4(X,z);if(U!==-1){let j=X.slice(0,U),B=X.slice(U).replace(z,(_)=>_.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+B}}return X}function $4($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],X;while((X=Y.exec($))!==null)J.push([X.index,X.index+X[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let W=G+K.index;if(!J.some(([z,U])=>W>=z&&W<U))return W;G=W+Math.max(K[0].length,1)}return-1}function ZZ($){let Z=[];for(let Y of $.split(",")){let J=Y.trim();if(!J||J.startsWith("type "))continue;let X=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X&&X[1]!==X[2])Z.push(`${X[2]} = ${X[1]}`)}if(Z.length===0)return s8;return`var ${Z.join(", ")}; ${s8}`}var uK=0,c8=`(?:"[^"]*"|'[^']*'|[^>"'])*`,r8,n8,c7,oK,s8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var X$=b(()=>{i5();u$();a5();M0();g1();d5();r8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;n8=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);c7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);oK=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import aK from"fs";import h from"path";function eK($){let Z=new WeakSet;try{let Y=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(Y);let X={};for(let Q of Object.keys(J).sort())X[Q]=Y(J[Q]);return X};return JSON.stringify(Y($))}catch{return null}}function YZ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $W($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function x1($){return!$W($)}function f1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let X=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)X=X.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),X=X.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return X}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function ZW($){let Z=[],Y=new Set,J=0,X=0,Q=$.length,G=(z)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===z){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let z=1;while(X<Q&&z>0)if($[X]==="{")z++,X++;else if($[X]==="}")z--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},W=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
7679
+ `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},q=()=>{if(J!==0)return;let z=$.slice(X).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let _=z[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of _)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let _=U[2];if(!Y.has(_))Z.push(_),Y.add(_);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let _=j[1];if(!Y.has(_))Z.push(_),Y.add(_);return}let B=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let _=B[1];if(!Y.has(_))Z.push(_),Y.add(_)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){J++,X++;continue}if($[X]==="}"){J--,X++;continue}if(J===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))q();X++}return Z}function YW($){let Z=[],Y=0,J=0,X=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G==="\\"){Q++;continue}if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function JW($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let X=$[J];if(Y){if(X==="\\"){J++;continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function XW($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let X=J,Q=0,G=-1;for(;J>=0;J--){let W=$[J];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of YW(K)){let q=W.trim();if(!q||q.startsWith("..."))continue;let z=JW(q);if(z===-1)continue;let U=q.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=q.slice(z+1).trim();if(!j)continue;try{let B=Object.keys(Z),_=Function(...B,`"use strict"; return (${j});`);Z[U]=_(...B.map((H)=>Z[H]))}catch{}}}catch{}}async function Q4($,Z,Y,J,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let L of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(L))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],z=typeof X.root==="string"?h.resolve(X.root):void 0,U=z??h.dirname(J),j=[],B=(L)=>{if(L&&!j.includes(L))j.push(L)},_=Y.__originalFilePath;if(_)B(h.join(h.dirname(_),"components"));B(Z),B(X._rootComponentsDir),B(h.join(h.dirname(J),"components")),B(X.componentsDir);let H=X._pluginComponentDirs;if(Array.isArray(H))for(let L of H)B(typeof L==="string"?L:null);if(z)B(h.resolve(z,"resources/views/components")),B(h.resolve(z,"resources/components")),B(h.resolve(z,"src/components")),B(h.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(h.resolve(h.dirname(J),`${Q}.stx`));for(let L of j){let V=h.isAbsolute(L)?L:h.resolve(U,L);for(let O of q)if(await c(h.join(V,O)))return!0}return!1}function QW($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function GW($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function KW($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let X;while((X=Y.exec(J))!==null)Z.add(X[1]);Y.lastIndex=0}return[...Z]}async function l1($,Z,Y,J,X,Q,G,K=new Set,W){let{extractVariables:q}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => ($$(),h$))),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let U=new Set(z);U.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=j&&j!=="load"&&QW(j)?j:"";try{let _=(v)=>v.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(v)=>v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,V=null,O=X.__importedComponents;if(O){let v=[L,L.toLowerCase(),_(L),H(L)];for(let x of v)if(O.has(x)){V=O.get(x);break}}let F=[];if(!V){let v=[`${L}.stx`,`${_(L)}.stx`,`${H(L)}.stx`],x=[...new Set(v)],m=X.__originalFilePath,u=[];if(m){let z0=h.join(h.dirname(m),"components");u.push(z0)}if(J)u.push(J);let j0=G._rootComponentsDir;if(typeof j0==="string"&&!u.includes(j0))u.push(j0);let N0=h.join(h.dirname(Q),"components");if(!u.includes(N0))u.push(N0);if(G.componentsDir&&G.componentsDir!==J&&!u.includes(G.componentsDir))u.push(G.componentsDir);let W1=G._pluginComponentDirs;if(Array.isArray(W1)){for(let z0 of W1)if(typeof z0==="string"&&!u.includes(z0))u.push(z0)}let l0=typeof G.root==="string"?h.resolve(G.root):void 0,v0=l0??h.dirname(Q),s0=[];if(l0)s0.push(h.resolve(l0,"resources/views/components")),s0.push(h.resolve(l0,"resources/components")),s0.push(h.resolve(l0,"src/components")),s0.push(h.resolve(l0,"components"));s0.push(h.resolve(import.meta.dir,"components"));for(let z0 of s0)if(!u.includes(z0))u.push(z0);let y1=[...new Set(u.map((z0)=>{if(!z0)return z0;return h.isAbsolute(z0)?z0:h.resolve(v0,z0)}))];u.length=0,u.push(...y1);let O1=`${L}\x00${Q}\x00${y1.join("\x00")}`,J5=X4.get(O1);if(J5)if(await c(J5))V=J5;else X4.delete(O1);if(!V&&(L.startsWith("./")||L.startsWith("../")))V=h.resolve(h.dirname(Q),`${L}.stx`),F.push(V);else if(!V)for(let z0 of u){if(!z0)continue;for(let i of x){let d0=h.join(z0,i);if(F.push(d0),await c(d0)){V=d0;break}}if(V)break;if(!V)try{let i=await import("fs");if(!i.statSync(z0,{throwIfNoEntry:!1})?.isDirectory())continue;let C5=8,X5=[{path:z0,depth:0}];while(X5.length>0&&!V){let q1=X5.pop();if(q1.depth>=C5)continue;let M$;try{M$=i.readdirSync(q1.path,{withFileTypes:!0})}catch{continue}for(let T$ of M$){if(!T$.isDirectory())continue;if(T$.name==="node_modules"||T$.name.startsWith("."))continue;let G9=h.join(q1.path,T$.name);for(let SQ of x){let B7=h.join(G9,SQ);if(F.push(B7),await c(B7)){V=B7;break}}if(V)break;X5.push({path:G9,depth:q1.depth+1})}}}catch{}if(V)break}if(V)X4.set(O1,V)}if(!V||!await c(V)){let v=F.length>0?`
7443
7680
  Searched paths:
7444
- ${V.map((x)=>` - ${x}`).join(`
7445
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}W.add(F);let w;if(Y4.has(F))w=Y4.get(F);else try{w=await Bun.file(F).text(),Y4.set(F,w)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let A=new Set(["__originalFilePath","__importedComponents",E$]),R={};for(let[P,x]of Object.entries(X))if(!P.startsWith("__")||A.has(P))R[P]=x;let{extractSlotContent:N}=await t("stx/slots",()=>Promise.resolve().then(() => (P7(),y7))),M=N(Y),T={};if(M.defaultSlot?.trim())T.default=M.defaultSlot;for(let[P,x]of M.namedSlots)T[P]=x.content;let I={...R,...Z,props:Z,slot:Y,$slots:T,__processedComponents:U,__sections:{},...rK(Y)&&{__stx_force_signals:!0}};oK(w,I);let E=w,D=v$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(y)],k=[],v=S.some((P)=>/\bserver\b/.test(P[1]||"")&&/\bcache\b/.test(P[1]||""))&&S.every((P)=>/\bserver\b/.test(P[1]||"")),g=null,f=null;if(v){let P=pK({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(P!==null){g=`${F}\x00${P}`;let x=o7.get(g);if(x){for(let m of x.dependencies)W.add(m);return x.output}f=new Set(W)}}for(let P of S){let x=P[1]||"",m=P[2]||"",u=x.includes("server");if(x1(x)&&m.trim())m=f1(m);if(u&&m)try{await q(m,I,F)}catch(N0){}if(!u){let N0=m.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),W1=N0.includes("{{")&&N0.includes("}}"),l0=N0.includes("{!!")&&N0.includes("!!}");if(W1||l0)N0=y$(N0,I);let v0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${v0}>${N0}</script>`)}}let d=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),p=d?d[1]:"",Q0=d?d[2]:"",Y0="",w0=p&&/\bscoped\b/i.test(p);if(d)Y0=`<style${p}>${Q0}</style>`;let s=E;if(s=s.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),d)s=s.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(s=s.replace(P,(m,u)=>{let j0=u.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(j0)x.push(`<style${j0[1]}>${j0[2]}</style>`);return""}),s=s.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)Y0=`${Y0}${x.join(`
7446
- `)}`}if(Y&&s.includes("{{ text || slot }}"))s=s.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:G0}=await t("stx/slots",()=>Promise.resolve().then(() => (P7(),y7))),{defaultSlot:b0,namedSlots:o0}=M;s=await G0(s,b0,o0,I);for(let[P,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let m=A7(x);I[P]=m}}let H1=k.some((P)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),Y5=aK(k);if(Y5.length>0)I.__stx_client_signal_names=Y5;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:H1||k.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let X0=await L0(s,I,F,n,W),H0=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let P of X0.matchAll(/\{\{([\s\S]*?)\}\}/g))H0.add(P[1].trim());if(H0.size>0)X.__stx_preserved_client_expressions=[...H0];let D0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++mK}_${Math.random().toString(36).slice(2,8)}`,C=X0;if(H1){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${t8(JSON.stringify(Z))}"`}catch{}let x=_?` stx-hydrate="${t8(_)}"`:"";C=`<div data-stx-scope="${D0}"${P}${x}>${X0}</div>`;let m=await Promise.all(k.map(async(u)=>{let j0=u.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!j0)return u;let[,N0,W1]=j0,l0=T$(W1,{filePath:F,projectRoot:process.cwd()}),v0=l0.code,s0=I$(l0.styles);v0=G5(v0).code;let{hasUserImports:y1,bundleClientScript:O1}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (u5(),d5)));if(y1(v0))v0=await O1(v0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:J5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (J$(),Z4)));v0=v0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(q1,N$)=>J5(N$));let z0=r0(v0),i=cK(z0),d0=`function(__scopeId) {
7447
- ${q5("const",[...J8,...i],z0)}
7681
+ ${F.map((x)=>` - ${x}`).join(`
7682
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${v}`}W.add(V);let w;if(J4.has(V))w=J4.get(V);else try{w=await Bun.file(V).text(),J4.set(V,w)}catch(v){return`[Error loading component: ${v instanceof Error?v.message:String(v)}]`}let A=new Set(["__originalFilePath","__importedComponents",k$]),R={};for(let[v,x]of Object.entries(X))if(!v.startsWith("__")||A.has(v))R[v]=x;let{extractSlotContent:N}=await t("stx/slots",()=>Promise.resolve().then(() => (v7(),C7))),T=N(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[v,x]of T.namedSlots)M[v]=x.content;let I={...R,...Z,props:Z,slot:Y,$slots:M,__processedComponents:U,__sections:{},...GW(Y)&&{__stx_force_signals:!0}};XW(w,I);let E=w,D=x$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(y)],k=[],C=S.some((v)=>/\bserver\b/.test(v[1]||"")&&/\bcache\b/.test(v[1]||""))&&S.every((v)=>/\bserver\b/.test(v[1]||"")),g=null,f=null;if(C){let v=eK({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(v!==null){g=`${V}\x00${v}`;let x=r7.get(g);if(x){for(let m of x.dependencies)W.add(m);return x.output}f=new Set(W)}}for(let v of S){let x=v[1]||"",m=v[2]||"",u=x.includes("server");if(x1(x)&&m.trim())m=f1(m);if(u&&m)try{await q(m,I,V)}catch(N0){}if(!u){let N0=m.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),W1=N0.includes("{{")&&N0.includes("}}"),l0=N0.includes("{!!")&&N0.includes("!!}");if(W1||l0)N0=P$(N0,I);let v0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${v0}>${N0}</script>`)}}let d=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),p=d?d[1]:"",Q0=d?d[2]:"",Y0="",w0=p&&/\bscoped\b/i.test(p);if(d)Y0=`<style${p}>${Q0}</style>`;let r=E;if(r=r.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),d)r=r.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let v=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(r=r.replace(v,(m,u)=>{let j0=u.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(j0)x.push(`<style${j0[1]}>${j0[2]}</style>`);return""}),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)Y0=`${Y0}${x.join(`
7683
+ `)}`}if(Y&&r.includes("{{ text || slot }}"))r=r.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:G0}=await t("stx/slots",()=>Promise.resolve().then(() => (v7(),C7))),{defaultSlot:b0,namedSlots:o0}=T;r=await G0(r,b0,o0,I);let H1=k.some((v)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(v)),Y5=KW(k);if(Y5.length>0)I.__stx_client_signal_names=Y5;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:H1||k.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let X0=await L0(r,I,V,n,W),H0=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let v of X0.matchAll(/\{\{([\s\S]*?)\}\}/g))H0.add(v[1].trim());if(H0.size>0)X.__stx_preserved_client_expressions=[...H0];let D0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++tK}_${Math.random().toString(36).slice(2,8)}`,P=X0;if(H1){let v="";if(Object.keys(Z).length>0)try{v=` data-stx-props="${YZ(JSON.stringify(Z))}"`}catch{}let x=B?` stx-hydrate="${YZ(B)}"`:"";P=`<div data-stx-scope="${D0}"${v}${x}>${X0}</div>`;let m=await Promise.all(k.map(async(u)=>{let j0=u.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!j0)return u;let[,N0,W1]=j0,l0=I$(W1,{filePath:V,projectRoot:process.cwd()}),v0=l0.code,s0=D$(l0.styles);v0=G5(v0).code;let{hasUserImports:y1,bundleClientScript:O1}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (m5(),u5)));if(y1(v0))v0=await O1(v0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:J5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (X$(),Y4)));v0=v0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(q1,M$)=>J5(M$));let z0=r0(v0),i=ZW(z0),d0=`function(__scopeId) {
7684
+ ${q5("const",[...G8,...i],z0)}
7448
7685
  const __scope = window.stx._scopes = window.stx._scopes || {};
7449
7686
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
7450
7687
  const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
@@ -7471,15 +7708,15 @@ catch (e) {}
7471
7708
  finally {
7472
7709
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
7473
7710
  }
7474
- }`,P5=_?null:g9(X,d0),X5=P5?`window.__stxComponentFactories[${JSON.stringify(P5)}](${JSON.stringify(D0)});`:`(${d0})(${JSON.stringify(D0)});`;if(_)return`${s0}<script type="stx/island" data-stx-island="${D0}" data-stx-scoped${N0}>${X5}</script>`;return`${s0}<script data-stx-scoped${N0}>${X5}</script>`}));if(C=C+`
7711
+ }`,C5=B?null:u9(X,d0),X5=C5?`window.__stxComponentFactories[${JSON.stringify(C5)}](${JSON.stringify(D0)});`:`(${d0})(${JSON.stringify(D0)});`;if(B)return`${s0}<script type="stx/island" data-stx-island="${D0}" data-stx-scoped${N0}>${X5}</script>`;return`${s0}<script data-stx-scoped${N0}>${X5}</script>`}));if(P=P+`
7475
7712
  `+m.join(`
7476
- `),Y0)C+=`
7477
- `+Y0}else{if(Y0)C+=`
7478
- `+Y0;if(k.length>0){let P=I.__stx_event_bindings||[],x=p5(I),m=await Promise.all(k.map(async(u)=>{let j0=u.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!j0)return u;return await l5(j0[1],{eventBindings:P,templateContent:C,filePath:F,projectRoot:process.cwd(),serverData:x})}));C+=`
7713
+ `),Y0)P+=`
7714
+ `+Y0}else{if(Y0)P+=`
7715
+ `+Y0;if(k.length>0){let v=I.__stx_event_bindings||[],x=l5(I),m=await Promise.all(k.map(async(u)=>{let j0=u.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!j0)return u;return await c5(j0[1],{eventBindings:v,templateContent:P,filePath:V,projectRoot:process.cwd(),serverData:x})}));P+=`
7479
7716
  `+m.join(`
7480
- `),I.__stx_event_bindings=[]}}if(w0){let P=C$(C,F);if(P.hasScoped)C=P.html}if(g&&f)o7.set(g,{output:C,dependencies:[...W].filter((P)=>!f.has(P))});return C}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{z.delete($)}}async function c($){return Bun.file($).exists()}function s7($,Z){let Y=h.resolve(Z),J=h.resolve($),X=Y.endsWith(h.sep)?Y:Y+h.sep;if(J===Y||J.startsWith(X))return J;return null}async function r7($,Z,Y,J){let X=await tK($,Z,Y,J);if(X===null)return null;let Q=s7(X,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(s7(X,W))return h.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function tK($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=h.join(Q,$),_=s7(j,Q);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await c(_)&&J)J.add(_);return _}let G=h.join(X,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let _=`${G}${j}`;if(await c(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(J)J.add(_);return _}}let K="",W=h.resolve(X),q=process.cwd();for(let j=0;j<10;j++){let _=h.join(W,"layouts"),B=!1;try{B=uK.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=_;break}let H=h.dirname(W);if(H===W||H.length<q.length)break;W=H}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,_=h.join(K,j);if(await c(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(J)J.add(_);return _}if(!j.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.layoutsDir){let j=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,B=h.join(j,_);if(await c(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let H=`${B}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(J)J.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),_=h.join(Y.partialsDir||X,"layouts",j[1]);if(await c(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(J)J.add(_);return _}if(!_.endsWith(".stx")){let B=`${_}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await c(K)){let j=h.join(K,$);if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}}let z=Y.partialsDir||h.join(process.cwd(),"views"),U=h.join(z,$);if(await c(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(J)J.add(j);return j}}if(X.includes("temp")){let j=h.join(h.dirname(X),"layouts",$);if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function e8($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
7481
- `),K=0;for(let W=0;W<G.length;W++)if(K+=G[W].length+1,K>=Z){J=W+1,X=G[W].trim();let q=Math.max(0,W-2),z=Math.min(G.length,W+3);Q=G.slice(q,z).map((U,j)=>{let _=q+j+1;return`${_===J?"> ":" "}${_}: ${U}`}).join(`
7482
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return e8($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function U0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=e8(J,X,Q),W=Y.split("/").pop(),q=0;if(typeof X==="number"&&X>=0&&J){let U=J.lastIndexOf(`
7717
+ `),I.__stx_event_bindings=[]}}if(w0){let v=v$(P,V);if(v.hasScoped)P=v.html}if(g&&f)r7.set(g,{output:P,dependencies:[...W].filter((v)=>!f.has(v))});return P}catch(_){return`[Error processing component: ${_ instanceof Error?_.message:String(_)}]`}finally{z.delete($)}}async function c($){return Bun.file($).exists()}function a7($,Z){let Y=h.resolve(Z),J=h.resolve($),X=Y.endsWith(h.sep)?Y:Y+h.sep;if(J===Y||J.startsWith(X))return J;return null}async function t7($,Z,Y,J){let X=await WW($,Z,Y,J);if(X===null)return null;let Q=a7(X,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(a7(X,W))return h.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function WW($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=h.join(Q,$),B=a7(j,Q);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${B}`);if(await c(B)&&J)J.add(B);return B}let G=h.join(X,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let B=`${G}${j}`;if(await c(B)){if(Y.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let K="",W=h.resolve(X),q=process.cwd();for(let j=0;j<10;j++){let B=h.join(W,"layouts"),_=!1;try{_=aK.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(_){K=B;break}let H=h.dirname(W);if(H===W||H.length<q.length)break;W=H}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,B=h.join(K,j);if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir: ${B}`);if(J)J.add(B);return B}if(!j.endsWith(".stx")){let _=`${B}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${_}`);if(J)J.add(_);return _}}}if(Y.layoutsDir){let j=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,_=h.join(j,B);if(await c(_)){if(Y.debug)console.log(`Found in options.layoutsDir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let H=`${_}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(J)J.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),B=h.join(Y.partialsDir||X,"layouts",j[1]);if(await c(B)){if(Y.debug)console.log(`Found in layouts path: ${B}`);if(J)J.add(B);return B}if(!B.endsWith(".stx")){let _=`${B}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in layouts path with extension: ${_}`);if(J)J.add(_);return _}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await c(K)){let j=h.join(K,$);if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}}let z=Y.partialsDir||h.join(process.cwd(),"views"),U=h.join(z,$);if(await c(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(J)J.add(j);return j}}if(X.includes("temp")){let j=h.join(h.dirname(X),"layouts",$);if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function JZ($,Z,Y){let J=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
7718
+ `),K=0;for(let W=0;W<G.length;W++)if(K+=G[W].length+1,K>=Z){J=W+1,X=G[W].trim();let q=Math.max(0,W-2),z=Math.min(G.length,W+3);Q=G.slice(q,z).map((U,j)=>{let B=q+j+1;return`${B===J?"> ":" "}${B}: ${U}`}).join(`
7719
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return JZ($,G)}}catch{}return{lineNumber:J,lineContent:X,context:Q}}function U0($,Z,Y,J,X,Q){let{lineNumber:G,context:K}=JZ(J,X,Q),W=Y.split("/").pop(),q=0;if(typeof X==="number"&&X>=0&&J){let U=J.lastIndexOf(`
7483
7720
  `,Math.max(0,X-1));q=X-(U+1)+1}let z="";if(G>0)z+=`
7484
7721
  ${Y}:${G}${q>0?`:${q}`:""}: ${$.toLowerCase()} error: ${Z}
7485
7722
  `;if(z+=`
@@ -7492,8 +7729,8 @@ ${e.yellow}${e.bold}Message:${e.reset} ${Z}
7492
7729
  `,K)z+=`
7493
7730
  ${e.blue}${e.bold}Context:${e.reset}
7494
7731
  ${e.dim}${K}${e.reset}
7495
- `;return z}function h8(){Y4.clear(),J4.clear(),o7.clear()}var Y4,J4,o7,mK=0,e;var M0=b(()=>{c5();F7();X1();r5();j5();Q4();P1();T7();I7();h5();j8();e5();Y4=new h1(500),J4=new h1(1000),o7=new h1(2000);e={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 $Z($,Z,Y=""){let J=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),q=W?W[1]:"",z=K+G[0].length,U=1,j=z,_=-1;while(U>0&&j<$.length){let L=$.indexOf("@markdown",j),F=$.indexOf("@endmarkdown",j);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
7496
- `||O==="\r"||O===" "||O===void 0)U++;j=L+9}else{if(U--,U===0){_=F;break}j=F+12}}if(_===-1)continue;let B=$.slice(z,_),H=$.slice(K,_+12);X.push({fullMatch:H,options:q,content:B,index:K}),Q.lastIndex=_+12}for(let{fullMatch:K,options:W,content:q,index:z}of X)try{let U={};if(W)W.split(",").forEach((B)=>{let H=B.trim();if(H)U[H]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},_=g5(q.trim(),j);J=J.split(K).join(_)}catch(U){let j=U instanceof Error?U.message:String(U),_=U0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,z,K);J=J.split(K).join(_)}return J}async function ZZ($,Z,Y,J){let X={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")X.breaks=!0;if(G==="no-gfm")X.gfm=!1}),g5($.trim(),X)}var a7=b(()=>{M0()});function ZW($){if(eK.set($.name,$),$.client)$W.set($.name,$.client)}function G4($){return ZW($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=YW(J,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let q=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(q)}}let K=Y;if($.transform)K=await $.transform(Y,G,X,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function YW($,Z){let Y={...Z};for(let J of $){let X=J.indexOf(":"),Q=J.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=J.slice(0,G).trim(),W=J.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var eK,$W;var t7=b(()=>{eK=new Map,$W=new Map});function e7($,Z=O5,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${Q$($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function YZ($,Z,Y=JW,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${Q$($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function $3($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([X,Q])=>{let G=/^\d+$/.test(X)?`${X}px`:X;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((X,Q)=>X.numericBp-Q.numericBp).map(({bp:X,size:Q})=>`(max-width: ${X}) ${Q}`);return J.push(Z),J.join(", ")}function Q$($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let J=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${J}`}function Z3($){return XW[$]||"application/octet-stream"}var O5,JW,X$,XW;var Y3=b(()=>{O5=[320,480,640,768,1024,1280,1536,1920,2560],JW=[1,1.5,2,3],X$=["avif","webp","jpeg"],XW={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function GW(){try{return await import("ts-images")}catch{return null}}async function KW($,Z={}){let Y={...QW,...Z},J=await GW();if(J)try{return await WW($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return qW($,Y)}async function WW($,Z,Y){let{generatePlaceholder:J,generateThumbHash:X}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await X($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function qW($,Z){let Y=Z.width||20,J=Z.height||Y,X="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function JZ($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
7732
+ `;return z}function p8(){J4.clear(),X4.clear(),r7.clear()}var J4,X4,r7,tK=0,e;var M0=b(()=>{i5();A7();X1();a5();j5();G4();P1();D7();E7();d5();H8();$$();J4=new h1(500),X4=new h1(1000),r7=new h1(2000);e={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 XZ($,Z,Y=""){let J=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),q=W?W[1]:"",z=K+G[0].length,U=1,j=z,B=-1;while(U>0&&j<$.length){let L=$.indexOf("@markdown",j),V=$.indexOf("@endmarkdown",j);if(V===-1)break;if(L!==-1&&L<V&&L!==K){let O=$[L+9];if(O==="("||O===`
7733
+ `||O==="\r"||O===" "||O===void 0)U++;j=L+9}else{if(U--,U===0){B=V;break}j=V+12}}if(B===-1)continue;let _=$.slice(z,B),H=$.slice(K,B+12);X.push({fullMatch:H,options:q,content:_,index:K}),Q.lastIndex=B+12}for(let{fullMatch:K,options:W,content:q,index:z}of X)try{let U={};if(W)W.split(",").forEach((_)=>{let H=_.trim();if(H)U[H]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},B=h5(q.trim(),j);J=J.split(K).join(B)}catch(U){let j=U instanceof Error?U.message:String(U),B=U0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,z,K);J=J.split(K).join(B)}return J}async function QZ($,Z,Y,J){let X={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")X.breaks=!0;if(G==="no-gfm")X.gfm=!1}),h5($.trim(),X)}var e7=b(()=>{M0()});function UW($){if(qW.set($.name,$),$.client)zW.set($.name,$.client)}function K4($){return UW($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,X,Q)=>{let G=jW(J,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let q=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(q)}}let K=Y;if($.transform)K=await $.transform(Y,G,X,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function jW($,Z){let Y={...Z};for(let J of $){let X=J.indexOf(":"),Q=J.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=J.slice(0,G).trim(),W=J.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var qW,zW;var $3=b(()=>{qW=new Map,zW=new Map});function Z3($,Z=O5,Y={},J){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${G$($,{...Y,w:X,fm:J})} ${X}w`}).join(", ")}function GZ($,Z,Y=BW,J={},X){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${G$($,{...J,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function Y3($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([X,Q])=>{let G=/^\d+$/.test(X)?`${X}px`:X;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((X,Q)=>X.numericBp-Q.numericBp).map(({bp:X,size:Q})=>`(max-width: ${X}) ${Q}`);return J.push(Z),J.join(", ")}function G$($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let J=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${J}`}function J3($){return _W[$]||"application/octet-stream"}var O5,BW,Q$,_W;var X3=b(()=>{O5=[320,480,640,768,1024,1280,1536,1920,2560],BW=[1,1.5,2,3],Q$=["avif","webp","jpeg"],_W={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function OW(){try{return await import("ts-images")}catch{return null}}async function LW($,Z={}){let Y={...HW,...Z},J=await OW();if(J)try{return await FW($,Y,J)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return VW($,Y)}async function FW($,Z,Y){let{generatePlaceholder:J,generateThumbHash:X}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await X($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function VW($,Z){let Y=Z.width||20,J=Z.height||Y,X="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function KZ($,Z,Y={}){let J=Y.transitionDuration||300,X=Y.easing||"ease-out";return`
7497
7734
  #${$} {
7498
7735
  --stx-img-transition-duration: ${J}ms;
7499
7736
  --stx-img-transition-easing: ${X};
@@ -7510,7 +7747,7 @@ ${e.dim}${K}${e.reset}
7510
7747
  #${$}.stx-img-loaded img {
7511
7748
  opacity: 1;
7512
7749
  }
7513
- `.trim()}async function XZ($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(J3.has(Y))return J3.get(Y);let J=await KW($,Z);return J3.set(Y,J),J}var QW,X3,J3;var QZ=b(()=>{QW={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},X3=`
7750
+ `.trim()}async function WZ($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(Q3.has(Y))return Q3.get(Y);let J=await LW($,Z);return Q3.set(Y,J),J}var HW,G3,Q3;var qZ=b(()=>{HW={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},G3=`
7514
7751
  .stx-img-placeholder {
7515
7752
  position: relative;
7516
7753
  overflow: hidden;
@@ -7539,8 +7776,8 @@ ${e.dim}${K}${e.reset}
7539
7776
  filter: blur(0);
7540
7777
  transform: scale(1);
7541
7778
  }
7542
- `.trim();J3=new Map});import{createHash as KZ}from"crypto";import{readFile as zW,stat as WZ}from"fs/promises";async function S0($){try{let Z=await zW($);return KZ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function GZ($){return KZ("sha256").update($).digest("hex").slice(0,16)}function K4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${GZ($)}-${GZ(Y)}`}async function Q3($){try{return(await WZ($)).mtimeMs}catch{return 0}}async function E0($){try{return await WZ($),!0}catch{return!1}}var c1=()=>{};import{mkdir as UW,readFile as jW,writeFile as _W,readdir as eO,rm as BW,stat as $L}from"fs/promises";import{join as zZ,dirname as HW}from"path";async function OW($){try{await UW($,{recursive:!0})}catch{}}function UZ($,Z,Y){return zZ($,Y,`${Z}.json`)}async function qZ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await Q3(Z)!==$.srcMtime)return!1;return!0}async function W4($,Z,Y,J=G3){if(!J.enabled)return null;let X=K4($,Z),Q=L5.get(X);if(Q){if(await qZ(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;L5.delete(X)}let G=UZ(J.directory,X,Y);if(await E0(G))try{let K=await jW(G,"utf-8"),W=JSON.parse(K);if(await qZ(W,$,J.maxAge))return W.lastAccessedAt=Date.now(),L5.set(X,W),W.data}catch{}return null}async function q4($,Z,Y,J,X=G3){if(!X.enabled)return;let Q=K4($,Z),G=await S0($),K=await Q3($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:K4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};L5.set(Q,W);let q=UZ(X.directory,Q,J);try{await OW(HW(q)),await _W(q,JSON.stringify(W,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function z4($,Z=G3){if($==="all")L5.clear();else L5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=zZ(Z.directory,J);try{await BW(X,{recursive:!0,force:!0})}catch{}}}var L5,G3;var K3=b(()=>{c1();L5=new Map,G3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class j4{config;constructor($={}){this.config={...LW,...$}}async get($,Z){return W4($,Z,"image",this.config)}async set($,Z,Y){return q4($,Z,Y,"image",this.config)}async clear(){return z4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function W3($){if(!U4)U4=new j4($);else if($)U4.updateConfig($);return U4}async function _4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return W3(J).get($,Z)}async function B4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return W3(X).set($,Z,Y)}async function jZ(){return W3().clear()}var LW,U4=null;var q3=b(()=>{K3();LW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as FW,basename as VW,extname as wW,join as AW}from"path";import{mkdir as RW}from"fs/promises";async function z3(){try{return await import("ts-images")}catch{return null}}function _Z($){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 NW($,Z){let Y=Z?_Z(Z):_Z("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function BZ($,Z,Y){let J=await z3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await _4($,Z,Y);if(X)return X;try{let Q=FW($);if(!await E0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=NW(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await RW(K,{recursive:!0});let q=await S0(Q),z=VW($,wW($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:q},_=null;if(Z.transformations&&Z.transformations.length>0)_=await U3(Q,Z.transformations,J);for(let B of U){let H=G[B]||{},L=`${z}-${q}.${B}`,F=AW(K,L);try{let O=await J.optimizeImage({input:_||Q,output:F,format:B,quality:H.quality,progressive:H.progressive});if(O){if(j.variants.push({path:F,url:`${W}/${L}`,width:O.width||0,height:O.height||0,format:B,size:O.outputSize||0}),!j.originalWidth&&O.width)j.originalWidth=O.width,j.originalHeight=O.height}}catch(O){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await J.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await J.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await B4($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function HZ($,Z,Y,J){let X=await z3();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function U3($,Z,Y){let J=Y||await z3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await J.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await J.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await J.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await J.sharpen(X,G.amount);break;case"grayscale":X=await J.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await J.rotate(X,G.angle);break;case"flip":X=await J.flip(X);break;case"flop":X=await J.flop(X);break;case"brightness":if(G.value!==void 0)X=await J.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await J.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await J.saturation(X,G.value);break}}return await J.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var OZ=b(()=>{c1();q3()});import{resolve as MW,basename as TW,extname as IW,join as DW}from"path";import{mkdir as EW}from"fs/promises";async function kW(){try{return await import("ts-images")}catch{return null}}async function LZ($,Z,Y){let J=await kW();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=MW($);if(!await E0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||bW,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await EW(K,{recursive:!0});let q=await S0(X),z=TW($,IW($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let H=[];for(let L of Q){let F=`${z}-${L}w-${q}.${B}`,O=DW(K,F),V=`${W}/${F}`;try{let w=U[B]?.quality||80;if(await E0(O)){j.byFormat[B].push({path:O,url:V,width:L,height:0,format:B,size:0}),H.push(`${V} ${L}w`);continue}let A=await J.processImage({input:X,output:O,format:B,quality:w,resize:{width:L}});if(A)j.byFormat[B].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${L}w: ${w}`)}}j.srcsets[B]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let B=await J.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await J.generatePlaceholder(X,{strategy:_,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:_}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||SW(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function SW($){let Z=[...$].sort((J,X)=>J-X),Y=[];for(let J=0;J<Z.length-1;J++){let X=Z[J];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function FZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var bW;var VZ=b(()=>{c1();bW=[320,480,640,768,1024,1280,1536,1920]});var wZ={};a(wZ,{setCachedImageResult:()=>B4,processImage:()=>BZ,optimizeImage:()=>HZ,getCachedImageResult:()=>_4,generateSrcset:()=>FZ,generateResponsiveVariants:()=>LZ,clearImageCache:()=>jZ,applyTransformations:()=>U3,ImageProcessorCache:()=>j4});var AZ=b(()=>{OZ();VZ();q3()});async function yW(){try{return await Promise.resolve().then(() => (AZ(),wZ))}catch($){if(!RZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),RZ=!0;return null}}async function H4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return xW(J,Y)}if(Y.processedResult?.processed)return H3($,Y.processedResult,Z);if(Y.responsiveVariants)return IZ($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=O5,dpr:z,formats:U=X$,quality:j=j3,params:_={},placeholder:B="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":L4,decoding:V=O4,fetchpriority:w,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:M}=$,T=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return vW($);let k,v,g=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!F)try{k=await XZ(X,{strategy:B,...H}),v=JZ(g,k,H)}catch{}let f=z!==void 0&&G!==void 0,d;if(f)d=CW($,g,k,Z);else d=await PW($,g,k,Z);let p;if(F){let w0=U.includes("webp")?"webp":U[0],s=e7(X,q,{..._,q:j},w0),G0=typeof W==="object"?$3(W):W||"100vw";p=`<link rel="preload" as="image" imagesrcset="${s}" imagesizes="${G0}" />`}let Q0=[];if(!NZ&&B!=="none")Q0.push(X3),NZ=!0;if(v)Q0.push(v);let Y0=L?TZ(g):void 0;return{html:d,preloadLink:p,css:Q0.length>0?Q0.join(`
7543
- `):void 0,script:Y0}}async function PW($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=O5,formats:z=X$,quality:U=j3,params:j={},lazy:_=!0,priority:B=!1,loading:H=B?"eager":L4,decoding:L=O4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A}=$,R=$.class,N=$.style,M=$.data||{},T=typeof W==="object"?$3(W):W||"100vw",I=[];for(let y of z){let S=e7(X,q,{...j,q:U},y),k=Z3(y);if(_&&!B)I.push(` <source type="${k}" data-srcset="${S}" data-sizes="${T}" />`);else I.push(` <source type="${k}" srcset="${S}" sizes="${T}" />`)}let E=_3({src:Q$(X,{...j,q:U}),alt:Q,width:G,height:K,loading:B?void 0:H,decoding:L,fetchpriority:B?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A,className:MZ(R,Y),style:B3(N,O,V,Y),lazy:_&&!B,data:M}),D;if(Y){let y=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
7779
+ `.trim();Q3=new Map});import{createHash as UZ}from"crypto";import{readFile as wW,stat as jZ}from"fs/promises";async function S0($){try{let Z=await wW($);return UZ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function zZ($){return UZ("sha256").update($).digest("hex").slice(0,16)}function W4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${zZ($)}-${zZ(Y)}`}async function K3($){try{return(await jZ($)).mtimeMs}catch{return 0}}async function E0($){try{return await jZ($),!0}catch{return!1}}var c1=()=>{};import{mkdir as AW,readFile as RW,writeFile as NW,readdir as jL,rm as MW,stat as BL}from"fs/promises";import{join as _Z,dirname as TW}from"path";async function IW($){try{await AW($,{recursive:!0})}catch{}}function HZ($,Z,Y){return _Z($,Y,`${Z}.json`)}async function BZ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await K3(Z)!==$.srcMtime)return!1;return!0}async function q4($,Z,Y,J=W3){if(!J.enabled)return null;let X=W4($,Z),Q=L5.get(X);if(Q){if(await BZ(Q,$,J.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;L5.delete(X)}let G=HZ(J.directory,X,Y);if(await E0(G))try{let K=await RW(G,"utf-8"),W=JSON.parse(K);if(await BZ(W,$,J.maxAge))return W.lastAccessedAt=Date.now(),L5.set(X,W),W.data}catch{}return null}async function z4($,Z,Y,J,X=W3){if(!X.enabled)return;let Q=W4($,Z),G=await S0($),K=await K3($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:W4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};L5.set(Q,W);let q=HZ(X.directory,Q,J);try{await IW(TW(q)),await NW(q,JSON.stringify(W,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function U4($,Z=W3){if($==="all")L5.clear();else L5.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let X=_Z(Z.directory,J);try{await MW(X,{recursive:!0,force:!0})}catch{}}}var L5,W3;var q3=b(()=>{c1();L5=new Map,W3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class B4{config;constructor($={}){this.config={...DW,...$}}async get($,Z){return q4($,Z,"image",this.config)}async set($,Z,Y){return z4($,Z,Y,"image",this.config)}async clear(){return U4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function z3($){if(!j4)j4=new B4($);else if($)j4.updateConfig($);return j4}async function _4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return z3(J).get($,Z)}async function H4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return z3(X).set($,Z,Y)}async function OZ(){return z3().clear()}var DW,j4=null;var U3=b(()=>{q3();DW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as EW,basename as kW,extname as bW,join as SW}from"path";import{mkdir as yW}from"fs/promises";async function j3(){try{return await import("ts-images")}catch{return null}}function LZ($){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 PW($,Z){let Y=Z?LZ(Z):LZ("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function FZ($,Z,Y){let J=await j3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await _4($,Z,Y);if(X)return X;try{let Q=EW($);if(!await E0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=PW(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await yW(K,{recursive:!0});let q=await S0(Q),z=kW($,bW($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:q},B=null;if(Z.transformations&&Z.transformations.length>0)B=await B3(Q,Z.transformations,J);for(let _ of U){let H=G[_]||{},L=`${z}-${q}.${_}`,V=SW(K,L);try{let O=await J.optimizeImage({input:B||Q,output:V,format:_,quality:H.quality,progressive:H.progressive});if(O){if(j.variants.push({path:V,url:`${W}/${L}`,width:O.width||0,height:O.height||0,format:_,size:O.outputSize||0}),!j.originalWidth&&O.width)j.originalWidth=O.width,j.originalHeight=O.height}}catch(O){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${_}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let _=await J.generateThumbHash(Q);j.placeholder=_.dataUrl}catch(_){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${_}`)}if(Z.useDominantColor)try{let _=await J.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=_.dominantColor}catch(_){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${_}`)}return await H4($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function VZ($,Z,Y,J){let X=await j3();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function B3($,Z,Y){let J=Y||await j3();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await J.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await J.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await J.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await J.sharpen(X,G.amount);break;case"grayscale":X=await J.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await J.rotate(X,G.angle);break;case"flip":X=await J.flip(X);break;case"flop":X=await J.flop(X);break;case"brightness":if(G.value!==void 0)X=await J.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await J.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await J.saturation(X,G.value);break}}return await J.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var wZ=b(()=>{c1();U3()});import{resolve as CW,basename as vW,extname as xW,join as fW}from"path";import{mkdir as gW}from"fs/promises";async function hW(){try{return await import("ts-images")}catch{return null}}async function AZ($,Z,Y){let J=await hW();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=CW($);if(!await E0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||dW,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await gW(K,{recursive:!0});let q=await S0(X),z=vW($,xW($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let _ of G){j.byFormat[_]=[];let H=[];for(let L of Q){let V=`${z}-${L}w-${q}.${_}`,O=fW(K,V),F=`${W}/${V}`;try{let w=U[_]?.quality||80;if(await E0(O)){j.byFormat[_].push({path:O,url:F,width:L,height:0,format:_,size:0}),H.push(`${F} ${L}w`);continue}let A=await J.processImage({input:X,output:O,format:_,quality:w,resize:{width:L}});if(A)j.byFormat[_].push({path:O,url:F,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:_,size:A.outputSize||0}),H.push(`${F} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${_} at ${L}w: ${w}`)}}j.srcsets[_]=H.join(", ")}let B=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let _=await J.generateThumbHash(X);j.placeholder={dataURL:_.dataUrl,width:_.width||32,height:_.height||32,strategy:"thumbhash"}}else{let _=await J.generatePlaceholder(X,{strategy:B,width:20});j.placeholder={dataURL:_.dataURL,width:_.width,height:_.height,strategy:B}}}catch(_){console.warn(`[stx-media] Failed to generate placeholder: ${_}`)}return j.sizes=Z.sizes||uW(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function uW($){let Z=[...$].sort((J,X)=>J-X),Y=[];for(let J=0;J<Z.length-1;J++){let X=Z[J];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function RZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var dW;var NZ=b(()=>{c1();dW=[320,480,640,768,1024,1280,1536,1920]});var MZ={};a(MZ,{setCachedImageResult:()=>H4,processImage:()=>FZ,optimizeImage:()=>VZ,getCachedImageResult:()=>_4,generateSrcset:()=>RZ,generateResponsiveVariants:()=>AZ,clearImageCache:()=>OZ,applyTransformations:()=>B3,ImageProcessorCache:()=>B4});var TZ=b(()=>{wZ();NZ();U3()});async function mW(){try{return await Promise.resolve().then(() => (TZ(),MZ))}catch($){if(!IZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),IZ=!0;return null}}async function O4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return iW(J,Y)}if(Y.processedResult?.processed)return L3($,Y.processedResult,Z);if(Y.responsiveVariants)return bZ($,Y.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=O5,dpr:z,formats:U=Q$,quality:j=_3,params:B={},placeholder:_="none",placeholderOptions:H={},lazy:L=!0,priority:V=!1,loading:O=V?"eager":F4,decoding:F=L4,fetchpriority:w,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return cW($);let k,C,g=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(_!=="none"&&!V)try{k=await WZ(X,{strategy:_,...H}),C=KZ(g,k,H)}catch{}let f=z!==void 0&&G!==void 0,d;if(f)d=lW($,g,k,Z);else d=await pW($,g,k,Z);let p;if(V){let w0=U.includes("webp")?"webp":U[0],r=Z3(X,q,{...B,q:j},w0),G0=typeof W==="object"?Y3(W):W||"100vw";p=`<link rel="preload" as="image" imagesrcset="${r}" imagesizes="${G0}" />`}let Q0=[];if(!DZ&&_!=="none")Q0.push(G3),DZ=!0;if(C)Q0.push(C);let Y0=L?kZ(g):void 0;return{html:d,preloadLink:p,css:Q0.length>0?Q0.join(`
7780
+ `):void 0,script:Y0}}async function pW($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=O5,formats:z=Q$,quality:U=_3,params:j={},lazy:B=!0,priority:_=!1,loading:H=_?"eager":F4,decoding:L=L4,fetchpriority:V,objectFit:O,objectPosition:F,crossorigin:w,referrerpolicy:A}=$,R=$.class,N=$.style,T=$.data||{},M=typeof W==="object"?Y3(W):W||"100vw",I=[];for(let y of z){let S=Z3(X,q,{...j,q:U},y),k=J3(y);if(B&&!_)I.push(` <source type="${k}" data-srcset="${S}" data-sizes="${M}" />`);else I.push(` <source type="${k}" srcset="${S}" sizes="${M}" />`)}let E=H3({src:G$(X,{...j,q:U}),alt:Q,width:G,height:K,loading:_?void 0:H,decoding:L,fetchpriority:_?"high":V,objectFit:O,objectPosition:F,crossorigin:w,referrerpolicy:A,className:EZ(R,Y),style:O3(N,O,F,Y),lazy:B&&!_,data:T}),D;if(Y){let y=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
7544
7781
  <picture>
7545
7782
  ${I.join(`
7546
7783
  `)}
@@ -7550,9 +7787,9 @@ ${I.join(`
7550
7787
  ${I.join(`
7551
7788
  `)}
7552
7789
  <img ${E} />
7553
- </picture>`;return D}function CW($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,dpr:W=[1,2,3],quality:q=j3,params:z={},lazy:U=!0,priority:j=!1,loading:_=j?"eager":L4,decoding:B=O4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,A=$.style,R=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),M=YZ(X,N,W,{...z,q}),T=_3({src:Q$(X,{...z,w:N,q}),alt:Q,width:G,height:K,loading:j?void 0:_,decoding:B,fetchpriority:j?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:MZ(w,Y),style:B3(A,L,F,Y),lazy:U&&!j,data:R}),I=U&&!j?`data-srcset="${M}"`:`srcset="${M}"`;if(Y){let E=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
7554
- <img ${T} ${I} />
7555
- </div>`}return`<img ${Z?`id="${Z}" `:""}${T} ${I} />`}function vW($){let{src:Z,alt:Y,width:J,height:X,loading:Q=L4,decoding:G=O4,fetchpriority:K,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U,priority:j=!1}=$,_=$.class,B=$.style,H=$.id,L=$.data||{};return{html:`<img ${_3({src:Z,alt:Y,width:J,height:X,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U,className:_,style:B3(B,W,q),id:H,data:L})} />`}}function _3($){let Z=[];if($.lazy)Z.push(`data-src="${t0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${t0($.src)}"`);if(Z.push(`alt="${t0($.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="${t0($.className)}"`);if($.style)Z.push(`style="${t0($.style)}"`);if($.id)Z.push(`id="${t0($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${t0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function MZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function B3($,Z,Y,J){let X=[];if(Z)X.push(`object-fit: ${Z}`);if(Y)X.push(`object-position: ${Y}`);if(J)X.push("opacity: 0; transition: opacity 300ms ease-out");if($)X.push($);return X.join("; ")}function t0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function TZ($){return`
7790
+ </picture>`;return D}function lW($,Z,Y,J){let{src:X,alt:Q,width:G,height:K,dpr:W=[1,2,3],quality:q=_3,params:z={},lazy:U=!0,priority:j=!1,loading:B=j?"eager":F4,decoding:_=L4,fetchpriority:H,objectFit:L,objectPosition:V,crossorigin:O,referrerpolicy:F}=$,w=$.class,A=$.style,R=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=GZ(X,N,W,{...z,q}),M=H3({src:G$(X,{...z,w:N,q}),alt:Q,width:G,height:K,loading:j?void 0:B,decoding:_,fetchpriority:j?"high":H,objectFit:L,objectPosition:V,crossorigin:O,referrerpolicy:F,className:EZ(w,Y),style:O3(A,L,V,Y),lazy:U&&!j,data:R}),I=U&&!j?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let E=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
7791
+ <img ${M} ${I} />
7792
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function cW($){let{src:Z,alt:Y,width:J,height:X,loading:Q=F4,decoding:G=L4,fetchpriority:K,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U,priority:j=!1}=$,B=$.class,_=$.style,H=$.id,L=$.data||{};return{html:`<img ${H3({src:Z,alt:Y,width:J,height:X,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U,className:B,style:O3(_,W,q),id:H,data:L})} />`}}function H3($){let Z=[];if($.lazy)Z.push(`data-src="${t0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${t0($.src)}"`);if(Z.push(`alt="${t0($.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="${t0($.className)}"`);if($.style)Z.push(`style="${t0($.style)}"`);if($.id)Z.push(`id="${t0($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${t0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function EZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function O3($,Z,Y,J){let X=[];if(Z)X.push(`object-fit: ${Z}`);if(Y)X.push(`object-position: ${Y}`);if(J)X.push("opacity: 0; transition: opacity 300ms ease-out");if($)X.push($);return X.join("; ")}function t0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kZ($){return`
7556
7793
  (function() {
7557
7794
  const container = document.getElementById('${$}');
7558
7795
  if (!container) return;
@@ -7589,22 +7826,22 @@ ${I.join(`
7589
7826
 
7590
7827
  observer.observe(container);
7591
7828
  })();
7592
- `.trim()}async function xW($,Z){let Y=await yW();if(!Y)return H4({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,J);if(Q)return IZ($,Q,Z)}else{let Q=await Y.processImage($.src,$,J);if(Q.processed)return H3($,Q,Z)}return H4({...$,process:!1},Z)}async function H3($,Z,Y){let{alt:J,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U}=$,j=$.class,_=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((v)=>v.format==="jpeg")||L.find((v)=>v.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((v)=>v.format===(F?.format||"jpeg")).map((v)=>`${v.url} ${v.width}w`).join(", "),w=new Map;for(let v of L){if(!w.has(v.format))w.set(v.format,[]);w.get(v.format).push(v)}let A=[],R=["avif","webp","jpeg","png"];for(let v of R){let g=w.get(v);if(g&&g.length>0){let f=g.map((p)=>`${p.url} ${p.width}w`).join(", "),d=Z3(v);if(G&&!K)A.push(` <source type="${d}" data-srcset="${f}" />`);else A.push(` <source type="${d}" srcset="${f}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${t0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)N.push(`data-srcset="${V}"`)}else if(N.push(`src="${t0(O)}"`),V)N.push(`srcset="${V}"`);N.push(`alt="${t0(J)}"`);let M=X||Z.originalWidth,T=Q||Z.originalHeight;if(M)N.push(`width="${M}"`);if(T)N.push(`height="${T}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(z)N.push(`crossorigin="${z}"`);if(U)N.push(`referrerpolicy="${U}"`);let I=[];if(W)I.push(`object-fit: ${W}`);if(q)I.push(`object-position: ${q}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)N.push(`style="${I.join("; ")}"`);let E=[];if(j)E.push(j);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)N.push(`class="${E.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[v,g]of Object.entries(H))N.push(`data-${v}="${t0(g)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let v=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${v}">
7829
+ `.trim()}async function iW($,Z){let Y=await mW();if(!Y)return O4({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,J);if(Q)return bZ($,Q,Z)}else{let Q=await Y.processImage($.src,$,J);if(Q.processed)return L3($,Q,Z)}return O4({...$,process:!1},Z)}async function L3($,Z,Y){let{alt:J,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U}=$,j=$.class,B=$.style,_=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],V=L.find((C)=>C.format==="jpeg")||L.find((C)=>C.format==="webp")||L[0],O=V?.url||$.src,F=L.filter((C)=>C.format===(V?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of L){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let A=[],R=["avif","webp","jpeg","png"];for(let C of R){let g=w.get(C);if(g&&g.length>0){let f=g.map((p)=>`${p.url} ${p.width}w`).join(", "),d=J3(C);if(G&&!K)A.push(` <source type="${d}" data-srcset="${f}" />`);else A.push(` <source type="${d}" srcset="${f}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${t0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${t0(O)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${t0(J)}"`);let T=X||Z.originalWidth,M=Q||Z.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(z)N.push(`crossorigin="${z}"`);if(U)N.push(`referrerpolicy="${U}"`);let I=[];if(W)I.push(`object-fit: ${W}`);if(q)I.push(`object-position: ${q}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(B)I.push(B);if(I.length>0)N.push(`style="${I.join("; ")}"`);let E=[];if(j)E.push(j);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)N.push(`class="${E.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[C,g]of Object.entries(H))N.push(`data-${C}="${t0(g)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${_}" class="stx-img-placeholder" style="${C}">
7593
7830
  <picture>
7594
7831
  ${A.join(`
7595
7832
  `)}
7596
7833
  <img ${N.join(" ")} />
7597
7834
  </picture>
7598
- </div>`}else D=`<picture${B?` id="${B}"`:""}>
7835
+ </div>`}else D=`<picture${_?` id="${_}"`:""}>
7599
7836
  ${A.join(`
7600
7837
  `)}
7601
7838
  <img ${N.join(" ")} />
7602
- </picture>`;let y=[];if(Z.placeholder)y.push(X3);let S=G?TZ(B):void 0,k;if(K&&V)k=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:k,css:y.length>0?y.join(`
7603
- `):void 0,script:S}}async function IZ($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[X,Q]of Object.entries(Z.byFormat))if(Q)J.variants.push(...Q);return H3($,J,Y)}var RZ=!1,j3=80,O4="async",L4="lazy",NZ=!1;var DZ=b(()=>{Y3();QZ()});function fW(){return G4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:X,alt:Q,options:G}=gW($,Z,Y);if(!X)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:X,alt:Q||"",widths:G.widths||O5,formats:G.formats||X$,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},W=Y.__isDev||!1,q=await H4(K,{isDev:W}),z=q.html;if(q.preloadLink)z=q.preloadLink+`
7839
+ </picture>`;let y=[];if(Z.placeholder)y.push(G3);let S=G?kZ(_):void 0,k;if(K&&F)k=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:D,preloadLink:k,css:y.length>0?y.join(`
7840
+ `):void 0,script:S}}async function bZ($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[X,Q]of Object.entries(Z.byFormat))if(Q)J.variants.push(...Q);return L3($,J,Y)}var IZ=!1,_3=80,L4="async",F4="lazy",DZ=!1;var SZ=b(()=>{X3();qZ()});function nW(){return K4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:X,alt:Q,options:G}=oW($,Z,Y);if(!X)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:X,alt:Q||"",widths:G.widths||O5,formats:G.formats||Q$,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},W=Y.__isDev||!1,q=await O4(K,{isDev:W}),z=q.html;if(q.preloadLink)z=q.preloadLink+`
7604
7841
  `+z;if(q.css)z+=`
7605
7842
  <style>${q.css}</style>`;if(q.script)z+=`
7606
- <script>${q.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function gW($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=hW(J),Q=O3(X[0],Y)||"",G=O3(X[1],Y)||"",K={};if(X[2]){let W=O3(X[2],Y);if(typeof W==="object"&&W!==null)K=W;else if(typeof X[2]==="string")try{K=JSON.parse(X[2])}catch{}}return{src:Q,alt:G,options:K}}function hW($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],q=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&q!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function O3($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var EZ;var kZ=b(()=>{t7();DZ();Y3();EZ=fW()});class V4{config;constructor($={}){this.config={...dW,...$}}async get($,Z){return W4($,Z,"video",this.config)}async set($,Z,Y){return q4($,Z,Y,"video",this.config)}async clear(){return z4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function L3($){if(!F4)F4=new V4($);else if($)F4.updateConfig($);return F4}async function w4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return L3(J).get($,Z)}async function A4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return L3(X).set($,Z,Y)}async function bZ(){return L3().clear()}var dW,F4=null;var F3=b(()=>{K3();dW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as V3,basename as w3,extname as A3,join as R4}from"path";import{mkdir as R3}from"fs/promises";async function N3(){try{return await import("ts-videos")}catch{return null}}async function N4($,Z,Y,J){let X=await N3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=V3($);if(!await E0(Q))return null;await R3(Y,{recursive:!0});let G=await S0(Q),K=w3($,A3($)),W=Z.format||"webp",q=Z.timestamp||0,z=`${K}-poster-${G}.${W}`,U=R4(Y,z),j=await X.extractThumbnails(Q,{timestamps:[q],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:Y,outputPattern:z.replace(`.${W}`,"")});if(j&&j.length>0){let _=j[0];return{path:U,url:`${J}/${z}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:q,size:_.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function M4($,Z,Y,J){let X=await N3();if(!X)return[];try{let Q=V3($);if(!await E0(Q))return[];await R3(Y,{recursive:!0});let G=await S0(Q),K=w3($,A3($)),W=Z.format||"webp",U=(await new X.Input(Q).getInfo()).duration||60,j=Z.count||10,_=Z.interval||U/j,B=[];for(let L=0;L<j&&L*_<U;L++)B.push(L*_);let H=await X.extractThumbnails(Q,{timestamps:B,width:Z.width||320,format:W,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||R4(Y,`${K}-thumb-${G}-${F}.${W}`),url:`${J}/${K}-thumb-${G}-${F}.${W}`,width:L.width||Z.width||320,height:L.height||180,timestamp:B[F],size:L.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function SZ($,Z,Y,J){let X=await N3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=V3($);if(!await E0(Q))return null;await R3(Y,{recursive:!0});let G=await S0(Q),K=w3($,A3($)),z=(await new X.Input(Q).getInfo()).duration||60,U=Z.columns||10,j=Z.interval||5,_=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(z/j),F=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,V=R4(Y,O),w=[];for(let R=0;R<L;R++)w.push(R*j);let A=await X.extractThumbnails(Q,{timestamps:w,width:_,height:B,format:H,quality:Z.quality||70,outputDir:R4(Y,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=U*_,M=F*B,T=await R.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:V,columns:U,rows:F,thumbnailWidth:_,thumbnailHeight:B,interval:j,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var M3=b(()=>{c1()});import{resolve as PZ,basename as CZ,extname as vZ,join as i1}from"path";import{mkdir as T4,writeFile as xZ}from"fs/promises";async function fZ(){try{return await import("ts-videos")}catch{return null}}async function I4($,Z,Y,J,X){let Q=await fZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=PZ($);if(!await E0(G))return null;let K=await S0(G),W=CZ($,vZ($)),q=i1(Y,`${W}-${K}-hls`);await T4(q,{recursive:!0});let z=Z.length>0?Z:gZ,U=X?.segmentDuration||6,B=(await new Q.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of z){let w=i1(q,V.label);await T4(w,{recursive:!0});let A=`${V.label}.m3u8`,R=i1(w,A);try{let N=await Q.generateHLS(G,{outputDir:w,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(N)H.push({quality:V,url:`${J}/${W}-${K}-hls/${V.label}/${A}`,path:R}),L+=N.segmentCount||Math.ceil(B/U)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${N}`)}}if(H.length===0)return null;let F=i1(q,"master.m3u8"),O=uW(H,J,W,K);return await xZ(F,O),{manifestUrl:`${J}/${W}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function uW($,Z,Y,J){let X=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),W=`${G.width}x${G.height||Math.round(G.width*9/16)}`;X.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${W},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return X.join(`
7607
- `)}async function D4($,Z,Y,J,X){let Q=await fZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=PZ($);if(!await E0(G))return null;let K=await S0(G),W=CZ($,vZ($)),q=i1(Y,`${W}-${K}-dash`);await T4(q,{recursive:!0});let z=Z.length>0?Z:gZ,U=X?.segmentDuration||4,j=X?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of z){let R=i1(q,A.label);await T4(R,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:R,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${W}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${J}/${W}-${K}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(L.length===0)return null;let O=i1(q,"manifest.mpd"),V=mW(L,F,H,U,j);await xZ(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${J}/${W}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function mW($,Z,Y,J,X){let Q=yZ(Y),G=yZ(X),K=`<?xml version="1.0" encoding="UTF-8"?>
7843
+ <script>${q.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function oW($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=sW(J),Q=F3(X[0],Y)||"",G=F3(X[1],Y)||"",K={};if(X[2]){let W=F3(X[2],Y);if(typeof W==="object"&&W!==null)K=W;else if(typeof X[2]==="string")try{K=JSON.parse(X[2])}catch{}}return{src:Q,alt:G,options:K}}function sW($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],q=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&q!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function F3($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var yZ;var PZ=b(()=>{$3();SZ();X3();yZ=nW()});class w4{config;constructor($={}){this.config={...rW,...$}}async get($,Z){return q4($,Z,"video",this.config)}async set($,Z,Y){return z4($,Z,Y,"video",this.config)}async clear(){return U4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function V3($){if(!V4)V4=new w4($);else if($)V4.updateConfig($);return V4}async function A4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return V3(J).get($,Z)}async function R4($,Z,Y,J){let X=J?{directory:`${J.outputDir}/../.cache`}:{};return V3(X).set($,Z,Y)}async function CZ(){return V3().clear()}var rW,V4=null;var w3=b(()=>{q3();rW={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as A3,basename as R3,extname as N3,join as N4}from"path";import{mkdir as M3}from"fs/promises";async function T3(){try{return await import("ts-videos")}catch{return null}}async function M4($,Z,Y,J){let X=await T3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=A3($);if(!await E0(Q))return null;await M3(Y,{recursive:!0});let G=await S0(Q),K=R3($,N3($)),W=Z.format||"webp",q=Z.timestamp||0,z=`${K}-poster-${G}.${W}`,U=N4(Y,z),j=await X.extractThumbnails(Q,{timestamps:[q],width:Z.width||1280,height:Z.height,format:W,quality:Z.quality||85,outputDir:Y,outputPattern:z.replace(`.${W}`,"")});if(j&&j.length>0){let B=j[0];return{path:U,url:`${J}/${z}`,width:B.width||Z.width||1280,height:B.height||720,timestamp:q,size:B.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function T4($,Z,Y,J){let X=await T3();if(!X)return[];try{let Q=A3($);if(!await E0(Q))return[];await M3(Y,{recursive:!0});let G=await S0(Q),K=R3($,N3($)),W=Z.format||"webp",U=(await new X.Input(Q).getInfo()).duration||60,j=Z.count||10,B=Z.interval||U/j,_=[];for(let L=0;L<j&&L*B<U;L++)_.push(L*B);let H=await X.extractThumbnails(Q,{timestamps:_,width:Z.width||320,format:W,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,V)=>({path:L.path||N4(Y,`${K}-thumb-${G}-${V}.${W}`),url:`${J}/${K}-thumb-${G}-${V}.${W}`,width:L.width||Z.width||320,height:L.height||180,timestamp:_[V],size:L.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function vZ($,Z,Y,J){let X=await T3();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=A3($);if(!await E0(Q))return null;await M3(Y,{recursive:!0});let G=await S0(Q),K=R3($,N3($)),z=(await new X.Input(Q).getInfo()).duration||60,U=Z.columns||10,j=Z.interval||5,B=Z.thumbnailWidth||160,_=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(z/j),V=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,F=N4(Y,O),w=[];for(let R=0;R<L;R++)w.push(R*j);let A=await X.extractThumbnails(Q,{timestamps:w,width:B,height:_,format:H,quality:Z.quality||70,outputDir:N4(Y,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=U*B,T=V*_,M=await R.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:F,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:F,columns:U,rows:V,thumbnailWidth:B,thumbnailHeight:_,interval:j,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var I3=b(()=>{c1()});import{resolve as fZ,basename as gZ,extname as hZ,join as i1}from"path";import{mkdir as I4,writeFile as dZ}from"fs/promises";async function uZ(){try{return await import("ts-videos")}catch{return null}}async function D4($,Z,Y,J,X){let Q=await uZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=fZ($);if(!await E0(G))return null;let K=await S0(G),W=gZ($,hZ($)),q=i1(Y,`${W}-${K}-hls`);await I4(q,{recursive:!0});let z=Z.length>0?Z:mZ,U=X?.segmentDuration||6,_=(await new Q.Input(G).getInfo()).duration||0,H=[],L=0;for(let F of z){let w=i1(q,F.label);await I4(w,{recursive:!0});let A=`${F.label}.m3u8`,R=i1(w,A);try{let N=await Q.generateHLS(G,{outputDir:w,segmentDuration:U,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(N)H.push({quality:F,url:`${J}/${W}-${K}-hls/${F.label}/${A}`,path:R}),L+=N.segmentCount||Math.ceil(_/U)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${N}`)}}if(H.length===0)return null;let V=i1(q,"master.m3u8"),O=aW(H,J,W,K);return await dZ(V,O),{manifestUrl:`${J}/${W}-${K}-hls/master.m3u8`,manifestPath:V,playlists:H,segmentCount:L,duration:_}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function aW($,Z,Y,J){let X=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),W=`${G.width}x${G.height||Math.round(G.width*9/16)}`;X.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${W},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return X.join(`
7844
+ `)}async function E4($,Z,Y,J,X){let Q=await uZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=fZ($);if(!await E0(G))return null;let K=await S0(G),W=gZ($,hZ($)),q=i1(Y,`${W}-${K}-dash`);await I4(q,{recursive:!0});let z=Z.length>0?Z:mZ,U=X?.segmentDuration||4,j=X?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,L=[],V=[];for(let A of z){let R=i1(q,A.label);await I4(R,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:R,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${W}-${K}-dash/${A.label}/video`}),A.audioBitrate)V.push({bandwidth:A.audioBitrate,url:`${J}/${W}-${K}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(L.length===0)return null;let O=i1(q,"manifest.mpd"),F=tW(L,V,H,U,j);await dZ(O,F);let w=[{type:"video",representations:L}];if(V.length>0)w.push({type:"audio",representations:V});return{manifestUrl:`${J}/${W}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function tW($,Z,Y,J,X){let Q=xZ(Y),G=xZ(X),K=`<?xml version="1.0" encoding="UTF-8"?>
7608
7845
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
7609
7846
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7610
7847
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -7630,7 +7867,7 @@ ${A.join(`
7630
7867
  </Representation>
7631
7868
  `}K+=` </AdaptationSet>
7632
7869
  `}return K+=` </Period>
7633
- </MPD>`,K}function yZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(Y>0)X+=`${Y}M`;return X+=`${J}S`,X}var gZ;var T3=b(()=>{c1();gZ=[{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 hZ,basename as pW,extname as lW,join as cW}from"path";import{mkdir as iW}from"fs/promises";async function dZ(){try{return await import("ts-videos")}catch{return null}}function nW($){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 oW($){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 I3($){let Z=await dZ();if(!Z)return null;try{let Y=hZ($),X=await new Z.Input(Y).getInfo();return{duration:X.duration||0,width:X.width||0,height:X.height||0,frameRate:X.frameRate||0,bitrate:X.bitrate||0,codec:X.videoCodec||"",audioCodec:X.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function uZ($,Z,Y,J){let X=await dZ();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await w4($,Z,Y);if(Q)return Q;try{let G=hZ($);if(!await E0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await iW(K,{recursive:!0});let q=await S0(G),z=pW($,lW($)),U={src:$,processed:!0,hash:q};J?.({percentage:5,stage:"analyzing"}),U.metadata=await I3(G)||void 0;let j={};if(Z.quality)j.bitrate=nW(Z.quality);if(Z.platform)Object.assign(j,oW(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let _=`${z}-${q}.mp4`,B=cW(K,_);try{let H=await sW(G,B,j,X,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:B,url:`${W}/${_}`,duration:H.duration,size:H.size,video:{codec:j.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await N4(G,_,K,W);if(B)U.poster=B}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let _=await M4(G,Y.thumbnails,K,W);if(_.length>0)U.thumbnails=_}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let B=await I4(G,_.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,hls:B}}if(_.format==="dash"){let B=await D4(G,_.qualities||Y.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,dash:B}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await A4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function sW($,Z,Y,J,X){try{let G=await new J.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{X?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var mZ=b(()=>{c1();F3();M3();T3()});var pZ={};a(pZ,{setCachedVideoResult:()=>A4,processVideo:()=>uZ,getCachedVideoResult:()=>w4,generateThumbnails:()=>M4,generateSpriteSheet:()=>SZ,generatePoster:()=>N4,generateHLSManifest:()=>I4,generateDASHManifest:()=>D4,clearVideoCache:()=>bZ,analyzeVideo:()=>I3,VideoProcessorCache:()=>V4});var lZ=b(()=>{mZ();M3();T3();F3()});async function iZ(){try{return await Promise.resolve().then(() => (lZ(),pZ))}catch($){if(!cZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),cZ=!0;return null}}async function E4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return Zq(J,Y)}if(Y.processedResult?.processed)return rZ($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await Yq(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:q=nZ,autoplay:z=!1,muted:U=!1,loop:j=!1,preload:_=oZ,playsinline:B=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=X||K,M=$.class,T=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return tW($,Z);if(F&&F!=="video")return aW(Q||"",F,$);let E=G.length>0?G:Q?[{src:Q,type:sZ(Q)}]:[],D=[`id="${I}"`];if(q)D.push("controls");if(z)D.push("autoplay");if(U)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(A)D.push("disablepictureinpicture");if(R)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(H){if(D.push(`data-preload="${_}"`),D.push('preload="none"'),N)D.push(`data-poster="${R0(N)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${_}"`),N)D.push(`poster="${R0(N)}"`);if(O)D.push(`width="${O}"`);if(V)D.push(`height="${V}"`);if(M)D.push(`class="${R0(M)}"`);if(T)D.push(`style="${R0(T)}"`);let y=E.map((v)=>{return` <source ${H?`data-src="${R0(v.src)}"`:`src="${R0(v.src)}"`} type="${v.type}"${v.media?` media="${v.media}"`:""} />`}).join(`
7870
+ </MPD>`,K}function xZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(Y>0)X+=`${Y}M`;return X+=`${J}S`,X}var mZ;var D3=b(()=>{c1();mZ=[{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 pZ,basename as eW,extname as $q,join as Zq}from"path";import{mkdir as Yq}from"fs/promises";async function lZ(){try{return await import("ts-videos")}catch{return null}}function Jq($){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 Xq($){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 E3($){let Z=await lZ();if(!Z)return null;try{let Y=pZ($),X=await new Z.Input(Y).getInfo();return{duration:X.duration||0,width:X.width||0,height:X.height||0,frameRate:X.frameRate||0,bitrate:X.bitrate||0,codec:X.videoCodec||"",audioCodec:X.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function cZ($,Z,Y,J){let X=await lZ();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await A4($,Z,Y);if(Q)return Q;try{let G=pZ($);if(!await E0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",W=Y.baseUrl||"/videos";await Yq(K,{recursive:!0});let q=await S0(G),z=eW($,$q($)),U={src:$,processed:!0,hash:q};J?.({percentage:5,stage:"analyzing"}),U.metadata=await E3(G)||void 0;let j={};if(Z.quality)j.bitrate=Jq(Z.quality);if(Z.platform)Object.assign(j,Xq(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let B=`${z}-${q}.mp4`,_=Zq(K,B);try{let H=await Qq(G,_,j,X,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:_,url:`${W}/${B}`,duration:H.duration,size:H.size,video:{codec:j.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let B=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},_=await M4(G,B,K,W);if(_)U.poster=_}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let B=await T4(G,Y.thumbnails,K,W);if(B.length>0)U.thumbnails=B}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let B=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let _=await D4(G,B.qualities||Y.streaming?.defaultQualities||[],K,W);if(_)U.streaming={...U.streaming,hls:_}}if(B.format==="dash"){let _=await E4(G,B.qualities||Y.streaming?.defaultQualities||[],K,W);if(_)U.streaming={...U.streaming,dash:_}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await R4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function Qq($,Z,Y,J,X){try{let G=await new J.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{X?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var iZ=b(()=>{c1();w3();I3();D3()});var nZ={};a(nZ,{setCachedVideoResult:()=>R4,processVideo:()=>cZ,getCachedVideoResult:()=>A4,generateThumbnails:()=>T4,generateSpriteSheet:()=>vZ,generatePoster:()=>M4,generateHLSManifest:()=>D4,generateDASHManifest:()=>E4,clearVideoCache:()=>CZ,analyzeVideo:()=>E3,VideoProcessorCache:()=>w4});var oZ=b(()=>{iZ();I3();D3();w3()});async function rZ(){try{return await Promise.resolve().then(() => (oZ(),nZ))}catch($){if(!sZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),sZ=!0;return null}}async function k4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return Uq(J,Y)}if(Y.processedResult?.processed)return $2($,Y.processedResult,Z);let X;if(J.generatePoster&&J.src&&!$.poster)X=await jq(J,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:q=aZ,autoplay:z=!1,muted:U=!1,loop:j=!1,preload:B=tZ,playsinline:_=!0,lazy:H=!0,player:L="native",type:V,width:O,height:F,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=X||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return Wq($,Z);if(V&&V!=="video")return Kq(Q||"",V,$);let E=G.length>0?G:Q?[{src:Q,type:eZ(Q)}]:[],D=[`id="${I}"`];if(q)D.push("controls");if(z)D.push("autoplay");if(U)D.push("muted");if(j)D.push("loop");if(_)D.push("playsinline");if(A)D.push("disablepictureinpicture");if(R)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(H){if(D.push(`data-preload="${B}"`),D.push('preload="none"'),N)D.push(`data-poster="${R0(N)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${B}"`),N)D.push(`poster="${R0(N)}"`);if(O)D.push(`width="${O}"`);if(F)D.push(`height="${F}"`);if(T)D.push(`class="${R0(T)}"`);if(M)D.push(`style="${R0(M)}"`);let y=E.map((C)=>{return` <source ${H?`data-src="${R0(C.src)}"`:`src="${R0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
7634
7871
  `),S=`<video ${D.join(" ")}>
7635
7872
  ${y}
7636
7873
  Your browser does not support the video tag.
@@ -7669,15 +7906,15 @@ ${y}
7669
7906
 
7670
7907
  observer.observe(video);
7671
7908
  })();
7672
- `.trim();return{html:S,script:k}}function aW($,Z,Y){let{width:J=640,height:X=360}=Y,Q=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,q=null;switch(Z){case"youtube":q=eW($),W=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=$q($),W=q?`https://player.vimeo.com/video/${q}`:$;break;case"dailymotion":q=$.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=$.split("/").pop()||"",W=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=$}let z=[`id="${K}"`,`src="${R0(W)}"`,`width="${J}"`,`height="${X}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)z.push(`class="${R0(Q)}"`);if(G)z.push(`style="${R0(G)}"`);if(Y.lazy)z.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
7909
+ `.trim();return{html:S,script:k}}function Kq($,Z,Y){let{width:J=640,height:X=360}=Y,Q=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,q=null;switch(Z){case"youtube":q=qq($),W=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=zq($),W=q?`https://player.vimeo.com/video/${q}`:$;break;case"dailymotion":q=$.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=$.split("/").pop()||"",W=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=$}let z=[`id="${K}"`,`src="${R0(W)}"`,`width="${J}"`,`height="${X}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)z.push(`class="${R0(Q)}"`);if(G)z.push(`style="${R0(G)}"`);if(Y.lazy)z.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
7673
7910
  <iframe ${z.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
7674
- </div>`}}function tW($,Z={}){let{src:Y,sources:J=[],poster:X,controls:Q=!0,autoplay:G=!1,muted:K=!1,loop:W=!1,preload:q="metadata",playsinline:z=!0,lazy:U=!0,width:j,height:_}=$,B=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:J.length>0?J:Y,autoplay:G,loop:W,muted:K,playsinline:z,preload:q,poster:X,controls:Q,title:$.title},O=["position: relative",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
7911
+ </div>`}}function Wq($,Z={}){let{src:Y,sources:J=[],poster:X,controls:Q=!0,autoplay:G=!1,muted:K=!1,loop:W=!1,preload:q="metadata",playsinline:z=!0,lazy:U=!0,width:j,height:B}=$,_=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,V={src:J.length>0?J:Y,autoplay:G,loop:W,muted:K,playsinline:z,preload:q,poster:X,controls:Q,title:$.title},O=["position: relative",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",H||""].filter(Boolean).join("; "),F=`
7675
7912
  <div
7676
7913
  id="${L}"
7677
- class="ts-video-player${B?" "+R0(B):""}"
7914
+ class="ts-video-player${_?" "+R0(_):""}"
7678
7915
  style="${O}"
7679
7916
  data-ts-video-player
7680
- data-config='${JSON.stringify(F)}'
7917
+ data-config='${JSON.stringify(V)}'
7681
7918
  ${U?"data-lazy":""}
7682
7919
  >
7683
7920
  <div class="ts-video-player__container">
@@ -7708,7 +7945,7 @@ ${y}
7708
7945
 
7709
7946
  // Load ts-video-player from CDN
7710
7947
  var script = document.createElement('script');
7711
- script.src = '${rW}';
7948
+ script.src = '${Gq}';
7712
7949
  script.onload = initPlayer;
7713
7950
  script.onerror = function() {
7714
7951
  console.error('[stx] Failed to load ts-video-player');
@@ -7838,14 +8075,14 @@ else {
7838
8075
  .ts-video-player__play-button svg {
7839
8076
  margin-left: 4px;
7840
8077
  }
7841
- `.trim();return{html:V,script:w,css:A}}function sZ($){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 eW($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let J=$.match(Y);if(J)return J[1]}return null}function $q($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function R0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function Zq($,Z){let Y=await iZ();if(!Y)return E4({...$,process:!1},Z);let J=Z.tsVideosConfig,X=await Y.processVideo($.src,$,J,$.onProcessProgress);if(X.processed)return rZ($,X,Z);return E4({...$,process:!1},Z)}async function Yq($,Z){let Y=await iZ();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},X=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,X.outputDir,X.baseUrl||"/videos"))?.url}function rZ($,Z,Y){let{controls:J=nZ,autoplay:X=!1,muted:Q=!1,loop:G=!1,preload:K=oZ,playsinline:W=!0,lazy:q=!0,width:z,height:U,crossorigin:j,disablePictureInPicture:_=!1,disableRemotePlayback:B=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=sZ(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,R=[`id="${F}"`];if(J)R.push("controls");if(X)R.push("autoplay");if(Q)R.push("muted");if(G)R.push("loop");if(W)R.push("playsinline");if(_)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(j)R.push(`crossorigin="${j}"`);if(q){if(R.push(`data-preload="${K}"`),R.push('preload="none"'),A)R.push(`data-poster="${R0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${K}"`),A)R.push(`poster="${R0(A)}"`);let N=z||Z.metadata?.width,M=U||Z.metadata?.height;if(N)R.push(`width="${N}"`);if(M)R.push(`height="${M}"`);if(H)R.push(`class="${R0(H)}"`);if(L)R.push(`style="${R0(L)}"`);let I=` <source ${q?`data-src="${R0(O)}"`:`src="${R0(O)}"`} type="${V}" />`,E=`<video ${R.join(" ")}>
8078
+ `.trim();return{html:F,script:w,css:A}}function eZ($){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 qq($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let J=$.match(Y);if(J)return J[1]}return null}function zq($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function R0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function Uq($,Z){let Y=await rZ();if(!Y)return k4({...$,process:!1},Z);let J=Z.tsVideosConfig,X=await Y.processVideo($.src,$,J,$.onProcessProgress);if(X.processed)return $2($,X,Z);return k4({...$,process:!1},Z)}async function jq($,Z){let Y=await rZ();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},X=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,X.outputDir,X.baseUrl||"/videos"))?.url}function $2($,Z,Y){let{controls:J=aZ,autoplay:X=!1,muted:Q=!1,loop:G=!1,preload:K=tZ,playsinline:W=!0,lazy:q=!0,width:z,height:U,crossorigin:j,disablePictureInPicture:B=!1,disableRemotePlayback:_=!1}=$,H=$.class,L=$.style,V=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,F=eZ(O);if(Z.transcoded)O=Z.transcoded.url,F="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,F="application/dash+xml"}let A=Z.poster?.url||$.poster,R=[`id="${V}"`];if(J)R.push("controls");if(X)R.push("autoplay");if(Q)R.push("muted");if(G)R.push("loop");if(W)R.push("playsinline");if(B)R.push("disablepictureinpicture");if(_)R.push("disableremoteplayback");if(j)R.push(`crossorigin="${j}"`);if(q){if(R.push(`data-preload="${K}"`),R.push('preload="none"'),A)R.push(`data-poster="${R0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${K}"`),A)R.push(`poster="${R0(A)}"`);let N=z||Z.metadata?.width,T=U||Z.metadata?.height;if(N)R.push(`width="${N}"`);if(T)R.push(`height="${T}"`);if(H)R.push(`class="${R0(H)}"`);if(L)R.push(`style="${R0(L)}"`);let I=` <source ${q?`data-src="${R0(O)}"`:`src="${R0(O)}"`} type="${F}" />`,E=`<video ${R.join(" ")}>
7842
8079
  ${I}
7843
8080
  Your browser does not support the video tag.
7844
8081
  </video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${R0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
7845
8082
  ${E}
7846
8083
  </div>`;let D;if(q)D=`
7847
8084
  (function() {
7848
- var video = document.getElementById('${F}');
8085
+ var video = document.getElementById('${V}');
7849
8086
  if (!video) return;
7850
8087
 
7851
8088
  var observer = new IntersectionObserver(function(entries) {
@@ -7887,9 +8124,9 @@ ${E}
7887
8124
  width: 100%;
7888
8125
  height: auto;
7889
8126
  }
7890
- `.trim();return{html:E,script:D,css:y}}var cZ=!1,nZ=!0,oZ="metadata",rW="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var aZ=b(()=>{E3()});function tZ(){return G4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:X,options:Q}=Jq($,Z,Y);if(!X)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:X,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},W={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},q=await E4(G,W),z=q.html;if(q.css)z+=`
8127
+ `.trim();return{html:E,script:D,css:y}}var sZ=!1,aZ=!0,tZ="metadata",Gq="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var Z2=b(()=>{b3()});function Y2(){return K4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:X,options:Q}=Bq($,Z,Y);if(!X)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:X,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},W={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},q=await k4(G,W),z=q.html;if(q.css)z+=`
7891
8128
  <style>${q.css}</style>`;if(q.script)z+=`
7892
- <script>${q.script}</script>`;return z},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Jq($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=Xq(J),Q=eZ(X[0],Y)||"",G={};if(X[1]){let K=eZ(X[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof X[1]==="string")try{G=JSON.parse(X[1])}catch{}}return{src:Q,options:G}}function Xq($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],q=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&q!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function eZ($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var D3;var E3=b(()=>{t7();aZ();D3=tZ()});function Qq($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
8129
+ <script>${q.script}</script>`;return z},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Bq($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let X=_q(J),Q=J2(X[0],Y)||"",G={};if(X[1]){let K=J2(X[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof X[1]==="string")try{G=JSON.parse(X[1])}catch{}}return{src:Q,options:G}}function _q($){let Z=[],Y="",J=!1,X="",Q=0,G=0;for(let K=0;K<$.length;K++){let W=$[K],q=K>0?$[K-1]:"";if((W==='"'||W==="'"||W==="`")&&q!=="\\"){if(!J)J=!0,X=W;else if(W===X)J=!1,X="";else Y+=W;continue}if(!J){if(W==="{")Q++;if(W==="}")Q--;if(W==="[")G++;if(W==="]")G--;if(W===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=W}if(Y.trim())Z.push(Y.trim());return Z}function J2($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var k3;var b3=b(()=>{$3();Z2();k3=Y2()});function Hq($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
7893
8130
  ${$}
7894
8131
  </div>
7895
8132
  <script>
@@ -7934,7 +8171,7 @@ ${E}
7934
8171
  }
7935
8172
  }
7936
8173
  })();
7937
- </script>`}function Gq($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",X=Y?.autoReload||!1,Q=$.trim().length>0,G=`
8174
+ </script>`}function Oq($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",X=Y?.autoReload||!1,Q=$.trim().length>0,G=`
7938
8175
  <div class="stx-pwa-update-banner" style="
7939
8176
  position: fixed;
7940
8177
  bottom: 0;
@@ -8045,7 +8282,7 @@ else {
8045
8282
  // Also listen for custom event
8046
8283
  window.addEventListener('pwa-update-available', showUpdate);
8047
8284
  })();
8048
- </script>`}function Kq($,Z){let Y=$.trim().length>0,J=`
8285
+ </script>`}function Lq($,Z){let Y=$.trim().length>0,J=`
8049
8286
  <div class="stx-offline-indicator" style="
8050
8287
  position: fixed;
8051
8288
  top: 16px;
@@ -8106,7 +8343,7 @@ else {
8106
8343
  window.addEventListener('offline', updateStatus);
8107
8344
  updateStatus();
8108
8345
  })();
8109
- </script>`}function Wq($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",X=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
8346
+ </script>`}function Fq($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",X=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
8110
8347
  ${$}
8111
8348
  </div>
8112
8349
  <script>
@@ -8188,55 +8425,55 @@ catch (error) {
8188
8425
  init();
8189
8426
  }
8190
8427
  })();
8191
- </script>`}var qq,zq,Uq,jq,$2;var Z2=b(()=>{qq={name:"pwa.installButton",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Qq($,X)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},zq={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Gq($,X)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Uq={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Kq($,X)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},jq={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Wq($,X)},hasEndTag:!0,description:"Renders a push notification subscription button"},$2=[qq,zq,Uq,jq]});function k3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var k4=b(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function G$(){return!1}function K$(){return!G$()||process.env.STX_DEBUG==="true"}function b4(){return!1}import _q from"path";function S4(){return{...b3}}function y4($){if(!b3.showRelativePaths||!$)return $;let Z=b3.baseDir||process.cwd();try{let Y=_q.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var Bq,b3,P4,n1,C4;var v4=b(()=>{k4();Bq={showRelativePaths:!1,enableAutoRecovery:K$(),logRecoveryWarnings:!0},b3={...Bq};P4=class P4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,X,Q,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=X;this.context=Q;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=y4(this.filePath)}};n1=class n1 extends P4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};C4=class C4 extends P4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function J2($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:W,snippet:q,suggestion:z,format:U="text"}=$,j=Q,_=G;if(!j&&K&&W!==void 0){let O=wq(K,W);j=O.line,_=O.column}let B=X?y4(X):void 0,H=J?k3(J):void 0,L={type:Z,code:J,codeName:H,message:Y,filePath:B,line:j,column:_,snippet:q,suggestion:z,timestamp:new Date().toISOString()},F;switch(U){case"html":F=Oq(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=Lq(L,K,W);break;case"text":default:F=Hq(L,K,W);break}return{formatted:F,data:L}}function Hq($,Z,Y){let J=[],X=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${X}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
8192
- ${$.message}`),Z&&$.line){let Q=Fq(Z,$.line,2);if(Q)J.push(`
8428
+ </script>`}var Vq,wq,Aq,Rq,X2;var Q2=b(()=>{Vq={name:"pwa.installButton",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Hq($,X)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},wq={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Oq($,X)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Aq={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Lq($,X)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Rq={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let X=Y.__stx_options||{};return Fq($,X)},hasEndTag:!0,description:"Renders a push notification subscription button"},X2=[Vq,wq,Aq,Rq]});function S3($){for(let[Z,Y]of Object.entries(s))if(Y===$)return Z;return}var s;var b4=b(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function K$(){return!1}function W$(){return!K$()||process.env.STX_DEBUG==="true"}function S4(){return!1}import Nq from"path";function y4(){return{...y3}}function P4($){if(!y3.showRelativePaths||!$)return $;let Z=y3.baseDir||process.cwd();try{let Y=Nq.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var Mq,y3,C4,n1,v4;var x4=b(()=>{b4();Mq={showRelativePaths:!1,enableAutoRecovery:W$(),logRecoveryWarnings:!0},y3={...Mq};C4=class C4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,X,Q,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=X;this.context=Q;if(this.name="StxError",this.numericCode=G||s.EVALUATION_ERROR,this.filePath)this.filePath=P4(this.filePath)}};n1=class n1 extends C4{constructor($,Z,Y,J,X,Q){super($,"stx_RUNTIME_ERROR",Z,Y,J,X,Q||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};v4=class v4 extends C4{isFatal=!0;constructor($,Z,Y,J,X,Q){super($,"stx_VALIDATION_ERROR",Z,Y,J,X,Q||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function K2($){let{type:Z,message:Y,code:J,filePath:X,line:Q,column:G,template:K,offset:W,snippet:q,suggestion:z,format:U="text"}=$,j=Q,B=G;if(!j&&K&&W!==void 0){let O=bq(K,W);j=O.line,B=O.column}let _=X?P4(X):void 0,H=J?S3(J):void 0,L={type:Z,code:J,codeName:H,message:Y,filePath:_,line:j,column:B,snippet:q,suggestion:z,timestamp:new Date().toISOString()},V;switch(U){case"html":V=Iq(L);break;case"json":V=JSON.stringify(L,null,2);break;case"console":V=Dq(L,K,W);break;case"text":default:V=Tq(L,K,W);break}return{formatted:V,data:L}}function Tq($,Z,Y){let J=[],X=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${X}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}J.push(`at ${Q}`)}if(J.push(`
8429
+ ${$.message}`),Z&&$.line){let Q=Eq(Z,$.line,2);if(Q)J.push(`
8193
8430
  ${Q}`)}if($.snippet)J.push(`
8194
8431
  Snippet: ${$.snippet}`);if($.suggestion)J.push(`
8195
- Suggestion: ${$.suggestion}`);return J.join(" ")}function Oq($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${Y2($.message)}`;if($.suggestion)J+=` | Suggestion: ${Y2($.suggestion)}`;return J+=" -->",J}function Lq($,Z,Y){let q=[],z=$.code?` [${$.codeName||$.code}]`:"";if(q.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${z} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let U=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(U+=`\x1B[90m:${$.line}\x1B[0m`,$.column)U+=`\x1B[90m:${$.column}\x1B[0m`}q.push(`
8432
+ Suggestion: ${$.suggestion}`);return J.join(" ")}function Iq($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${G2($.message)}`;if($.suggestion)J+=` | Suggestion: ${G2($.suggestion)}`;return J+=" -->",J}function Dq($,Z,Y){let q=[],z=$.code?` [${$.codeName||$.code}]`:"";if(q.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${z} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let U=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(U+=`\x1B[90m:${$.line}\x1B[0m`,$.column)U+=`\x1B[90m:${$.column}\x1B[0m`}q.push(`
8196
8433
  \x1B[90mat\x1B[0m ${U}`)}if(q.push(`
8197
8434
 
8198
- ${$.message}`),Z&&$.line){let U=Vq(Z,$.line,2);if(U)q.push(`
8435
+ ${$.message}`),Z&&$.line){let U=kq(Z,$.line,2);if(U)q.push(`
8199
8436
 
8200
8437
  \x1B[90mContext:\x1B[0m
8201
8438
  ${U}`)}if($.suggestion)q.push(`
8202
8439
 
8203
8440
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return q.push(`
8204
- ${"\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"}`),q.join("")}function Fq($,Z,Y){let J=$.split(`
8441
+ ${"\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"}`),q.join("")}function Eq($,Z,Y){let J=$.split(`
8205
8442
  `),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G=[];for(let K=X;K<=Q;K++){let W=(K+1).toString().padStart(4),q=K===Z-1?">":" ";G.push(`${q}${W} | ${J[K]}`)}return G.join(`
8206
- `)}function Vq($,Z,Y){let J=$.split(`
8207
- `),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",W="\x1B[0m",q=[];for(let z=X;z<=Q;z++){let U=(z+1).toString().padStart(4),j=z===Z-1,_=j?"\x1B[31m>\x1B[0m":" ",B=j?`\x1B[31m${J[z]}\x1B[0m`:`\x1B[90m${J[z]}\x1B[0m`;q.push(`${_}\x1B[90m${U}\x1B[0m | ${B}`)}return q.join(`
8208
- `)}function Y2($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function wq($,Z){let J=$.substring(0,Z).split(`
8209
- `);return{line:J.length,column:J[J.length-1].length}}function $0($,Z,Y){return J2({type:$,message:Z,code:Y,format:"html"}).formatted}async function F5($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var X2=b(()=>{k4();v4()});class y3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let J={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
8443
+ `)}function kq($,Z,Y){let J=$.split(`
8444
+ `),X=Math.max(0,Z-Y-1),Q=Math.min(J.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",W="\x1B[0m",q=[];for(let z=X;z<=Q;z++){let U=(z+1).toString().padStart(4),j=z===Z-1,B=j?"\x1B[31m>\x1B[0m":" ",_=j?`\x1B[31m${J[z]}\x1B[0m`:`\x1B[90m${J[z]}\x1B[0m`;q.push(`${B}\x1B[90m${U}\x1B[0m | ${_}`)}return q.join(`
8445
+ `)}function G2($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function bq($,Z){let J=$.substring(0,Z).split(`
8446
+ `);return{line:J.length,column:J[J.length-1].length}}function $0($,Z,Y){return K2({type:$,message:Z,code:Y,format:"html"}).formatted}async function F5($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var W2=b(()=>{b4();x4()});class C3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let J={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
8210
8447
  `).slice(1).join(`
8211
8448
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
8212
8449
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),J=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});await this.rotateIfNeeded(Z);let X=`${this.formatEntry($)}
8213
8450
  `;Z.appendFileSync(this.logFilePath,X,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let J=`${this.logFilePath}.${Y}`,X=`${this.logFilePath}.${Y+1}`;if($.existsSync(J))if(Y>=this.maxLogFiles-1)$.unlinkSync(J);else $.renameSync(J,X)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let J=Y.error.constructor.name;$[J]=($[J]||0)+1;let X=Y.level||"error";Z[X]=(Z[X]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),X=(await import("path")).dirname($);if(!Y.existsSync(X))Y.mkdirSync(X,{recursive:!0});if(Z==="json"){let Q=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Y.writeFileSync($,JSON.stringify(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,Q.join(`
8214
8451
 
8215
- `),"utf-8")}}async flush(){await this.writeQueue}}var S3,e0,P3;var Q2=b(()=>{v4();S3={isEnabled(){return S4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=S4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],X=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(X>Q){let K=X-Q;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let W=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,q=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(W>q){let z=W-q;for(let U=0;U<z;U++)Y+=`
8216
- @end${K}`;J.push(`Added ${z} missing @end${K}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent($,Z){if(K$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};e0=new y3,P3={isDevelopment(){return K$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
8217
- `)}}});var G2=()=>{};var K2=b(()=>{k4();X2();Q2();G2();v4()});var U1=b(()=>{K2()});function W2($,Z,Y,J){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,q)=>{if(!q&&W.includes(":")){let z=W.split(":"),U=W,j=z.length>1?z[1]:"";if(j&&Z[j])q=Z[j];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])q=Z.openGraph[z[1]];else q="";return q?`<meta property="${l(U)}" content="${l(q)}">`:""}return q?`<meta name="${l(W)}" content="${l(q)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,W=K+G[0].length-1,q=1,z=W+1;while(z<X.length&&q>0){if(X[z]==="(")q++;else if(X[z]===")"){if(q--,q===0)break}z++}if(q!==0)break;let U=X.substring(W+1,z).trim(),j=z+1,_=(()=>{try{let B=T0(U,Z);if(!B)return"";let H="<meta";if(B.name)H+=` name="${l(String(B.name))}"`;if(B.property)H+=` property="${l(String(B.property))}"`;if(B.httpEquiv)H+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)H+=` content="${l(String(B.content))}"`;return H+=">",H}catch(B){let H=B instanceof Error?B.message:String(B);return $0("MetaTag",H,o.EVALUATION_ERROR)}})();X=X.substring(0,K)+_+X.substring(j),Q.lastIndex=0}return X}function q2($,Z,Y){let J=$,X=/@structuredData\s*\(/g,Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")"){if(W--,W===0)break}q++}if(W!==0)break;let z=J.substring(K+1,q).trim(),U=q+1,j=(()=>{try{let _=T0(z,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let B=_ instanceof Error?_.message:String(_);return $0("StructuredData",B,o.EVALUATION_ERROR)}})();J=J.substring(0,G)+j+J.substring(U),X.lastIndex=0}return J}function z2($,Z,Y,J){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),W=1,q=K+1,z=null,U=!1;while(q<X.length&&W>0){let F=X[q];if(U){U=!1,q++;continue}if(F==="\\"&&z){U=!0,q++;continue}if(z){if(F===z)z=null;q++;continue}if(F==='"'||F==="'"||F==="`"){z=F,q++;continue}if(F==="{")W++;else if(F==="}")W--;q++}if(W!==0)break;let j=X.substring(q).match(/^\s*\)/);if(!j)break;let _=q+j[0].length,B=X.substring(K,q),H=X.substring(G.index,_),L=((F)=>{try{let O=T0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${l(O.title)}</title>
8218
- `,V+=`<meta name="title" content="${l(O.title)}">
8219
- `;if(O.description)V+=`<meta name="description" content="${l(O.description)}">
8220
- `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${l(w)}">
8221
- `}if(O.robots)V+=`<meta name="robots" content="${l(O.robots)}">
8222
- `;if(O.canonical)V+=`<link rel="canonical" href="${l(O.canonical)}">
8223
- `;if(O.openGraph){let w=O.openGraph;if(V+=`<meta property="og:type" content="${l(w.type||"website")}">
8224
- `,w.title||O.title){let A=w.title||O.title||"";V+=`<meta property="og:title" content="${l(A)}">
8225
- `}if(w.description||O.description){let A=w.description||O.description||"";V+=`<meta property="og:description" content="${l(A)}">
8226
- `}if(w.url||O.canonical){let A=w.url||O.canonical||"";V+=`<meta property="og:url" content="${l(A)}">
8227
- `}if(w.image){if(V+=`<meta property="og:image" content="${l(w.image)}">
8228
- `,w.imageAlt)V+=`<meta property="og:image:alt" content="${l(w.imageAlt)}">
8229
- `;if(w.imageWidth)V+=`<meta property="og:image:width" content="${l(String(w.imageWidth))}">
8230
- `;if(w.imageHeight)V+=`<meta property="og:image:height" content="${l(String(w.imageHeight))}">
8231
- `}if(w.siteName)V+=`<meta property="og:site_name" content="${l(w.siteName)}">
8232
- `}if(O.twitter){let w=O.twitter;if(V+=`<meta name="twitter:card" content="${l(w.card||"summary_large_image")}">
8233
- `,w.title||O.title){let A=w.title||O.title||"";V+=`<meta name="twitter:title" content="${l(A)}">
8234
- `}if(w.description||O.description){let A=w.description||O.description||"";V+=`<meta name="twitter:description" content="${l(A)}">
8235
- `}if(w.image||O.openGraph&&O.openGraph.image){let A=w.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${l(A)}">
8236
- `}if(w.site)V+=`<meta name="twitter:site" content="${l(w.site)}">
8237
- `;if(w.creator)V+=`<meta name="twitter:creator" content="${l(w.creator)}">
8238
- `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
8239
- `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return $0("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(B);X=X.substring(0,G.index)+L+X.substring(_),Q.lastIndex=G.index+L.length}return X}function U2($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let W="";if(Z.image)W=Z.image;else if(Z.meta&&Z.meta.image)W=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)W=Z.openGraph.image;else if(Y.seo?.defaultImage)W=Y.seo.defaultImage;else if(Y.defaultImage)W=Y.defaultImage;let q=`
8452
+ `),"utf-8")}}async flush(){await this.writeQueue}}var P3,e0,v3;var q2=b(()=>{x4();P3={isEnabled(){return y4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=y4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],X=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(X>Q){let K=X-Q;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let W=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,q=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(W>q){let z=W-q;for(let U=0;U<z;U++)Y+=`
8453
+ @end${K}`;J.push(`Added ${z} missing @end${K}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent($,Z){if(W$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};e0=new C3,v3={isDevelopment(){return W$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
8454
+ `)}}});var z2=()=>{};var U2=b(()=>{b4();W2();q2();z2();x4()});var U1=b(()=>{U2()});function j2($,Z,Y,J){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,q)=>{if(!q&&W.includes(":")){let z=W.split(":"),U=W,j=z.length>1?z[1]:"";if(j&&Z[j])q=Z[j];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])q=Z.openGraph[z[1]];else q="";return q?`<meta property="${l(U)}" content="${l(q)}">`:""}return q?`<meta name="${l(W)}" content="${l(q)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,W=K+G[0].length-1,q=1,z=W+1;while(z<X.length&&q>0){if(X[z]==="(")q++;else if(X[z]===")"){if(q--,q===0)break}z++}if(q!==0)break;let U=X.substring(W+1,z).trim(),j=z+1,B=(()=>{try{let _=T0(U,Z);if(!_)return"";let H="<meta";if(_.name)H+=` name="${l(String(_.name))}"`;if(_.property)H+=` property="${l(String(_.property))}"`;if(_.httpEquiv)H+=` http-equiv="${l(String(_.httpEquiv))}"`;if(_.content)H+=` content="${l(String(_.content))}"`;return H+=">",H}catch(_){let H=_ instanceof Error?_.message:String(_);return $0("MetaTag",H,s.EVALUATION_ERROR)}})();X=X.substring(0,K)+B+X.substring(j),Q.lastIndex=0}return X}function B2($,Z,Y){let J=$,X=/@structuredData\s*\(/g,Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")"){if(W--,W===0)break}q++}if(W!==0)break;let z=J.substring(K+1,q).trim(),U=q+1,j=(()=>{try{let B=T0(z,Z);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let _=B instanceof Error?B.message:String(B);return $0("StructuredData",_,s.EVALUATION_ERROR)}})();J=J.substring(0,G)+j+J.substring(U),X.lastIndex=0}return J}function _2($,Z,Y,J){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),W=1,q=K+1,z=null,U=!1;while(q<X.length&&W>0){let V=X[q];if(U){U=!1,q++;continue}if(V==="\\"&&z){U=!0,q++;continue}if(z){if(V===z)z=null;q++;continue}if(V==='"'||V==="'"||V==="`"){z=V,q++;continue}if(V==="{")W++;else if(V==="}")W--;q++}if(W!==0)break;let j=X.substring(q).match(/^\s*\)/);if(!j)break;let B=q+j[0].length,_=X.substring(K,q),H=X.substring(G.index,B),L=((V)=>{try{let O=T0(V,Z);if(!O)return"";let F="";if(O.title)F+=`<title>${l(O.title)}</title>
8455
+ `,F+=`<meta name="title" content="${l(O.title)}">
8456
+ `;if(O.description)F+=`<meta name="description" content="${l(O.description)}">
8457
+ `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;F+=`<meta name="keywords" content="${l(w)}">
8458
+ `}if(O.robots)F+=`<meta name="robots" content="${l(O.robots)}">
8459
+ `;if(O.canonical)F+=`<link rel="canonical" href="${l(O.canonical)}">
8460
+ `;if(O.openGraph){let w=O.openGraph;if(F+=`<meta property="og:type" content="${l(w.type||"website")}">
8461
+ `,w.title||O.title){let A=w.title||O.title||"";F+=`<meta property="og:title" content="${l(A)}">
8462
+ `}if(w.description||O.description){let A=w.description||O.description||"";F+=`<meta property="og:description" content="${l(A)}">
8463
+ `}if(w.url||O.canonical){let A=w.url||O.canonical||"";F+=`<meta property="og:url" content="${l(A)}">
8464
+ `}if(w.image){if(F+=`<meta property="og:image" content="${l(w.image)}">
8465
+ `,w.imageAlt)F+=`<meta property="og:image:alt" content="${l(w.imageAlt)}">
8466
+ `;if(w.imageWidth)F+=`<meta property="og:image:width" content="${l(String(w.imageWidth))}">
8467
+ `;if(w.imageHeight)F+=`<meta property="og:image:height" content="${l(String(w.imageHeight))}">
8468
+ `}if(w.siteName)F+=`<meta property="og:site_name" content="${l(w.siteName)}">
8469
+ `}if(O.twitter){let w=O.twitter;if(F+=`<meta name="twitter:card" content="${l(w.card||"summary_large_image")}">
8470
+ `,w.title||O.title){let A=w.title||O.title||"";F+=`<meta name="twitter:title" content="${l(A)}">
8471
+ `}if(w.description||O.description){let A=w.description||O.description||"";F+=`<meta name="twitter:description" content="${l(A)}">
8472
+ `}if(w.image||O.openGraph&&O.openGraph.image){let A=w.image||(O.openGraph?O.openGraph.image:"")||"";F+=`<meta name="twitter:image" content="${l(A)}">
8473
+ `}if(w.site)F+=`<meta name="twitter:site" content="${l(w.site)}">
8474
+ `;if(w.creator)F+=`<meta name="twitter:creator" content="${l(w.creator)}">
8475
+ `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${w}</script>
8476
+ `}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return $0("SEO",`Error processing @seo directive: ${F}`,s.EVALUATION_ERROR)}})(_);X=X.substring(0,G.index)+L+X.substring(B),Q.lastIndex=G.index+L.length}return X}function H2($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let W="";if(Z.image)W=Z.image;else if(Z.meta&&Z.meta.image)W=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)W=Z.openGraph.image;else if(Y.seo?.defaultImage)W=Y.seo.defaultImage;else if(Y.defaultImage)W=Y.defaultImage;let q=`
8240
8477
  <!-- stx SEO Tags -->
8241
8478
  <meta name="title" content="${l(G)}">
8242
8479
  <meta name="description" content="${l(K)}">
@@ -8252,7 +8489,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
8252
8489
  `;let z=$;if(!Q)z=z.replace(/<head[^>]*>/,`$&
8253
8490
  <title>${l(G)}</title>`);return z.replace(/<head[^>]*>/,`$&
8254
8491
  ${q}
8255
- `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var j2,_2;var C3=b(()=>{U1();A0();j2={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(X)}" content="${l(Q)}">`},hasEndTag:!1},_2={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let X=JSON.parse($);if(!X["@context"])X["@context"]="https://schema.org";if(!X["@type"])return $0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(X)}</script>`}catch(X){let Q=X instanceof Error?X.message:String(X);return $0("StructuredData",Q,o.EVALUATION_ERROR)}},hasEndTag:!0}});import W$ from"path";function Aq($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",X=Z,Q=[],G=!0;if(J){let U=J.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let j=U[1],_=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)X=_[1];let B=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=j.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),W=K?K[1].trim():"",q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),z=q?q[1].trim():"";return{tag:X,props:Q,template:W,styles:z,script:J,shadowDOM:G}}function Rq($){let{tag:Z,props:Y,template:J,styles:X,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),W=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=Y.map((U)=>`'${U}'`).join(", "),z=Y.map((U)=>`
8492
+ `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var O2,L2;var x3=b(()=>{U1();A0();O2={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(X)}" content="${l(Q)}">`},hasEndTag:!1},L2={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let X=JSON.parse($);if(!X["@context"])X["@context"]="https://schema.org";if(!X["@type"])return $0("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(X)}</script>`}catch(X){let Q=X instanceof Error?X.message:String(X);return $0("StructuredData",Q,s.EVALUATION_ERROR)}},hasEndTag:!0}});import q$ from"path";function Sq($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",X=Z,Q=[],G=!0;if(J){let U=J.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let j=U[1],B=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)X=B[1];let _=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(_)Q=_[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=j.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),W=K?K[1].trim():"",q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),z=q?q[1].trim():"";return{tag:X,props:Q,template:W,styles:z,script:J,shadowDOM:G}}function yq($){let{tag:Z,props:Y,template:J,styles:X,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),W=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=Y.map((U)=>`'${U}'`).join(", "),z=Y.map((U)=>`
8256
8493
  get ${U}() {
8257
8494
  return this.getAttribute('${U}') || '';
8258
8495
  }
@@ -8303,16 +8540,16 @@ ${z}
8303
8540
  }
8304
8541
 
8305
8542
  customElements.define('${Z}', ${G});
8306
- `}async function B2($,Z,Y,J){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[W$.join(W$.dirname(J),G,`${X}.stx`),W$.join(process.cwd(),G,`${X}.stx`),W$.join(W$.dirname(J),`${X}.stx`)],W=null;for(let U of K)if(await c(U)){W=await Bun.file(U).text();break}if(!W)return $0("WebComponent",`Component file not found: ${X}.stx`,o.FILE_NOT_FOUND);let q=Aq(W,X);return`<script type="module">
8307
- ${Rq(q)}
8308
- </script>`}var H2=b(()=>{U1();M0()});var O2={};a(O2,{timingPlugin:()=>Dq,pluginManager:()=>Nq,definePlugin:()=>x4,debugPlugin:()=>Iq,createVariablesPlugin:()=>Eq,createFilterPlugin:()=>Tq,createDirectivePlugin:()=>Mq,PluginManager:()=>v3});function x4($){return $}class v3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let X=J[$];if(X)try{let Q=await X(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return J}}function Mq($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function Tq($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function Eq($){return x4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var Nq,Iq,Dq;var L2=b(()=>{Nq=new v3;Iq=x4({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)}}),Dq=x4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var V2={};a(V2,{validateConfig:()=>Pq,loadStxConfig:()=>j1,defineStxConfig:()=>yq,defaultConfig:()=>o1,config:()=>f3});import x3 from"fs";import y0 from"path";import{loadConfigWithResult as kq}from"bunfig";function bq($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=y0.join(process.cwd(),"resources","views"),X=y0.join(process.cwd(),"resources","layouts");if(x3.existsSync(J)&&x3.existsSync(X))return{root:"resources",pagesDir:"views"};let Q=y0.join(process.cwd(),"resources","views","pages");if(x3.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function Sq($){if(Q9($.stateDir),$.stateDir=v5(),$.cachePath=x5($.cachePath),$.build)$.build.cacheDir=x5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=x5($.media.cache.directory);if($.story)$.story.outDir=x5($.story.outDir)}async function j1($){if(!$){if(V5)return V5;if(f4)return f4}let Z=$?y0.resolve($):process.cwd(),Y=F2.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await kq({name:"stx",alias:"ui",cwd:Z,defaultConfig:o1,verbose:!1})).config;Sq(Q);let G=bq(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!y0.isAbsolute(Q.partialsDir))Q.partialsDir=y0.join(K,Q.partialsDir);if(Q.componentsDir&&!y0.isAbsolute(Q.componentsDir))Q.componentsDir=y0.join(K,Q.componentsDir);if(Q.layoutsDir&&!y0.isAbsolute(Q.layoutsDir))Q.layoutsDir=y0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (L2(),O2)),W=[],q=[];for(let z of Q.plugins){let U=typeof z==="string"?z:z[0],j=typeof z==="string"?{}:z[1]||{};try{let _,B;try{_=await import(U),B=y0.dirname(_0.resolve(U))}catch{let L=y0.resolve(process.cwd(),U);_=await import(L),B=y0.dirname(L)}let H=_.default||_;if(K.register(H,Q),H.components){let L=y0.resolve(B,H.components);W.push(L)}if(H.pages){let L=y0.resolve(B,H.pages),F=j.path||"/";q.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(F)},addRoute:(F,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[F]=O},addMiddleware:(F)=>{Q.middleware=Q.middleware||[],Q.middleware.push(F)},pluginDir:B,config:Q};await H.setup(j,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(_){console.warn(`[stx] Failed to load plugin ${U}:`,_.message)}}Q._pluginComponentDirs=W,Q._pluginPageDirs=q}return Q})();if(F2.set(Z,J),!$)f4=J,J.then((X)=>{V5=X}).catch(()=>{});return J}function yq($){return $}function Pq($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${X}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((X,Q)=>{if(!X.pattern||typeof X.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(X.maxAgeSeconds!==void 0&&(typeof X.maxAgeSeconds!=="number"||X.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(X.maxEntries!==void 0&&(typeof X.maxEntries!=="number"||X.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((X)=>typeof X!=="number"||X<16||X>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var o1,V5=null,F2,f4=null,f3;var s1=b(()=>{j7();_7();B7();H7();a7();kZ();E3();Z2();C3();f5();H2();o1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Q5,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:ZZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:B2,hasEndTag:!1,description:"Include a web component in the template"},W9,q9,j2,_2,z9,j9,_9,U9,L9,w9,EZ,D3,...$2],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}};F2=new Map;f3=new Proxy(o1,{get($,Z){if(V5&&Z in V5)return V5[Z];if(!f4)j1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var T2={};a(T2,{resetCssCache:()=>uq,resetCrosswindCache:()=>mq,rebuildCrosswindCSS:()=>pq,loadCrosswindConfig:()=>u3,loadCrosswind:()=>d3,injectCrosswindCSS:()=>z$,getCrosswindServeAsset:()=>xq,getCachedCSS:()=>lq,generateCrosswindCSS:()=>M2,extractClassNames:()=>N2,buildCrosswindCSS:()=>R2});import J0 from"path";import{hasLocalConfig as Cq}from"bunfig";function h4($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function g3($,Z){if(_1.has($))_1.delete($);else if(_1.size>=A2)_1.delete(_1.keys().next().value);_1.set($,Z)}function vq($){let Z=h4($);if($1.has(Z))$1.delete(Z);else if($1.size>=A2)$1.delete($1.keys().next().value);return $1.set(Z,$),Z}function xq($){let Z=$1.get($);if(Z===void 0)return;return $1.delete($),$1.set($,Z),Z}async function fq($){if(!I1)return null;try{let Z=Bun.file(J0.join(I1,`cw-${h4($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function gq($,Z){if(!I1)return;try{if(!fs.existsSync(I1))fs.mkdirSync(I1,{recursive:!0});await Bun.write(J0.join(I1,`cw-${h4($)}.css`),Z)}catch{}}async function w2($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function hq(){let $=[],Z=process.cwd();while(Z!==J0.dirname(Z))$.push(J0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(J0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(J0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(J0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(J0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(J0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=J0.dirname(Z);return $}function dq(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[J0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),J0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),J0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),J0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),J0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),J0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function d3(){if(h3)return Q1;h3=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await w2(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${J0.dirname(J0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=J0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return Q1=Q,Q1}let Z=await $(hq());if(Z)return Q1=Z,Q1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of Y){let Q=await w2(X);if(Q){if(Q1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return Q1}}let J=await $(dq());if(J)return Q1=J,Q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}function uq(){_1.clear(),$1.clear()}function mq(){Q1=null,h3=!1,Z1=null,q$="",_1.clear(),$1.clear(),g4=null}async function u3($){try{if(!Cq({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=J0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function R2($){if(w5)return q$;w5=!0;try{let Z=await d3();if(!Z||!Z.build)return w5=!1,"";if(!Z1)Z1=await u3($);if(!Z1)return w5=!1,"";let Y=Z.defaultConfig?.theme||{},J=Z1.theme||{},X={...Z.defaultConfig,...Z1,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(q$=G.css,console.log(`${O0.cyan}[Crosswind]${O0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let W=J0.isAbsolute(X.output)?X.output:J0.join($,X.output),q=J0.dirname(W);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(W,G.css)}return w5=!1,G.css}catch(Z){return console.error(`${O0.red}[Crosswind]${O0.reset} Build error:`,Z),w5=!1,q$}}async function pq($){Z1=null,await R2($)}function lq(){return q$}function N2($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let X=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=X.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=X.exec($)}return Z}async function M2($,Z){try{let Y=await d3();if(!Y)return"";let J=typeof Y.extractClasses==="function"?Y.extractClasses($):N2($);if(J.size===0)return"";let X=Z?J0.resolve(Z):process.cwd();if(!I1)I1=L1(X,"cache");let Q=[...J].sort().join(" "),G=`${g4||"default"}::${Q}`,K=_1.get(G);if(K!==void 0)return g3(G,K),K;let W=await fq(G);if(W!==null)return g3(G,W),W;if(!Z1){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (s1(),V2)),N=await R(X);if(N.css)if(typeof N.css==="string"){let M=J0.isAbsolute(N.css)?N.css:J0.resolve(X,N.css);if(await Bun.file(M).exists()){let T=await import(M);A=T.default||T,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(A={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let M=J0.isAbsolute(N.css.config)?N.css.config:J0.resolve(X,N.css.config);if(await Bun.file(M).exists()){let T=await import(M);A={...T.default||T,...A}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}Z1=A||await u3(X);try{g4=h4(JSON.stringify(Z1??{}))}catch{g4="unhashable"}}let q=Y.defaultConfig||Y.config,z=Z1||{},U=q.theme||{},_=(z.theme||{}).extend||{},B={...U};if(Object.keys(_).length>0)B.extend=_;let H=[...q.safelist||[],...z.safelist||[]],L={...q,...z,content:[],output:"",preflight:!0,minify:!1,theme:B,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of J)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||z.shortcuts||{};for(let[A,R]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let N=R.split(/\s+/).filter(Boolean);for(let M of N)F.generate(M)}O=F.toCSS(!0,!1);let w=O.split(`
8309
- `);for(let[A,R]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let N=R.split(/\s+/).filter(Boolean),M=[],T=[];for(let I of N){let E=I.startsWith("dark:"),S=`.${(E?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<w.length;k++){let v=w[k].trim();if(v===`${S} {`||v.startsWith(`${S} {`)){let g=k,f="";while(g<w.length){if(f+=w[g],w[g].includes("}"))break;g++}let d=f.match(/\{([^}]+)\}/);if(d)if(E)T.push(d[1].trim());else M.push(d[1].trim());break}}}if(M.length)O+=`
8310
- .${A} { ${M.join(" ")} }`;if(T.length)O+=`
8311
- @media (prefers-color-scheme: dark) { .dark .${A} { ${T.join(" ")} } }`}return g3(G,O),gq(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function z$($,Z,Y=!1){let J=await M2($,Z);if(!J)return $;let X=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${vq(J)}.css">`:`<style data-crosswind="generated">
8543
+ `}async function F2($,Z,Y,J){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[q$.join(q$.dirname(J),G,`${X}.stx`),q$.join(process.cwd(),G,`${X}.stx`),q$.join(q$.dirname(J),`${X}.stx`)],W=null;for(let U of K)if(await c(U)){W=await Bun.file(U).text();break}if(!W)return $0("WebComponent",`Component file not found: ${X}.stx`,s.FILE_NOT_FOUND);let q=Sq(W,X);return`<script type="module">
8544
+ ${yq(q)}
8545
+ </script>`}var V2=b(()=>{U1();M0()});var w2={};a(w2,{timingPlugin:()=>fq,pluginManager:()=>Pq,definePlugin:()=>f4,debugPlugin:()=>xq,createVariablesPlugin:()=>gq,createFilterPlugin:()=>vq,createDirectivePlugin:()=>Cq,PluginManager:()=>f3});function f4($){return $}class f3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let X=J[$];if(X)try{let Q=await X(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return J}}function Cq($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function vq($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function gq($){return f4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var Pq,xq,fq;var A2=b(()=>{Pq=new f3;xq=f4({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)}}),fq=f4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var N2={};a(N2,{validateConfig:()=>pq,loadStxConfig:()=>j1,defineStxConfig:()=>mq,defaultConfig:()=>o1,config:()=>h3});import g3 from"fs";import y0 from"path";import{loadConfigWithResult as hq}from"bunfig";function dq($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=y0.join(process.cwd(),"resources","views"),X=y0.join(process.cwd(),"resources","layouts");if(g3.existsSync(J)&&g3.existsSync(X))return{root:"resources",pagesDir:"views"};let Q=y0.join(process.cwd(),"resources","views","pages");if(g3.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function uq($){if(W9($.stateDir),$.stateDir=x5(),$.cachePath=f5($.cachePath),$.build)$.build.cacheDir=f5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=f5($.media.cache.directory);if($.story)$.story.outDir=f5($.story.outDir)}async function j1($){if(!$){if(V5)return V5;if(g4)return g4}let Z=$?y0.resolve($):process.cwd(),Y=R2.get(Z);if(Y)return Y;let J=(async()=>{let Q=(await hq({name:"stx",alias:"ui",cwd:Z,defaultConfig:o1,verbose:!1})).config;uq(Q);let G=dq(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!y0.isAbsolute(Q.partialsDir))Q.partialsDir=y0.join(K,Q.partialsDir);if(Q.componentsDir&&!y0.isAbsolute(Q.componentsDir))Q.componentsDir=y0.join(K,Q.componentsDir);if(Q.layoutsDir&&!y0.isAbsolute(Q.layoutsDir))Q.layoutsDir=y0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (A2(),w2)),W=[],q=[];for(let z of Q.plugins){let U=typeof z==="string"?z:z[0],j=typeof z==="string"?{}:z[1]||{};try{let B,_;try{B=await import(U),_=y0.dirname(B0.resolve(U))}catch{let L=y0.resolve(process.cwd(),U);B=await import(L),_=y0.dirname(L)}let H=B.default||B;if(K.register(H,Q),H.components){let L=y0.resolve(_,H.components);W.push(L)}if(H.pages){let L=y0.resolve(_,H.pages),V=j.path||"/";q.push({dir:L,prefix:V})}if(H.setup){let L={addDirective:(V)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(V)},addRoute:(V,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[V]=O},addMiddleware:(V)=>{Q.middleware=Q.middleware||[],Q.middleware.push(V)},pluginDir:_,config:Q};await H.setup(j,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(B){console.warn(`[stx] Failed to load plugin ${U}:`,B.message)}}Q._pluginComponentDirs=W,Q._pluginPageDirs=q}return Q})();if(R2.set(Z,J),!$)g4=J,J.then((X)=>{V5=X}).catch(()=>{});return J}function mq($){return $}function pq($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${X}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,X)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((X,Q)=>{if(!X.pattern||typeof X.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(X.maxAgeSeconds!==void 0&&(typeof X.maxAgeSeconds!=="number"||X.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(X.maxEntries!==void 0&&(typeof X.maxEntries!=="number"||X.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((X)=>typeof X!=="number"||X<16||X>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var o1,V5=null,R2,g4=null,h3;var s1=b(()=>{H7();O7();L7();F7();e7();PZ();b3();Q2();x3();g5();V2();o1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Q5,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:QZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:F2,hasEndTag:!1,description:"Include a web component in the template"},U9,j9,O2,L2,B9,H9,O9,_9,w9,N9,yZ,k3,...X2],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}};R2=new Map;h3=new Proxy(o1,{get($,Z){if(V5&&Z in V5)return V5[Z];if(!g4)j1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var k2={};a(k2,{resetCssCache:()=>aq,resetCrosswindCache:()=>tq,rebuildCrosswindCSS:()=>eq,loadCrosswindConfig:()=>p3,loadCrosswind:()=>m3,injectCrosswindCSS:()=>U$,getCrosswindServeAsset:()=>iq,getCachedCSS:()=>$z,generateCrosswindCSS:()=>E2,extractClassNames:()=>D2,buildCrosswindCSS:()=>I2});import J0 from"path";import{hasLocalConfig as lq}from"bunfig";function d4($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function d3($,Z){if(B1.has($))B1.delete($);else if(B1.size>=T2)B1.delete(B1.keys().next().value);B1.set($,Z)}function cq($){let Z=d4($);if($1.has(Z))$1.delete(Z);else if($1.size>=T2)$1.delete($1.keys().next().value);return $1.set(Z,$),Z}function iq($){let Z=$1.get($);if(Z===void 0)return;return $1.delete($),$1.set($,Z),Z}async function nq($){if(!I1)return null;try{let Z=Bun.file(J0.join(I1,`cw-${d4($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function oq($,Z){if(!I1)return;try{if(!fs.existsSync(I1))fs.mkdirSync(I1,{recursive:!0});await Bun.write(J0.join(I1,`cw-${d4($)}.css`),Z)}catch{}}async function M2($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function sq(){let $=[],Z=process.cwd();while(Z!==J0.dirname(Z))$.push(J0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(J0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(J0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(J0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(J0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(J0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=J0.dirname(Z);return $}function rq(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[J0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),J0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),J0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),J0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),J0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),J0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function m3(){if(u3)return Q1;u3=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await M2(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${J0.dirname(J0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=J0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return Q1=Q,Q1}let Z=await $(sq());if(Z)return Q1=Z,Q1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of Y){let Q=await M2(X);if(Q){if(Q1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return Q1}}let J=await $(rq());if(J)return Q1=J,Q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}function aq(){B1.clear(),$1.clear()}function tq(){Q1=null,u3=!1,Z1=null,z$="",B1.clear(),$1.clear(),h4=null}async function p3($){try{if(!lq({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=J0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function I2($){if(w5)return z$;w5=!0;try{let Z=await m3();if(!Z||!Z.build)return w5=!1,"";if(!Z1)Z1=await p3($);if(!Z1)return w5=!1,"";let Y=Z.defaultConfig?.theme||{},J=Z1.theme||{},X={...Z.defaultConfig,...Z1,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(z$=G.css,console.log(`${O0.cyan}[Crosswind]${O0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let W=J0.isAbsolute(X.output)?X.output:J0.join($,X.output),q=J0.dirname(W);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(W,G.css)}return w5=!1,G.css}catch(Z){return console.error(`${O0.red}[Crosswind]${O0.reset} Build error:`,Z),w5=!1,z$}}async function eq($){Z1=null,await I2($)}function $z(){return z$}function D2($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let X=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=X.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=X.exec($)}return Z}async function E2($,Z){try{let Y=await m3();if(!Y)return"";let J=typeof Y.extractClasses==="function"?Y.extractClasses($):D2($);if(J.size===0)return"";let X=Z?J0.resolve(Z):process.cwd();if(!I1)I1=L1(X,"cache");let Q=[...J].sort().join(" "),G=`${h4||"default"}::${Q}`,K=B1.get(G);if(K!==void 0)return d3(G,K),K;let W=await nq(G);if(W!==null)return d3(G,W),W;if(!Z1){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (s1(),N2)),N=await R(X);if(N.css)if(typeof N.css==="string"){let T=J0.isAbsolute(N.css)?N.css:J0.resolve(X,N.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(A={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let T=J0.isAbsolute(N.css.config)?N.css.config:J0.resolve(X,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}Z1=A||await p3(X);try{h4=d4(JSON.stringify(Z1??{}))}catch{h4="unhashable"}}let q=Y.defaultConfig||Y.config,z=Z1||{},U=q.theme||{},B=(z.theme||{}).extend||{},_={...U};if(Object.keys(B).length>0)_.extend=B;let H=[...q.safelist||[],...z.safelist||[]],L={...q,...z,content:[],output:"",preflight:!0,minify:!1,theme:_,safelist:H},V=new Y.CSSGenerator(L);for(let A of H)V.generate(A);for(let A of J)V.generate(A);let O=V.toCSS(!0,!1),F=L.shortcuts||z.shortcuts||{};for(let[A,R]of Object.entries(F)){if(!J.has(A)&&!H.includes(A))continue;let N=R.split(/\s+/).filter(Boolean);for(let T of N)V.generate(T)}O=V.toCSS(!0,!1);let w=O.split(`
8546
+ `);for(let[A,R]of Object.entries(F)){if(!J.has(A)&&!H.includes(A))continue;let N=R.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of N){let E=I.startsWith("dark:"),S=`.${(E?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<w.length;k++){let C=w[k].trim();if(C===`${S} {`||C.startsWith(`${S} {`)){let g=k,f="";while(g<w.length){if(f+=w[g],w[g].includes("}"))break;g++}let d=f.match(/\{([^}]+)\}/);if(d)if(E)M.push(d[1].trim());else T.push(d[1].trim());break}}}if(T.length)O+=`
8547
+ .${A} { ${T.join(" ")} }`;if(M.length)O+=`
8548
+ @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return d3(G,O),oq(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function U$($,Z,Y=!1){let J=await E2($,Z);if(!J)return $;let X=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${cq(J)}.css">`:`<style data-crosswind="generated">
8312
8549
  ${J}
8313
8550
  </style>`,Q=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(Q.test($)){let G=!1;return $.replace(Q,()=>{if(G)return"";return G=!0,X})}if($.includes("</head>"))return $.replace("</head>",`${X}
8314
8551
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
8315
- ${X}`);return X+$}var Q1=null,h3=!1,Z1=null,q$="",w5=!1,A2=256,_1,$1,I1=null,g4=null;var d4=b(()=>{f5();G9();_1=new Map,$1=new Map});function I2(){return`
8552
+ ${X}`);return X+$}var Q1=null,u3=!1,Z1=null,z$="",w5=!1,T2=256,B1,$1,I1=null,h4=null;var u4=b(()=>{g5();q9();B1=new Map,$1=new Map});function b2(){return`
8316
8553
  // STX Lifecycle Runtime
8317
8554
  (function() {
8318
8555
  if (typeof window === 'undefined') return;
@@ -8657,7 +8894,7 @@ else {
8657
8894
 
8658
8895
  console.log('[stx] Lifecycle runtime initialized');
8659
8896
  })();
8660
- `}function m3($){return Symbol($)}var _V,BV,HV;var D2=b(()=>{_V=m3("theme"),BV=m3("router"),HV=m3("i18n")});import*as k2 from"crypto";function E2($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function cq(){return`stx-${k2.randomBytes(4).toString("hex")}`}function iq($){return/\$\w+\./.test($)}function nq($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,X=$;return X=X.replace(J,(Q,G,K,W)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let q=[],z=!1,U=K,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(j)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(iq(V)){z=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(q.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),E2(A).forEach((N)=>Y.add(N)),O==="text")U=U.replace(F,"");else if(O==="class")U=U.replace(F,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(F,"");else U=U.replace(F,`${O}=""`)}}}if(!z)return Q;let B=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(B)H=B[1];else H=cq(),U=` id="${H}"${U}`;for(let L of q)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:E2(L.expr)});return`<${G}${U}${W}`}),{html:X,bindings:Z,stores:Y}}function oq($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
8897
+ `}function l3($){return Symbol($)}var IV,DV,EV;var S2=b(()=>{IV=l3("theme"),DV=l3("router"),EV=l3("i18n")});import*as P2 from"crypto";function y2($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function Zz(){return`stx-${P2.randomBytes(4).toString("hex")}`}function Yz($){return/\$\w+\./.test($)}function Jz($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,X=$;return X=X.replace(J,(Q,G,K,W)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let q=[],z=!1,U=K,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...K.matchAll(j)];for(let L of B){let V=L[0],O=L[1],F=L[2];if(Yz(F)){z=!0;let w=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(q.push({attr:O,expr:A,fullMatch:V,originalAttr:O}),y2(A).forEach((N)=>Y.add(N)),O==="text")U=U.replace(V,"");else if(O==="class")U=U.replace(V,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(V,"");else U=U.replace(V,`${O}=""`)}}}if(!z)return Q;let _=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(_)H=_[1];else H=Zz(),U=` id="${H}"${U}`;for(let L of q)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:y2(L.expr)});return`<${G}${U}${W}`}),{html:X,bindings:Z,stores:Y}}function Xz($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
8661
8898
  <script>
8662
8899
  (function() {
8663
8900
  'use strict';
@@ -8815,10 +9052,10 @@ else {
8815
9052
  }
8816
9053
  })();
8817
9054
  </script>
8818
- `,J}function b2($){let{html:Z,bindings:Y,stores:J}=nq($);if(Y.length===0)return $;let X=oq(Y,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var S2=()=>{};function sq($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return rq(Z);case"google-analytics":return aq(Z);case"plausible":return tq(Z);case"self-hosted":return eq(Z);case"custom":return $z(Z);default:return""}}function rq($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",X=[`data-site="${m0(Z.siteId)}"`];if(Z.honorDnt)X.push('data-honor-dnt="true"');if(Z.spa)X.push('data-spa="auto"');if(Z.canonical)X.push(`data-canonical="${m0(Z.canonical)}"`);if(Z.auto===!1)X.push('data-auto="false"');return`
9055
+ `,J}function C2($){let{html:Z,bindings:Y,stores:J}=Jz($);if(Y.length===0)return $;let X=Xz(Y,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+X+Z.slice(Q);return Z+X}var v2=()=>{};function Qz($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return Gz(Z);case"google-analytics":return Kz(Z);case"plausible":return Wz(Z);case"self-hosted":return qz(Z);case"custom":return zz(Z);default:return""}}function Gz($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",X=[`data-site="${m0(Z.siteId)}"`];if(Z.honorDnt)X.push('data-honor-dnt="true"');if(Z.spa)X.push('data-spa="auto"');if(Z.canonical)X.push(`data-canonical="${m0(Z.canonical)}"`);if(Z.auto===!1)X.push('data-auto="false"');return`
8819
9056
  <!-- Fathom Analytics -->
8820
9057
  <script src="${m0(Y)}" ${X.join(" ")}${J}></script>
8821
- `}function aq($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=m0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
9058
+ `}function Kz($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=m0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
8822
9059
  <!-- Google Analytics -->
8823
9060
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
8824
9061
  <script>
@@ -8828,10 +9065,10 @@ else {
8828
9065
  gtag('config', '${Y}');
8829
9066
  ${J}
8830
9067
  </script>
8831
- `}function tq($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${m0(Z.domain)}"`],X=Y,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&Y==="https://plausible.io/js/script.js")X=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
9068
+ `}function Wz($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${m0(Z.domain)}"`],X=Y,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&Y==="https://plausible.io/js/script.js")X=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
8832
9069
  <!-- Plausible Analytics -->
8833
9070
  <script defer data-domain="${m0(Z.domain)}" src="${m0(X)}"></script>
8834
- `}function eq($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=m0(Z.siteId),J=m0(Z.apiEndpoint),X=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
9071
+ `}function qz($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=m0(Z.siteId),J=m0(Z.apiEndpoint),X=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
8835
9072
  d.addEventListener('click',function(e){
8836
9073
  var a=e.target.closest('a');
8837
9074
  if(a&&a.hostname!==location.hostname){
@@ -8864,7 +9101,7 @@ else {
8864
9101
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
8865
9102
  })();
8866
9103
  </script>
8867
- `}function $z($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
9104
+ `}function zz($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
8868
9105
  <!-- Custom Analytics -->
8869
9106
  <script>
8870
9107
  ${Z.inlineScript}
@@ -8872,7 +9109,7 @@ ${Z.inlineScript}
8872
9109
  `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${m0(Z.scriptId)}"`);if(Z.attributes)for(let[X,Q]of Object.entries(Z.attributes))Y.push(`${m0(X)}="${m0(Q)}"`);return`
8873
9110
  <!-- Custom Analytics -->
8874
9111
  <script${Y.length>0?` ${Y.join(" ")}`:""} src="${m0(Z.scriptUrl)}" defer></script>
8875
- `}function y2($,Z){let Y=sq(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function m0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var P2=()=>{};function x2($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let J=Y.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(Zz.has(J))Z.systemKeys.push(J);else if(J in f2)Z.mouse=J;else if(J in v2||/^[a-z]$/.test(J))Z.keys.push(v2[J]||J.toUpperCase());else if(J.startsWith("debounce")){let X=J.match(/debounce(?:\.(\d+))?/);Z.debounce=X?.[1]?Number.parseInt(X[1],10):300}else if(J.startsWith("throttle")){let X=J.match(/throttle(?:\.(\d+))?/);Z.throttle=X?.[1]?Number.parseInt(X[1],10):300}}return Z}function g2($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,X;while((X=J.exec($))!==null){let[Q,G,K]=X,W=X.index,q=W+Q.length,z=`__stx_evt_${Y++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=j.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!C2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:x2(F.slice(1)),elementId:z})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=B.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!C2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:x2(F.slice(1)),elementId:z})}if(U.length>0)Z.push({originalTag:Q,elementId:z,events:U,startIndex:W,endIndex:q})}return Z}function Yz($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=f2[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Jz($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function Xz($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=Yz($),X=Jz($.handler,Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
9112
+ `}function x2($,Z){let Y=Qz(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function m0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var f2=()=>{};function d2($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let J=Y.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(Uz.has(J))Z.systemKeys.push(J);else if(J in u2)Z.mouse=J;else if(J in h2||/^[a-z]$/.test(J))Z.keys.push(h2[J]||J.toUpperCase());else if(J.startsWith("debounce")){let X=J.match(/debounce(?:\.(\d+))?/);Z.debounce=X?.[1]?Number.parseInt(X[1],10):300}else if(J.startsWith("throttle")){let X=J.match(/throttle(?:\.(\d+))?/);Z.throttle=X?.[1]?Number.parseInt(X[1],10):300}}return Z}function m2($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,X;while((X=J.exec($))!==null){let[Q,G,K]=X,W=X.index,q=W+Q.length,z=`__stx_evt_${Y++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=j.exec(K))!==null){let[,H,L]=B,V=H.split("."),O=V[0];if(!g2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:d2(V.slice(1)),elementId:z})}let _=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=_.exec(K))!==null){let[,H,L]=B,V=H.split("."),O=V[0];if(!g2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:d2(V.slice(1)),elementId:z})}if(U.length>0)Z.push({originalTag:Q,elementId:z,events:U,startIndex:W,endIndex:q})}return Z}function jz($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=u2[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Bz($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function _z($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=jz($),X=Bz($.handler,Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
8876
9113
  (function() {
8877
9114
  var $el = document.getElementById('${Y}');
8878
9115
  if (!$el) return;
@@ -8926,7 +9163,7 @@ else {
8926
9163
  __stx_runHandler('${K}', $event, $el);
8927
9164
  }
8928
9165
  }${G});
8929
- })();`}function Qz($){if($.length===0)return"";return`
9166
+ })();`}function Hz($){if($.length===0)return"";return`
8930
9167
  <script data-stx-events>
8931
9168
  (function() {
8932
9169
  'use strict';
@@ -8974,11 +9211,11 @@ else {
8974
9211
  }
8975
9212
 
8976
9213
  // Event listeners
8977
- ${$.flatMap((Y)=>Y.events).map(Xz).join(`
9214
+ ${$.flatMap((Y)=>Y.events).map(_z).join(`
8978
9215
  `)}
8979
9216
  })();
8980
- </script>`}function Gz($){let Z=g2($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];for(let X=Z.length-1;X>=0;X--){let Q=Z[X],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let W of Q.events)W.elementId=K[1]}for(let K of Q.events){let W=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(q,""),G=G.replace(z,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),J.push(...Q.events)}return{template:Y,bindings:J}}function h2($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:W,bindings:q}=Gz($),z=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...z,...q],W}let X=g2($);if(X.length===0)return $;let Q=$;for(let W=X.length-1;W>=0;W--){let q=X[W],z=q.originalTag;if(!z.includes(" id="))z=z.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let U=z.match(/id=["']([^"']+)["']/);if(U)for(let j of q.events)j.elementId=U[1]}for(let U of q.events){let j=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");z=z.replace(_,""),z=z.replace(B,"")}Q=Q.slice(0,q.startIndex)+z+Q.slice(q.endIndex)}let G=Qz(X),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+G+`
8981
- `+Q.slice(K);else Q+=G;return Q}var C2,v2,Zz,f2;var d2=b(()=>{C2=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"]),v2={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"},Zz=new Set(["ctrl","alt","shift","meta"]),f2={left:0,middle:1,right:2}});function u4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function u2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function Wz($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[X,Q,G]=J,K=J.index,W=u2(G,"x-data");if(!W)continue;let q=`__stx_scope_${p2++}`,z=u2(G,"x-init"),U=qz($,Q,K+X.length),j=$.slice(K,U.endIndex),_=zz(j);Z.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:W,initExpr:z,bindings:[],refs:_})}return Z}function qz($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X,K.lastIndex=X;let W=Q.exec($),q=G.exec($),z=K.exec($);if(z&&z.index<(W?.index??1/0)){X=z.index+z[0].length;continue}if(!q)return{endIndex:$.length};if(W&&W.index<q.index)J++,X=W.index+W[0].length;else{if(J--,J===0)return{endIndex:q.index+q[0].length};X=q.index+q[0].length}}return{endIndex:$.length}}function zz($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,X;while((X=J.exec(Y))!==null){let[,Q,G]=X,K=Uz(Q);Z.set(G,K)}return Z}function Uz($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${Kz++}`}function jz(){return`
9217
+ </script>`}function Oz($){let Z=m2($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];for(let X=Z.length-1;X>=0;X--){let Q=Z[X],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let W of Q.events)W.elementId=K[1]}for(let K of Q.events){let W=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(q,""),G=G.replace(z,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),J.push(...Q.events)}return{template:Y,bindings:J}}function p2($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:W,bindings:q}=Oz($),z=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...z,...q],W}let X=m2($);if(X.length===0)return $;let Q=$;for(let W=X.length-1;W>=0;W--){let q=X[W],z=q.originalTag;if(!z.includes(" id="))z=z.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let U=z.match(/id=["']([^"']+)["']/);if(U)for(let j of q.events)j.elementId=U[1]}for(let U of q.events){let j=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),_=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");z=z.replace(B,""),z=z.replace(_,"")}Q=Q.slice(0,q.startIndex)+z+Q.slice(q.endIndex)}let G=Hz(X),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+G+`
9218
+ `+Q.slice(K);else Q+=G;return Q}var g2,h2,Uz,u2;var l2=b(()=>{g2=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"]),h2={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"},Uz=new Set(["ctrl","alt","shift","meta"]),u2={left:0,middle:1,right:2}});function m4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function c2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function Fz($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[X,Q,G]=J,K=J.index,W=c2(G,"x-data");if(!W)continue;let q=`__stx_scope_${n2++}`,z=c2(G,"x-init"),U=Vz($,Q,K+X.length),j=$.slice(K,U.endIndex),B=wz(j);Z.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:W,initExpr:z,bindings:[],refs:B})}return Z}function Vz($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X,K.lastIndex=X;let W=Q.exec($),q=G.exec($),z=K.exec($);if(z&&z.index<(W?.index??1/0)){X=z.index+z[0].length;continue}if(!q)return{endIndex:$.length};if(W&&W.index<q.index)J++,X=W.index+W[0].length;else{if(J--,J===0)return{endIndex:q.index+q[0].length};X=q.index+q[0].length}}return{endIndex:$.length}}function wz($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,X;while((X=J.exec(Y))!==null){let[,Q,G]=X,K=Az(Q);Z.set(G,K)}return Z}function Az($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${Lz++}`}function Rz(){return`
8982
9219
  // STX Reactive Runtime - x-cloak and transition CSS
8983
9220
  (function() {
8984
9221
  var style = document.createElement('style');
@@ -9185,7 +9422,7 @@ window.__stx_reactive = (function() {
9185
9422
 
9186
9423
  return { initScope: initScope, reactive: reactive };
9187
9424
  })();
9188
- `}function m2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=i0(X,Z,!0);if(Q===void 0)return J;return String(Q)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{try{let Q=i0(X,Z,!0);if(Q===void 0)return J;if(typeof Q==="string"){let G=Q.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(Q)}catch{return J}}),Y}function _z($,Z){if($.length===0)return"";let Y=$.map((J)=>{let X=JSON.stringify(Object.fromEntries(J.refs)),Q=m2(J.stateExpr,Z),G=J.initExpr?m2(J.initExpr,Z):null,K=JSON.stringify(Q),W=G?JSON.stringify(G):"null";return`
9425
+ `}function i2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,X)=>{try{let Q=i0(X,Z,!0);if(Q===void 0)return J;return String(Q)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,X)=>{try{let Q=i0(X,Z,!0);if(Q===void 0)return J;if(typeof Q==="string"){let G=Q.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(Q)}catch{return J}}),Y}function Nz($,Z){if($.length===0)return"";let Y=$.map((J)=>{let X=JSON.stringify(Object.fromEntries(J.refs)),Q=i2(J.stateExpr,Z),G=J.initExpr?i2(J.initExpr,Z):null,K=JSON.stringify(Q),W=G?JSON.stringify(G):"null";return`
9189
9426
  (function() {
9190
9427
  var scopeEl = document.querySelector('${J.selector}');
9191
9428
  if (!scopeEl) return;
@@ -9194,16 +9431,16 @@ window.__stx_reactive = (function() {
9194
9431
  })();`}).join(`
9195
9432
  `);return`
9196
9433
  <script data-stx-scoped data-stx-reactive>
9197
- ${jz()}
9434
+ ${Rz()}
9198
9435
  ${Y}
9199
- </script>`}function l2($,Z,Y){if(p2=0,!Hz($))return $;let J=Wz($);if(J.length===0)return $;let X=Bz($,J),Q=_z(J,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
9200
- `+X.slice(G);else X+=Q;return X}function Bz($,Z){let Y=$;for(let J of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${u4(J.stateExpr)}["']`,"gi").exec(Y);if(Q)J.id=Q[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${u4(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)J.id=K[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${u4(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${u4(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Hz($){return/x-data\s*=\s*["']/.test($)}var p2=0,Kz=0;var c2=b(()=>{X1()});import Oz from"fs";import p3 from"path";import{createHighlighter as Lz}from"ts-syntax-highlighter";async function Fz($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let J=(await Oz.promises.stat($)).mtime.getTime();if(Z.cache&&l3.has($)){let U=l3.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=R9(X),K=Z.markdown||f3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=g5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)q=await Vz(q,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:q,data:Q||{}};if(Z.cache)l3.set($,{...z,updatedAt:J});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:U0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function Vz($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!m4)try{m4=await Lz({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,q,z)=>{let U=z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=q||(Y?"text":"");if(!j)return K;try{if(!m4.getSupportedLanguages().includes(j))return K;return(await m4.highlight(U,j,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${q}:`,_)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[W,q,z,U]=K,j=await X(W,q,z,U);Q=Q.replace(W,j)}return Q}async function i2($,Z,Y="",J={}){return await wz($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,q)=>{try{let z=K;if(!p3.isAbsolute(K))z=p3.resolve(p3.dirname(Y),K);let U={};if(W)try{try{U=JSON.parse(W)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),R=V.substring(w+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),M=R.startsWith("'")&&R.endsWith("'");if(N||M)R=R.substring(1,R.length-1);U[A]=R}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:j,data:_}=await Fz(z,J),B={...Z,..._,...U},H=j,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return B[V]!==void 0?String(B[V]):F}),H}catch(z){let U=z instanceof Error?z.message:String(z);return U0("Markdown File",`Error including markdown file: ${U}`,Y,$,q,G)}})}async function wz($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,q=X;J.push(Y(...q).then((z)=>({match:K,replacement:z,index:W})))}let Q=await Promise.all(J);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var l3,m4=null;var n2=b(()=>{s1();M0();l3=new Map});function D1($,Z){try{let Y=$.trim();if(W0(Y))return q0(Y,Object.keys(Z))(...Object.values(Z));else return Z0(Y,Z)}catch{return!1}}var o2=b(()=>{A0()});function Az($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=C7(J,G);if(!K)break;try{let W;if(W0(K.expression))W=q0(K.expression,Object.keys(Z))(...Object.values(Z));else W=Z0(K.expression,Z);let q="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)q=U.content.trim()}else try{let j;if(U.value&&W0(U.value))j=q0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=Z0(U.value,Z);if(W===j){q=U.content.trim(),z=!0;break}}catch{continue}J=J.substring(0,G)+q+J.substring(K.end),X=!0}catch(W){let q=W instanceof Error?W.message:String(W),z=$0("Switch",`Error evaluating @switch expression: ${q}`,o.EVALUATION_ERROR);J=J.substring(0,G)+z+J.substring(K.end);break}}return J}function r1($,Z,Y){let J=$;J=Az(J,Z,Y);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=M1(J,K+7);if(!W)break;let q=W.endPos,z=m1(J,"unless","endunless",q);if(z===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=J.slice(q,z),j=W.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((A,R)=>A.pos-R.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let B;if(_!==-1){let H=U.slice(0,_),L=U.slice(_+5);B=`@if (${j})${L}@else ${H}@endif`}else B=`@if (!(${j}))${U}@endif`;J=J.substring(0,K)+B+J.substring(z+10),Q=!0}}J=i3(J,Z,Y),J=n3(J,Z,Y),J=c3(J,Z);let X=()=>{let Q=$$(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",q=!1;for(let z of K.branches){if(q)break;if(z.type==="else")W=z.content,q=!0;else try{let U;if(z.condition&&W0(z.condition))U=q0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Z0(z.condition,Z);if(U)W=z.content,q=!0}catch(U){W=$0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,o.EVALUATION_ERROR),q=!0}}J=J.substring(0,K.start)+W+J.substring(K.end)}catch(W){let q=W instanceof Error?W.message:String(W),z=$0("If",`Error processing @if block: ${q}`,o.EVALUATION_ERROR);J=J.substring(0,K.start)+z+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function s2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(X===Y){Z++;break}J.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function c3($,Z){let Y=$;function J(K,W,q,z){let U=1,j=z,_=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(j<K.length&&U>0){_.lastIndex=j,B.lastIndex=j;let H=_.exec(K),L=B.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)U++,j=F+H[0].length;else if(O<1/0){if(U--,U===0)return O;j=O+L[0].length}else break}return-1}function X(K,W,q){let z=0,U=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${q}(?![a-z])`,"g"),_=/@else(?![a-z])/g,B=[],H;while((H=U.exec(K))!==null)B.push({pos:H.index,type:"open"});while((H=j.exec(K))!==null)B.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)B.push({pos:H.index,type:"else"});B.sort((L,F)=>L.pos-F.pos);for(let L of B)if(L.type==="open")z++;else if(L.type==="close")z--;else if(L.type==="else"&&z===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,z,U,j=Y.slice(q+5),_=s2(j);if(_)z=_.value,U=q+5+_.consumed;else U=q+5;let B=J(Y,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,B),L=X(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=z?D1(`auth?.check && auth?.user?.[${z}]`,Z):D1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,q)+O+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,z,U,j=Y.slice(q+6),_=s2(j);if(_)z=_.value,U=q+6+_.consumed;else U=q+6;let B=J(Y,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,B),L=X(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=z?D1(`!auth?.check || !auth?.user?.[${z}]`,Z):D1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,q)+O+Y.substring(B+9),K=!0}}function Q(K,W,q){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(W)z.push(W);if(q){let U=D1(q,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,q=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,_=Y.slice(j+`@${K}`.length),B=G(_);if(!B)break;let H=j+`@${K}`.length+B.paramsEnd,L=J(Y,K,W,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${W}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),N=/@else(?![a-z])/g,M=[],T;while((T=w.exec(F))!==null)M.push({pos:T.index,type:"open"});while((T=A.exec(F))!==null)M.push({pos:T.index,type:"close"});while((T=R.exec(F))!==null)M.push({pos:T.index,type:"elseDirective"});while((T=N.exec(F))!==null)M.push({pos:T.index,type:"else"});M.sort((k,v)=>k.pos-v.pos);for(let k of M){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)O.push(k)}let I=[],E=0;for(let k=0;k<O.length;k++){let v=O[k];if(I.push({content:F.slice(E,v.pos),ability:void 0}),v.type==="elseDirective"){let g=F.slice(v.pos+`@${q}`.length),f=G(g);if(f){I[I.length-1]={content:F.slice(E,v.pos)},E=v.pos+`@${q}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let d=O[k+1],p=d?d.pos:F.length;I.push({content:F.slice(E,p),ability:f.ability,type:f.type,id:f.id}),E=p}}else E=v.pos+5}if(E<F.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(E)})}let D=Q(B.ability,B.type,B.id),y=K==="can"?D:!D,S="";if(y)S=I[0]?.content||"";else{let k=!1;for(let v=1;v<I.length;v++){let g=I[v];if(g.isFinalElse){S=g.content,k=!0;break}if(g.ability){let f=Q(g.ability,g.type,g.id);if(K==="can"?f:!f){S=g.content,k=!0;break}}}if(!k&&I.length>0){let v=I[I.length-1];if(v.isFinalElse)S=v.content}}Y=Y.substring(0,j)+S+Y.substring(L+`@${W}`.length),z=!0}}return Y}function i3($,Z,Y){let J=$;function X(Q,G,K,W,q){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),j=Q.match(U);if(!j||j.index===void 0)break;let _=j.index,B=M1(Q,_+`@${G}`.length);if(!B)break;let H=B.endPos,L=m1(Q,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(H,L),O=B.expression,V=-1,w=0,A=0;while(A<F.length){let R=F.indexOf("@",A);if(R===-1)break;let N=F.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,A=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){V=R;break}A=R+1}try{let R=W(O.trim()),N;if(V!==-1){let M=F.slice(0,V),T=F.slice(V+5);N=R?M:T}else N=R?F:"";Q=Q.substring(0,_)+N+Q.substring(L+`@${K}`.length),z=!0}catch(R){let N=R instanceof Error?R.message:String(R),M=$0(q,`Error processing @${G} directive: ${N}`,o.EVALUATION_ERROR);Q=Q.substring(0,_)+M+Q.substring(L+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=D1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=D1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function n3($,Z,Y){let J=$,X="development";function Q(G,K,W,q){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${W}(?![a-z])`),B=G,H=!0;while(H){H=!1,z.lastIndex=0;let L=z.exec(B);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let D=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,q=X===D[2]}let V=1,w=O,A=-1;while(V>0&&w<B.length){z.lastIndex=w,U.lastIndex=w;let D=z.exec(B),y=U.exec(B),S=D?D.index:1/0,k=y?y.index:1/0;if(S<k)V++,w=S+D[0].length;else if(k<1/0){if(V--,V===0){A=k;break}w=k+y[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${W} \u2014 the block was skipped.`);break}let R=B.substring(O,A),N=-1,M=0,T=0;while(T<R.length){let D=R.indexOf("@",T);if(D===-1)break;let y=R.substring(D);if(j.test(y)){M++,T=D+1;continue}if(_.test(y)){M--,T=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(y)){N=D;break}T=D+1}let I;if(N!==-1){let D=R.slice(0,N),y=R.slice(N+5);I=q?D:y}else I=q?R:"";let E=`@${W}`.length;B=B.substring(0,F)+I+B.substring(A+E),H=!0}return B}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",X==="production"),J=Q(J,"development","enddevelopment",X==="development"),J=Q(J,"staging","endstaging",X==="staging"),J=Q(J,"testing","endtesting",X==="testing"),J}var p4=b(()=>{o2();U1();d$();A0()});function a2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function l4($,Z){if(!$)return Z?.nonceGenerator?.()??a2();let Y=r2.get($);if(!Y)Y=Z?.nonceGenerator?.()??a2(),r2.set($,Y);return Y}function Rz($,Z){let Y=[];for(let[J,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)Y.push(J);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${J} ${Q.join(" ")}`)}}return Y.join("; ")}function t2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Rz($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function e2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?l4(Y,Z):void 0,X=t2(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
9201
- ${X}`)}function $Y($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<script nonce="${Z}"${X}>`}),Y=Y.replace(/<style([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<style nonce="${Z}"${X}>`}),Y}function ZY($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?l4(Z,Q):void 0;return t2(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return l4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=l4(Z,Q);return X}var r2;var YY=b(()=>{r2=new WeakMap});import Nz from"crypto";function Tz($=Mz){let Z=Nz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return o3=Z,Z}function Iz(){if(!o3)Tz();return o3}function Dz($=JY){let Z=Iz();return`<input type="hidden" name="${$}" value="${Z}">`}function XY($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return Dz(J||JY)})}var Mz=40,JY="_token",o3=null;var QY=()=>{};async function GY($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let X=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)X=await Ez(X,Q,Z,Y,J);else X=await kz(X,Q,Z,Y,J)}return X}async function Ez($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,q=$,z=U5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),U=[],j=z.exec(q);while(j!==null){let[_,B="",H=""]=j,L=j.index||0;try{let F=B?KY(B):[],O=H.trim(),V=await G(O,F,Y,J);U.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(X.debug)console.error(`Error processing custom directive @${Q}:`,F);U.push({original:_,processed:$0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:L})}j=z.exec(q)}for(let _=U.length-1;_>=0;_--){let{original:B,processed:H}=U[_];q=q.replace(B,H)}return q}async function kz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,W=U5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],z=W.exec(K);while(z!==null){let[_,B=""]=z,H=z.index||0;try{let L=KY(B),F=await G("",L,Y,J);q.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(X.debug)console.error(`Error processing custom directive @${Q}:`,L);q.push({original:_,processed:$0("CustomDirective",`Error in @${Q}(${B}): ${F}`,o.EVALUATION_ERROR),startIndex:H})}z=W.exec(K)}let U=U5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=U.exec(K);while(j!==null){let[_]=j,B=j.index||0;try{let H=await G("",[],Y,J);q.push({original:_,processed:H,startIndex:B})}catch(H){let L=H instanceof Error?H.message:String(H);if(X.debug)console.error(`Error processing custom directive @${Q}:`,H);q.push({original:_,processed:$0("CustomDirective",`Error in @${Q}: ${L}`,o.EVALUATION_ERROR),startIndex:B})}j=U.exec(K)}for(let _=q.length-1;_>=0;_--){let{original:B,processed:H}=q[_];K=K.replace(B,H)}return K}function KY($){if(!$.trim())return[];let Z=[],Y="",J=!1,X="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,X=G;else if(G===X)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var WY=b(()=>{U1();j5()});function a1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function Sz($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,J=Z.colorMode;if(a1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(a1(Y.key,"appearance.key"),a1(Y.attribute,"appearance.attribute"),a1(Y.default,"appearance.default"),a1(J.key,"colorMode.key"),a1(J.attribute,"colorMode.attribute"),a1(J.default,"colorMode.default"),!zY.test(Y.key)||!zY.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!qY.test(Y.attribute)||!qY.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((X)=>typeof X!=="string"||X.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!bz.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function yz($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Pz($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${yz($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function Cz($,Z){let Y=1,J=null,X=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(X){X=!1;continue}if(J){if(G==="\\")X=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function UY($,Z){let Y=$,J=/@appearanceBootstrap\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index+X[0].length-1,G=Cz(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),W=Z0(`(${K})`,Z),q=Pz(Sz(W));Y=Y.slice(0,X.index)+q+Y.slice(G+1),J.lastIndex=X.index+q.length}return Y}var qY,zY,bz;var jY=b(()=>{A0();qY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,zY=/^[A-Za-z_$][\w$]*$/,bz=new Set(["light","dark","system"])});import vz from"crypto";function I0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function c4($,Z,Y,J){let X=$||Z;return Y?`${X} ${J}`:X}function xz(){return vz.randomUUID()}function i4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=xz();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${I0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,X)=>{let Q=X.toUpperCase();if(X&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${I0(Q)}">`;return J}),Y}function HY($,Z,Y=BY){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,W,q="")=>{let z=Q||G||"POST",U=K||W||"",j=E1(q),_=z.toUpperCase(),B=["GET","POST"].includes(_)?_:"POST",H=`<form method="${I0(B)}" action="${I0(U)}"${j?` ${j}`:""}>`;if(H+=`
9202
- ${i4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
9203
- ${i4(`@method('${_}')`,Z)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,q="")=>{let z=Q||G||"",U=K||W||"",j=E1(q),_=U$(z,Z),B=_!==void 0&&_!==null?_:U||"",H=j.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=j$(z,Z),O=j.match(/class=['"]([^'"]+)['"]/i),V=c4(O?O[1]:"",Y.input,F,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${I0(L)}" name="${I0(z)}" value="${I0(B)}" class="${V}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=E1(G),q=U$(Q,Z)||K.trim(),z=j$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=c4(U?U[1]:"",Y.input,z,Y.inputError),_=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${I0(Q)}" class="${j}"${_?` ${_}`:""}>${I0(q)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=E1(G),q=U$(Q,Z),z=j$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=c4(U?U[1]:"",Y.input,z,Y.inputError),_=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(q!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(q)?q.some((V)=>String(V)===F):String(q)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${I0(Q)}" class="${j}"${_?` ${_}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="1",K="")=>{let W=E1(K),q=U$(Q,Z),z=q!==void 0&&(Array.isArray(q)?q.some((B)=>String(B)===G):q===!0||String(q)===G),U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${I0(Q)}" value="${I0(G)}" class="${j}"${z?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=E1(K),q=U$(Q,Z),z=q!==void 0&&q===G,U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${I0(Q)}" value="${I0(G)}" class="${j}"${z?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=E1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),q=W?W[1]:"",z=K.includes("multiple"),U=j$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),_=c4(j?j[1]:"",Y.input,U,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${I0(Q)}"`,`class="${_}"`];if(q)H.push(`accept="${I0(q)}"`);if(z)H.push("multiple");if(B)H.push(B);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=E1(G),q=W.match(/class=['"]([^'"]+)['"]/i),z=q?q[1]:Y.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${I0(Q)}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),J}function OY($,Z,Y=BY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(j$(X,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return _Y(X,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return _Y(X,Z)}let W=K.trim();if(W0(W)){let q=Z0(W,Z);return q!==void 0?String(q):W}return W}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function j$($,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 _Y($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function U$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function E1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=J.exec(Y))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var BY;var LY=b(()=>{A0();BY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import a3 from"path";async function fz(){if(_$!==void 0)return _$;try{_$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{_$=null}return _$}function gz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function hz($,Z){if({...$6,...Z.i18n}.cache&&t3[$]){let X=t3[$],Q=Z.i18n?.cacheMaxAge??0;if(!gz(X,Q))return X.translations}if(B$[$]?.state==="loading")return B$[$].promise;s3[$]="loading";let J=e3($,Z).then((X)=>{return s3[$]="loaded",delete B$[$],X}).catch((X)=>{throw s3[$]="error",B$[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return B$[$]={promise:J,state:"loading"},J}async function e3($,Z){let Y={...$6,...Z.i18n},J=a3.isAbsolute(Y.translationsDir)?Y.translationsDir:a3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await fz(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:lz(Y.format)}):await dz($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return e3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)t3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(X){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,X);if($!==Y.defaultLocale)return e3(Y.defaultLocale,Z);return{}}}async function dz($,Z,Y){let J=a3.join(Y,`${$}${uz(Z.format)}`);try{let X=await import(J);return X.default||X}catch(X){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return mz(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function uz($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function mz($){let Z={},Y=$.split(`
9204
- `),J=[{obj:Z,indent:-1}];for(let X of Y){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,q,z]=W,U=q.trim(),j=z.trim();if(j==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=pz(j)}}return Z}function pz($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function lz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function cz($,Z){return hz($,Z)}function iz($,Z){for(let Y of $){let J=Y.trim(),X=J.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function nz($,Z={}){return wY($,Z)}function wY($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=oz($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=sz(Q,Z),J=X+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function oz($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function sz($,Z){let Y=rz($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),X=Z[J];if(Y.length===1)return X!==void 0?String(X):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return az(X,Y.slice(2).join(","),Z);case"select":return ez(X,Y.slice(2).join(","));case"selectordinal":return $U(X,Y.slice(2).join(","));case"number":return YU(X,Y[2]?.trim());case"date":return JU(X,Y[2]?.trim());case"time":return XU(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function rz($){let Z=[],Y="",J=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")J++,Y+=Q;else if(Q==="}")J--,Y+=Q;else if(Q===","&&J===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function az($,Z,Y){let J=Number($)||0,X=Z6(Z),Q=`=${J}`;if(X[Q])return r3(X[Q],J,Y);let G=tz(J);if(X[G])return r3(X[G],J,Y);if(X.other)return r3(X.other,J,Y);return String(J)}function r3($,Z,Y){let J=$.replace(/#/g,String(Z));return wY(J,Y)}function tz($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function ez($,Z){let Y=String($||""),J=Z6(Z);if(J[Y])return J[Y];return J.other||String($)}function $U($,Z){let Y=Number($)||0,J=Z6(Z),X=ZU(Y);if(J[X])return J[X].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function ZU($){let Z=Math.abs($),Y=Z%10,J=Z%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function Z6($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function YU($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function JU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function XU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function QU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function FY($,Z,Y=!0,J={}){let X=$.split("."),Q=Z;for(let K of X){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(QU(G))return nz(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),W=G.split("|");G=iz(W,K)}for(let[K,W]of Object.entries(J)){let q=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${q}`,"g"),String(W))}return G}async function AY($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...$6,...J.i18n},K=await cz(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await VY(X,Q,async(z,U,j,_,B)=>{try{let H={};if(j)try{let F=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return T0(j,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(J.debug)console.error("Error parsing parameters for @translate directive:",F)}return FY(U,K,G.fallbackToKey,H)||_.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return $0("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...X.matchAll(W)];console.warn(`Found ${z.length} @translate matches`),z.forEach((U,j)=>console.warn(`Match ${j}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return X=await VY(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,U,j,_)=>{try{let B={};if(j)try{let H=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return T0(j,Z)}];for(let L of H)try{if(B=L(),Object.keys(B).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return FY(U,K,G.fallbackToKey,B)}catch(B){if(J.debug)console.error("Error processing @translate directive:",B);return $0("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),X}async function VY($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var _$,$6,t3,B$,s3;var RY=b(()=>{U1();A0();$6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},t3={},B$={},s3={}});var X6={};a(X6,{streamingSuspenseDirective:()=>TY,streamToResponse:()=>LU,streamTemplateSimple:()=>_U,streamTemplate:()=>KU,renderStreamingPage:()=>qU,registerStreamingDirectives:()=>HU,processStreamDirectives:()=>UU,processSectionDirectives:()=>OU,islandDirective:()=>IY,generateHydrationRuntime:()=>FU,extractStreamBoundaries:()=>jU,createStreamRenderer:()=>BU,buildSuspenseResolveScript:()=>J6,SUSPENSE_RESOLVER_RUNTIME:()=>MY});import n4 from"path";function GU($){let Z=[],Y=0,J;NY.lastIndex=0;while((J=NY.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let X=J[1],Q=J[2];Z.push({type:"suspense",name:X,content:Q}),Y=J.index+J[0].length}if(Y<$.length){let X=$.slice(Y);if(X.trim())Z.push({type:Z.length===0?"shell":"content",content:X})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function KU($,Z={},Y={}){let J={...o1,...Y,streaming:{...Y6,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:n4.dirname($)};if(W.trim())await u1(W,z,$);let U=GU(q),j=new Set;if(!U.some((B)=>B.type==="suspense")){let B=J.streaming?.strategy||"auto",H=new RegExp(t1.source,"g");if(!(B!=="manual"&&H.test(q))){let F=await L0(q,z,$,J,j);for(let O=0;O<F.length;O+=X)Q.enqueue(F.slice(O,O+X)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(t1.source,"g"),V;while((V=O.exec(q))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let A of F){if(A.start>w){let N=q.slice(w,A.start);if(N.trim()){let M=await L0(N,z,$,J,j);Q.enqueue(M),await new Promise((T)=>setTimeout(T,0))}}let R=await L0(A.content,z,$,J,j);Q.enqueue(R),await new Promise((N)=>setTimeout(N,0)),w=A.end}if(w<q.length){let A=q.slice(w);if(A.trim()){let R=await L0(A,z,$,J,j);Q.enqueue(R)}}}}else{let B=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let F=await L0(L.content,z,$,J,j);Q.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;Q.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
9436
+ </script>`}function o2($,Z,Y){if(n2=0,!Tz($))return $;let J=Fz($);if(J.length===0)return $;let X=Mz($,J),Q=Nz(J,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
9437
+ `+X.slice(G);else X+=Q;return X}function Mz($,Z){let Y=$;for(let J of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${m4(J.stateExpr)}["']`,"gi").exec(Y);if(Q)J.id=Q[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${m4(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)J.id=K[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${m4(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${m4(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Tz($){return/x-data\s*=\s*["']/.test($)}var n2=0,Lz=0;var s2=b(()=>{X1()});import Iz from"fs";import c3 from"path";import{createHighlighter as Dz}from"ts-syntax-highlighter";async function Ez($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let J=(await Iz.promises.stat($)).mtime.getTime();if(Z.cache&&i3.has($)){let U=i3.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=T9(X),K=Z.markdown||h3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=h5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)q=await kz(q,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:q,data:Q||{}};if(Z.cache)i3.set($,{...z,updatedAt:J});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:U0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function kz($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!p4)try{p4=await Dz({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,q,z)=>{let U=z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=q||(Y?"text":"");if(!j)return K;try{if(!p4.getSupportedLanguages().includes(j))return K;return(await p4.highlight(U,j,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${q}:`,B)}return K},Q=$,G=$.matchAll(J);for(let K of G){let[W,q,z,U]=K,j=await X(W,q,z,U);Q=Q.replace(W,j)}return Q}async function r2($,Z,Y="",J={}){return await bz($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,q)=>{try{let z=K;if(!c3.isAbsolute(K))z=c3.resolve(c3.dirname(Y),K);let U={};if(W)try{try{U=JSON.parse(W)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let w=F.indexOf(":");if(w>0){let A=F.substring(0,w).trim(),R=F.substring(w+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(N||T)R=R.substring(1,R.length-1);U[A]=R}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:j,data:B}=await Ez(z,J),_={...Z,...B,...U},H=j,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(V,O)=>{let F=O.trim();return _[F]!==void 0?String(_[F]):V}),H}catch(z){let U=z instanceof Error?z.message:String(z);return U0("Markdown File",`Error including markdown file: ${U}`,Y,$,q,G)}})}async function bz($,Z,Y){let J=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,q=X;J.push(Y(...q).then((z)=>({match:K,replacement:z,index:W})))}let Q=await Promise.all(J);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var i3,p4=null;var a2=b(()=>{s1();M0();i3=new Map});function D1($,Z){try{let Y=$.trim();if(W0(Y))return q0(Y,Object.keys(Z))(...Object.values(Z));else return Z0(Y,Z)}catch{return!1}}var t2=b(()=>{A0()});function Sz($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=x7(J,G);if(!K)break;try{let W;if(W0(K.expression))W=q0(K.expression,Object.keys(Z))(...Object.values(Z));else W=Z0(K.expression,Z);let q="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)q=U.content.trim()}else try{let j;if(U.value&&W0(U.value))j=q0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=Z0(U.value,Z);if(W===j){q=U.content.trim(),z=!0;break}}catch{continue}J=J.substring(0,G)+q+J.substring(K.end),X=!0}catch(W){let q=W instanceof Error?W.message:String(W),z=$0("Switch",`Error evaluating @switch expression: ${q}`,s.EVALUATION_ERROR);J=J.substring(0,G)+z+J.substring(K.end);break}}return J}function r1($,Z,Y){let J=$;J=Sz(J,Z,Y);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=M1(J,K+7);if(!W)break;let q=W.endPos,z=m1(J,"unless","endunless",q);if(z===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=J.slice(q,z),j=W.expression,B=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],w;while((w=L.exec(U))!==null)F.push({pos:w.index,type:"open"});while((w=V.exec(U))!==null)F.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)F.push({pos:w.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){B=A.pos;break}}let _;if(B!==-1){let H=U.slice(0,B),L=U.slice(B+5);_=`@if (${j})${L}@else ${H}@endif`}else _=`@if (!(${j}))${U}@endif`;J=J.substring(0,K)+_+J.substring(z+10),Q=!0}}J=o3(J,Z,Y),J=s3(J,Z,Y),J=n3(J,Z);let X=()=>{let Q=Z$(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",q=!1;for(let z of K.branches){if(q)break;if(z.type==="else")W=z.content,q=!0;else try{let U;if(z.condition&&W0(z.condition))U=q0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Z0(z.condition,Z);if(U)W=z.content,q=!0}catch(U){W=$0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),q=!0}}J=J.substring(0,K.start)+W+J.substring(K.end)}catch(W){let q=W instanceof Error?W.message:String(W),z=$0("If",`Error processing @if block: ${q}`,s.EVALUATION_ERROR);J=J.substring(0,K.start)+z+J.substring(K.end)}}return!0};while(!0){let Q=J;if(!X())break;if(J===Q)break}return J}function e2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(X===Y){Z++;break}J.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function n3($,Z){let Y=$;function J(K,W,q,z){let U=1,j=z,B=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${q}(?![a-z])`,"g");while(j<K.length&&U>0){B.lastIndex=j,_.lastIndex=j;let H=B.exec(K),L=_.exec(K),V=H?H.index:1/0,O=L?L.index:1/0;if(V<O)U++,j=V+H[0].length;else if(O<1/0){if(U--,U===0)return O;j=O+L[0].length}else break}return-1}function X(K,W,q){let z=0,U=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${q}(?![a-z])`,"g"),B=/@else(?![a-z])/g,_=[],H;while((H=U.exec(K))!==null)_.push({pos:H.index,type:"open"});while((H=j.exec(K))!==null)_.push({pos:H.index,type:"close"});while((H=B.exec(K))!==null)_.push({pos:H.index,type:"else"});_.sort((L,V)=>L.pos-V.pos);for(let L of _)if(L.type==="open")z++;else if(L.type==="close")z--;else if(L.type==="else"&&z===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,z,U,j=Y.slice(q+5),B=e2(j);if(B)z=B.value,U=q+5+B.consumed;else U=q+5;let _=J(Y,"auth","endauth",U);if(_===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,_),L=X(H,"auth","endauth"),V;if(!Z.auth)V=!1;else V=z?D1(`auth?.check && auth?.user?.[${z}]`,Z):D1("auth?.check",Z);let O;if(L!==-1){let F=H.slice(0,L),w=H.slice(L+5);O=V?F:w}else O=V?H:"";Y=Y.substring(0,q)+O+Y.substring(_+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,z,U,j=Y.slice(q+6),B=e2(j);if(B)z=B.value,U=q+6+B.consumed;else U=q+6;let _=J(Y,"guest","endguest",U);if(_===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,_),L=X(H,"guest","endguest"),V;if(!Z.auth)V=!0;else V=z?D1(`!auth?.check || !auth?.user?.[${z}]`,Z):D1("!auth?.check",Z);let O;if(L!==-1){let F=H.slice(0,L),w=H.slice(L+5);O=V?F:w}else O=V?H:"";Y=Y.substring(0,q)+O+Y.substring(_+9),K=!0}}function Q(K,W,q){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(W)z.push(W);if(q){let U=D1(q,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,q=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,B=Y.slice(j+`@${K}`.length),_=G(B);if(!_)break;let H=j+`@${K}`.length+_.paramsEnd,L=J(Y,K,W,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let V=Y.slice(H,L),O=[],F=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${W}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=w.exec(V))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(V))!==null)T.push({pos:M.index,type:"close"});while((M=R.exec(V))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(V))!==null)T.push({pos:M.index,type:"else"});T.sort((k,C)=>k.pos-C.pos);for(let k of T){if(k.type==="open"){F++;continue}if(k.type==="close"){F--;continue}if(F===0)O.push(k)}let I=[],E=0;for(let k=0;k<O.length;k++){let C=O[k];if(I.push({content:V.slice(E,C.pos),ability:void 0}),C.type==="elseDirective"){let g=V.slice(C.pos+`@${q}`.length),f=G(g);if(f){I[I.length-1]={content:V.slice(E,C.pos)},E=C.pos+`@${q}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let d=O[k+1],p=d?d.pos:V.length;I.push({content:V.slice(E,p),ability:f.ability,type:f.type,id:f.id}),E=p}}else E=C.pos+5}if(E<V.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:V.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:V.slice(E)})}let D=Q(_.ability,_.type,_.id),y=K==="can"?D:!D,S="";if(y)S=I[0]?.content||"";else{let k=!1;for(let C=1;C<I.length;C++){let g=I[C];if(g.isFinalElse){S=g.content,k=!0;break}if(g.ability){let f=Q(g.ability,g.type,g.id);if(K==="can"?f:!f){S=g.content,k=!0;break}}}if(!k&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)S=C.content}}Y=Y.substring(0,j)+S+Y.substring(L+`@${W}`.length),z=!0}}return Y}function o3($,Z,Y){let J=$;function X(Q,G,K,W,q){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),j=Q.match(U);if(!j||j.index===void 0)break;let B=j.index,_=M1(Q,B+`@${G}`.length);if(!_)break;let H=_.endPos,L=m1(Q,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${K} \u2014 the block was skipped.`);break}let V=Q.slice(H,L),O=_.expression,F=-1,w=0,A=0;while(A<V.length){let R=V.indexOf("@",A);if(R===-1)break;let N=V.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,A=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=W(O.trim()),N;if(F!==-1){let T=V.slice(0,F),M=V.slice(F+5);N=R?T:M}else N=R?V:"";Q=Q.substring(0,B)+N+Q.substring(L+`@${K}`.length),z=!0}catch(R){let N=R instanceof Error?R.message:String(R),T=$0(q,`Error processing @${G} directive: ${N}`,s.EVALUATION_ERROR);Q=Q.substring(0,B)+T+Q.substring(L+`@${K}`.length);break}}return Q}return J=X(J,"isset","endisset",(Q)=>{let G=D1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=X(J,"empty","endempty",(Q)=>{let G=D1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function s3($,Z,Y){let J=$,X="development";function Q(G,K,W,q){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),B=new RegExp(`^@${W}(?![a-z])`),_=G,H=!0;while(H){H=!1,z.lastIndex=0;let L=z.exec(_);if(!L)break;let V=L.index,O=V+L[0].length;if(K==="env"){let D=_.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,q=X===D[2]}let F=1,w=O,A=-1;while(F>0&&w<_.length){z.lastIndex=w,U.lastIndex=w;let D=z.exec(_),y=U.exec(_),S=D?D.index:1/0,k=y?y.index:1/0;if(S<k)F++,w=S+D[0].length;else if(k<1/0){if(F--,F===0){A=k;break}w=k+y[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${V} has no matching @${W} \u2014 the block was skipped.`);break}let R=_.substring(O,A),N=-1,T=0,M=0;while(M<R.length){let D=R.indexOf("@",M);if(D===-1)break;let y=R.substring(D);if(j.test(y)){T++,M=D+1;continue}if(B.test(y)){T--,M=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(y)){N=D;break}M=D+1}let I;if(N!==-1){let D=R.slice(0,N),y=R.slice(N+5);I=q?D:y}else I=q?R:"";let E=`@${W}`.length;_=_.substring(0,V)+I+_.substring(A+E),H=!0}return _}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",X==="production"),J=Q(J,"development","enddevelopment",X==="development"),J=Q(J,"staging","endstaging",X==="staging"),J=Q(J,"testing","endtesting",X==="testing"),J}var l4=b(()=>{t2();U1();u$();A0()});function ZY($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function c4($,Z){if(!$)return Z?.nonceGenerator?.()??ZY();let Y=$Y.get($);if(!Y)Y=Z?.nonceGenerator?.()??ZY(),$Y.set($,Y);return Y}function yz($,Z){let Y=[];for(let[J,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)Y.push(J);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${J} ${Q.join(" ")}`)}}return Y.join("; ")}function YY($,Z){return`<meta http-equiv="Content-Security-Policy" content="${yz($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function JY($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?c4(Y,Z):void 0,X=YY(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
9438
+ ${X}`)}function XY($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<script nonce="${Z}"${X}>`}),Y=Y.replace(/<style([^>]*)>/gi,(J,X)=>{if(X.includes("nonce="))return J;return`<style nonce="${Z}"${X}>`}),Y}function QY($,Z,Y,J){let X=$,Q=J.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?c4(Z,Q):void 0;return YY(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return c4(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=c4(Z,Q);return X}var $Y;var GY=b(()=>{$Y=new WeakMap});import Pz from"crypto";function vz($=Cz){let Z=Pz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return r3=Z,Z}function xz(){if(!r3)vz();return r3}function fz($=KY){let Z=xz();return`<input type="hidden" name="${$}" value="${Z}">`}function WY($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return fz(J||KY)})}var Cz=40,KY="_token",r3=null;var qY=()=>{};async function zY($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let X=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)X=await gz(X,Q,Z,Y,J);else X=await hz(X,Q,Z,Y,J)}return X}async function gz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,q=$,z=U5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),U=[],j=z.exec(q);while(j!==null){let[B,_="",H=""]=j,L=j.index||0;try{let V=_?UY(_):[],O=H.trim(),F=await G(O,V,Y,J);U.push({original:B,processed:F,startIndex:L})}catch(V){let O=V instanceof Error?V.message:String(V);if(X.debug)console.error(`Error processing custom directive @${Q}:`,V);U.push({original:B,processed:$0("CustomDirective",`Error in @${Q}${_?`(${_})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:L})}j=z.exec(q)}for(let B=U.length-1;B>=0;B--){let{original:_,processed:H}=U[B];q=q.replace(_,H)}return q}async function hz($,Z,Y,J,X){let{name:Q,handler:G}=Z,K=$,W=U5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],z=W.exec(K);while(z!==null){let[B,_=""]=z,H=z.index||0;try{let L=UY(_),V=await G("",L,Y,J);q.push({original:B,processed:V,startIndex:H})}catch(L){let V=L instanceof Error?L.message:String(L);if(X.debug)console.error(`Error processing custom directive @${Q}:`,L);q.push({original:B,processed:$0("CustomDirective",`Error in @${Q}(${_}): ${V}`,s.EVALUATION_ERROR),startIndex:H})}z=W.exec(K)}let U=U5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=U.exec(K);while(j!==null){let[B]=j,_=j.index||0;try{let H=await G("",[],Y,J);q.push({original:B,processed:H,startIndex:_})}catch(H){let L=H instanceof Error?H.message:String(H);if(X.debug)console.error(`Error processing custom directive @${Q}:`,H);q.push({original:B,processed:$0("CustomDirective",`Error in @${Q}: ${L}`,s.EVALUATION_ERROR),startIndex:_})}j=U.exec(K)}for(let B=q.length-1;B>=0;B--){let{original:_,processed:H}=q[B];K=K.replace(_,H)}return K}function UY($){if(!$.trim())return[];let Z=[],Y="",J=!1,X="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,X=G;else if(G===X)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var jY=b(()=>{U1();j5()});function a1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function uz($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,J=Z.colorMode;if(a1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(a1(Y.key,"appearance.key"),a1(Y.attribute,"appearance.attribute"),a1(Y.default,"appearance.default"),a1(J.key,"colorMode.key"),a1(J.attribute,"colorMode.attribute"),a1(J.default,"colorMode.default"),!_Y.test(Y.key)||!_Y.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!BY.test(Y.attribute)||!BY.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((X)=>typeof X!=="string"||X.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!dz.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function mz($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function pz($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${mz($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function lz($,Z){let Y=1,J=null,X=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(X){X=!1;continue}if(J){if(G==="\\")X=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function HY($,Z){let Y=$,J=/@appearanceBootstrap\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index+X[0].length-1,G=lz(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),W=Z0(`(${K})`,Z),q=pz(uz(W));Y=Y.slice(0,X.index)+q+Y.slice(G+1),J.lastIndex=X.index+q.length}return Y}var BY,_Y,dz;var OY=b(()=>{A0();BY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,_Y=/^[A-Za-z_$][\w$]*$/,dz=new Set(["light","dark","system"])});import cz from"crypto";function I0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function i4($,Z,Y,J){let X=$||Z;return Y?`${X} ${J}`:X}function iz(){return cz.randomUUID()}function n4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=iz();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${I0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,X)=>{let Q=X.toUpperCase();if(X&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${I0(Q)}">`;return J}),Y}function VY($,Z,Y=FY){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,W,q="")=>{let z=Q||G||"POST",U=K||W||"",j=E1(q),B=z.toUpperCase(),_=["GET","POST"].includes(B)?B:"POST",H=`<form method="${I0(_)}" action="${I0(U)}"${j?` ${j}`:""}>`;if(H+=`
9439
+ ${n4("@csrf",Z)}`,!["GET","POST"].includes(B))H+=`
9440
+ ${n4(`@method('${B}')`,Z)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,q="")=>{let z=Q||G||"",U=K||W||"",j=E1(q),B=j$(z,Z),_=B!==void 0&&B!==null?B:U||"",H=j.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",V=B$(z,Z),O=j.match(/class=['"]([^'"]+)['"]/i),F=i4(O?O[1]:"",Y.input,V,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${I0(L)}" name="${I0(z)}" value="${I0(_)}" class="${F}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=E1(G),q=j$(Q,Z)||K.trim(),z=B$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=i4(U?U[1]:"",Y.input,z,Y.inputError),B=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${I0(Q)}" class="${j}"${B?` ${B}`:""}>${I0(q)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=E1(G),q=j$(Q,Z),z=B$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=i4(U?U[1]:"",Y.input,z,Y.inputError),B=W.replace(/class=['"][^'"]+['"]/i,""),_=K;if(q!==void 0)_=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,V)=>{if((Array.isArray(q)?q.some((F)=>String(F)===V):String(q)===V)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${I0(Q)}" class="${j}"${B?` ${B}`:""}>${_}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="1",K="")=>{let W=E1(K),q=j$(Q,Z),z=q!==void 0&&(Array.isArray(q)?q.some((_)=>String(_)===G):q===!0||String(q)===G),U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,B=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${I0(Q)}" value="${I0(G)}" class="${j}"${z?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=E1(K),q=j$(Q,Z),z=q!==void 0&&q===G,U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,B=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${I0(Q)}" value="${I0(G)}" class="${j}"${z?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=E1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),q=W?W[1]:"",z=K.includes("multiple"),U=B$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),B=i4(j?j[1]:"",Y.input,U,Y.inputError),_=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${I0(Q)}"`,`class="${B}"`];if(q)H.push(`accept="${I0(q)}"`);if(z)H.push("multiple");if(_)H.push(_);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=E1(G),q=W.match(/class=['"]([^'"]+)['"]/i),z=q?q[1]:Y.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${I0(Q)}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),J}function wY($,Z,Y=FY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,X,Q)=>{try{if(B$(X,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return LY(X,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return LY(X,Z)}let W=K.trim();if(W0(W)){let q=Z0(W,Z);return q!==void 0?String(q):W}return W}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function B$($,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 LY($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function j$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function E1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=J.exec(Y))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var FY;var AY=b(()=>{A0();FY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import e3 from"path";async function nz(){if(_$!==void 0)return _$;try{_$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{_$=null}return _$}function oz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function sz($,Z){if({...Y6,...Z.i18n}.cache&&$6[$]){let X=$6[$],Q=Z.i18n?.cacheMaxAge??0;if(!oz(X,Q))return X.translations}if(H$[$]?.state==="loading")return H$[$].promise;a3[$]="loading";let J=Z6($,Z).then((X)=>{return a3[$]="loaded",delete H$[$],X}).catch((X)=>{throw a3[$]="error",H$[$]={promise:J,state:"error",error:X instanceof Error?X:Error(String(X))},X});return H$[$]={promise:J,state:"loading"},J}async function Z6($,Z){let Y={...Y6,...Z.i18n},J=e3.isAbsolute(Y.translationsDir)?Y.translationsDir:e3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let X=await nz(),Q=X?await X($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:$U(Y.format)}):await rz($,Y,J);if(Q===void 0){if($!==Y.defaultLocale)return Z6(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)$6[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(X){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,X);if($!==Y.defaultLocale)return Z6(Y.defaultLocale,Z);return{}}}async function rz($,Z,Y){let J=e3.join(Y,`${$}${az(Z.format)}`);try{let X=await import(J);return X.default||X}catch(X){try{let Q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return tz(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function az($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function tz($){let Z={},Y=$.split(`
9441
+ `),J=[{obj:Z,indent:-1}];for(let X of Y){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,q,z]=W,U=q.trim(),j=z.trim();if(j==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=ez(j)}}return Z}function ez($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function $U($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function ZU($,Z){return sz($,Z)}function YU($,Z){for(let Y of $){let J=Y.trim(),X=J.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function JU($,Z={}){return MY($,Z)}function MY($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let X=XU($,J);if(X===-1){Y+=$[J],J++;continue}let Q=$.slice(J+1,X);Y+=QU(Q,Z),J=X+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function XU($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function QU($,Z){let Y=GU($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),X=Z[J];if(Y.length===1)return X!==void 0?String(X):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return KU(X,Y.slice(2).join(","),Z);case"select":return qU(X,Y.slice(2).join(","));case"selectordinal":return zU(X,Y.slice(2).join(","));case"number":return jU(X,Y[2]?.trim());case"date":return BU(X,Y[2]?.trim());case"time":return _U(X,Y[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function GU($){let Z=[],Y="",J=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")J++,Y+=Q;else if(Q==="}")J--,Y+=Q;else if(Q===","&&J===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function KU($,Z,Y){let J=Number($)||0,X=J6(Z),Q=`=${J}`;if(X[Q])return t3(X[Q],J,Y);let G=WU(J);if(X[G])return t3(X[G],J,Y);if(X.other)return t3(X.other,J,Y);return String(J)}function t3($,Z,Y){let J=$.replace(/#/g,String(Z));return MY(J,Y)}function WU($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function qU($,Z){let Y=String($||""),J=J6(Z);if(J[Y])return J[Y];return J.other||String($)}function zU($,Z){let Y=Number($)||0,J=J6(Z),X=UU(Y);if(J[X])return J[X].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function UU($){let Z=Math.abs($),Y=Z%10,J=Z%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function J6($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function jU($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function BU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function _U($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function HU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function RY($,Z,Y=!0,J={}){let X=$.split("."),Q=Z;for(let K of X){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(HU(G))return JU(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),W=G.split("|");G=YU(W,K)}for(let[K,W]of Object.entries(J)){let q=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${q}`,"g"),String(W))}return G}async function TY($,Z,Y,J){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...Y6,...J.i18n},K=await ZU(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await NY(X,Q,async(z,U,j,B,_)=>{try{let H={};if(j)try{let V=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return T0(j,Z)}];for(let O of V)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(V){if(J.debug)console.error("Error parsing parameters for @translate directive:",V)}return RY(U,K,G.fallbackToKey,H)||B.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return $0("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...X.matchAll(W)];console.warn(`Found ${z.length} @translate matches`),z.forEach((U,j)=>console.warn(`Match ${j}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return X=await NY(X,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,U,j,B)=>{try{let _={};if(j)try{let H=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return T0(j,Z)}];for(let L of H)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return RY(U,K,G.fallbackToKey,_)}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${U}'): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR)}}),X}async function NY($,Z,Y){let J=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return J.push(K),Q}),(await Promise.all(J)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var _$,Y6,$6,H$,a3;var IY=b(()=>{U1();A0();Y6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},$6={},H$={},a3={}});var G6={};a(G6,{streamingSuspenseDirective:()=>kY,streamToResponse:()=>DU,streamTemplateSimple:()=>NU,streamTemplate:()=>LU,renderStreamingPage:()=>VU,registerStreamingDirectives:()=>TU,processStreamDirectives:()=>AU,processSectionDirectives:()=>IU,islandDirective:()=>bY,generateHydrationRuntime:()=>EU,extractStreamBoundaries:()=>RU,createStreamRenderer:()=>MU,buildSuspenseResolveScript:()=>Q6,SUSPENSE_RESOLVER_RUNTIME:()=>EY});import o4 from"path";function OU($){let Z=[],Y=0,J;DY.lastIndex=0;while((J=DY.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let X=J[1],Q=J[2];Z.push({type:"suspense",name:X,content:Q}),Y=J.index+J[0].length}if(Y<$.length){let X=$.slice(Y);if(X.trim())Z.push({type:Z.length===0?"shell":"content",content:X})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function LU($,Z={},Y={}){let J={...o1,...Y,streaming:{...X6,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:o4.dirname($)};if(W.trim())await u1(W,z,$);let U=OU(q),j=new Set;if(!U.some((_)=>_.type==="suspense")){let _=J.streaming?.strategy||"auto",H=new RegExp(t1.source,"g");if(!(_!=="manual"&&H.test(q))){let V=await L0(q,z,$,J,j);for(let O=0;O<V.length;O+=X)Q.enqueue(V.slice(O,O+X)),await new Promise((F)=>setTimeout(F,0))}else{let V=[],O=new RegExp(t1.source,"g"),F;while((F=O.exec(q))!==null)V.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let w=0;for(let A of V){if(A.start>w){let N=q.slice(w,A.start);if(N.trim()){let T=await L0(N,z,$,J,j);Q.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let R=await L0(A.content,z,$,J,j);Q.enqueue(R),await new Promise((N)=>setTimeout(N,0)),w=A.end}if(w<q.length){let A=q.slice(w);if(A.trim()){let R=await L0(A,z,$,J,j);Q.enqueue(R)}}}}else{let _=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let V=await L0(L.content,z,$,J,j);Q.enqueue(V)}else if(L.type==="suspense"&&L.name){let V=`stx-suspense-${L.name}`;Q.enqueue(`<div id="${V}" data-suspense="${L.name}" style="display:contents;">
9205
9442
  <template data-suspense-fallback>Loading...</template>
9206
- </div>`),B.set(L.name,L0(L.content,z,$,J,j))}Q.enqueue(`
9443
+ </div>`),_.set(L.name,L0(L.content,z,$,J,j))}Q.enqueue(`
9207
9444
  <script>
9208
9445
  (function() {
9209
9446
  window.__stxSuspense = window.__stxSuspense || {
@@ -9219,13 +9456,13 @@ ${X}`)}function $Y($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*
9219
9456
  }
9220
9457
  };
9221
9458
  })();
9222
- </script>`);let H=Array.from(B.entries()).map(async([L,F])=>{Q.enqueue(await J6(L,F))});await Promise.all(H)}Q.close()}catch(G){Q.error(G)}}})}async function J6($,Z){try{let J=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
9459
+ </script>`);let H=Array.from(_.entries()).map(async([L,V])=>{Q.enqueue(await Q6(L,V))});await Promise.all(H)}Q.close()}catch(G){Q.error(G)}}})}async function Q6($,Z){try{let J=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
9223
9460
  <script>
9224
9461
  window.__stxSuspense.resolve('${$}', \`${J}\`);
9225
9462
  </script>`}catch(Y){let J=Y instanceof Error?Y.message:String(Y);return`
9226
9463
  <script>
9227
9464
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${a0(J)}</div>');
9228
- </script>`}}function WU($,Z,Y){if(!Z||Z<=0)return $;let J,X=new Promise((Q,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(J))}function qU($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(MY),await Promise.all(Z.map(async(Q)=>{let G=WU(Q.render(),J,Q.id);X.enqueue(await J6(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function UU($,Z){return $.replace(zU,(Y,J,X)=>{let Q=J.trim(),G=X.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function jU($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,X])=>({id:J,render:X})):void 0}async function _U($,Z={},Y={}){let J={...o1,...Y,streaming:{...Y6,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:n4.dirname($)};if(W.trim())await u1(W,z,$);let U=new Set,j=J.streaming?.strategy||"auto",_=new RegExp(t1.source,"g");if(!(j!=="manual"&&_.test(q))){let H=await L0(q,z,$,J,U);for(let L=0;L<H.length;L+=X)Q.enqueue(H.slice(L,L+X))}else{let H=[],L=new RegExp(t1.source,"g"),F;while((F=L.exec(q))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=q.slice(O,V.start);if(A.trim()){let R=await L0(A,z,$,J,U);Q.enqueue(R)}}let w=await L0(V.content,z,$,J,U);Q.enqueue(w),O=V.end}if(O<q.length){let V=q.slice(O);if(V.trim()){let w=await L0(V,z,$,J,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function BU($,Z={}){let Y={...o1,...Z,streaming:{...Y6,...Z.streaming}},J=await Bun.file($).text(),X=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},q;t1.lastIndex=0;while((q=t1.exec(G))!==null){let j=q[1],_=q[2];W[j]=_}let z=G.replace(t1,"");return{renderShell:async(j={})=>{let _={...j,__filename:$,__dirname:n4.dirname($)};return await u1(Q,_,$),L0(z,_,$,Y,new Set)},renderSection:async(j,_={})=>{try{if(!W[j])return`<div class="error-message">Section "${a0(j)}" not found in template "${a0($)}"</div>`;let B={..._,__filename:$,__dirname:n4.dirname($)};await u1(Q,B,$);let H=new Set;return await L0(W[j],B,$,Y,H)}catch(B){let H=B instanceof Error?B.message:String(B);return U0("Expression",H,$,W[j]||"",0,W[j]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function HU($={}){let Z=[];if($.streaming?.enabled)Z.push(TY);if($.hydration?.enabled)Z.push(IY);return Z}async function OU($,Z,Y,J={}){return $}function LU($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),X=new Headers(Z.headers);if(!X.has("Content-Type"))X.set("Content-Type","text/html; charset=utf-8");if(!X.has("Transfer-Encoding"))X.set("Transfer-Encoding","chunked");if(!X.has("X-Content-Type-Options"))X.set("X-Content-Type-Options","nosniff");if(!X.has("X-Accel-Buffering"))X.set("X-Accel-Buffering","no");return new Response(J,{...Z,headers:X})}function FU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
9465
+ </script>`}}function FU($,Z,Y){if(!Z||Z<=0)return $;let J,X=new Promise((Q,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(J))}function VU($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(EY),await Promise.all(Z.map(async(Q)=>{let G=FU(Q.render(),J,Q.id);X.enqueue(await Q6(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function AU($,Z){return $.replace(wU,(Y,J,X)=>{let Q=J.trim(),G=X.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function RU($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,X])=>({id:J,render:X})):void 0}async function NU($,Z={},Y={}){let J={...o1,...Y,streaming:{...X6,...Y.streaming}},X=J.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:o4.dirname($)};if(W.trim())await u1(W,z,$);let U=new Set,j=J.streaming?.strategy||"auto",B=new RegExp(t1.source,"g");if(!(j!=="manual"&&B.test(q))){let H=await L0(q,z,$,J,U);for(let L=0;L<H.length;L+=X)Q.enqueue(H.slice(L,L+X))}else{let H=[],L=new RegExp(t1.source,"g"),V;while((V=L.exec(q))!==null)H.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let O=0;for(let F of H){if(F.start>O){let A=q.slice(O,F.start);if(A.trim()){let R=await L0(A,z,$,J,U);Q.enqueue(R)}}let w=await L0(F.content,z,$,J,U);Q.enqueue(w),O=F.end}if(O<q.length){let F=q.slice(O);if(F.trim()){let w=await L0(F,z,$,J,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function MU($,Z={}){let Y={...o1,...Z,streaming:{...X6,...Z.streaming}},J=await Bun.file($).text(),X=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},q;t1.lastIndex=0;while((q=t1.exec(G))!==null){let j=q[1],B=q[2];W[j]=B}let z=G.replace(t1,"");return{renderShell:async(j={})=>{let B={...j,__filename:$,__dirname:o4.dirname($)};return await u1(Q,B,$),L0(z,B,$,Y,new Set)},renderSection:async(j,B={})=>{try{if(!W[j])return`<div class="error-message">Section "${a0(j)}" not found in template "${a0($)}"</div>`;let _={...B,__filename:$,__dirname:o4.dirname($)};await u1(Q,_,$);let H=new Set;return await L0(W[j],_,$,Y,H)}catch(_){let H=_ instanceof Error?_.message:String(_);return U0("Expression",H,$,W[j]||"",0,W[j]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function TU($={}){let Z=[];if($.streaming?.enabled)Z.push(kY);if($.hydration?.enabled)Z.push(bY);return Z}async function IU($,Z,Y,J={}){return $}function DU($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),X=new Headers(Z.headers);if(!X.has("Content-Type"))X.set("Content-Type","text/html; charset=utf-8");if(!X.has("Transfer-Encoding"))X.set("Transfer-Encoding","chunked");if(!X.has("X-Content-Type-Options"))X.set("X-Content-Type-Options","nosniff");if(!X.has("X-Accel-Buffering"))X.set("X-Accel-Buffering","no");return new Response(J,{...Z,headers:X})}function EU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,X=Object.entries(Y).map(([Q,G])=>`'${Q}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
9229
9466
  `);if(Z==="loader")return`
9230
9467
  (function() {
9231
9468
  window.__stx = window.__stx || {};
@@ -9367,7 +9604,7 @@ else {
9367
9604
  else {
9368
9605
  stx.hydrate();
9369
9606
  }
9370
- })();`}var Y6,t1,NY,MY=`
9607
+ })();`}var X6,t1,DY,EY=`
9371
9608
  <script>
9372
9609
  (function(){
9373
9610
  window.__stxSuspense = window.__stxSuspense || {
@@ -9387,25 +9624,25 @@ else {
9387
9624
  }
9388
9625
  };
9389
9626
  })();
9390
- </script>`,zU,TY,IY;var Q6=b(()=>{s1();X1();Q4();M0();Y6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},t1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,NY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;zU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;TY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let X=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${X} -->${$}<!-- @endsuspense:${X} -->`}},IY={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let X=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${X}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",q=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
9627
+ </script>`,wU,kY,bY;var K6=b(()=>{s1();X1();G4();M0();X6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},t1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,DY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;wU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;kY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let X=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${X} -->${$}<!-- @endsuspense:${X} -->`}},bY={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let X=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${X}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",q=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
9391
9628
  ${q}
9392
9629
  <script type="application/json" data-island-props="${G}">
9393
9630
  ${W?`{${W}}`:"{}"}
9394
9631
  </script>
9395
- </div>`}}});var kY={};a(kY,{warnUnbalancedTags:()=>G6,findUnbalancedTags:()=>EY});function A5($){return $.replace(/[^\n]/g," ")}function EY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,A5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,A5).replace(/<!--[\s\S]*?-->/g,A5).replace(/\{\{\{[\s\S]*?\}\}\}/g,A5).replace(/\{\{[\s\S]*?\}\}/g,A5).replace(/\{!![\s\S]*?!!\}/g,A5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",W=Q[2],q=Q[3]==="/";if(VU.has(W.toLowerCase()))continue;if(q)continue;if(K)J.set(W,(J.get(W)??0)+1);else{let z=Y.get(W);if(z)z.count++;else{let U=Z.slice(0,Q.index).split(`
9396
- `).length;Y.set(W,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(wU.has(K.toLowerCase()))continue;let W=Y.get(K)?.count??0,q=J.get(K)??0;if(W!==q)G.push({tag:K,opened:W,closed:q,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function G6($,Z){let Y;try{Y=EY($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(DY.has(J))return;DY.add(J);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:W}of Y)if(G>K){let q=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${q} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var VU,wU,DY;var K6=b(()=>{VU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),wU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);DY=new Set});import n0 from"path";import W6 from"fs";function bY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function SY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class yY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,J){let X=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let _=[X,X.toLowerCase(),bY(X),SY(X)];for(let B of _)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${X}.stx`,`${bY(X)}.stx`,`${SY(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let _=n0.resolve(n0.dirname(Z),`${X}.stx`);if(await c(_))return _;return null}let K=[],W=Y.componentsDir||"",q=J?.__originalFilePath;if(q)K.push(n0.join(n0.dirname(q),"components"));if(W)K.push(W);let z=n0.join(n0.dirname(Z),"components");if(!K.includes(z))K.push(z);let U=process.cwd(),j=[n0.resolve(U,"src/components"),n0.resolve(U,"components"),n0.resolve(import.meta.dir,"components")];for(let _ of j)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let B of G){let H=n0.join(_,B);if(await c(H))return H}try{if(!W6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=W6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=n0.join(_,L.name);for(let O of G){let V=n0.join(F,O);if(await c(V))return V}}}catch{}}return null}}var g0;var q6=b(()=>{M0();g0=new yY});function P0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function R5($,Z){let Y=[];for(let[J,X]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof X==="boolean"){if(X)Y.push(P0(Q));continue}Y.push(`${P0(Q)}="${P0(X)}"`)}return Y}var o4=()=>{};function H$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function AU($){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 z6;var U6=b(()=>{o4();z6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=AU($),X=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,W=[];if(J.reactive)W.push(`:href="${H$(J.value)}"`);else W.push(`href="${H$(J.value)}"`);if(X)W.push(`class="${H$(X)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${H$(Q)}"`),W.push(`data-stx-exact-active-class="${H$(G)}"`),K)W.push("data-stx-prefetch");let q=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...R5($,q)),`<a ${W.join(" ")}>${Z}</a>`}}});function k0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function C0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function _6($,Z,Y=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let X=$.static[Z];if(X!==void 0)return X!=="false"&&X!==!1;return Y}function PY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[X,Q]=J.split(":"),G=RU[X];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(X);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(J);return Y.join(", ")}function B6($,Z,Y,J){return Z.map((X)=>`${O$($,X,void 0,Y,J)} ${X}w`).join(", ")}function NU($,Z,Y,J,X){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${O$($,G,void 0,J,X)} ${Q}x`}).join(", ")}function O$($,Z,Y,J,X){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(X)Q.push(`f_${X}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(X)Q.set("fm",X);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(X)Q.set("format",X);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function MU($,Z,Y="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var RU,j6,H6;var O6=b(()=>{o4();RU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},j6=[320,640,768,1024,1280,1536,1920];H6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=C0($,"src")||"",X=C0($,"alt")||"",Q=C0($,"width"),G=C0($,"height"),K=C0($,"sizes"),W=C0($,"srcset"),q=C0($,"densities"),z=C0($,"format"),U=C0($,"placeholder"),j=C0($,"placeholderColor")||"#e5e7eb",_=C0($,"provider"),B=C0($,"class")||C0($,"className")||"",H=C0($,"style")||"",L=C0($,"quality"),F=_6($,"lazy",!0),O=_6($,"preload",!1),V=_6($,"picture",!1)||!!z,w=Q?Number.parseInt(Q):void 0,A=G?Number.parseInt(G):void 0,R=W||"",N="";if(!R&&K)R=B6(J,j6,_,z),N=PY(K);else if(!R&&q){let S=q.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));R=NU(J,S,w,_,z)}else if(K)N=PY(K);let M=[];if(H)M.push(H);if(w&&A)M.push(`aspect-ratio:${w}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let S=MU(w||16,A||9,j);M.push(`background-image:url(${S})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")M.push(`background-image:url(${k0(U)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let T=O$(J,w,A,_,z),I=[];if(I.push(`src="${k0(T)}"`),I.push(`alt="${k0(X)}"`),Q)I.push(`width="${k0(Q)}"`);if(G)I.push(`height="${k0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),B)I.push(`class="${k0(B)}"`);if(M.length>0)I.push(`style="${k0(M.join(";"))}"`);if(R)I.push(`srcset="${k0(R)}"`);if(N)I.push(`sizes="${k0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...R5($,E));let D=`<img ${I.join(" ")} />`,y="";if(O){let k=z==="webp"?"image/webp":z==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${k0(T)}"${k?` type="${k}"`:""}${R?` imagesrcset="${k0(R)}"`:""}${N?` imagesizes="${k0(N)}"`:""} />
9397
- `}if(V){let S=[];if(z==="avif"||z==="auto"){let k=O$(J,w,A,_,"avif"),v=R?B6(J,j6,_,"avif"):`${k}`;S.push(`<source type="image/avif" srcset="${k0(v)}"${N?` sizes="${k0(N)}"`:""} />`)}if(z==="webp"||z==="auto"){let k=O$(J,w,A,_,"webp"),v=R?B6(J,j6,_,"webp"):`${k}`;S.push(`<source type="image/webp" srcset="${k0(v)}"${N?` sizes="${k0(N)}"`:""} />`)}return`${y}<picture>
9632
+ </div>`}}});var PY={};a(PY,{warnUnbalancedTags:()=>W6,findUnbalancedTags:()=>yY});function A5($){return $.replace(/[^\n]/g," ")}function yY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,A5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,A5).replace(/<!--[\s\S]*?-->/g,A5).replace(/\{\{\{[\s\S]*?\}\}\}/g,A5).replace(/\{\{[\s\S]*?\}\}/g,A5).replace(/\{!![\s\S]*?!!\}/g,A5),Y=new Map,J=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",W=Q[2],q=Q[3]==="/";if(kU.has(W.toLowerCase()))continue;if(q)continue;if(K)J.set(W,(J.get(W)??0)+1);else{let z=Y.get(W);if(z)z.count++;else{let U=Z.slice(0,Q.index).split(`
9633
+ `).length;Y.set(W,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(bU.has(K.toLowerCase()))continue;let W=Y.get(K)?.count??0,q=J.get(K)??0;if(W!==q)G.push({tag:K,opened:W,closed:q,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function W6($,Z){let Y;try{Y=yY($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(SY.has(J))return;SY.add(J);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:W}of Y)if(G>K){let q=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${q} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var kU,bU,SY;var q6=b(()=>{kU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),bU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);SY=new Set});import n0 from"path";import z6 from"fs";function CY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function vY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class xY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,J){let X=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let B=[X,X.toLowerCase(),CY(X),vY(X)];for(let _ of B)if(Q.has(_))return Q.get(_)}let G=[...new Set([`${X}.stx`,`${CY(X)}.stx`,`${vY(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let B=n0.resolve(n0.dirname(Z),`${X}.stx`);if(await c(B))return B;return null}let K=[],W=Y.componentsDir||"",q=J?.__originalFilePath;if(q)K.push(n0.join(n0.dirname(q),"components"));if(W)K.push(W);let z=n0.join(n0.dirname(Z),"components");if(!K.includes(z))K.push(z);let U=process.cwd(),j=[n0.resolve(U,"src/components"),n0.resolve(U,"components"),n0.resolve(import.meta.dir,"components")];for(let B of j)if(!K.includes(B))K.push(B);for(let B of K){if(!B)continue;for(let _ of G){let H=n0.join(B,_);if(await c(H))return H}try{if(!z6.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let H=z6.readdirSync(B,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let V=n0.join(B,L.name);for(let O of G){let F=n0.join(V,O);if(await c(F))return F}}}catch{}}return null}}var g0;var U6=b(()=>{M0();g0=new xY});function P0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function R5($,Z){let Y=[];for(let[J,X]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof X==="boolean"){if(X)Y.push(P0(Q));continue}Y.push(`${P0(Q)}="${P0(X)}"`)}return Y}var s4=()=>{};function O$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function SU($){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 j6;var B6=b(()=>{s4();j6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=SU($),X=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,W=[];if(J.reactive)W.push(`:href="${O$(J.value)}"`);else W.push(`href="${O$(J.value)}"`);if(X)W.push(`class="${O$(X)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${O$(Q)}"`),W.push(`data-stx-exact-active-class="${O$(G)}"`),K)W.push("data-stx-prefetch");let q=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...R5($,q)),`<a ${W.join(" ")}>${Z}</a>`}}});function k0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function C0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function H6($,Z,Y=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let X=$.static[Z];if(X!==void 0)return X!=="false"&&X!==!1;return Y}function fY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[X,Q]=J.split(":"),G=yU[X];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(X);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(J);return Y.join(", ")}function O6($,Z,Y,J){return Z.map((X)=>`${L$($,X,void 0,Y,J)} ${X}w`).join(", ")}function PU($,Z,Y,J,X){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${L$($,G,void 0,J,X)} ${Q}x`}).join(", ")}function L$($,Z,Y,J,X){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(X)Q.push(`f_${X}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(X)Q.set("fm",X);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(X)Q.set("format",X);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function CU($,Z,Y="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var yU,_6,L6;var F6=b(()=>{s4();yU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},_6=[320,640,768,1024,1280,1536,1920];L6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=C0($,"src")||"",X=C0($,"alt")||"",Q=C0($,"width"),G=C0($,"height"),K=C0($,"sizes"),W=C0($,"srcset"),q=C0($,"densities"),z=C0($,"format"),U=C0($,"placeholder"),j=C0($,"placeholderColor")||"#e5e7eb",B=C0($,"provider"),_=C0($,"class")||C0($,"className")||"",H=C0($,"style")||"",L=C0($,"quality"),V=H6($,"lazy",!0),O=H6($,"preload",!1),F=H6($,"picture",!1)||!!z,w=Q?Number.parseInt(Q):void 0,A=G?Number.parseInt(G):void 0,R=W||"",N="";if(!R&&K)R=O6(J,_6,B,z),N=fY(K);else if(!R&&q){let S=q.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));R=PU(J,S,w,B,z)}else if(K)N=fY(K);let T=[];if(H)T.push(H);if(w&&A)T.push(`aspect-ratio:${w}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let S=CU(w||16,A||9,j);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(${k0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=L$(J,w,A,B,z),I=[];if(I.push(`src="${k0(M)}"`),I.push(`alt="${k0(X)}"`),Q)I.push(`width="${k0(Q)}"`);if(G)I.push(`height="${k0(G)}"`);if(V)I.push('loading="lazy"');if(I.push('decoding="async"'),_)I.push(`class="${k0(_)}"`);if(T.length>0)I.push(`style="${k0(T.join(";"))}"`);if(R)I.push(`srcset="${k0(R)}"`);if(N)I.push(`sizes="${k0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...R5($,E));let D=`<img ${I.join(" ")} />`,y="";if(O){let k=z==="webp"?"image/webp":z==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${k0(M)}"${k?` type="${k}"`:""}${R?` imagesrcset="${k0(R)}"`:""}${N?` imagesizes="${k0(N)}"`:""} />
9634
+ `}if(F){let S=[];if(z==="avif"||z==="auto"){let k=L$(J,w,A,B,"avif"),C=R?O6(J,_6,B,"avif"):`${k}`;S.push(`<source type="image/avif" srcset="${k0(C)}"${N?` sizes="${k0(N)}"`:""} />`)}if(z==="webp"||z==="auto"){let k=L$(J,w,A,B,"webp"),C=R?O6(J,_6,B,"webp"):`${k}`;S.push(`<source type="image/webp" srcset="${k0(C)}"${N?` sizes="${k0(N)}"`:""} />`)}return`${y}<picture>
9398
9635
  ${S.join(`
9399
9636
  `)}
9400
9637
  ${D}
9401
- </picture>`}return`${y}${D}`}}});function L$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function N5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var CY="/images/safe-image-default.svg",TU,L6;var F6=b(()=>{o4();TU=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${CY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,L6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=N5($,"src")||"",X=N5($,"alt")||"",Q=N5($,"fallback")||CY,G=N5($,"class")||N5($,"className")||"",K=N5($,"fallbackClassName")||"",W=[];if(W.push(`src="${L$(J)}"`),W.push(`alt="${L$(X)}"`),G)W.push(`class="${L$(G)}"`);if(W.push(`data-fallback="${L$(Q)}"`),K)W.push(`data-fallback-class="${L$(K)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...R5($,q));let z=`<img ${W.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${TU}${z}`;return z}}});function V6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function F$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function s4($,Z,Y){let J=F$($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var w6;var A6=b(()=>{w6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=V6(F$($,"color")||"#6366f1"),X=V6(F$($,"initialColor")||F$($,"initial-color")||""),Q=V6(F$($,"height")||"3px"),G=s4($,"duration",2000),K=s4($,"throttle",200),W=s4($,"zIndex",999999)||s4($,"z-index",999999),q=X?`linear-gradient(to right, ${X}, ${J})`:J;return`
9638
+ </picture>`}return`${y}${D}`}}});function F$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function N5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var gY="/images/safe-image-default.svg",vU,V6;var w6=b(()=>{s4();vU=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${gY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,V6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=N5($,"src")||"",X=N5($,"alt")||"",Q=N5($,"fallback")||gY,G=N5($,"class")||N5($,"className")||"",K=N5($,"fallbackClassName")||"",W=[];if(W.push(`src="${F$(J)}"`),W.push(`alt="${F$(X)}"`),G)W.push(`class="${F$(G)}"`);if(W.push(`data-fallback="${F$(Q)}"`),K)W.push(`data-fallback-class="${F$(K)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...R5($,q));let z=`<img ${W.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${vU}${z}`;return z}}});function A6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function V$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function r4($,Z,Y){let J=V$($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var R6;var N6=b(()=>{R6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=A6(V$($,"color")||"#6366f1"),X=A6(V$($,"initialColor")||V$($,"initial-color")||""),Q=A6(V$($,"height")||"3px"),G=r4($,"duration",2000),K=r4($,"throttle",200),W=r4($,"zIndex",999999)||r4($,"z-index",999999),q=X?`linear-gradient(to right, ${X}, ${J})`:J;return`
9402
9639
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${q};z-index:${W};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
9403
9640
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
9404
9641
  </div>
9405
9642
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
9406
9643
  <script>
9407
9644
  (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()})})();
9408
- </script>`}}});function xY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function IU($,Z,Y){let J=xY($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var vY,R6;var N6=b(()=>{vY={"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%)"},R6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=P0(xY($,"position")||"top-right"),X=IU($,"max",5),Q=vY[J]||vY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${X}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
9645
+ </script>`}}});function dY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function xU($,Z,Y){let J=dY($,Z);if(J!==void 0){let X=Number.parseInt(J,10);if(!Number.isNaN(X))return X}return Y}var hY,M6;var T6=b(()=>{hY={"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%)"},M6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=P0(dY($,"position")||"top-right"),X=xU($,"max",5),Q=hY[J]||hY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${X}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
9409
9646
  <style>
9410
9647
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
9411
9648
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -9413,7 +9650,7 @@ ${D}
9413
9650
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
9414
9651
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
9415
9652
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
9416
- </style>`}}});function r4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var fY,M6;var T6=b(()=>{fY={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)"},M6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=r4($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let X=P0(J),Q=r4($,"size")||"md",G=r4($,"closeOnBackdrop")!=="false",K=r4($,"closeOnEscape")!=="false",W=fY[Q]||fY.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
9653
+ </style>`}}});function a4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var uY,I6;var D6=b(()=>{uY={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)"},I6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=a4($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let X=P0(J),Q=a4($,"size")||"md",G=a4($,"closeOnBackdrop")!=="false",K=a4($,"closeOnEscape")!=="false",W=uY[Q]||uY.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
9417
9654
  <div class="stx-modal-panel" style="${W};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)">
9418
9655
  <div style="padding:1.5rem">${Z}</div>
9419
9656
  </div>
@@ -9422,8 +9659,8 @@ ${D}
9422
9659
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
9423
9660
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
9424
9661
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
9425
- </style>`}}});function M5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var gY,I6;var D6=b(()=>{gY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},I6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=M5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let X=P0(J),Q=M5($,"side")||"right",G=M5($,"size")||"md",K=M5($,"closeOnBackdrop")!=="false",W=M5($,"closeOnEscape")!=="false",q=M5($,"overlay")!=="false",z=gY[G]||gY.md,U=Q==="left",j=U?"left:0":"right:0",_=U?"translateX(-100%)":"translateX(100%)",B=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${K}" data-close-escape="${W}" 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">
9426
- <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${j};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">
9662
+ </style>`}}});function M5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var mY,E6;var k6=b(()=>{mY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},E6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=M5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let X=P0(J),Q=M5($,"side")||"right",G=M5($,"size")||"md",K=M5($,"closeOnBackdrop")!=="false",W=M5($,"closeOnEscape")!=="false",q=M5($,"overlay")!=="false",z=mY[G]||mY.md,U=Q==="left",j=U?"left:0":"right:0",B=U?"translateX(-100%)":"translateX(100%)",_=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${K}" data-close-escape="${W}" 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">
9663
+ <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${j};width:${z};max-width:100vw;transform:${B};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
9427
9664
  <div style="padding:1.5rem">${Z}</div>
9428
9665
  </div>
9429
9666
  </div>
@@ -9431,18 +9668,18 @@ ${D}
9431
9668
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
9432
9669
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
9433
9670
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
9434
- </style>`}}});import{existsSync as DU,readFileSync as EU}from"fs";function kU($){if(hY.has($))return;hY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function bU($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(DU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return _0.resolve(Y)}catch{}return null}function SU($){if(a4.has($))return a4.get($);let Z=bU($);if(!Z)return kU($),null;try{let Y=JSON.parse(EU(Z,"utf8"));return a4.set($,Y.icons),Y.icons}catch{return null}}function T5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var a4,hY,E6;var k6=b(()=>{a4=new Map,hY=new Set;E6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=T5($,"name")??T5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=J;if(J.includes(":")){let O=J.split(":");X=O[0],Q=O[1]}let G=P0(T5($,"size")||"24"),K=P0(T5($,"color")||"currentColor"),W=P0(T5($,"class")||""),q=P0(T5($,"style")||""),z=a4.get(X)??SU(X);if(!z)return`<!-- Icon: collection "${X}" not loaded -->`;let U=z[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${X} -->`;let j=U.width||24,_=U.height||24,B=`0 0 ${j} ${_}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=W?` class="${W}"`:"",F=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${L}${F}>${H}</svg>`}}});function dY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function uY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var b6;var S6=b(()=>{b6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=uY(Z,"fallback"),X=J.rest,Q=uY(X,"error"),G=Q.rest,K=J.region??dY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??dY($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function t4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var y6;var P6=b(()=>{y6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(t4($,"name")||"v").replace(/["'<>]/g,""),X=(t4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=t4($,"class"),G=t4($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function mY(){g0.registerBuiltin(z6),g0.registerBuiltin(H6),g0.registerBuiltin(L6),g0.registerBuiltin(w6),g0.registerBuiltin(R6),g0.registerBuiltin(M6),g0.registerBuiltin(I6),g0.registerBuiltin(E6),g0.registerBuiltin(b6),g0.registerBuiltin(y6)}var pY=b(()=>{U6();O6();F6();A6();N6();T6();D6();k6();S6();P6();q6();U6();O6();F6();A6();N6();T6();D6();k6();S6();P6()});function e4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function lY($,Z,Y){let J=[],X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})`));if(!K){X=Q+1;continue}let W=K[1];if(Y&&Y.has(W.toLowerCase())){let H=Q+1+W.length;while(H<$.length&&$[H]!==">")H++;X=H+1;continue}let q=Q+1+W.length,z=null,U=q,j=-1,_=!1;while(q<$.length){let H=$[q];if(z){if(H==="\\"&&q+1<$.length){q+=2;continue}if(H===z)z=null;q++;continue}if(H==='"'||H==="'"){z=H,q++;continue}if(H==="/"&&q+1<$.length&&$[q+1]===">"){j=q+2,_=!0;break}if(H===">"){j=q+1;break}q++}if(j===-1){X=Q+1;continue}let B=$.slice(U,_?j-2:j-1).trim();if(_)J.push({fullMatch:$.slice(Q,j),tagName:W,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),X=j;else{let H=`<${W}`,L=`</${W}>`,F=1,O=j,V=-1;while(F>0&&O<$.length){let R=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(R!==-1&&R<N){let M=$[R+H.length];if(M===" "||M===">"||M==="/"||M===`
9435
- `||M==="\t")F++;O=R+H.length}else{if(F--,F===0){V=N;break}O=N+L.length}}if(V===-1){X=j;continue}let w=$.slice(j,V),A=V+L.length;J.push({fullMatch:$.slice(Q,A),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:A,isSelfClosing:!1}),X=A}}return J}function cY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var iY=b(()=>{A0();M0();g1()});var eY={};a(eY,{processESImports:()=>aY,processComponents:()=>Z7});import $7 from"fs";import p0 from"path";function PU($,Z,Y){let J={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(W,q)=>q.toUpperCase())},G=(K,W)=>{let q=Q(K);if(J.static[q]=W,q!==K)J.staticNames[q]=K};for(let[K,W]of Object.entries($)){let q=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(q.startsWith("@")){J.events[q]=W;continue}if(q.startsWith("__stx_")){let z=Q(q.slice(6));J.serverDynamic[z]=cY(W,Y);continue}if(q.startsWith(":")){let z=Q(q.slice(1)),U=W===C6?z:W;if(z==="if"||z==="for"||z==="show"){J.clientReactive[z]=U;continue}try{if(!W0(U)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);J.clientReactive[z]=U;continue}let j=Object.keys(Z),B=q0(U,j)(...Object.values(Z));if(B===void 0){let H=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!j.includes(O))){J.clientReactive[z]=U;continue}}J.serverDynamic[z]=B}catch{J.clientReactive[z]=U}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let z=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let U=z[1];if(W0(U)){let _=q0(U,Object.keys(Z))(...Object.values(Z));G(q,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${U}`);G(q,W)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,U);G(q,W)}else{let U=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(W))!==null)try{let B=_[1];if(!W0(B)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let L=q0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(_[0],String(L??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,B)}G(q,U)}continue}G(q,W===C6?"true":W)}return J}function CU($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let X="";while(Y<J&&!/[\s=]/.test($[Y]))X+=$[Y],Y++;if(!X)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let Q="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[X]=Q}else Z[X]=C6}return Z}function oY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vU($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let X=J[1];if(g0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function xU($){let Z=sY.get($);if(Z)return Z;let Y=new Map,J=[p0.join($,"src"),p0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=$7.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let q=p0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(q,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let z=W.name.slice(0,-4);if(!Y.has(z))Y.set(z,q);let U=z.toLowerCase();if(!Y.has(U))Y.set(U,q);let j=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,q)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return sY.set($,Y),Y}function fU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=p0.join(Y,"node_modules",$);try{if($7.statSync(J).isDirectory())return J}catch{}let X=p0.dirname(Y);if(X===Y)return null;Y=X}}async function aY($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=p0.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(q,z,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=U,B,H=[];while((B=j.exec(U))!==null){let[L,F,O,V]=B,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let M=p0.resolve(G,V);if(M.endsWith(".stx"))A=M;else{let T=`${M}.stx`;try{if($7.statSync(T).isFile())A=T}catch{try{if($7.statSync(M).isDirectory())w=M}catch{}}}}else w=fU(V,G);if(!w&&!A)continue;let R=!1,N=(M,T)=>{Q.set(M,T),Q.set(M.toLowerCase(),T);let I=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,T),X.add(T)};if(O&&A)N(O,A),R=!0;else if(F){let M=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),T=w?xU(w):null;for(let{source:I,local:E}of M){let D=null;if(A)D=A;else if(T)D=T.get(I)??T.get(I.toLowerCase())??T.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)N(E,D),R=!0}}if(R)H.push({start:B.index,end:B.index+L.length})}if(H.length===0)return q;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${z}>${_}</script>`}),K}async function gU($,Z,Y,J,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[q,z]=W,U=z.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let _=j.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[p0.resolve(p0.dirname(Y),`${j}.stx`),p0.resolve(p0.dirname(Y),j),p0.resolve(J.componentsDir||"components",`${j}.stx`),p0.resolve(J.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),X.add(F),J.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(q,""),K.lastIndex=0}return Q}async function hU($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,q;while((q=W.exec(Q))!==null){let z=q.index,U=z+q[0].length-1,j=1,_=U+1;while(_<Q.length&&j>0){if(Q[_]==="(")j++;else if(Q[_]===")"){if(j--,j===0)break}_++}if(j!==0)break;let B=Q.substring(U+1,_),H=_+1,L=B.match(/^\s*['"]([^'"]+)['"]/);if(!L){W.lastIndex=0;continue}let F=L[1],O,V=B.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=T0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(z,H),`[Error parsing component props: ${D}]`);continue}let R="",N=H,T=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)R=T[1].trim(),N=H+T[0].length;let I=await l1(F,A,R,G,Z,Y,J,K,X);Q=Q.substring(0,z)+I+Q.substring(N),W.lastIndex=0}return Q}async function dU($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=w1(Q);return Q=W.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,yU),Q=n5(Q,W.scripts),Q;async function j(_,B,H,L){if(!_)return _;let F=_,O=lY(F,B,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?e4(w.tagName):w.tagName,R=CU(w.attributes),N=PU(R,Z,J),M=g0.getBuiltin(w.tagName),T=M?await X4(A,G,Z,Y,J):!1;if(M&&!T){let y={context:Z,filePath:Y,options:J,dependencies:X},S=M.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)S=rY(S,N.clientReactive);if(Object.keys(N.events).length>0){let k=Object.entries(N.events).map(([v,g])=>`${v}="${oY(g)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}F=F.substring(0,w.startIndex)+S+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await X4(A,G,Z,Y,J))continue;let I={};for(let[y,S]of Object.entries(N.static))I[y]=S;for(let[y,S]of Object.entries(N.serverDynamic))I[y]=S;let D=await l1(A,I,w.content,G,Z,Y,J,K,X);if(Object.keys(N.clientReactive).length>0)D=rY(D,N.clientReactive);if(Object.keys(N.events).length>0){let y=tY(D);if(y){let S=Object.entries(N.events).map(([v,g])=>`${v}="${oY(g)}"`).join(" "),k=Object.keys(N.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${k}" ${S}`+D.substring(y.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function rY($,Z){let Y=new Set(["if","for"]),J=new Set(["show"]),X=Object.entries(Z).filter(([z])=>!Y.has(z)),Q=X.filter(([z])=>!J.has(z)).map(([z])=>e4(z)).join(" "),G=$,K=X.length>0?tY(G):null;if(K){let z=X.map(([j,_])=>`:${e4(j)}="${_.replace(/"/g,"&quot;")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${z}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,"&quot;")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,"&quot;")}">${G}</template>`;return G}function tY($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let J=$.slice(Y),X=J.match(/^\s+/);if(X){Y+=X[0].length;continue}if(J.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,Y+Q[0].length);if(W===-1)return null;Y=W+K.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function Z7($,Z,Y,J,X){if(!nY)mY(),nY=!0;let Q=await aY($,Z,Y,J,X);Q=await gU(Q,Z,Y,J,X),Q=await hU(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let W=J1(Q,i5,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...W.tokens);let q=Q;if(Q=await dU(W.output,Z,Y,J,X),Q===q)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(J.debug){let K=vU(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var nY=!1,C6="\x00stx-boolean-attribute",yU,sY;var v6=b(()=>{q6();pY();iY();g1();M0();A0();yU=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"]);sY=new Map});var GJ={};a(GJ,{processLoops:()=>x6});function pU($,Z){let Y=/@component\s*\(/g,J=$,X,Q=[];while((X=Y.exec(J))!==null){let G=X.index,K=G+X[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")"){if(W--,W===0)break}q++}if(W!==0)continue;let z=J.substring(K+1,q),U=q+1,j=z.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let _=j[1],B=z.slice(j[0].length),H=B.match(/^\s*,\s*/);if(!H)continue;let L=B.slice(H[0].length).trim();if(!L)continue;try{let F=T0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;Q.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];J=J.substring(0,K)+q+J.substring(W)}return J}function Y7($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1,z=null,U=!1;while(q<J.length&&W>0){let B=J[q];if(U){U=!1,q++;continue}if(B==="\\"&&z){U=!0,q++;continue}if(z){if(B===z)z=null;q++;continue}if(B==='"'||B==="'"||B==="`"){z=B,q++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}q++}if(W!==0)break;let j=J.substring(K+1,q),_=Y(j);J=J.substring(0,G)+_+J.substring(q+1)}return J}function lU($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,X)=>{if(X in Z)return`:${X}="${X}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);k$(Q);let q=q0(Q,G)(...K),z=JSON.stringify(q),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return J}}),Y}function cU($,Z){let Y=$;return Y=Y7(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?J7:""}catch{return""}}),Y=Y7(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?X7:""}catch{return""}}),Y}function iU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,J7),Z=Z.replace(/@continue(?!\()/g,X7),Z}function $J($){let Z=$.includes(J7),Y=Z?$.substring(0,$.indexOf(J7)):$;return{hasBreak:Z,content:Y}}function ZJ($){let Z=$.includes(X7),Y=Z?$.substring(0,$.indexOf(X7)):$;return{hasContinue:Z,content:Y}}function JJ($){let Z=$;return Z=Y7(Z,"@break",(Y)=>{let J=Y.trim();if(!b$(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=Y7(Z,"@continue",(Y)=>{let J=Y.trim();if(!b$(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function nU($){let Z=/@forelse\s*\(/g,Y,J=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((z,U)=>z.pos-U.pos);let K=[],W=0;for(let z of J)W+=z.delta,K.push({pos:z.pos,depth:W});function q(z){let U=0,j=K.length-1,_=0;while(U<=j){let B=U+j>>1;if(K[B].pos<=z)_=K[B].depth,U=B+1;else j=B-1}return _}while((Y=Z.exec($))!==null){if(q(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,j=1,_=U+1,B=-1;while(_<$.length&&j>0){if($[_]==="(")j++;else if($[_]===")"){if(j--,j===0){B=_;break}}_++}if(B===-1)continue;let H=$.substring(U+1,B),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=B+1,w=1,A=V,R=/@forelse\s*\(/g,N=/@endforelse/g,M=-1;while(w>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let S=R.exec($),k=N.exec($);if(!k)break;if(S&&S.index<k.index)w++,A=S.index+S[0].length;else{if(w--,w===0){M=k.index;break}A=k.index+11}}if(M===-1)continue;let T=$.substring(V,M),I=M+11,E=-1,D=0,y=0;while(y<T.length){let S=T.indexOf("@",y);if(S===-1)break;let k=T.substring(S);if(/^@forelse\s*\(/.test(k))D++,y=S+1;else if(k.startsWith("@endforelse"))D--,y=S+11;else if(D===0&&k.startsWith("@empty")){if(T.length<=S+6||!/[a-z]/i.test(T[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:z,end:I,arrayExpr:F,itemVar:O,foreachContent:T.substring(0,E),emptyContent:T.substring(E+6)}}return null}function YJ($,Z){let Y=$;while(!0){let J=nU(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:q}=J;try{let z;if(W0(G))z=q0(G,Object.keys(Z))(...Object.values(Z));else z=Z0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=q;else U=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,X)+U+Y.substring(Q)}catch(z){let U=z instanceof Error?z.message:String(z),j=$0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,o.EVALUATION_ERROR);Y=Y.substring(0,X)+j+Y.substring(Q)}}return Y}function x6($,Z,Y,J){let X=$;X=YJ(X,Z);function Q(W){let q=/@foreach\s*\(/g,z;while((z=q.exec(W))!==null){let U=z.index,j=z.index+z[0].length-1,_=1,B=j+1,H=-1;while(B<W.length&&_>0){if(W[B]==="(")_++;else if(W[B]===")"){if(_--,_===0){H=B;break}}B++}if(H===-1)continue;let L=W.substring(j+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=U,V=L.substring(0,F),w=L.substring(F+4),A=H+1,R=1,N=A,M=/@foreach\s*\(/g,T=/@endforeach/g;while(R>0&&N<W.length){M.lastIndex=N,T.lastIndex=N;let I=M.exec(W),E=T.exec(W);if(!E)break;if(I&&I.index<E.index)R++,N=I.index+I[0].length;else{if(R--,R===0){let D=W.substring(A,E.index),y=E.index+11;return{start:O,end:y,arrayExpr:V,itemVar:w,content:D}}N=E.index+11}}}return null}function G(W,q){let z=W;while(!0){let U=Q(z);if(!U)break;let{start:j,end:_,arrayExpr:B,itemVar:H,content:L}=U;try{let F=B.trim(),O;if(W0(F))O=q0(F,Object.keys(q))(...Object.values(q));else O=Z0(F,q);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let E=$0("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);z=z.substring(0,j)+E+z.substring(_);continue}let w=J?.loops?.useAltLoopVariable??mU,A=H.trim(),R=null,N,M=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1],M=!0;else N=A}else N=A;let T="",I=O;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...q,loop:y,$loop:y};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(D))f.forEach((d,p)=>{if(d)S[d]=D[p]});else S[N]=D}else S[N]=D;if(R)if(!M&&V&&Array.isArray(D)&&D.length===2)S[R]=D[0],S[N]=D[1];else S[R]=E;let k=cU(L,S),v=ZJ(k);if(v.hasContinue){T+=v.content;continue}let g=$J(k);if(g.hasBreak){T+=g.content;break}if(k=YJ(k,S),k=G(k,S),k=r1(k,S,Y),k=iU(k),g=$J(k),g.hasBreak){T+=g.content;break}if(v=ZJ(k),v.hasContinue){T+=v.content;continue}k=A1(k,S,Y),k=lU(k,S),k=pU(k,S),T+=k}z=z.substring(0,j)+T+z.substring(_)}catch(F){let O=$0("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);z=z.substring(0,j)+O+z.substring(_)}}return z}X=G(X,Z),X=QJ(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??uU;return X=rU(X,Z,K),X}function XJ($){return b$($)}function QJ($,Z,Y,J){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,q=f0(X,"(",")",W);if(q===-1)break;let z=X.slice(W+1,q),U=q+1,j=h$(X.slice(K),"for","endfor");if(j.length===0)break;let _=j[0].content,B=K+j[0].end;if(!XJ(z)){let H=$0("For",`Unsafe expression in @for: ${z}`,o.UNSAFE_EXPRESSION);X=X.substring(0,K)+H+X.substring(B),Q=!0;continue}try{let H=oU(z),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let R=sU({forExpr:z,content:_,iterVarNames:H,context:Z,filePath:Y,options:J});X=X.substring(0,K)+R+X.substring(B),Q=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});V=JJ(V);let A=Function(...F,`
9671
+ </style>`}}});import{existsSync as fU,readFileSync as gU}from"fs";function hU($){if(pY.has($))return;pY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function dU($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(fU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return B0.resolve(Y)}catch{}return null}function uU($){if(t4.has($))return t4.get($);let Z=dU($);if(!Z)return hU($),null;try{let Y=JSON.parse(gU(Z,"utf8"));return t4.set($,Y.icons),Y.icons}catch{return null}}function T5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var t4,pY,b6;var S6=b(()=>{t4=new Map,pY=new Set;b6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=T5($,"name")??T5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=J;if(J.includes(":")){let O=J.split(":");X=O[0],Q=O[1]}let G=P0(T5($,"size")||"24"),K=P0(T5($,"color")||"currentColor"),W=P0(T5($,"class")||""),q=P0(T5($,"style")||""),z=t4.get(X)??uU(X);if(!z)return`<!-- Icon: collection "${X}" not loaded -->`;let U=z[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${X} -->`;let j=U.width||24,B=U.height||24,_=`0 0 ${j} ${B}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=W?` class="${W}"`:"",V=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${_}" fill="none"${L}${V}>${H}</svg>`}}});function lY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function cY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var y6;var P6=b(()=>{y6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=cY(Z,"fallback"),X=J.rest,Q=cY(X,"error"),G=Q.rest,K=J.region??lY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??lY($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function e4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var C6;var v6=b(()=>{C6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(e4($,"name")||"v").replace(/["'<>]/g,""),X=(e4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=e4($,"class"),G=e4($,"id"),K=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function iY(){g0.registerBuiltin(j6),g0.registerBuiltin(L6),g0.registerBuiltin(V6),g0.registerBuiltin(R6),g0.registerBuiltin(M6),g0.registerBuiltin(I6),g0.registerBuiltin(E6),g0.registerBuiltin(b6),g0.registerBuiltin(y6),g0.registerBuiltin(C6)}var nY=b(()=>{B6();F6();w6();N6();T6();D6();k6();S6();P6();v6();U6();B6();F6();w6();N6();T6();D6();k6();S6();P6();v6()});function $7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function oY($,Z,Y){let J=[],X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})`));if(!K){X=Q+1;continue}let W=K[1];if(Y&&Y.has(W.toLowerCase())){let H=Q+1+W.length;while(H<$.length&&$[H]!==">")H++;X=H+1;continue}let q=Q+1+W.length,z=null,U=q,j=-1,B=!1;while(q<$.length){let H=$[q];if(z){if(H==="\\"&&q+1<$.length){q+=2;continue}if(H===z)z=null;q++;continue}if(H==='"'||H==="'"){z=H,q++;continue}if(H==="/"&&q+1<$.length&&$[q+1]===">"){j=q+2,B=!0;break}if(H===">"){j=q+1;break}q++}if(j===-1){X=Q+1;continue}let _=$.slice(U,B?j-2:j-1).trim();if(B)J.push({fullMatch:$.slice(Q,j),tagName:W,attributes:_,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),X=j;else{let H=`<${W}`,L=`</${W}>`,V=1,O=j,F=-1;while(V>0&&O<$.length){let R=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(R!==-1&&R<N){let T=$[R+H.length];if(T===" "||T===">"||T==="/"||T===`
9672
+ `||T==="\t")V++;O=R+H.length}else{if(V--,V===0){F=N;break}O=N+L.length}}if(F===-1){X=j;continue}let w=$.slice(j,F),A=F+L.length;J.push({fullMatch:$.slice(Q,A),tagName:W,attributes:_,content:w,startIndex:Q,endIndex:A,isSelfClosing:!1}),X=A}}return J}function sY($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function rY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var aY=b(()=>{A0();M0();g1()});var XJ={};a(XJ,{processESImports:()=>YJ,processComponents:()=>Y7});import Z7 from"fs";import p0 from"path";function pU($,Z,Y){let J={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(W,q)=>q.toUpperCase())},G=(K,W)=>{let q=Q(K);if(J.static[q]=W,q!==K)J.staticNames[q]=K};for(let[K,W]of Object.entries($)){let q=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(q.startsWith("@")){J.events[q]=W;continue}if(q.startsWith("__stx_")){let z=Q(q.slice(6));J.serverDynamic[z]=rY(W,Y);continue}if(q.startsWith(":")){let z=Q(q.slice(1)),U=W===x6?z:W;if(z==="if"||z==="for"||z==="show"){J.clientReactive[z]=U;continue}try{if(!W0(U)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);J.clientReactive[z]=U;continue}let j=Object.keys(Z),_=q0(U,j)(...Object.values(Z));if(_===void 0){let H=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!j.includes(O))){J.clientReactive[z]=U;continue}}J.serverDynamic[z]=_}catch{J.clientReactive[z]=U}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let z=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let U=z[1];if(W0(U)){let B=q0(U,Object.keys(Z))(...Object.values(Z));G(q,B!=null?String(B):"")}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${U}`);G(q,W)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,U);G(q,W)}else{let U=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=j.exec(W))!==null)try{let _=B[1];if(!W0(_)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${_}`);continue}let L=q0(_,Object.keys(Z))(...Object.values(Z));U=U.replace(B[0],String(L??""))}catch(_){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,_)}G(q,U)}continue}G(q,W===x6?"true":sY(W))}return J}function lU($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let X="";while(Y<J&&!/[\s=]/.test($[Y]))X+=$[Y],Y++;if(!X)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let Q="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[X]=Q}else Z[X]=x6}return Z}function eY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function cU($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let X=J[1];if(g0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function iU($){let Z=$J.get($);if(Z)return Z;let Y=new Map,J=[p0.join($,"src"),p0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=Z7.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let q=p0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(q,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let z=W.name.slice(0,-4);if(!Y.has(z))Y.set(z,q);let U=z.toLowerCase();if(!Y.has(U))Y.set(U,q);let j=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,q)}}}for(let Q of J)if(X(Q,0),Y.size>0)break;return $J.set($,Y),Y}function nU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=p0.join(Y,"node_modules",$);try{if(Z7.statSync(J).isDirectory())return J}catch{}let X=p0.dirname(Y);if(X===Y)return null;Y=X}}async function YJ($,Z,Y,J,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=p0.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(q,z,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=U,_,H=[];while((_=j.exec(U))!==null){let[L,V,O,F]=_,w=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=p0.resolve(G,F);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(Z7.statSync(M).isFile())A=M}catch{try{if(Z7.statSync(T).isDirectory())w=T}catch{}}}}else w=nU(F,G);if(!w&&!A)continue;let R=!1,N=(T,M)=>{Q.set(T,M),Q.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,M),X.add(M)};if(O&&A)N(O,A),R=!0;else if(V){let T=V.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),M=w?iU(w):null;for(let{source:I,local:E}of T){let D=null;if(A)D=A;else if(M)D=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)N(E,D),R=!0}}if(R)H.push({start:_.index,end:_.index+L.length})}if(H.length===0)return q;for(let L=H.length-1;L>=0;L--)B=B.slice(0,H[L].start)+B.slice(H[L].end);return`<script${z}>${B}</script>`}),K}async function oU($,Z,Y,J,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[q,z]=W,U=z.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let B=j.split("/"),H=B[B.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),V=null,O=[p0.resolve(p0.dirname(Y),`${j}.stx`),p0.resolve(p0.dirname(Y),j),p0.resolve(J.componentsDir||"components",`${j}.stx`),p0.resolve(J.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(L,V),G.set(H,V),G.set(H.toLowerCase(),V);let F=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),X.add(V),J.debug)console.log(`Imported component: ${L} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(q,""),K.lastIndex=0}return Q}async function sU($,Z,Y,J,X){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,q;while((q=W.exec(Q))!==null){let z=q.index,U=z+q[0].length-1,j=1,B=U+1;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")"){if(j--,j===0)break}B++}if(j!==0)break;let _=Q.substring(U+1,B),H=B+1,L=_.match(/^\s*['"]([^'"]+)['"]/);if(!L){W.lastIndex=0;continue}let V=L[1],O,F=_.slice(L[0].length),w=F.match(/^\s*,\s*/);if(w)O=F.slice(w[0].length).trim();let A={};if(O)try{A=T0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(z,H),`[Error parsing component props: ${D}]`);continue}let R="",N=H,M=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)R=M[1].trim(),N=H+M[0].length;let I=await l1(V,A,R,G,Z,Y,J,K,X);Q=Q.substring(0,z)+I+Q.substring(N),W.lastIndex=0}return Q}async function rU($,Z,Y,J,X){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=w1(Q);return Q=W.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,mU),Q=o5(Q,W.scripts),Q;async function j(B,_,H,L){if(!B)return B;let V=B,O=oY(V,_,L);for(let F=O.length-1;F>=0;F--){let w=O[F],A=H?$7(w.tagName):w.tagName,R=lU(w.attributes),N=pU(R,Z,J),T=g0.getBuiltin(w.tagName),M=T?await Q4(A,G,Z,Y,J):!1;if(T&&!M){let y={context:Z,filePath:Y,options:J,dependencies:X},S=T.render(N,w.content,y);if(Object.keys(N.clientReactive).length>0)S=ZJ(S,N.clientReactive);if(Object.keys(N.events).length>0){let k=Object.entries(N.events).map(([C,g])=>`${C}="${eY(g)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}V=V.substring(0,w.startIndex)+S+V.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await Q4(A,G,Z,Y,J))continue;let I={};for(let[y,S]of Object.entries(N.static))I[y]=S;for(let[y,S]of Object.entries(N.serverDynamic))I[y]=S;let D=await l1(A,I,w.content,G,Z,Y,J,K,X);if(Object.keys(N.clientReactive).length>0)D=ZJ(D,N.clientReactive);if(Object.keys(N.events).length>0){let y=JJ(D);if(y){let S=Object.entries(N.events).map(([C,g])=>`${C}="${eY(g)}"`).join(" "),k=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${k}" ${S}`+D.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+D+V.substring(w.endIndex)}return V}}function ZJ($,Z){let Y=new Set(["if","for"]),J=new Set(["show"]),X=Object.entries(Z).filter(([z])=>!Y.has(z)),Q=X.filter(([z])=>!J.has(z)).map(([z])=>$7(z)).join(" "),G=$,K=X.length>0?JJ(G):null;if(K){let z=X.map(([j,B])=>`:${$7(j)}="${B.replace(/"/g,"&quot;")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${z}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,"&quot;")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,"&quot;")}">${G}</template>`;return G}function JJ($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let J=$.slice(Y),X=J.match(/^\s+/);if(X){Y+=X[0].length;continue}if(J.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,Y+Q[0].length);if(W===-1)return null;Y=W+K.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function Y7($,Z,Y,J,X){if(!tY)iY(),tY=!0;let Q=await YJ($,Z,Y,J,X);Q=await oU(Q,Z,Y,J,X),Q=await sU(Q,Z,Y,J,X);let G=[];for(let K=0;K<3;K++){let W=J1(Q,n5,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...W.tokens);let q=Q;if(Q=await rU(W.output,Z,Y,J,X),Q===q)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(J.debug){let K=cU(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var tY=!1,x6="\x00stx-boolean-attribute",mU,$J;var f6=b(()=>{U6();nY();aY();g1();M0();A0();mU=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"]);$J=new Map});var UJ={};a(UJ,{processLoops:()=>g6});function eU($,Z){let Y=/@component\s*\(/g,J=$,X,Q=[];while((X=Y.exec(J))!==null){let G=X.index,K=G+X[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")"){if(W--,W===0)break}q++}if(W!==0)continue;let z=J.substring(K+1,q),U=q+1,j=z.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let B=j[1],_=z.slice(j[0].length),H=_.match(/^\s*,\s*/);if(!H)continue;let L=_.slice(H[0].length).trim();if(!L)continue;try{let V=T0(L,Z),O=JSON.stringify(V),F=`@component('${B}', ${O})`;Q.push({start:G,end:U,replacement:F})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];J=J.substring(0,K)+q+J.substring(W)}return J}function J7($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1,z=null,U=!1;while(q<J.length&&W>0){let _=J[q];if(U){U=!1,q++;continue}if(_==="\\"&&z){U=!0,q++;continue}if(z){if(_===z)z=null;q++;continue}if(_==='"'||_==="'"||_==="`"){z=_,q++;continue}if(_==="(")W++;else if(_===")"){if(W--,W===0)break}q++}if(W!==0)break;let j=J.substring(K+1,q),B=Y(j);J=J.substring(0,G)+B+J.substring(q+1)}return J}function $j($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,X)=>{if(X in Z)return`:${X}="${X}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);b$(Q);let q=q0(Q,G)(...K),z=JSON.stringify(q),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return J}}),Y}function Zj($,Z){let Y=$;return Y=J7(Y,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?X7:""}catch{return""}}),Y=J7(Y,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?Q7:""}catch{return""}}),Y}function Yj($){let Z=$;return Z=Z.replace(/@break(?!\()/g,X7),Z=Z.replace(/@continue(?!\()/g,Q7),Z}function QJ($){let Z=$.includes(X7),Y=Z?$.substring(0,$.indexOf(X7)):$;return{hasBreak:Z,content:Y}}function GJ($){let Z=$.includes(Q7),Y=Z?$.substring(0,$.indexOf(Q7)):$;return{hasContinue:Z,content:Y}}function WJ($){let Z=$;return Z=J7(Z,"@break",(Y)=>{let J=Y.trim();if(!S$(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=J7(Z,"@continue",(Y)=>{let J=Y.trim();if(!S$(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function Jj($){let Z=/@forelse\s*\(/g,Y,J=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((z,U)=>z.pos-U.pos);let K=[],W=0;for(let z of J)W+=z.delta,K.push({pos:z.pos,depth:W});function q(z){let U=0,j=K.length-1,B=0;while(U<=j){let _=U+j>>1;if(K[_].pos<=z)B=K[_].depth,U=_+1;else j=_-1}return B}while((Y=Z.exec($))!==null){if(q(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,j=1,B=U+1,_=-1;while(B<$.length&&j>0){if($[B]==="(")j++;else if($[B]===")"){if(j--,j===0){_=B;break}}B++}if(_===-1)continue;let H=$.substring(U+1,_),L=H.indexOf(" as ");if(L===-1)continue;let V=H.substring(0,L).trim(),O=H.substring(L+4).trim(),F=_+1,w=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let S=R.exec($),k=N.exec($);if(!k)break;if(S&&S.index<k.index)w++,A=S.index+S[0].length;else{if(w--,w===0){T=k.index;break}A=k.index+11}}if(T===-1)continue;let M=$.substring(F,T),I=T+11,E=-1,D=0,y=0;while(y<M.length){let S=M.indexOf("@",y);if(S===-1)break;let k=M.substring(S);if(/^@forelse\s*\(/.test(k))D++,y=S+1;else if(k.startsWith("@endforelse"))D--,y=S+11;else if(D===0&&k.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:z,end:I,arrayExpr:V,itemVar:O,foreachContent:M.substring(0,E),emptyContent:M.substring(E+6)}}return null}function KJ($,Z){let Y=$;while(!0){let J=Jj(Y);if(!J)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:q}=J;try{let z;if(W0(G))z=q0(G,Object.keys(Z))(...Object.values(Z));else z=Z0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=q;else U=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,X)+U+Y.substring(Q)}catch(z){let U=z instanceof Error?z.message:String(z),j=$0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,X)+j+Y.substring(Q)}}return Y}function g6($,Z,Y,J){let X=$;X=KJ(X,Z);function Q(W){let q=/@foreach\s*\(/g,z;while((z=q.exec(W))!==null){let U=z.index,j=z.index+z[0].length-1,B=1,_=j+1,H=-1;while(_<W.length&&B>0){if(W[_]==="(")B++;else if(W[_]===")"){if(B--,B===0){H=_;break}}_++}if(H===-1)continue;let L=W.substring(j+1,H),V=L.indexOf(" as ");if(V===-1)continue;let O=U,F=L.substring(0,V),w=L.substring(V+4),A=H+1,R=1,N=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(R>0&&N<W.length){T.lastIndex=N,M.lastIndex=N;let I=T.exec(W),E=M.exec(W);if(!E)break;if(I&&I.index<E.index)R++,N=I.index+I[0].length;else{if(R--,R===0){let D=W.substring(A,E.index),y=E.index+11;return{start:O,end:y,arrayExpr:F,itemVar:w,content:D}}N=E.index+11}}}return null}function G(W,q){let z=W;while(!0){let U=Q(z);if(!U)break;let{start:j,end:B,arrayExpr:_,itemVar:H,content:L}=U;try{let V=_.trim(),O;if(W0(V))O=q0(V,Object.keys(q))(...Object.values(q));else O=Z0(V,q);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{let E=$0("Foreach",`Error in @foreach: ${V} is not iterable`,s.TYPE_ERROR);z=z.substring(0,j)+E+z.substring(B);continue}let w=J?.loops?.useAltLoopVariable??tU,A=H.trim(),R=null,N,T=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1],T=!0;else N=A}else N=A;let M="",I=O;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...q,loop:y,$loop:y};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(D))f.forEach((d,p)=>{if(d)S[d]=D[p]});else S[N]=D}else S[N]=D;if(R)if(!T&&F&&Array.isArray(D)&&D.length===2)S[R]=D[0],S[N]=D[1];else S[R]=E;let k=Zj(L,S),C=GJ(k);if(C.hasContinue){M+=C.content;continue}let g=QJ(k);if(g.hasBreak){M+=g.content;break}if(k=KJ(k,S),k=G(k,S),k=r1(k,S,Y),k=Yj(k),g=QJ(k),g.hasBreak){M+=g.content;break}if(C=GJ(k),C.hasContinue){M+=C.content;continue}k=A1(k,S,Y),k=$j(k,S),k=eU(k,S),M+=k}z=z.substring(0,j)+M+z.substring(B)}catch(V){let O=$0("Foreach",`Error in @foreach(${_.trim()} as ${H.trim()}): ${V instanceof Error?V.message:String(V)}`,s.EVALUATION_ERROR);z=z.substring(0,j)+O+z.substring(B)}}return z}X=G(X,Z),X=zJ(X,Z,Y,J);let K=J?.loops?.maxWhileIterations??aU;return X=Gj(X,Z,K),X}function qJ($){return S$($)}function zJ($,Z,Y,J){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,q=f0(X,"(",")",W);if(q===-1)break;let z=X.slice(W+1,q),U=q+1,j=d$(X.slice(K),"for","endfor");if(j.length===0)break;let B=j[0].content,_=K+j[0].end;if(!qJ(z)){let H=$0("For",`Unsafe expression in @for: ${z}`,s.UNSAFE_EXPRESSION);X=X.substring(0,K)+H+X.substring(_),Q=!0;continue}try{let H=Xj(z),L=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(H.length>0&&L){let R=Qj({forExpr:z,content:B,iterVarNames:H,context:Z,filePath:Y,options:J});X=X.substring(0,K)+R+X.substring(_),Q=!0;continue}let V=Object.keys(Z),O=Object.values(Z),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=WJ(F);let A=Function(...V,`
9436
9673
  let result = '';
9437
9674
  for (${z}) {
9438
- result += \`${V}\`;
9675
+ result += \`${F}\`;
9439
9676
  }
9440
9677
  return result;
9441
- `)(...O);X=X.substring(0,K)+A+X.substring(B),Q=!0}catch(H){let L=$0("For",`Error in @for(${z}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);X=X.substring(0,K)+L+X.substring(B),Q=!0}}return X}function oU($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let Q=Y[1];return Q.slice(1,-1).split(",").map((K)=>{let W=K.trim();if(!W)return"";let q=W.indexOf(":");if(q>=0&&Q.startsWith("{")){let j=W.slice(q+1).trim(),_=j.indexOf("=");return(_>=0?j.slice(0,_):j).trim()}let z=W.indexOf("="),U=(z>=0?W.slice(0,z):W).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(X)return[X[1]];return[]}function sU($){let{forExpr:Z,content:Y,iterVarNames:J,context:X,filePath:Q,options:G}=$,K=Object.keys(X),W=Object.values(X),q=Function(...K,"__pushIter",`
9678
+ `)(...O);X=X.substring(0,K)+A+X.substring(_),Q=!0}catch(H){let L=$0("For",`Error in @for(${z}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);X=X.substring(0,K)+L+X.substring(_),Q=!0}}return X}function Xj($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let Q=Y[1];return Q.slice(1,-1).split(",").map((K)=>{let W=K.trim();if(!W)return"";let q=W.indexOf(":");if(q>=0&&Q.startsWith("{")){let j=W.slice(q+1).trim(),B=j.indexOf("=");return(B>=0?j.slice(0,B):j).trim()}let z=W.indexOf("="),U=(z>=0?W.slice(0,z):W).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(X)return[X[1]];return[]}function Qj($){let{forExpr:Z,content:Y,iterVarNames:J,context:X,filePath:Q,options:G}=$,K=Object.keys(X),W=Object.values(X),q=Function(...K,"__pushIter",`
9442
9679
  for (${Z}) {
9443
9680
  __pushIter([${J.join(", ")}])
9444
9681
  }
9445
- `),z=[];q(...W,(_)=>{z.push(_)});let U=Q??"inline.stx",j="";for(let _ of z){let B={...X};J.forEach((L,F)=>{B[L]=_[F]});let H=QJ(Y,B,Q,G);H=r1(H,B,U),H=A1(H,B,U),j+=H}return j}function rU($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,W=f0(J,"(",")",K);if(W===-1)break;let q=J.slice(K+1,W),z=h$(J.slice(G),"while","endwhile");if(z.length===0)break;let U=z[0].content,j=G+z[0].end;if(!XJ(q)){let _=$0("While",`Unsafe expression in @while: ${q}`,o.UNSAFE_EXPRESSION);J=J.substring(0,G)+_+J.substring(j),X=!0;continue}try{let _=Object.keys(Z),B=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=JJ(H);let F=Function(..._,`
9682
+ `),z=[];q(...W,(B)=>{z.push(B)});let U=Q??"inline.stx",j="";for(let B of z){let _={...X};J.forEach((L,V)=>{_[L]=B[V]});let H=zJ(Y,_,Q,G);H=r1(H,_,U),H=A1(H,_,U),j+=H}return j}function Gj($,Z,Y){let J=$,X=!0;while(X){X=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,W=f0(J,"(",")",K);if(W===-1)break;let q=J.slice(K+1,W),z=d$(J.slice(G),"while","endwhile");if(z.length===0)break;let U=z[0].content,j=G+z[0].end;if(!qJ(q)){let B=$0("While",`Unsafe expression in @while: ${q}`,s.UNSAFE_EXPRESSION);J=J.substring(0,G)+B+J.substring(j),X=!0;continue}try{let B=Object.keys(Z),_=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});H=WJ(H);let V=Function(...B,`
9446
9683
  let result = '';
9447
9684
  let maxIterations = ${Y}; // Configurable safety limit
9448
9685
  let counter = 0;
@@ -9454,8 +9691,8 @@ ${D}
9454
9691
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
9455
9692
  }
9456
9693
  return result;
9457
- `)(...B);J=J.substring(0,G)+F+J.substring(j),X=!0}catch(_){let B=$0("While",`Error in @while(${q}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);J=J.substring(0,G)+B+J.substring(j),X=!0}}return J}var uU=1000,mU=!1,J7="<!--__STX_BREAK__-->",X7="<!--__STX_CONTINUE__-->";var f6=b(()=>{p4();U1();X1();d$();A0()});import B0 from"path";function g6($,Z){let Y=0;for(let J=Z;J<$.length;J++){let X=$[J];if(X==="("||X==="["||X==="{")Y++;else if(X===")"||X==="]"||X==="}")Y--;else if(X===","&&Y===0)return J}return-1}function aU($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=X.exec(J);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")")W--;q++}if(W!==0)break;let z=J.substring(K+1,q-1),U=`${Y}(${z})`;J=J.substring(0,G)+U+J.substring(q),X.lastIndex=G+U.length,Q=X.exec(J)}return J}function tU($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function WJ($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
9458
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(X!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Y.push(B),J.add(B);return}let j=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Y.push(B),J.add(B);return}let _=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let B=_[1];if(!J.has(B))Y.push(B),J.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){W();continue}if(Z[Q]==="{"){X++,Q++;continue}if(Z[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))z();Q++}return Y.join(", ")}function qJ($,Z=""){let Y=WJ($).split(",").map((J)=>J.trim()).filter(Boolean);return`
9694
+ `)(..._);J=J.substring(0,G)+V+J.substring(j),X=!0}catch(B){let _=$0("While",`Error in @while(${q}): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR);J=J.substring(0,G)+_+J.substring(j),X=!0}}return J}var aU=1000,tU=!1,X7="<!--__STX_BREAK__-->",Q7="<!--__STX_CONTINUE__-->";var h6=b(()=>{l4();U1();X1();u$();A0()});import _0 from"path";function d6($,Z){let Y=0;for(let J=Z;J<$.length;J++){let X=$[J];if(X==="("||X==="["||X==="{")Y++;else if(X===")"||X==="]"||X==="}")Y--;else if(X===","&&Y===0)return J}return-1}function Kj($,Z,Y){let J=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=X.exec(J);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<J.length&&W>0){if(J[q]==="(")W++;else if(J[q]===")")W--;q++}if(W!==0)break;let z=J.substring(K+1,q-1),U=`${Y}(${z})`;J=J.substring(0,G)+U+J.substring(q),X.lastIndex=G+U.length,Q=X.exec(J)}return J}function Wj($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function BJ($){let Z=$,Y=[],J=new Set,X=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
9695
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(X!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let _=U[2];if(!J.has(_))Y.push(_),J.add(_);return}let j=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let _=j[1];if(!J.has(_))Y.push(_),J.add(_);return}let B=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let _=B[1];if(!J.has(_))Y.push(_),J.add(_)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){W();continue}if(Z[Q]==="{"){X++,Q++;continue}if(Z[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))z();Q++}return Y.join(", ")}function _J($,Z=""){let Y=BJ($).split(",").map((J)=>J.trim()).filter(Boolean);return`
9459
9696
  (function() {
9460
9697
  ${q5("var",Y)}
9461
9698
  var __destroyHooks = [];
@@ -9464,11 +9701,11 @@ ${D}
9464
9701
 
9465
9702
  ${$}
9466
9703
  ${Z}})();
9467
- `}function zJ($,Z){return`
9704
+ `}function HJ($,Z){return`
9468
9705
  // Register scope variables for STX runtime
9469
9706
  if (!window.stx._scopes) window.stx._scopes = {};
9470
9707
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
9471
- ${WJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
9708
+ ${BJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
9472
9709
  `)}
9473
9710
  // #1767: when the bundler renamed a component const that collided with an
9474
9711
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -9476,7 +9713,7 @@ ${WJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
9476
9713
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
9477
9714
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
9478
9715
  window.stx._scopes['${Z}'] = __scopeRegistration;
9479
- `}function eU($,Z){let Y=zJ($,Z),J=`
9716
+ `}function qj($,Z){let Y=HJ($,Z),J=`
9480
9717
  (function() {
9481
9718
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
9482
9719
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -9485,70 +9722,71 @@ ${WJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
9485
9722
  } finally {
9486
9723
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
9487
9724
  }
9488
- })();`;return J+qJ($,Y)+`
9725
+ })();`;return J+_J($,Y)+`
9489
9726
  } finally {
9490
9727
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
9491
9728
  }
9492
- })();`}function $j($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let X=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function Yj($){if($.__onceStore instanceof Set)return $.__onceStore;return Zj}async function h6($,Z,Y,J,X,Q=new Set){let G=J.partialsDir||B0.join(B0.dirname(Y),"partials");if(G&&!B0.isAbsolute(G))G=B0.resolve(process.cwd(),G);let K=aU($,"@partial","@include"),W=Yj(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(W.has(O))return"";return W.add(O),H});{let B=/@includeIf\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){B.lastIndex=V;continue}let R=A[1],N=q(R,G,Y),M="";if(N&&await Bun.file(N).exists())X.add(N),M=`@include(${w})`;K=K.substring(0,L)+M+K.substring(V),B.lastIndex=0}}for(let[B,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,A=V+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let R=K.substring(V+1,A-1),N=g6(R,0);if(N===-1){L.lastIndex=A;continue}let M=R.substring(0,N).trim(),T=R.substring(N+1).trim(),I=T.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let E=I[1],D=T.substring(I[0].length),y,S=g6(D,0);if(S!==-1)y=D.substring(S+1).trim();try{let k=`Boolean(${M})`,v;if(W0(k)){let d=q0(k,Object.keys(Z));v=Boolean(d(...Object.values(Z)))}else v=Boolean(Z0(k,Z));let g=H?!v:v,f="";if(g){let d=q(E,G,Y);if(d&&await Bun.file(d).exists())X.add(d);f=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,O)+f+K.substring(A),L.lastIndex=0}catch(k){let v=k instanceof Error?k.message:String(k),g=U0("Include",`Error evaluating ${B} condition: ${v}`,Y,$,O);K=K.substring(0,O)+g+K.substring(A),L.lastIndex=0}}}{let B=/@each\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),R=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){B.lastIndex=0,K=K.replace(A,"");continue}let[,N,M,T,I]=R;try{let E,D=M.trim();if(W0(D))E=q0(D,Object.keys(Z))(...Object.values(Z));else E=Z0(D,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let k={...Z,[T]:S},v=await U(N,k,$,L);y+=v}else if(I)y=await U(I,{},$,L);K=K.substring(0,L)+y+K.substring(V+1),B.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+U0("Each",`Error in @each: ${D}`,Y,$,L)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,H;while((H=B.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),R=w.match(/^\s*(\[[^\]]+\])/);if(!R){B.lastIndex=0,K=K.replace(A,"");continue}let N=R[1],M=w.slice(R[0].length),T,I=M.match(/^\s*,\s*\{/);if(I){M=M.slice(I[0].length-1);let y=1,S=1;while(S<M.length&&y>0){if(M[S]==="{")y++;else if(M[S]==="}"){if(y--,y===0)break}S++}T=M.substring(0,S+1),M=M.slice(S+1)}let E,D=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let y=JSON.parse(N.replace(/'/g,'"')),S={};if(T)try{S=T0(T,Z)}catch(v){let g=v instanceof Error?v.message:String(v);if(J.debug){let f=U0("Include",`Error parsing includeFirst variables: ${g}`,Y,$,L,A);K=K.replace(A,()=>f)}else K=K.replace(A,()=>E||"");continue}let k=!1;for(let v of y){let g=q(v,G,Y);if(!g)continue;if(await c(g)){let f=await U(v,S,$,L);K=K.replace(A,()=>f),k=!0;break}}if(!k)if(E!==void 0)K=K.replace(A,()=>E);else if(J.debug){let v=U0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,A);K=K.replace(A,()=>v)}else K=K.replace(A,"")}catch(y){let S=y instanceof Error?y.message:String(y),k=U0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>k)}B.lastIndex=0}}function q(B,H,L){try{let F=B;if(!B.endsWith(".stx"))F=`${B}.stx`;let O=B0.resolve(H),V=B0.resolve(B0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=B0.resolve(H,F);else w=B0.resolve(V,F);let A=B0.normalize(w),R=A.startsWith(O+B0.sep)||A===O,N=A.startsWith(V+B0.sep)||A===V,M=!1,T=B0.dirname(V);if(A.startsWith(T+B0.sep)){if(!B0.relative(T,A).split(B0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))M=!0}if(!R&&!N&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${B}: ${F}`),null}}let z=B0.resolve(Y);Q.add(z);async function U(B,H={},L,F){let O=q(B,G,Y);if(!O)return U0("Include",`Could not resolve path for include: ${B}`,Y,L,F);let V=B0.resolve(O);if(Q.has(V)){let w=[...Q,V].map((A)=>B0.basename(A)).join(" -> ");return U0("Include",`Circular include detected: ${w}`,Y,L,F)}try{X.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(f){let d=f instanceof Error?f.message:String(f);return U0("Include",`Error loading include file ${B}: ${d}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (Q6(),X6));w=f(w,Z)}if(w&&(J.debug||!G$()&&!b4()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (K6(),kY));f(w,O)}catch{}let A=w;try{let{processESImports:f}=await Promise.resolve().then(() => (v6(),eY));await f(w,Z,O,J,X)}catch(f){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let R=v$(A);if(R)A=R.content.trim();let M=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(M)T=`<style${M[1]}>${M[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[f,d]of Object.entries(H))I[f]=d;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(E)],y="",S=null;for(let f of D){let d=f[1]||"",p=f[2]||"",Q0=d.includes("server"),Y0=x1(d),w0="";try{let{extractAndStripCssImports:G0,renderVendorStyleTags:b0}=await Promise.resolve().then(() => (c5(),v9)),o0=G0(p,{filePath:O,projectRoot:process.cwd()});p=o0.code,w0=b0(o0.styles)}catch(G0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,G0 instanceof Error?G0.message:G0)}if(Y0&&p.trim())p=f1(p);if(!Q0)try{let{hasUserImports:G0,bundleClientScript:b0}=await Promise.resolve().then(() => (u5(),d5));if(G0(p))p=await b0(p,O,{projectRoot:process.cwd()})}catch(G0){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,G0 instanceof Error?G0.message:G0)}let s=tU(p);if(s&&!Q0){S=`stx_scope_${B0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++KJ}`;let G0=r0(p),b0=eU(G0,S);y+=`${w0}<script data-stx-scoped>${b0}</script>
9493
- `;continue}if(Q0)try{let{extractVariables:G0}=await Promise.resolve().then(() => (e5(),g$));await G0(p,I,O)}catch(G0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,G0)}if(!Q0&&!s){let G0=d.replace(/\bclient\b/i,"").trim();S=`stx_scope_${B0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++KJ}`;let b0=r0(p),o0=zJ(b0,S),H1=qJ(b0,o0);y+=`${w0}<script data-stx-scoped${G0?` ${G0}`:""}>${H1}</script>
9494
- `}}if(S){let f=$j(A,S);if(A=f.html,f.mergedIntoExisting)y=y.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),S=f.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await h6(A,I,O,J,X,Q);let{processLoops:k}=await Promise.resolve().then(() => (f6(),GJ)),v=k(A,I,O);v=r1(v,I,O);let g=W5(w);if(v=A1(v,I,O,{forceSignals:g}),T)v+=`
9495
- `+T;if(y)v+=`
9496
- `+y;return v}catch(w){let A=w instanceof Error?w.message:String(w);return U0("Include",`Error processing include ${B}: ${A}`,Y,L,F)}}let j=/@include\s*\(/g,_;while((_=j.exec(K))!==null){let B=_.index,H=B+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(B,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=F;continue}let A=w[1],R,N=V.substring(w[0].length),M=g6(N,0);if(M!==-1)R=N.substring(M+1).trim();let T={};if(R)try{T=T0(R,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(O,U0("Include",`Error parsing include variables for ${A}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let I=await U(A,T,$,B);K=K.substring(0,B)+I+K.substring(F),j.lastIndex=0}return K}function d6($,Z){let Y=$;function J(X,Q,G,K){let W=X,q=!0;while(q){q=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=W.match(z);if(!U||U.index===void 0)break;let j=U.index,_=U[1],B=j+U[0].length,H=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=B,V=-1;while(F>0&&O<W.length){let A=W.slice(O),R=A.match(H),N=A.match(L),M=R?O+R.index:1/0,T=N?O+N.index:1/0;if(M<T)F++,O=M+(R[0].length||1);else if(T<1/0){if(F--,F===0){V=T;break}O=T+G.length+1}else break}if(V===-1)break;let w=W.slice(B,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(w);else Z[_].push(w);W=W.substring(0,j)+W.substring(V+`@${G}`.length),q=!0}return W}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function u6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
9497
- `)})}var KJ=0,EA,Zj;var UJ=b(()=>{I7();p4();X1();r5();j5();A0();M0();EA=new h1(500),Zj=new Set});import*as m6 from"path";async function jJ($,Z,Y=""){if(m6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return BJ($,Z,Y,"@js","@endjs")}async function _J($,Z,Y=""){if(m6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return BJ($,Z,Y,"@ts","@endts")}async function BJ($,Z,Y,J,X){let Q=$,G=U5(`${J}([\\s\\S]*?)${X}`,"g"),K=[],W;while((W=G.exec($))!==null)K.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:q,content:z,index:U}of K)try{let j={...Z,global:Z},_=Object.keys(j),B=Object.values(j),H=z.trim();if(J==="@ts")H=H.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=(H.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=F.length>0?`return { ${F.join(", ")} };`:"return {};",V=`
9729
+ })();`}function zj($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let X=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function jj($){if($.__onceStore instanceof Set)return $.__onceStore;return Uj}async function u6($,Z,Y,J,X,Q=new Set){let G=J.partialsDir||_0.join(_0.dirname(Y),"partials");if(G&&!_0.isAbsolute(G))G=_0.resolve(process.cwd(),G);let K=Kj($,"@partial","@include"),W=jj(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(_,H,L)=>{let V=H.trim(),O=`${Y}:${V}`;if(W.has(O))return"";return W.add(O),H});{let _=/@includeIf\s*\(/g,H;while((H=_.exec(K))!==null){let L=H.index,V=L+H[0].length-1,O=1,F=V+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let w=K.substring(V+1,F-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){_.lastIndex=F;continue}let R=A[1],N=q(R,G,Y),T="";if(N&&await Bun.file(N).exists())X.add(N),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(F),_.lastIndex=0}}for(let[_,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),V;while((V=L.exec(K))!==null){let O=V.index,F=O+V[0].length-1,w=1,A=F+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let R=K.substring(F+1,A-1),N=d6(R,0);if(N===-1){L.lastIndex=A;continue}let T=R.substring(0,N).trim(),M=R.substring(N+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let E=I[1],D=M.substring(I[0].length),y,S=d6(D,0);if(S!==-1)y=D.substring(S+1).trim();try{let k=`Boolean(${T})`,C;if(W0(k)){let d=q0(k,Object.keys(Z));C=Boolean(d(...Object.values(Z)))}else C=Boolean(Z0(k,Z));let g=H?!C:C,f="";if(g){let d=q(E,G,Y);if(d&&await Bun.file(d).exists())X.add(d);f=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,O)+f+K.substring(A),L.lastIndex=0}catch(k){let C=k instanceof Error?k.message:String(k),g=U0("Include",`Error evaluating ${_} condition: ${C}`,Y,$,O);K=K.substring(0,O)+g+K.substring(A),L.lastIndex=0}}}{let _=/@each\s*\(/g,H;while((H=_.exec(K))!==null){let L=H.index,V=L+H[0].length-1,O=1,F=V+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let w=K.substring(V+1,F),A=K.substring(L,F+1),R=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){_.lastIndex=0,K=K.replace(A,"");continue}let[,N,T,M,I]=R;try{let E,D=T.trim();if(W0(D))E=q0(D,Object.keys(Z))(...Object.values(Z));else E=Z0(D,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let k={...Z,[M]:S},C=await U(N,k,$,L);y+=C}else if(I)y=await U(I,{},$,L);K=K.substring(0,L)+y+K.substring(F+1),_.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+U0("Each",`Error in @each: ${D}`,Y,$,L)+K.substring(F+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,H;while((H=_.exec(K))!==null){let L=H.index,V=L+H[0].length-1,O=1,F=V+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let w=K.substring(V+1,F),A=K.substring(L,F+1),R=w.match(/^\s*(\[[^\]]+\])/);if(!R){_.lastIndex=0,K=K.replace(A,"");continue}let N=R[1],T=w.slice(R[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[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++}M=T.substring(0,S+1),T=T.slice(S+1)}let E,D=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let y=JSON.parse(N.replace(/'/g,'"')),S={};if(M)try{S=T0(M,Z)}catch(C){let g=C instanceof Error?C.message:String(C);if(J.debug){let f=U0("Include",`Error parsing includeFirst variables: ${g}`,Y,$,L,A);K=K.replace(A,()=>f)}else K=K.replace(A,()=>E||"");continue}let k=!1;for(let C of y){let g=q(C,G,Y);if(!g)continue;if(await c(g)){let f=await U(C,S,$,L);K=K.replace(A,()=>f),k=!0;break}}if(!k)if(E!==void 0)K=K.replace(A,()=>E);else if(J.debug){let C=U0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,A);K=K.replace(A,()=>C)}else K=K.replace(A,"")}catch(y){let S=y instanceof Error?y.message:String(y),k=U0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>k)}_.lastIndex=0}}function q(_,H,L){try{let V=_;if(!_.endsWith(".stx"))V=`${_}.stx`;let O=_0.resolve(H),F=_0.resolve(_0.dirname(L)),w;if(!V.startsWith("./")&&!V.startsWith("../"))w=_0.resolve(H,V);else w=_0.resolve(F,V);let A=_0.normalize(w),R=A.startsWith(O+_0.sep)||A===O,N=A.startsWith(F+_0.sep)||A===F,T=!1,M=_0.dirname(F);if(A.startsWith(M+_0.sep)){if(!_0.relative(M,A).split(_0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))T=!0}if(!R&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${F}`),null;return A}catch(V){return console.error(`Error resolving path ${_}: ${V}`),null}}let z=_0.resolve(Y);Q.add(z);async function U(_,H={},L,V){let O=q(_,G,Y);if(!O)return U0("Include",`Could not resolve path for include: ${_}`,Y,L,V);let F=_0.resolve(O);if(Q.has(F)){let w=[...Q,F].map((A)=>_0.basename(A)).join(" -> ");return U0("Include",`Circular include detected: ${w}`,Y,L,V)}try{X.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(f){let d=f instanceof Error?f.message:String(f);return U0("Include",`Error loading include file ${_}: ${d}`,Y,L,V)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (K6(),G6));w=f(w,Z)}if(w&&(J.debug||!K$()&&!S4()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (q6(),PY));f(w,O)}catch{}let A=w;try{let{processESImports:f}=await Promise.resolve().then(() => (f6(),XJ));await f(w,Z,O,J,X)}catch(f){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let R=x$(A);if(R)A=R.content.trim();let T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[f,d]of Object.entries(H))I[f]=d;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(E)],y="",S=null;for(let f of D){let d=f[1]||"",p=f[2]||"",Q0=d.includes("server"),Y0=x1(d),w0="";try{let{extractAndStripCssImports:G0,renderVendorStyleTags:b0}=await Promise.resolve().then(() => (i5(),g9)),o0=G0(p,{filePath:O,projectRoot:process.cwd()});p=o0.code,w0=b0(o0.styles)}catch(G0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,G0 instanceof Error?G0.message:G0)}if(Y0&&p.trim())p=f1(p);if(!Q0)try{let{hasUserImports:G0,bundleClientScript:b0}=await Promise.resolve().then(() => (m5(),u5));if(G0(p))p=await b0(p,O,{projectRoot:process.cwd()})}catch(G0){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,G0 instanceof Error?G0.message:G0)}let r=Wj(p);if(r&&!Q0){S=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++jJ}`;let G0=r0(p),b0=qj(G0,S);y+=`${w0}<script data-stx-scoped data-stx-run="always">${b0}</script>
9730
+ `;continue}if(Q0)try{let{extractVariables:G0}=await Promise.resolve().then(() => ($$(),h$));await G0(p,I,O)}catch(G0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,G0)}if(!Q0&&!r){let G0=d.replace(/\bclient\b/i,"").trim();S=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++jJ}`;let b0=r0(p),o0=HJ(b0,S),H1=_J(b0,o0);y+=`${w0}<script data-stx-scoped data-stx-run="always"${G0?` ${G0}`:""}>${H1}</script>
9731
+ `}}if(S){let f=zj(A,S);if(A=f.html,f.mergedIntoExisting)y=y.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),S=f.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await u6(A,I,O,J,X,Q);let{processLoops:k}=await Promise.resolve().then(() => (h6(),UJ)),C=k(A,I,O);C=r1(C,I,O);let g=W5(w);if(C=A1(C,I,O,{forceSignals:g}),M)C+=`
9732
+ `+M;if(y)C+=`
9733
+ `+y;return C}catch(w){let A=w instanceof Error?w.message:String(w);return U0("Include",`Error processing include ${_}: ${A}`,Y,L,V)}}let j=/@include\s*\(/g,B;while((B=j.exec(K))!==null){let _=B.index,H=_+B[0].length-1,L=1,V=H+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let O=K.substring(_,V),F=K.substring(H+1,V-1),w=F.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=V;continue}let A=w[1],R,N=F.substring(w[0].length),T=d6(N,0);if(T!==-1)R=N.substring(T+1).trim();let M={};if(R)try{M=T0(R,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(O,U0("Include",`Error parsing include variables for ${A}: ${D}`,Y,$,_)),j.lastIndex=0;continue}let I=await U(A,M,$,_);K=K.substring(0,_)+I+K.substring(V),j.lastIndex=0}return K}function m6($,Z){let Y=$;function J(X,Q,G,K){let W=X,q=!0;while(q){q=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=W.match(z);if(!U||U.index===void 0)break;let j=U.index,B=U[1],_=j+U[0].length,H=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),V=1,O=_,F=-1;while(V>0&&O<W.length){let A=W.slice(O),R=A.match(H),N=A.match(L),T=R?O+R.index:1/0,M=N?O+N.index:1/0;if(T<M)V++,O=T+(R[0].length||1);else if(M<1/0){if(V--,V===0){F=M;break}O=M+G.length+1}else break}if(F===-1)break;let w=W.slice(_,F);if(!Z[B])Z[B]=[];if(K)Z[B].unshift(w);else Z[B].push(w);W=W.substring(0,j)+W.substring(F+`@${G}`.length),q=!0}return W}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function p6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
9734
+ `)})}var jJ=0,uA,Uj;var OJ=b(()=>{E7();l4();X1();a5();j5();A0();M0();uA=new h1(500),Uj=new Set});import*as l6 from"path";async function LJ($,Z,Y=""){if(l6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return VJ($,Z,Y,"@js","@endjs")}async function FJ($,Z,Y=""){if(l6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return VJ($,Z,Y,"@ts","@endts")}async function VJ($,Z,Y,J,X){let Q=$,G=U5(`${J}([\\s\\S]*?)${X}`,"g"),K=[],W;while((W=G.exec($))!==null)K.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:q,content:z,index:U}of K)try{let j={...Z,global:Z},B=Object.keys(j),_=Object.values(j),H=z.trim();if(J==="@ts")H=H.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 V=(H.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=V.length>0?`return { ${V.join(", ")} };`:"return {};",F=`
9498
9735
  ${H}
9499
9736
  ${O}
9500
- `,A=Function(..._,V)(...B);if(A&&typeof A==="object")Object.assign(Z,A);Q=Q.replace(q,"")}catch(j){console.error(`Error executing ${J} code block in ${Y}:`,j);let _=j instanceof Error?j.message:String(j),B=U0(`${J} Directive`,`Error executing code: ${_}`,Y,$,U,q);console.error(B),Q=Q.replace(q,"")}return Q}var HJ=b(()=>{j5();M0()});function Jj($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function OJ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return Jj(J,Q||"_method")})}async function LJ($,Z,Y,J,X){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((K)=>K.timing===X);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,J);if(typeof W==="string")Q=W;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(J.debug)console.error(`Error in middleware ${K.name}:`,W);if(J.debug){let q=U0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
9737
+ `,A=Function(...B,F)(..._);if(A&&typeof A==="object")Object.assign(Z,A);Q=Q.replace(q,"")}catch(j){console.error(`Error executing ${J} code block in ${Y}:`,j);let B=j instanceof Error?j.message:String(j),_=U0(`${J} Directive`,`Error executing code: ${B}`,Y,$,U,q);console.error(_),Q=Q.replace(q,"")}return Q}var wJ=b(()=>{j5();M0()});function Bj($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function AJ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,X,Q)=>{return Bj(J,Q||"_method")})}async function RJ($,Z,Y,J,X){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((K)=>K.timing===X);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,J);if(typeof W==="string")Q=W;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(J.debug)console.error(`Error in middleware ${K.name}:`,W);if(J.debug){let q=U0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
9501
9738
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${a0(q)}</div>
9502
- `)}}}return Q}async function FJ($,Z,Y,J){return LJ($,Z,Y,J,"before")}async function VJ($,Z,Y,J){return LJ($,Z,Y,J,"after")}var wJ=b(()=>{X1();M0()});import{defineRoute as uA,defineRoutes as mA,resetRoutes as pA,route as lA,setAppUrl as cA}from"stx-router";import{route as Xj}from"stx-router";function AJ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?T0(X,{}):{};return Xj(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var RJ=b(()=>{A0()});async function NJ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(V$.exact[$])for(let J of V$.exact[$])await Promise.resolve(J(Z,$));if(V$.exact[Y])for(let J of V$.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of V$.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var V$;var MJ=b(()=>{V$={patterns:[],exact:{}}});function TJ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>TJ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function IJ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(q){return X.some(([z,U])=>q>=z&&q<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let q=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,_=z,B=!1;while((j=U.exec(z))!==null){let H=j[1],L=j[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${L})`)(...O);if(H==="class"){let R=TJ(A);if(R){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${R}"`);else _=_.replace(j[0],` class="${R}"`)}else _=_.replace(j[0],"");B=!0;continue}if(Qj.has(H)){if(A)_=_.replace(j[0],` ${H}`);else _=_.replace(j[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(j[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(j[0],` ${H}="${R}"`)}B=!0}catch{continue}}if(B){let H=q.endsWith("/>")?" /":"",F=`<${Q[1]}${_}${H}>`;W.push({start:Q.index,end:Q.index+q.length,replacement:F})}}for(let q=W.length-1;q>=0;q--){let{start:z,end:U,replacement:j}=W[q];Y=Y.slice(0,z)+j+Y.slice(U)}return Y}var Qj;var DJ=b(()=>{Qj=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function e1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;let X=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&Gj.has(J[1]),Q=X?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:X,start:J.index,end:J.index+J[0].length}}function Wj($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)J++,X=K.index+K[0].length;else{if(J--,J===0)return W.index+W[0].length;X=W.index+W[0].length}}return-1}function G1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=Wj($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function EJ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function I5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function k1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function b1($,Z,Y){let J=Z.selfClosing?" /":"",X=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function qj($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function zj($){let Z=$,Y=0;while(Y<Z.length){let J=e1(Z,Y);if(!J)break;let X=I5(J.attrs,"v-for");if(X===null){Y=J.end;continue}let Q=X.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=J.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];W=`${K} as ${O} => ${F}`}else W=`${K} as ${G}`;let q=k1(J.attrs,"v-for"),z=k1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=G1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),_=b1(j,{...J,start:0,end:J.end-J.start},z),B=`@foreach(${W})
9503
- `,H=`${B}${_}
9504
- @endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+B.length}return Z}function Uj($){let Z=$,Y=0;while(Y<Z.length){let J=e1(Z,Y);if(!J)break;let X=I5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=G1(Z,J),K=k1(J.attrs,"v-if"),W=b1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},K);Q.push({type:"if",expr:X,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:J});let q=G.outerEnd,z=!0;while(z){let H=Z.slice(q).match(/^\s*/),L=H?H[0].length:0,F=e1(Z,q+L);if(!F){z=!1;break}let O=I5(F.attrs,"v-else-if"),V=EJ(F.attrs,"v-else");if(O!==null){let w=G1(Z,F),A=k1(F.attrs,"v-else-if"),R=b1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);Q.push({type:"else-if",expr:O,outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:F}),q=w.outerEnd}else if(V){let w=G1(Z,F),A=k1(F.attrs,"v-else"),R=b1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:F}),z=!1}else z=!1}let U=[];for(let H of Q)if(H.type==="if")U.push(`@if(${H.expr})
9739
+ `)}}}return Q}async function NJ($,Z,Y,J){return RJ($,Z,Y,J,"before")}async function MJ($,Z,Y,J){return RJ($,Z,Y,J,"after")}var TJ=b(()=>{X1();M0()});import{defineRoute as $R,defineRoutes as ZR,resetRoutes as YR,route as JR,setAppUrl as XR}from"stx-router";import{route as _j}from"stx-router";function IJ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,X,Q)=>{try{let G=X?T0(X,{}):{};return _j(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var DJ=b(()=>{A0()});async function EJ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(w$.exact[$])for(let J of w$.exact[$])await Promise.resolve(J(Z,$));if(w$.exact[Y])for(let J of w$.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:X}of w$.patterns)if(J.test($)||J.test(Y))await Promise.resolve(X(Z,$))}var w$;var kJ=b(()=>{w$={patterns:[],exact:{}}});function bJ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>bJ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function SJ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=J.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(q){return X.some(([z,U])=>q>=z&&q<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let q=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,B=z,_=!1;while((j=U.exec(z))!==null){let H=j[1],L=j[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let V=Object.keys(Z),O=Object.values(Z),F=L.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!V.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...V,`return (${L})`)(...O);if(H==="class"){let R=bJ(A);if(R){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${R}"`);else B=B.replace(j[0],` class="${R}"`)}else B=B.replace(j[0],"");_=!0;continue}if(Hj.has(H)){if(A)B=B.replace(j[0],` ${H}`);else B=B.replace(j[0],"");_=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(j[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(j[0],` ${H}="${R}"`)}_=!0}catch{continue}}if(_){let H=q.endsWith("/>")?" /":"",V=`<${Q[1]}${B}${H}>`;W.push({start:Q.index,end:Q.index+q.length,replacement:V})}}for(let q=W.length-1;q>=0;q--){let{start:z,end:U,replacement:j}=W[q];Y=Y.slice(0,z)+j+Y.slice(U)}return Y}var Hj;var yJ=b(()=>{Hj=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function e1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;let X=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&Oj.has(J[1]),Q=X?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:X,start:J.index,end:J.index+J[0].length}}function Fj($,Z,Y){let J=1,X=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)J++,X=K.index+K[0].length;else{if(J--,J===0)return W.index+W[0].length;X=W.index+W[0].length}}return-1}function G1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=Fj($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function PJ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function I5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function k1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function b1($,Z,Y){let J=Z.selfClosing?" /":"",X=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function Vj($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function wj($){let Z=$,Y=0;while(Y<Z.length){let J=e1(Z,Y);if(!J)break;let X=I5(J.attrs,"v-for");if(X===null){Y=J.end;continue}let Q=X.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=J.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let L=G.split(",").map((F)=>F.trim()),V=L[0],O=L[1];W=`${K} as ${O} => ${V}`}else W=`${K} as ${G}`;let q=k1(J.attrs,"v-for"),z=k1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=G1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),B=b1(j,{...J,start:0,end:J.end-J.start},z),_=`@foreach(${W})
9740
+ `,H=`${_}${B}
9741
+ @endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+_.length}return Z}function Aj($){let Z=$,Y=0;while(Y<Z.length){let J=e1(Z,Y);if(!J)break;let X=I5(J.attrs,"v-if");if(X===null){Y=J.end;continue}let Q=[],G=G1(Z,J),K=k1(J.attrs,"v-if"),W=b1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},K);Q.push({type:"if",expr:X,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:J});let q=G.outerEnd,z=!0;while(z){let H=Z.slice(q).match(/^\s*/),L=H?H[0].length:0,V=e1(Z,q+L);if(!V){z=!1;break}let O=I5(V.attrs,"v-else-if"),F=PJ(V.attrs,"v-else");if(O!==null){let w=G1(Z,V),A=k1(V.attrs,"v-else-if"),R=b1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},A);Q.push({type:"else-if",expr:O,outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:V}),q=w.outerEnd}else if(F){let w=G1(Z,V),A=k1(V.attrs,"v-else"),R=b1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},A);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:V}),z=!1}else z=!1}let U=[];for(let H of Q)if(H.type==="if")U.push(`@if(${H.expr})
9505
9742
  ${H.element}`);else if(H.type==="else-if")U.push(`@elseif(${H.expr})
9506
9743
  ${H.element}`);else U.push(`@else
9507
9744
  ${H.element}`);U.push("@endif");let j=U.join(`
9508
- `),_=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,_)+j+Z.slice(B),Y=_+j.length}return Z}function jj($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function _j($){let Z=$,Y=0;while(Y<Z.length){let J=e1(Z,Y);if(!J)break;let X=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=X.match(G);while(K){Q=!0;let z=K[1],U=K[2],j=K[3];X=X.replace(K[0],""),X+=` :${z}="${j}" @update:${z}="${j} = $event"`,K=X.match(G)}if(Q){let z=G1(Z,J),U=Z.slice(z.outerStart,z.outerEnd),j=b1(U,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),Y=z.outerStart+j.length;continue}let W=I5(J.attrs,"v-model");if(W===null){Y=J.end;continue}if(Kj.has(J.tag)){let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,U=G1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),_=b1(j,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}else{let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let U=G1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),_=b1(j,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}}return Z}function Bj($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Hj($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Oj($){let Z=$,Y=0;while(Y<Z.length){let J=e1(Z,Y);if(!J)break;let X=I5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=G1(Z,J),G=k1(J.attrs,"v-html"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{!! ${X} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function Lj($){let Z=$,Y=0;while(Y<Z.length){let J=e1(Z,Y);if(!J)break;let X=I5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=G1(Z,J),G=k1(J.attrs,"v-text"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{{ ${X} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function Fj($){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 Vj($){let Z=$,Y=0;while(Y<Z.length){let J=e1(Z,Y);if(!J)break;if(!EJ(J.attrs,"v-once")){Y=J.end;continue}let X=k1(J.attrs,"v-once"),Q=G1(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
9745
+ `),B=Q[0].outerStart,_=Q[Q.length-1].outerEnd;Z=Z.slice(0,B)+j+Z.slice(_),Y=B+j.length}return Z}function Rj($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Nj($){let Z=$,Y=0;while(Y<Z.length){let J=e1(Z,Y);if(!J)break;let X=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=X.match(G);while(K){Q=!0;let z=K[1],U=K[2],j=K[3];X=X.replace(K[0],""),X+=` :${z}="${j}" @update:${z}="${j} = $event"`,K=X.match(G)}if(Q){let z=G1(Z,J),U=Z.slice(z.outerStart,z.outerEnd),j=b1(U,{...J,start:0,end:J.end-J.start},X);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),Y=z.outerStart+j.length;continue}let W=I5(J.attrs,"v-model");if(W===null){Y=J.end;continue}if(Lj.has(J.tag)){let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,U=G1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),B=b1(j,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length}else{let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let U=G1(Z,J),j=Z.slice(U.outerStart,U.outerEnd),B=b1(j,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length}}return Z}function Mj($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Tj($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Ij($){let Z=$,Y=0;while(Y<Z.length){let J=e1(Z,Y);if(!J)break;let X=I5(J.attrs,"v-html");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=G1(Z,J),G=k1(J.attrs,"v-html"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{!! ${X} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function Dj($){let Z=$,Y=0;while(Y<Z.length){let J=e1(Z,Y);if(!J)break;let X=I5(J.attrs,"v-text");if(X===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let Q=G1(Z,J),G=k1(J.attrs,"v-text"),K=J.selfClosing?" /":"",W=`<${J.tag}${G}${K}>{{ ${X} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function Ej($){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 kj($){let Z=$,Y=0;while(Y<Z.length){let J=e1(Z,Y);if(!J)break;if(!PJ(J.attrs,"v-once")){Y=J.end;continue}let X=k1(J.attrs,"v-once"),Q=G1(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
9509
9746
  ${b1(G,{...J,start:0,end:J.end-J.start},X)}
9510
- @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function wj($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Aj($){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 kJ($){if(!qj($))return $;let Z=$;return Z=zj(Z),Z=Uj(Z),Z=Vj(Z),Z=Bj(Z),Z=Hj(Z),Z=_j(Z),Z=jj(Z),Z=Aj(Z),Z=Oj(Z),Z=Lj(Z),Z=Fj(Z),Z=wj(Z),Z}var Gj,Kj;var bJ=b(()=>{Gj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Kj=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function Q7($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function SJ($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let q=K.length-1;q>=0;q--){let z=K[q];try{let U=Z0(z.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${Q7(z.expr)}" -->`;Q=Q.slice(0,z.index)+O+Q.slice(z.index+z.full.length);continue}let j=z.attrs.trim(),_={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=B.exec(j))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=Z0(V,Z)}catch{_[O]=V}else _[O]=V}let L=J.componentsDir||"components",F=await l1(U,_,z.slotContent,L,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,z.index)+F+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${Q7(j)} -->`;Q=Q.slice(0,z.index)+_+Q.slice(z.index+z.full.length)}}return Q=await Rj(Q,Z,Y,J,X),Q}async function Rj($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let q=K.length-1;q>=0;q--){let z=K[q];try{let U=Z0(z.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${Q7(z.expr)}" -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length);continue}let j=J.componentsDir||"components",_=await l1(U,{},"",j,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,z.index)+_+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${Q7(j)} -->`;Q=Q.slice(0,z.index)+_+Q.slice(z.index+z.full.length)}}return Q}var yJ=b(()=>{M0();A0()});function Ij($){let Z=$.storageKey??"stx-color-mode",Y=$.initialMode??"auto",J=$.darkClass??"dark",X=$.attribute??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Nj.has(Y))throw Error(`colorMode.initialMode must be one of light, dark, auto \u2014 got ${JSON.stringify(Y)}`);if(typeof J!=="string"||!Tj.test(J))throw Error(`colorMode.darkClass must be a single CSS class name \u2014 got ${JSON.stringify(J)}`);if(X!==null&&(typeof X!=="string"||!Mj.test(X)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(X)}`);return{storageKey:Z,initialMode:Y,darkClass:J,attribute:X}}function Dj($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function p6($={}){let Z=Ij($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${Dj(Z)};var p=c.initialMode;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"||v==="auto")p=v}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute){r.setAttribute(c.attribute,m)}else if(m==="dark"){r.classList.add(c.darkClass)}else{r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,preference:p,mode:m}}catch(e){}}());`}</script>`}function PJ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let Y=/<head\b[^>]*>/i.exec($);if(!Y)return $;let J=Y.index+Y[0].length,X=$.slice(J),Q=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(X);if(Q)J+=Q[0].length;let G=p6(Z);return`${$.slice(0,J)}
9511
- ${G}${$.slice(J)}`}var Nj,Mj,Tj;var l6=b(()=>{Nj=new Set(["light","dark","auto"]),Mj=/^[a-z][\w:-]*$/i,Tj=/^[\w-]+$/});function vJ($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${CJ}
9512
- ${$.slice(Z)}`}function Ej($){let Z=[],Y=0;while(Y<$.length){let Q=$.slice(Y),G=Q.match(/^\s+/);if(G){Y+=G[0].length;continue}if(Q.startsWith("<!--")){let U=$.indexOf("-->",Y);if(U===-1)break;Y=U+3;continue}let K=Q.match(/^<script\b[^>]*>/i);if(K){let U=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(U===-1)break;Y=U+9;continue}let W=Q.match(/^<link\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let z=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(z){Z.push(z[0]),Y+=z[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",X=0;while(X<$.length&&X<Y){let Q=$.slice(X),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){X+=G[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){X+=K[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W&&Z.includes(W[0])){X+=W[0].length;continue}J+=$[X],X++}return J+=$.slice(Y),{body:J,hoisted:Z}}function kj($,Z={},Y={}){let{title:J="stx App",lang:X="en",meta:Q=[],link:G=[],script:K=[],headRaw:W="",bodyClass:q="",bodyAttrs:z={}}=Z,U=Y.title||J,B=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...Q].map((N)=>{return` <meta ${Object.entries(N).map(([T,I])=>`${T}="${I}"`).join(" ")}>`}).join(`
9513
- `),H=G.map((N)=>{return` <link ${Object.entries(N).map(([T,I])=>`${T}="${I}"`).join(" ")}>`}).join(`
9514
- `),L=K.map((N)=>{if(N.src)return` <script ${Object.entries(N).filter(([T])=>T!=="content").map(([T,I])=>`${T}="${I}"`).join(" ")}></script>`;if(N.content)return` <script>${N.content}</script>`;return""}).filter(Boolean).join(`
9515
- `),F=Object.entries(z).map(([N,M])=>` ${N}="${M}"`).join(""),O=q?` class="${q}"`:"",{body:V,hoisted:w}=Ej($),A=[B,Y.colorMode?` ${p6(Y.colorMode)}`:"",` <title>${U}</title>`,` ${CJ}`,H,L,W?` ${W}`:"",...(Y.styles||[]).map((N)=>` ${N}`),...w.map((N)=>` ${N}`),...(Y.headScripts||[]).map((N)=>` ${N}`),Y.headStack||""].filter(Boolean),R=[V,...(Y.bodyScripts||[]).map((N)=>N),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
9516
- <html lang="${X}">
9747
+ @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function bj($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Sj($){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 CJ($){if(!Vj($))return $;let Z=$;return Z=wj(Z),Z=Aj(Z),Z=kj(Z),Z=Mj(Z),Z=Tj(Z),Z=Nj(Z),Z=Rj(Z),Z=Sj(Z),Z=Ij(Z),Z=Dj(Z),Z=Ej(Z),Z=bj(Z),Z}var Oj,Lj;var vJ=b(()=>{Oj=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Lj=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function G7($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function xJ($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let q=K.length-1;q>=0;q--){let z=K[q];try{let U=Z0(z.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${G7(z.expr)}" -->`;Q=Q.slice(0,z.index)+O+Q.slice(z.index+z.full.length);continue}let j=z.attrs.trim(),B={},_=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=_.exec(j))!==null){let O=H[1]||H[2],F=H[3];if(H[1])try{B[O]=Z0(F,Z)}catch{B[O]=F}else B[O]=F}let L=J.componentsDir||"components",V=await l1(U,B,z.slotContent,L,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,z.index)+V+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${G7(j)} -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}}return Q=await yj(Q,Z,Y,J,X),Q}async function yj($,Z,Y,J,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let q=K.length-1;q>=0;q--){let z=K[q];try{let U=Z0(z.expr,Z);if(!U||typeof U!=="string"){let _=`<!-- dynamic component: could not resolve "${G7(z.expr)}" -->`;Q=Q.slice(0,z.index)+_+Q.slice(z.index+z.full.length);continue}let j=J.componentsDir||"components",B=await l1(U,{},"",j,Z,Y,J,new Set,X??new Set);Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${G7(j)} -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length)}}return Q}var fJ=b(()=>{M0();A0()});function fj($){let Z=$.storageKey??"stx-color-mode",Y=$.initialMode??"auto",J=$.darkClass===void 0?"dark":$.darkClass,X=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Pj.has(Y))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!xj.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(X!==null&&(typeof X!=="string"||!vj.test(X)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(X)}`);if(Q!==null&&!Cj.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(J===null&&X===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:Y==="system"?"auto":Y,darkClass:J,attribute:X,autoValue:Q}}function gj($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function c6($={}){let Z=fj($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${gj(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function gJ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let Y=/<head\b[^>]*>/i.exec($);if(!Y)return $;let J=Y.index+Y[0].length,X=$.slice(J),Q=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(X);if(Q)J+=Q[0].length;let G=c6(Z);return`${$.slice(0,J)}
9748
+ ${G}${$.slice(J)}`}var Pj,Cj,vj,xj;var i6=b(()=>{Pj=new Set(["light","dark","auto","system"]),Cj=new Set(["auto","system"]),vj=/^[a-z][\w:-]*$/i,xj=/^[\w-]+$/});function hj(){if(n6===null)n6=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return n6}function hJ($,Z=hj()){if($.includes('name="stx-build"'))return $;let Y=/<head\b[^>]*>/i.exec($);if(!Y)return $;let J=Y.index+Y[0].length;return`${$.slice(0,J)}
9749
+ <meta name="stx-build" content="${Z}">${$.slice(J)}`}var n6=null;function D5($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function dj($={},Z="en"){let Y=[],J=[],X="",Q=Z;for(let[K,W]of Object.entries($||{})){if(W==null)continue;let q=K.trim();if(!uJ.test(q))continue;let z=q.toLowerCase();if(z==="lang"){Q=String(W);continue}if(z==="class"){X=String(W).trim();continue}Y.push(` ${q}="${D5(String(W))}"`),J.push(q)}let G=` lang="${D5(Q)}"`;if(X)G+=` class="${D5(X)}"`;if(G+=Y.join(""),X)G+=` ${W7}="${D5(X)}"`;if(J.length)G+=` ${K7}="${D5(J.join(" "))}"`;return G}function mJ($={},Z={}){let Y={...$,...Z};if($.class&&Z.class){let J=$.class.split(/\s+/).filter(Boolean);for(let X of Z.class.split(/\s+/).filter(Boolean))if(!J.includes(X))J.push(X);Y.class=J.join(" ")}return Y}function pJ($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let Y=$.match(/<html\b([^>]*)>/i);if(!Y)return $;let J={},X=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(Y[1]))!==null){let z=G[1];if(!(z in J))X.push(z);J[z]=G[2]??G[3]??G[4]??""}let K=[],W=[];for(let[z,U]of Object.entries(Z)){if(U==null)continue;let j=z.trim();if(!uJ.test(j))continue;let B=j.toLowerCase();if(B==="class"){let _=(J.class||"").split(/\s+/).filter(Boolean);for(let H of String(U).split(/\s+/).filter(Boolean))if(!_.includes(H))_.push(H),K.push(H);if(!("class"in J))X.push("class");J.class=_.join(" ");continue}if(!(j in J))X.push(j);if(J[j]=String(U),B!=="lang")W.push(j)}if(K.length){if(!(W7 in J))X.push(W7);J[W7]=K.join(" ")}if(W.length){if(!(K7 in J))X.push(K7);J[K7]=W.join(" ")}let q=X.map((z)=>` ${z}="${D5(J[z])}"`).join("");return $.replace(Y[0],()=>`<html${q}>`)}function lJ($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${dJ}
9750
+ ${$.slice(Z)}`}function uj($){let Z=[],Y=0;while(Y<$.length){let Q=$.slice(Y),G=Q.match(/^\s+/);if(G){Y+=G[0].length;continue}if(Q.startsWith("<!--")){let U=$.indexOf("-->",Y);if(U===-1)break;Y=U+3;continue}let K=Q.match(/^<script\b[^>]*>/i);if(K){let U=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(U===-1)break;Y=U+9;continue}let W=Q.match(/^<link\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let q=Q.match(/^<meta\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let z=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(z){Z.push(z[0]),Y+=z[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",X=0;while(X<$.length&&X<Y){let Q=$.slice(X),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){X+=G[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){X+=K[0].length;continue}let W=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W&&Z.includes(W[0])){X+=W[0].length;continue}J+=$[X],X++}return J+=$.slice(Y),{body:J,hoisted:Z}}function mj($,Z={},Y={}){let{title:J="stx App",lang:X="en",meta:Q=[],link:G=[],script:K=[],headRaw:W="",htmlAttrs:q={},bodyClass:z="",bodyAttrs:U={}}=Z,j=Y.title||J,H=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...Q].map((M)=>{return` <meta ${Object.entries(M).map(([E,D])=>`${E}="${D}"`).join(" ")}>`}).join(`
9751
+ `),L=G.map((M)=>{return` <link ${Object.entries(M).map(([E,D])=>`${E}="${D}"`).join(" ")}>`}).join(`
9752
+ `),V=K.map((M)=>{if(M.src)return` <script ${Object.entries(M).filter(([E])=>E!=="content").map(([E,D])=>`${E}="${D}"`).join(" ")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
9753
+ `),O=dj(q,X),F=Object.entries(U).map(([M,I])=>` ${M}="${I}"`).join(""),w=z?` class="${z}"`:"",{body:A,hoisted:R}=uj($),N=[H,Y.colorMode?` ${c6(Y.colorMode)}`:"",` <title>${j}</title>`,` ${dJ}`,L,V,W?` ${W}`:"",...(Y.styles||[]).map((M)=>` ${M}`),...R.map((M)=>` ${M}`),...(Y.headScripts||[]).map((M)=>` ${M}`),Y.headStack||""].filter(Boolean),T=[A,...(Y.bodyScripts||[]).map((M)=>M),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
9754
+ <html${O}>
9517
9755
  <head>
9518
- ${A.join(`
9756
+ ${N.join(`
9519
9757
  `)}
9520
9758
  </head>
9521
- <body${O}${F}>
9522
- ${R.join(`
9759
+ <body${w}${F}>
9760
+ ${T.join(`
9523
9761
  `)}
9524
9762
  </body>
9525
- </html>`}function c6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function xJ($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:X=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),W=[];for(let q of J){let z=q.name?`name="${q.name}"`:q.property?`property="${q.property}"`:q.charset!=null?"charset=":q["http-equiv"]?`http-equiv="${q["http-equiv"]}"`:"";if(z&&K.includes(z))continue;W.push(` <meta ${Object.entries(q).map(([U,j])=>`${U}="${j}"`).join(" ")}>`)}for(let q of X){if(q.href&&K.includes(`href="${q.href}"`))continue;W.push(` <link ${Object.entries(q).map(([z,U])=>`${z}="${U}"`).join(" ")}>`)}for(let q of Q)if(q.src){if(K.includes(`src="${q.src}"`))continue;W.push(` <script ${Object.entries(q).filter(([z])=>z!=="content").map(([z,U])=>`${z}="${U}"`).join(" ")}></script>`)}else if(q.content){if(K.includes(q.content))continue;W.push(` <script>${q.content}</script>`)}if(G&&!K.includes(G))W.push(` ${G}`);if(W.length===0)return $;return`${$.slice(0,Y)}${W.join(`
9763
+ </html>`}function o6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function cJ($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:X=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),W=[];for(let q of J){let z=q.name?`name="${q.name}"`:q.property?`property="${q.property}"`:q.charset!=null?"charset=":q["http-equiv"]?`http-equiv="${q["http-equiv"]}"`:"";if(z&&K.includes(z))continue;W.push(` <meta ${Object.entries(q).map(([U,j])=>`${U}="${j}"`).join(" ")}>`)}for(let q of X){if(q.href&&K.includes(`href="${q.href}"`))continue;W.push(` <link ${Object.entries(q).map(([z,U])=>`${z}="${U}"`).join(" ")}>`)}for(let q of Q)if(q.src){if(K.includes(`src="${q.src}"`))continue;W.push(` <script ${Object.entries(q).filter(([z])=>z!=="content").map(([z,U])=>`${z}="${U}"`).join(" ")}></script>`)}else if(q.content){if(K.includes(q.content))continue;W.push(` <script>${q.content}</script>`)}if(G&&!K.includes(G))W.push(` ${G}`);if(W.length===0)return $;return`${$.slice(0,Y)}${W.join(`
9526
9764
  `)}
9527
- ${$.slice(Y)}`}function fJ($,Z={},Y={}){if(c6($))return $;return kj($,Z,Y)}var CJ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>";var gJ=b(()=>{l6()});import D5 from"path";function hJ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function dJ($,Z,Y){try{let J;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=D5.join(X,$);if(await Bun.file(G).exists())return G;X=D5.dirname(X)}J=D5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=D5.resolve(Z,$);else J=D5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function uJ($,Z,Y){let J=$,X=D5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[q,z,U,j]=G;if(hJ(U))continue;let _=await dJ(U,X,Z);if(_)try{let B=await Bun.file(_).text();if(Y.add(_),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:c0()});if(L.outputs.length>0)B=await L.outputs[0].text()}let H=`<script>
9765
+ ${$.slice(Y)}`}function iJ($,Z={},Y={}){if(o6($))return $;return mj($,Z,Y)}var dJ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",K7="data-stx-html-attrs",W7="data-stx-html-class",uJ;var nJ=b(()=>{i6();uJ=/^[A-Za-z_:][\w:.-]*$/});import E5 from"path";function oJ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function sJ($,Z,Y){try{let J;if($.startsWith("/")){let X=Z;for(let Q=0;Q<5;Q++){let G=E5.join(X,$);if(await Bun.file(G).exists())return G;X=E5.dirname(X)}J=E5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=E5.resolve(Z,$);else J=E5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function rJ($,Z,Y){let J=$,X=E5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[q,z,U,j]=G;if(oJ(U))continue;let B=await sJ(U,X,Z);if(B)try{let _=await Bun.file(B).text();if(Y.add(B),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:c0()});if(L.outputs.length>0)_=await L.outputs[0].text()}let H=`<script>
9528
9766
  // Source: ${U}
9529
- ${B}
9530
- </script>`;J=J.replace(q,H),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(J))!==null){let[q,z,U,j]=W,_=z+j;if(hJ(U))continue;if(/rel=["']stylesheet["']/.test(_)||U.endsWith(".css")){let H=await dJ(U,X,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
9767
+ ${_}
9768
+ </script>`;J=J.replace(q,H),Q.lastIndex=0}catch(_){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(J))!==null){let[q,z,U,j]=W,B=z+j;if(oJ(U))continue;if(/rel=["']stylesheet["']/.test(B)||U.endsWith(".css")){let H=await sJ(U,X,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let V=`<style>
9531
9769
  /* Source: ${U} */
9532
9770
  ${L}
9533
- </style>`;J=J.replace(q,F),K.lastIndex=0}catch(L){}}}return J}var mJ=b(()=>{P1()});function i6($,Z){let Y=$,J=/@json\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,q=null,z=!1;while(W<Y.length&&K>0){let V=Y[W];if(z){z=!1,W++;continue}if(V==="\\"&&q){z=!0,W++;continue}if(q){if(V===q)q=null;W++;continue}if(V==='"'||V==="'"||V==="`"){q=V,W++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=Y.substring(G+1,W).trim(),j=Y.substring(Q,W+1),_=-1,B=0,H=null,L=!1;for(let V=0;V<U.length;V++){let w=U[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){_=V;break}}let F=_>=0?U.substring(0,_).trim():U,O=_>=0?U.substring(_+1).trim():void 0;try{let V=F.trim(),w;if(W0(V))w=q0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+R+Y.substring(W+1),J.lastIndex=Q+R.length}catch(V){e0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),J.lastIndex=Q+j.length}}return Y}function n6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function pJ($){let Z=$,Y=/@memo\s*\(/g,J,X=[];while((J=Y.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let q=Z.slice(G,W-1).trim(),z=W,U=Z.slice(z),j=U.indexOf("@endmemo");if(j===-1)continue;let _=U.slice(0,j),B=z+j+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,M,T="",I]=A,E=`<${M}${T} data-stx-memo="${q}"${I}>`;R=_.slice(0,L)+E+w.slice(N.length)+_.slice(L+w.length)}else R=`${_.slice(0,L)}<div data-stx-memo="${q}">${w}</div>${_.slice(L+w.length)}`;X.push({start:Q,end:B,replacement:R}),Y.lastIndex=B}for(let Q=X.length-1;Q>=0;Q--){let G=X[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function o6($){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 lJ($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,q=!1,z=-1;while(K<$.length){let H=$[K];if(W){if(H==="'")W=!1}else if(q){if(H==='"')q=!1}else if(H==="'")W=!0;else if(H==='"')q=!0;else if(H===">"){z=K;break}K++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let j=$.slice(z+1),_=j.indexOf("</"),B=_>=0?j.slice(0,_):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))J+=$.slice(X,z)+" x-cloak>",X=z+1}return J+=$.slice(X),J}function cJ($){let Z=/<[a-z][\w-]*/gi,Y="",J=0,X;while((X=Z.exec($))!==null){let Q=X.index,G=X[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,H=$.toLowerCase().indexOf(B,Q);if(H!==-1)Z.lastIndex=H+B.length;continue}let K=Q+X[0].length,W=!1,q=!1,z=-1;while(K<$.length){let B=$[K];if(W){if(B==="'")W=!1}else if(q){if(B==='"')q=!1}else if(B==="'")W=!0;else if(B==='"')q=!0;else if(B===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(Q+X[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!bj.test(U))continue;let j=$[z-1]==="/",_=j?z-1:z;Y+=`${$.slice(J,_)} x-cloak${j?" ":""}`,J=_}return Y+=$.slice(J),Y}var bj;var s6=b(()=>{U1();A0();bj=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function r6($,Z,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},X=J.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:W}of Sj){if(X.some((z)=>K.includes(z)||G.source.includes(z)))continue;G.lastIndex=0;let q=$.match(G);if(q&&q.length>0){let z=$.split(`
9534
- `),U=[];z.forEach((_,B)=>{if(G.lastIndex=0,G.test(_))U.push(B+1)});let j=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";Q.push(` \u2717 ${K}${j}
9771
+ </style>`;J=J.replace(q,V),K.lastIndex=0}catch(L){}}}return J}var aJ=b(()=>{P1()});function s6($,Z){let Y=$,J=/@json\s*\(/g,X;while((X=J.exec(Y))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,q=null,z=!1;while(W<Y.length&&K>0){let F=Y[W];if(z){z=!1,W++;continue}if(F==="\\"&&q){z=!0,W++;continue}if(q){if(F===q)q=null;W++;continue}if(F==='"'||F==="'"||F==="`"){q=F,W++;continue}if(F==="(")K++;else if(F===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=Y.substring(G+1,W).trim(),j=Y.substring(Q,W+1),B=-1,_=0,H=null,L=!1;for(let F=0;F<U.length;F++){let w=U[F];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")_++;else if(w===")"||w==="]"||w==="}")_--;if(w===","&&_===0){B=F;break}}let V=B>=0?U.substring(0,B).trim():U,O=B>=0?U.substring(B+1).trim():void 0;try{let F=V.trim(),w;if(W0(F))w=q0(F,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+R+Y.substring(W+1),J.lastIndex=Q+R.length}catch(F){e0.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=Q+j.length}}return Y}function r6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function tJ($){let Z=$,Y=/@memo\s*\(/g,J,X=[];while((J=Y.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let q=Z.slice(G,W-1).trim(),z=W,U=Z.slice(z),j=U.indexOf("@endmemo");if(j===-1)continue;let B=U.slice(0,j),_=z+j+8,H=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,V=B.slice(L),O=B.match(/(\s*)$/),F=O?O[0].length:0,w=V.slice(0,V.length-F),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,T,M="",I]=A,E=`<${T}${M} data-stx-memo="${q}"${I}>`;R=B.slice(0,L)+E+w.slice(N.length)+B.slice(L+w.length)}else R=`${B.slice(0,L)}<div data-stx-memo="${q}">${w}</div>${B.slice(L+w.length)}`;X.push({start:Q,end:_,replacement:R}),Y.lastIndex=_}for(let Q=X.length-1;Q>=0;Q--){let G=X[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function a6($){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 eJ($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",X=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,q=!1,z=-1;while(K<$.length){let H=$[K];if(W){if(H==="'")W=!1}else if(q){if(H==='"')q=!1}else if(H==="'")W=!0;else if(H==='"')q=!0;else if(H===">"){z=K;break}K++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let j=$.slice(z+1),B=j.indexOf("</"),_=B>=0?j.slice(0,B):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(_))J+=$.slice(X,z)+" x-cloak>",X=z+1}return J+=$.slice(X),J}function $X($){let Z=/<[a-z][\w-]*/gi,Y="",J=0,X;while((X=Z.exec($))!==null){let Q=X.index,G=X[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let _=`</${G}>`,H=$.toLowerCase().indexOf(_,Q);if(H!==-1)Z.lastIndex=H+_.length;continue}let K=Q+X[0].length,W=!1,q=!1,z=-1;while(K<$.length){let _=$[K];if(W){if(_==="'")W=!1}else if(q){if(_==='"')q=!1}else if(_==="'")W=!0;else if(_==='"')q=!0;else if(_===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(Q+X[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!pj.test(U))continue;let j=$[z-1]==="/",B=j?z-1:z;Y+=`${$.slice(J,B)} x-cloak${j?" ":""}`,J=B}return Y+=$.slice(J),Y}var pj;var t6=b(()=>{U1();A0();pj=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function e6($,Z,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},X=J.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:W}of lj){if(X.some((z)=>K.includes(z)||G.source.includes(z)))continue;G.lastIndex=0;let q=$.match(G);if(q&&q.length>0){let z=$.split(`
9772
+ `),U=[];z.forEach((B,_)=>{if(G.lastIndex=0,G.test(B))U.push(_+1)});let j=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";Q.push(` \u2717 ${K}${j}
9535
9773
  \u2192 ${W}`)}}if(Q.length>0&&J.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
9536
9774
  ${Q.join(`
9537
9775
  `)}
9538
- Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var Sj;var a6=b(()=>{Sj=[{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 iJ={};a(iJ,{getStoreScript:()=>yj,clearStoreCache:()=>Pj});import G7 from"path";async function yj($){let Z;if($)Z=G7.resolve($);else{let z=await j1();Z=G7.resolve(z.root||process.cwd(),z.storesDir||"stores")}let Y=E5.get(Z);if(Y!==void 0)return Y||null;let J=new Bun.Glob("*.ts"),X=[];try{for await(let z of J.scan({cwd:Z,absolute:!0})){let U=G7.basename(z,".ts");if(["index","types"].includes(U))continue;if(z.includes(".d.ts"))continue;X.push(z)}}catch{return E5.set(Z,""),null}if(X.length===0)return E5.set(Z,""),null;let Q=[];for(let z of X){let U=await Bun.file(z).text();Q.push({file:z,hasUseStore:/useStore\s*\(/.test(U)})}Q.sort((z,U)=>{if(z.hasUseStore===U.hasUseStore)return 0;return z.hasUseStore?1:-1});let G=Q.map((z)=>z.file),K=[],W=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()});for(let z of G)try{let U=await Bun.file(z).text(),j=G7.basename(z,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=W.transformSync(U),K.push(`// Store: ${j}
9539
- ${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${z}:`,U)}if(K.length===0)return E5.set(Z,""),null;let q=`;(function(){
9776
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var lj;var $9=b(()=>{lj=[{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 ZX={};a(ZX,{getStoreScript:()=>cj,clearStoreCache:()=>ij});import q7 from"path";async function cj($){let Z;if($)Z=q7.resolve($);else{let z=await j1();Z=q7.resolve(z.root||process.cwd(),z.storesDir||"stores")}let Y=k5.get(Z);if(Y!==void 0)return Y||null;let J=new Bun.Glob("*.ts"),X=[];try{for await(let z of J.scan({cwd:Z,absolute:!0})){let U=q7.basename(z,".ts");if(["index","types"].includes(U))continue;if(z.includes(".d.ts"))continue;X.push(z)}}catch{return k5.set(Z,""),null}if(X.length===0)return k5.set(Z,""),null;let Q=[];for(let z of X){let U=await Bun.file(z).text();Q.push({file:z,hasUseStore:/useStore\s*\(/.test(U)})}Q.sort((z,U)=>{if(z.hasUseStore===U.hasUseStore)return 0;return z.hasUseStore?1:-1});let G=Q.map((z)=>z.file),K=[],W=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()});for(let z of G)try{let U=await Bun.file(z).text(),j=q7.basename(z,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=W.transformSync(U),K.push(`// Store: ${j}
9777
+ ${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${z}:`,U)}if(K.length===0)return k5.set(Z,""),null;let q=`;(function(){
9540
9778
  ${K.join(`
9541
9779
 
9542
9780
  `)}
9543
- })();`;return E5.set(Z,q),q}function Pj(){E5.clear()}var E5;var nJ=b(()=>{s1();P1();E5=new Map});var sJ={};a(sJ,{getComposableScript:()=>fj,clearComposableCache:()=>gj});import w$ from"path";function oJ($){let Z=w$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function vj($){if($)return w$.resolve($);let Z=`<default>:${process.cwd()}`,Y=t6.get(Z);if(Y!==void 0)return Y;let J=await xj();return t6.set(Z,J),J}async function xj(){let $=await j1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return w$.resolve(Z,Y);for(let J of Cj){let X=w$.resolve(Z,J);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:X,absolute:!0}))if(!oJ(G))return X}catch{}}return null}async function fj($){let Z=await vj($);if(!Z)return null;let Y=k5.get(Z);if(Y!==void 0)return Y||null;let J=[];try{let _=new Bun.Glob("**/*.ts");for await(let B of _.scan({cwd:Z,absolute:!0})){if(oJ(B))continue;J.push(B)}}catch{return k5.set(Z,""),null}if(J.length===0)return k5.set(Z,""),null;J.sort();let X=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()}),Q=[],G=new Set,K=new Set;for(let _ of J)try{let B=await Bun.file(_).text(),H=w$.basename(_,".ts");for(let L of B.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of X.scan(B).exports)if(L!=="default")G.add(L)}catch{}B=r0(B),B=B.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),B=B.replace(/^export\s+(default\s+)?/gm,""),B=X.transformSync(B),Q.push(`// Composable: ${H}
9544
- ${B.trim()}`)}catch(B){console.warn(`[stx] Failed to load composable ${_}:`,B)}if(Q.length===0||G.size===0)return k5.set(Z,""),null;let W=[...G].map((_)=>` try { __c[${JSON.stringify(_)}] = ${_}; } catch (e) {}`).join(`
9781
+ })();`;return k5.set(Z,q),q}function ij(){k5.clear()}var k5;var YX=b(()=>{s1();P1();k5=new Map});var XX={};a(XX,{getComposableScript:()=>rj,clearComposableCache:()=>aj});import A$ from"path";function JX($){let Z=A$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function oj($){if($)return A$.resolve($);let Z=`<default>:${process.cwd()}`,Y=Z9.get(Z);if(Y!==void 0)return Y;let J=await sj();return Z9.set(Z,J),J}async function sj(){let $=await j1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return A$.resolve(Z,Y);for(let J of nj){let X=A$.resolve(Z,J);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:X,absolute:!0}))if(!JX(G))return X}catch{}}return null}async function rj($){let Z=await oj($);if(!Z)return null;let Y=b5.get(Z);if(Y!==void 0)return Y||null;let J=[];try{let B=new Bun.Glob("**/*.ts");for await(let _ of B.scan({cwd:Z,absolute:!0})){if(JX(_))continue;J.push(_)}}catch{return b5.set(Z,""),null}if(J.length===0)return b5.set(Z,""),null;J.sort();let X=new Bun.Transpiler({loader:"ts",target:"browser",define:c0()}),Q=[],G=new Set,K=new Set;for(let B of J)try{let _=await Bun.file(B).text(),H=A$.basename(B,".ts");for(let L of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of X.scan(_).exports)if(L!=="default")G.add(L)}catch{}_=r0(_),_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(default\s+)?/gm,""),_=X.transformSync(_),Q.push(`// Composable: ${H}
9782
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${B}:`,_)}if(Q.length===0||G.size===0)return b5.set(Z,""),null;let W=[...G].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
9545
9783
  `),q=JSON.stringify([...G]),z=Q.join(`
9546
9784
 
9547
9785
  `),j=`;(function(){
9548
9786
  window.__composables = window.__composables || {};
9549
9787
  var __c = window.__composables;
9550
9788
  var __stx = window.stx || {};
9551
- ${P$.filter((_)=>!K.has(_)&&new RegExp(`\\b${_}\\b`).test(z)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
9789
+ ${C$.filter((B)=>!K.has(B)&&new RegExp(`\\b${B}\\b`).test(z)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
9552
9790
  `)}
9553
9791
  ${z}
9554
9792
  ${W}
@@ -9565,7 +9803,7 @@ ${W}
9565
9803
  }
9566
9804
  window[__n] = __c[__n];
9567
9805
  }
9568
- })();`;return k5.set(Z,j),j}function gj(){k5.clear(),t6.clear()}var k5,t6,Cj;var rJ=b(()=>{s1();P1();r5();k5=new Map,t6=new Map,Cj=["composables","functions"]});var tJ={};a(tJ,{processDeferDirectives:()=>pj});function hj(){return`stx-defer-${++aJ}`}function dj($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function uj($,Z,Y){let{trigger:J,value:X}=dj(Z),Q=Y,G,K,W,q=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(q)G=q[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)W=U[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:J,triggerValue:X,content:Q,placeholder:G,loading:K,error:W}}function mj($,Z){let{trigger:Y,triggerValue:J}=Z,X;switch(Y){case"visible":X=`
9806
+ })();`;return b5.set(Z,j),j}function aj(){b5.clear(),Z9.clear()}var b5,Z9,nj;var QX=b(()=>{s1();P1();a5();b5=new Map,Z9=new Map,nj=["composables","functions"]});var KX={};a(KX,{processDeferDirectives:()=>YB});function tj(){return`stx-defer-${++GX}`}function ej($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function $B($,Z,Y){let{trigger:J,value:X}=ej(Z),Q=Y,G,K,W,q=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(q)G=q[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)W=U[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:J,triggerValue:X,content:Q,placeholder:G,loading:K,error:W}}function ZB($,Z){let{trigger:Y,triggerValue:J}=Z,X;switch(Y){case"visible":X=`
9569
9807
  const observer = new IntersectionObserver((entries) => {
9570
9808
  if (entries[0].isIntersecting) {
9571
9809
  observer.disconnect();
@@ -9638,15 +9876,15 @@ else {
9638
9876
  ${X}
9639
9877
  })();
9640
9878
  </script>
9641
- `}function pj($,Z,Y){aJ=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(X,Q,G)=>{let K=hj(),W=uj(X,Q,G),q=W.placeholder?`<div data-defer-placeholder>${W.placeholder}</div>`:"",z=W.loading?`<div data-defer-loading style="display: none;">${W.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',U=W.error?`<div data-defer-error style="display: none;">${W.error}</div>`:"",j=`<div data-defer-content style="display: none;">${W.content}</div>`,_=mj(K,W);return`
9879
+ `}function YB($,Z,Y){GX=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(X,Q,G)=>{let K=tj(),W=$B(X,Q,G),q=W.placeholder?`<div data-defer-placeholder>${W.placeholder}</div>`:"",z=W.loading?`<div data-defer-loading style="display: none;">${W.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',U=W.error?`<div data-defer-error style="display: none;">${W.error}</div>`:"",j=`<div data-defer-content style="display: none;">${W.content}</div>`,B=ZB(K,W);return`
9642
9880
  <div id="${K}" class="stx-defer" data-defer-trigger="${W.trigger}">
9643
9881
  ${q}
9644
9882
  ${z}
9645
9883
  ${j}
9646
9884
  ${U}
9647
9885
  </div>
9648
- ${_}
9649
- `})}var aJ=0;var $X={};a($X,{processTeleportDirectives:()=>nj,ensureTeleportTargets:()=>oj});function lj(){return`stx-teleport-${++eJ}`}function cj($){let Z=$.split(",").map((X)=>X.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let X=1;X<Z.length;X++){let Q=Z[X].match(/disabled:\s*(.+)/);if(Q)J=Q[1].trim()}return{target:Y,disabled:J}}function ij($,Z){return`
9886
+ ${B}
9887
+ `})}var GX=0;var qX={};a(qX,{processTeleportDirectives:()=>GB,ensureTeleportTargets:()=>KB});function JB(){return`stx-teleport-${++WX}`}function XB($){let Z=$.split(",").map((X)=>X.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let X=1;X<Z.length;X++){let Q=Z[X].match(/disabled:\s*(.+)/);if(Q)J=Q[1].trim()}return{target:Y,disabled:J}}function QB($,Z){return`
9650
9888
  <script>
9651
9889
  (function() {
9652
9890
  const source = document.getElementById('${$}');
@@ -9692,12 +9930,12 @@ else {
9692
9930
  });
9693
9931
  })();
9694
9932
  </script>
9695
- `}function nj($,Z,Y){eJ=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(X,Q,G)=>{let K=lj(),{target:W,disabled:q}=cj(Q),z=G.trim();if(q)try{let j=!1;if(q==="true")j=!0;else if(q==="false")j=!1;else if(q in Z)j=Boolean(Z[q]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${z}</div>`}catch{}let U=ij(K,W);return`
9933
+ `}function GB($,Z,Y){WX=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(X,Q,G)=>{let K=JB(),{target:W,disabled:q}=XB(Q),z=G.trim();if(q)try{let j=!1;if(q==="true")j=!0;else if(q==="false")j=!1;else if(q in Z)j=Boolean(Z[q]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${z}</div>`}catch{}let U=QB(K,W);return`
9696
9934
  <div id="${K}" class="stx-teleport-source" style="display: none;">
9697
9935
  <template>${z}</template>
9698
9936
  </div>
9699
9937
  ${U}
9700
- `})}function oj(){return`
9938
+ `})}function KB(){return`
9701
9939
  <script>
9702
9940
  (function() {
9703
9941
  // Common teleport targets
@@ -9714,7 +9952,7 @@ else {
9714
9952
  });
9715
9953
  })();
9716
9954
  </script>
9717
- `}var eJ=0;var XX={};a(XX,{processTransitionDirectives:()=>tj,processTransitionAttributes:()=>Y_,performLeave:()=>aj,performEnter:()=>rj,generateTransitionRuntime:()=>Z_,generateTransitionCSS:()=>$_});function ZX($,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 sj($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=Z.animationDuration||"0s",X=(Q)=>{let G=Q.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(X(Y),X(J))}function YX($,Z){return new Promise((Y)=>{let J=Z??sj($);if(J===0){Y();return}let X=!1,Q=()=>{if(X)return;X=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,J+50)})}function JX($){$.offsetHeight}async function rj($,Z={}){let Y=Z.name||"stx",J=ZX(Y,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),JX($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await YX($,X);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function aj($,Z={}){let Y=Z.name||"stx",J=ZX(Y,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),JX($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await YX($,X);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function tj($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(X,Q,G)=>{let K=ej(Q),W=K.name||"stx",q=K.duration||300,z=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
9955
+ `}var WX=0;var BX={};a(BX,{processTransitionDirectives:()=>UB,processTransitionAttributes:()=>HB,performLeave:()=>zB,performEnter:()=>qB,generateTransitionRuntime:()=>_B,generateTransitionCSS:()=>BB});function zX($,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 WB($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=Z.animationDuration||"0s",X=(Q)=>{let G=Q.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(X(Y),X(J))}function UX($,Z){return new Promise((Y)=>{let J=Z??WB($);if(J===0){Y();return}let X=!1,Q=()=>{if(X)return;X=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,J+50)})}function jX($){$.offsetHeight}async function qB($,Z={}){let Y=Z.name||"stx",J=zX(Y,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),jX($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await UX($,X);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function zB($,Z={}){let Y=Z.name||"stx",J=zX(Y,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),jX($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await UX($,X);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function UB($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(X,Q,G)=>{let K=jB(Q),W=K.name||"stx",q=K.duration||300,z=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
9718
9956
  <div
9719
9957
  class="stx-transition-wrapper"
9720
9958
  data-transition="${W}"
@@ -9756,7 +9994,7 @@ else {
9756
9994
  });
9757
9995
  })();
9758
9996
  </script>
9759
- `})}function ej($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4]||J[5];switch(X){case"name":Z.name=Q;break;case"duration":Z.duration=parseInt(Q,10);break;case"mode":Z.mode=Q;break;case"easing":Z.easing=Q;break}}return Z}function $_(){return`
9997
+ `})}function jB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4]||J[5];switch(X){case"name":Z.name=Q;break;case"duration":Z.duration=parseInt(Q,10);break;case"mode":Z.mode=Q;break;case"easing":Z.easing=Q;break}}return Z}function BB(){return`
9760
9998
  /* STX Transition Presets */
9761
9999
 
9762
10000
  /* Fade */
@@ -9943,7 +10181,7 @@ else {
9943
10181
  opacity: 1;
9944
10182
  max-height: 1000px;
9945
10183
  }
9946
- `}function Z_(){return`
10184
+ `}function _B(){return`
9947
10185
  // STX Transition Runtime
9948
10186
  (function() {
9949
10187
  if (typeof window === 'undefined') return;
@@ -10032,7 +10270,7 @@ else {
10032
10270
 
10033
10271
  console.log('[stx] Transition runtime initialized');
10034
10272
  })();
10035
- `}function Y_($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var GX={};a(GX,{withErrorBoundary:()=>QX,processErrorBoundaryDirectives:()=>Q_,generateErrorBoundaryRuntime:()=>z_,generateErrorBoundaryCSS:()=>q_,createErrorBoundary:()=>W_});function X_(){return`eb-${++J_}-${Date.now().toString(36)}`}function Q_($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(X,Q,G,K)=>{let W=X_(),q=G_(Q||"");return K_(W,G.trim(),K.trim(),q)})}function G_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4];switch(X){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function K_($,Z,Y,J){let X=J.logErrors!==!1;return`
10273
+ `}function HB($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var HX={};a(HX,{withErrorBoundary:()=>_X,processErrorBoundaryDirectives:()=>FB,generateErrorBoundaryRuntime:()=>NB,generateErrorBoundaryCSS:()=>RB,createErrorBoundary:()=>AB});function LB(){return`eb-${++OB}-${Date.now().toString(36)}`}function FB($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(X,Q,G,K)=>{let W=LB(),q=VB(Q||"");return wB(W,G.trim(),K.trim(),q)})}function VB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3]||J[4];switch(X){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function wB($,Z,Y,J){let X=J.logErrors!==!1;return`
10036
10274
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
10037
10275
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
10038
10276
  ${Z}
@@ -10152,7 +10390,7 @@ else {
10152
10390
  };
10153
10391
  })();
10154
10392
  </script>
10155
- `}async function QX($,Z,Y){try{return await $()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return Z}}function W_($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>QX(J,$,Y)}function q_(){return`
10393
+ `}async function _X($,Z,Y){try{return await $()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return Z}}function AB($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>_X(J,$,Y)}function RB(){return`
10156
10394
  /* STX Error Boundary Styles */
10157
10395
  .stx-error-boundary {
10158
10396
  position: relative;
@@ -10196,7 +10434,7 @@ else {
10196
10434
  color: #fecaca;
10197
10435
  }
10198
10436
  }
10199
- `}function z_(){return`
10437
+ `}function NB(){return`
10200
10438
  // STX Error Boundary Runtime
10201
10439
  (function() {
10202
10440
  if (typeof window === 'undefined') return;
@@ -10261,7 +10499,7 @@ else {
10261
10499
 
10262
10500
  console.log('[stx] Error boundary runtime initialized');
10263
10501
  })();
10264
- `}var J_=0;var KX={};a(KX,{renderSSRSuspense:()=>L_,processSuspenseDirectives:()=>__,generateSuspenseRuntime:()=>V_,generateSuspenseCSS:()=>F_,createSSRSuspense:()=>O_});function j_(){return`suspense-${++U_}-${Date.now().toString(36)}`}function __($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let W=j_(),q=B_(Q||"");return H_(W,G.trim(),K.trim(),q)})}function B_($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function H_($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
10502
+ `}var OB=0;var OX={};a(OX,{renderSSRSuspense:()=>bB,processSuspenseDirectives:()=>IB,generateSuspenseRuntime:()=>yB,generateSuspenseCSS:()=>SB,createSSRSuspense:()=>kB});function TB(){return`suspense-${++MB}-${Date.now().toString(36)}`}function IB($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(X,Q,G,K)=>{let W=TB(),q=DB(Q||"");return EB(W,G.trim(),K.trim(),q)})}function DB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function EB($,Z,Y,J){let X=J.timeout||30000,Q=J.id||$;return`
10265
10503
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${Q}" data-status="pending">
10266
10504
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
10267
10505
  ${Y}
@@ -10451,7 +10689,7 @@ else {
10451
10689
  }, 0);
10452
10690
  })();
10453
10691
  </script>
10454
- `}function O_($,Z,Y){return{id:$,fallback:Y,content:Z}}async function L_($){let Z=$.map((J)=>`
10692
+ `}function kB($,Z,Y){return{id:$,fallback:Y,content:Z}}async function bB($){let Z=$.map((J)=>`
10455
10693
  <div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
10456
10694
  ${J.fallback}
10457
10695
  </div>
@@ -10476,7 +10714,7 @@ else {
10476
10714
  }
10477
10715
  })();
10478
10716
  </script>
10479
- `}}return{initial:Z,streaming:Y()}}function F_(){return`
10717
+ `}}return{initial:Z,streaming:Y()}}function SB(){return`
10480
10718
  /* STX Suspense Styles */
10481
10719
  .stx-suspense {
10482
10720
  position: relative;
@@ -10532,7 +10770,7 @@ else {
10532
10770
  background-size: 200% 100%;
10533
10771
  }
10534
10772
  }
10535
- `}function V_(){return`
10773
+ `}function yB(){return`
10536
10774
  // STX Suspense Runtime
10537
10775
  (function() {
10538
10776
  if (typeof window === 'undefined') return;
@@ -10599,7 +10837,7 @@ else {
10599
10837
 
10600
10838
  console.log('[stx] Suspense runtime initialized');
10601
10839
  })();
10602
- `}var U_=0;var UX={};a(UX,{processAsyncDirectives:()=>A_,isAsyncComponent:()=>N_,generateAsyncComponentRuntime:()=>T_,generateAsyncComponentCSS:()=>M_,defineAsyncComponent:()=>R_});function WX(){return`async-${++w_}-${Date.now().toString(36)}`}function A_($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(J,(G,K,W,q)=>{let z=WX(),U=qX(K);return zX(z,U,W.trim(),q.trim())}),Q=Q.replace(X,(G,K,W)=>{let q=WX(),z=qX(K);return zX(q,z,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function qX($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4],K=J[5];switch(X){case"component":Z.component=Q||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function zX($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:W}=Z;return`
10840
+ `}var MB=0;var wX={};a(wX,{processAsyncDirectives:()=>CB,isAsyncComponent:()=>xB,generateAsyncComponentRuntime:()=>gB,generateAsyncComponentCSS:()=>fB,defineAsyncComponent:()=>vB});function LX(){return`async-${++PB}-${Date.now().toString(36)}`}function CB($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(J,(G,K,W,q)=>{let z=LX(),U=FX(K);return VX(z,U,W.trim(),q.trim())}),Q=Q.replace(X,(G,K,W)=>{let q=LX(),z=FX(K);return VX(q,z,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function FX($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4],K=J[5];switch(X){case"component":Z.component=Q||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function VX($,Z,Y,J){let{component:X,timeout:Q,delay:G,suspensible:K,retries:W}=Z;return`
10603
10841
  <div class="stx-async-component" data-async-id="${$}" data-component="${X}" data-status="pending">
10604
10842
  <div class="stx-async-loading" data-async-loading="${$}">
10605
10843
  ${Y}
@@ -10826,7 +11064,7 @@ catch (error) {
10826
11064
  loadComponent();
10827
11065
  })();
10828
11066
  </script>
10829
- `}function R_($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function N_($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function M_(){return`
11067
+ `}function vB($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function xB($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function fB(){return`
10830
11068
  /* STX Async Component Styles */
10831
11069
  .stx-async-component {
10832
11070
  position: relative;
@@ -10900,7 +11138,7 @@ catch (error) {
10900
11138
  background-size: 200% 100%;
10901
11139
  }
10902
11140
  }
10903
- `}function T_(){return`
11141
+ `}function gB(){return`
10904
11142
  // STX Async Component Runtime
10905
11143
  (function() {
10906
11144
  if (typeof window === 'undefined') return;
@@ -10954,7 +11192,7 @@ catch (error) {
10954
11192
 
10955
11193
  console.log('[stx] Async component runtime initialized');
10956
11194
  })();
10957
- `}var w_=0;var _X={};a(_X,{shouldCacheComponent:()=>S_,processKeepAliveDirectives:()=>D_,onDeactivated:()=>v_,onActivated:()=>C_,generateKeepAliveRuntime:()=>P_,generateKeepAliveCSS:()=>y_,createKeepAliveCache:()=>b_});function jX(){return`keep-alive-${++I_}-${Date.now().toString(36)}`}function D_($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(X,Q,G)=>{let K=jX(),W=E_(Q||"");return k_(K,G.trim(),W)})}function E_($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=Q;break;case"exclude":Z.exclude=Q;break;case"id":Z.id=Q;break}}return Z}function k_($,Z,Y){let{max:J,include:X,exclude:Q}=Y,G=Y.id||$;return`
11195
+ `}var PB=0;var RX={};a(RX,{shouldCacheComponent:()=>lB,processKeepAliveDirectives:()=>dB,onDeactivated:()=>oB,onActivated:()=>nB,generateKeepAliveRuntime:()=>iB,generateKeepAliveCSS:()=>cB,createKeepAliveCache:()=>pB});function AX(){return`keep-alive-${++hB}-${Date.now().toString(36)}`}function dB($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(X,Q,G)=>{let K=AX(),W=uB(Q||"");return mB(K,G.trim(),W)})}function uB($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let X=J[1],Q=J[2]||J[3],G=J[4];switch(X){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=Q;break;case"exclude":Z.exclude=Q;break;case"id":Z.id=Q;break}}return Z}function mB($,Z,Y){let{max:J,include:X,exclude:Q}=Y,G=Y.id||$;return`
10958
11196
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
10959
11197
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
10960
11198
  ${Z}
@@ -11241,7 +11479,7 @@ else {
11241
11479
  });
11242
11480
  })();
11243
11481
  </script>
11244
- `}function b_($={}){return{id:$.id||jX(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function S_($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function y_(){return`
11482
+ `}function pB($={}){return{id:$.id||AX(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function lB($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function cB(){return`
11245
11483
  /* STX Keep-Alive Styles */
11246
11484
  .stx-keep-alive {
11247
11485
  position: relative;
@@ -11266,7 +11504,7 @@ else {
11266
11504
  .stx-keep-alive-content > [data-activated] {
11267
11505
  opacity: 1;
11268
11506
  }
11269
- `}function P_(){return`
11507
+ `}function iB(){return`
11270
11508
  // STX Keep-Alive Runtime
11271
11509
  (function() {
11272
11510
  if (typeof window === 'undefined') return;
@@ -11302,20 +11540,20 @@ else {
11302
11540
 
11303
11541
  console.log('[stx] Keep-alive runtime initialized');
11304
11542
  })();
11305
- `}function C_($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function v_($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var I_=0;var FX={};a(FX,{useVirtualList:()=>HX,processVirtualListDirectives:()=>$9,processVirtualGridDirectives:()=>LX,processInfiniteListDirectives:()=>OX,generateVirtualListCSS:()=>BX,default:()=>x_,createVirtualList:()=>e6});function e6($,Z){let{itemHeight:Y,containerHeight:J,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:W="vertical"}=Z,q=[...$],z=0,U=new Map;function j(){if(G)return _();let R=Math.max(0,Math.floor(z/Y)-X),N=Math.ceil(J/Y),M=Math.min(q.length-1,R+N+X*2);return{startIndex:R,endIndex:M}}function _(){let R=0,N=0,M=q.length-1;for(let T=0;T<q.length;T++){let I=U.get(T)||K;if(R+I>z){N=Math.max(0,T-X);break}R+=I}R=0;for(let T=0;T<q.length;T++){let I=U.get(T)||K;if(R+=I,R>z+J){M=Math.min(q.length-1,T+X);break}}return{startIndex:N,endIndex:M}}function B(){if(G){let R=0;for(let N=0;N<q.length;N++)R+=U.get(N)||K;return R}return q.length*Y}function H(R){if(G){let N=0;for(let M=0;M<R;M++)N+=U.get(M)||K;return N}return R*Y}function L(){let{startIndex:R,endIndex:N}=j();return{startIndex:R,endIndex:N,scrollTop:z,totalHeight:B(),visibleItems:q.slice(R,N+1),itemHeights:new Map(U)}}function F(R,N="auto"){let M=H(R);O(M,N)}function O(R,N="auto"){z=Math.max(0,Math.min(R,B()-J))}function V(){j()}function w(R){q=[...R],U.clear(),V()}function A(){q=[],U.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:A}}function $9($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();z={...z,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(z.containerHeight/z.itemHeight),_=z.overscan||3,B=0,H=Math.min(q.length-1,j+_),L="";for(let O=B;O<=H&&O<q.length;O++){let V=q[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof V==="object"&&V!==null)return String(V[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
11543
+ `}function nB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function oB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var hB=0;var DX={};a(DX,{useVirtualList:()=>MX,processVirtualListDirectives:()=>J9,processVirtualGridDirectives:()=>IX,processInfiniteListDirectives:()=>TX,generateVirtualListCSS:()=>NX,default:()=>sB,createVirtualList:()=>Y9});function Y9($,Z){let{itemHeight:Y,containerHeight:J,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:W="vertical"}=Z,q=[...$],z=0,U=new Map;function j(){if(G)return B();let R=Math.max(0,Math.floor(z/Y)-X),N=Math.ceil(J/Y),T=Math.min(q.length-1,R+N+X*2);return{startIndex:R,endIndex:T}}function B(){let R=0,N=0,T=q.length-1;for(let M=0;M<q.length;M++){let I=U.get(M)||K;if(R+I>z){N=Math.max(0,M-X);break}R+=I}R=0;for(let M=0;M<q.length;M++){let I=U.get(M)||K;if(R+=I,R>z+J){T=Math.min(q.length-1,M+X);break}}return{startIndex:N,endIndex:T}}function _(){if(G){let R=0;for(let N=0;N<q.length;N++)R+=U.get(N)||K;return R}return q.length*Y}function H(R){if(G){let N=0;for(let T=0;T<R;T++)N+=U.get(T)||K;return N}return R*Y}function L(){let{startIndex:R,endIndex:N}=j();return{startIndex:R,endIndex:N,scrollTop:z,totalHeight:_(),visibleItems:q.slice(R,N+1),itemHeights:new Map(U)}}function V(R,N="auto"){let T=H(R);O(T,N)}function O(R,N="auto"){z=Math.max(0,Math.min(R,_()-J))}function F(){j()}function w(R){q=[...R],U.clear(),F()}function A(){q=[],U.clear()}return{scrollToIndex:V,scrollToOffset:O,getState:L,refresh:F,setItems:w,destroy:A}}function J9($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),F=Function(`return ${O}`)();z={...z,...F}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(z.containerHeight/z.itemHeight),B=z.overscan||3,_=0,H=Math.min(q.length-1,j+B),L="";for(let O=_;O<=H&&O<q.length;O++){let F=q[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
11306
11544
  <div class="virtual-item ${z.itemClass||""}"
11307
11545
  style="position: absolute; top: ${O*z.itemHeight}px; height: ${z.itemHeight}px; width: 100%;"
11308
11546
  data-index="${O}">
11309
11547
  ${w}
11310
- </div>`}let F=q.length*z.itemHeight;return`
11548
+ </div>`}let V=q.length*z.itemHeight;return`
11311
11549
  <div id="${U}"
11312
11550
  class="virtual-list-container ${z.containerClass||""}"
11313
11551
  style="position: relative; height: ${z.containerHeight}px; overflow-y: auto;"
11314
11552
  data-item-height="${z.itemHeight}"
11315
11553
  data-total-items="${q.length}"
11316
- data-overscan="${_}">
11554
+ data-overscan="${B}">
11317
11555
  <div class="virtual-list-viewport ${z.viewportClass||""}"
11318
- style="position: relative; height: ${F}px; width: 100%;">
11556
+ style="position: relative; height: ${V}px; width: 100%;">
11319
11557
  ${L}
11320
11558
  </div>
11321
11559
  </div>
@@ -11327,7 +11565,7 @@ else {
11327
11565
  const viewport = container.querySelector('.virtual-list-viewport');
11328
11566
  const itemHeight = ${z.itemHeight};
11329
11567
  const totalItems = ${q.length};
11330
- const overscan = ${_};
11568
+ const overscan = ${B};
11331
11569
  const containerHeight = ${z.containerHeight};
11332
11570
  const items = ${JSON.stringify(q)};
11333
11571
  const template = ${JSON.stringify(K.trim())};
@@ -11379,7 +11617,7 @@ else {
11379
11617
  };
11380
11618
  })();
11381
11619
  </script>
11382
- `})}function BX(){return`
11620
+ `})}function NX(){return`
11383
11621
  .virtual-list-container {
11384
11622
  position: relative;
11385
11623
  overflow-y: auto;
@@ -11427,7 +11665,7 @@ else {
11427
11665
  0% { background-position: 200% 0; }
11428
11666
  100% { background-position: -200% 0; }
11429
11667
  }
11430
- `}function HX($,Z){let Y=null,J=()=>{if(!Y)Y=e6($(),Z);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(X)=>{let Q=X.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(X)=>({style:{position:"absolute",top:`${X*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":X}),scrollToIndex:(X)=>{J().scrollToIndex(X)}}}function OX($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(X,Q,G,K,W)=>{let q=Q.trim(),z=Z[q];if(!z||!Array.isArray(z))return`<!-- infiniteList: items "${q}" 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 j=`ilist-${Math.random().toString(36).substring(2,9)}`,_=$9(`@virtualList(${q}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
11668
+ `}function MX($,Z){let Y=null,J=()=>{if(!Y)Y=Y9($(),Z);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(X)=>{let Q=X.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(X)=>({style:{position:"absolute",top:`${X*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":X}),scrollToIndex:(X)=>{J().scrollToIndex(X)}}}function TX($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(X,Q,G,K,W)=>{let q=Q.trim(),z=Z[q];if(!z||!Array.isArray(z))return`<!-- infiniteList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let _=Function(`return ${G.trim()}`)();U={...U,..._}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,B=J9(`@virtualList(${q}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return B=B.replace("</script>",`
11431
11669
  // Infinite scroll detection
11432
11670
  container.addEventListener('scroll', function() {
11433
11671
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -11440,22 +11678,22 @@ else {
11440
11678
  });
11441
11679
  </script>`),`
11442
11680
  <div id="${j}" class="infinite-list-wrapper">
11443
- ${_}
11681
+ ${B}
11444
11682
  <div class="infinite-list-loading" style="display: none;">
11445
11683
  ${W}
11446
11684
  </div>
11447
11685
  </div>
11448
- `})}function LX($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualGrid: items "${W}" not found or not an array -->`;let z={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();z={...z,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(q.length/z.columns),_=j*(z.rowHeight+(z.gap||0)),B=Math.ceil(z.containerHeight/(z.rowHeight+(z.gap||0))),H=z.overscan||2,L=0,F=Math.min(j-1,B+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<z.columns;w++){let A=V*z.columns+w;if(A>=q.length)break;let R=q[A],N=w*(100/z.columns),M=V*(z.rowHeight+(z.gap||0)),T=K.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,E)=>{if(typeof R==="object"&&R!==null)return String(R[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
11686
+ `})}function IX($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualGrid: items "${W}" not found or not an array -->`;let z={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let F=Function(`return ${G.trim()}`)();z={...z,...F}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(q.length/z.columns),B=j*(z.rowHeight+(z.gap||0)),_=Math.ceil(z.containerHeight/(z.rowHeight+(z.gap||0))),H=z.overscan||2,L=0,V=Math.min(j-1,_+H),O="";for(let F=L;F<=V;F++)for(let w=0;w<z.columns;w++){let A=F*z.columns+w;if(A>=q.length)break;let R=q[A],N=w*(100/z.columns),T=F*(z.rowHeight+(z.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,E)=>{if(typeof R==="object"&&R!==null)return String(R[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
11449
11687
  <div class="virtual-grid-item"
11450
- style="position: absolute; top: ${M}px; left: ${N}%; width: calc(${100/z.columns}% - ${z.gap||0}px); height: ${z.rowHeight}px;"
11688
+ style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/z.columns}% - ${z.gap||0}px); height: ${z.rowHeight}px;"
11451
11689
  data-index="${A}">
11452
- ${T}
11690
+ ${M}
11453
11691
  </div>`}return`
11454
11692
  <div id="${U}"
11455
11693
  class="virtual-grid-container"
11456
11694
  style="position: relative; height: ${z.containerHeight}px; overflow-y: auto;">
11457
11695
  <div class="virtual-grid-viewport"
11458
- style="position: relative; height: ${_}px; width: 100%;">
11696
+ style="position: relative; height: ${B}px; width: 100%;">
11459
11697
  ${O}
11460
11698
  </div>
11461
11699
  </div>
@@ -11515,7 +11753,7 @@ else {
11515
11753
  });
11516
11754
  })();
11517
11755
  </script>
11518
- `})}var x_;var VX=b(()=>{x_={createVirtualList:e6,processVirtualListDirectives:$9,processInfiniteListDirectives:OX,processVirtualGridDirectives:LX,generateVirtualListCSS:BX,useVirtualList:HX}});function wX(){return`<script data-stx-hydration-runtime>
11756
+ `})}var sB;var EX=b(()=>{sB={createVirtualList:Y9,processVirtualListDirectives:J9,processInfiniteListDirectives:TX,processVirtualGridDirectives:IX,generateVirtualListCSS:NX,useVirtualList:MX}});function kX(){return`<script data-stx-hydration-runtime>
11519
11757
  (function() {
11520
11758
  'use strict';
11521
11759
 
@@ -11675,7 +11913,7 @@ else {
11675
11913
  stxIslands.initIslands();
11676
11914
  }
11677
11915
  })();
11678
- </script>`}function AX($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function RX($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var PX={};a(PX,{processStaticDirectives:()=>SX,processPartialHydrationDirectives:()=>MX,onHydrated:()=>bX,isHydrated:()=>kX,hydrateIsland:()=>IX,hydrateByStrategy:()=>DX,hydrateAll:()=>EX,generatePartialHydrationCSS:()=>TX,generateIslandManifest:()=>yX,default:()=>l_,createIslandRegistry:()=>NX});function NX(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function f_($){return`
11916
+ </script>`}function bX($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function SX($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var mX={};a(mX,{processStaticDirectives:()=>dX,processPartialHydrationDirectives:()=>PX,onHydrated:()=>hX,isHydrated:()=>gX,hydrateIsland:()=>vX,hydrateByStrategy:()=>xX,hydrateAll:()=>fX,generatePartialHydrationCSS:()=>CX,generateIslandManifest:()=>uX,default:()=>J_,createIslandRegistry:()=>yX});function yX(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function rB($){return`
11679
11917
  <script data-hydrate="${$}">
11680
11918
  (function() {
11681
11919
  const island = document.querySelector('[data-island="${$}"]');
@@ -11686,7 +11924,7 @@ else {
11686
11924
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
11687
11925
  })();
11688
11926
  </script>
11689
- `}function g_($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
11927
+ `}function aB($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
11690
11928
  <script data-hydrate="${$}">
11691
11929
  (function() {
11692
11930
  const island = document.querySelector('[data-island="${$}"]');
@@ -11722,7 +11960,7 @@ else {
11722
11960
  }
11723
11961
  })();
11724
11962
  </script>
11725
- `}function h_($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
11963
+ `}function tB($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
11726
11964
  <script data-hydrate="${$}">
11727
11965
  (function() {
11728
11966
  const island = document.querySelector('[data-island="${$}"]');
@@ -11755,7 +11993,7 @@ else {
11755
11993
  }
11756
11994
  })();
11757
11995
  </script>
11758
- `}function d_($,Z){let Y=Z.media||"(min-width: 768px)";return`
11996
+ `}function eB($,Z){let Y=Z.media||"(min-width: 768px)";return`
11759
11997
  <script data-hydrate="${$}">
11760
11998
  (function() {
11761
11999
  const island = document.querySelector('[data-island="${$}"]');
@@ -11784,7 +12022,7 @@ else {
11784
12022
  }
11785
12023
  })();
11786
12024
  </script>
11787
- `}function u_($){return`
12025
+ `}function $_($){return`
11788
12026
  <script data-hydrate="${$}">
11789
12027
  (function() {
11790
12028
  const island = document.querySelector('[data-island="${$}"]');
@@ -11806,7 +12044,7 @@ else {
11806
12044
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
11807
12045
  })();
11808
12046
  </script>
11809
- `}function m_($,Z){let Y=Z.event||"stx:activate";return`
12047
+ `}function Z_($,Z){let Y=Z.event||"stx:activate";return`
11810
12048
  <script data-hydrate="${$}">
11811
12049
  (function() {
11812
12050
  const island = document.querySelector('[data-island="${$}"]');
@@ -11827,19 +12065,19 @@ else {
11827
12065
  });
11828
12066
  })();
11829
12067
  </script>
11830
- `}function MX($,Z={},Y){let J=$,X=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=b5(J,"load",Z),J=b5(J,"idle",Z),J=b5(J,"visible",Z),J=b5(J,"media",Z),J=p_(J),J=b5(J,"hover",Z),J=b5(J,"event",Z),X=Q&&J!==$,X)J+=`
11831
- `+wX();return J}function b5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(X,Q,G)=>{let K={strategy:Z};if(Q)try{let H=Q.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,q=AX(G.trim()),z=RX(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(q)U.push(`data-component="${q}"`);let _=Object.keys(z).length>0?`
11832
- <script type="application/json" data-island-props="${W}">${JSON.stringify(z)}</script>`:"",B="";switch(Z){case"load":B=f_(W);break;case"idle":B=g_(W,K);break;case"visible":B=h_(W,K);break;case"media":B=d_(W,K);break;case"hover":B=u_(W);break;case"event":B=m_(W,K);break}return`
12068
+ `}function PX($,Z={},Y){let J=$,X=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=S5(J,"load",Z),J=S5(J,"idle",Z),J=S5(J,"visible",Z),J=S5(J,"media",Z),J=Y_(J),J=S5(J,"hover",Z),J=S5(J,"event",Z),X=Q&&J!==$,X)J+=`
12069
+ `+kX();return J}function S5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(X,Q,G)=>{let K={strategy:Z};if(Q)try{let H=Q.split(",").map((L)=>L.trim());for(let L of H){let[V,O]=L.split(":").map((F)=>F.trim());if(V&&O){let F=O.replace(/^['"]|['"]$/g,"");K[V]=F}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,q=bX(G.trim()),z=SX(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(q)U.push(`data-component="${q}"`);let B=Object.keys(z).length>0?`
12070
+ <script type="application/json" data-island-props="${W}">${JSON.stringify(z)}</script>`:"",_="";switch(Z){case"load":_=rB(W);break;case"idle":_=aB(W,K);break;case"visible":_=tB(W,K);break;case"media":_=eB(W,K);break;case"hover":_=$_(W);break;case"event":_=Z_(W,K);break}return`
11833
12071
  <div data-island="${W}"
11834
12072
  data-strategy="${Z}"
11835
12073
  ${U.join(`
11836
12074
  `)}
11837
12075
  class="stx-island"
11838
12076
  style="contents;">
11839
- ${G.trim()}${_}
12077
+ ${G.trim()}${B}
11840
12078
  </div>
11841
- ${B}
11842
- `})}function p_($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let X=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
12079
+ ${_}
12080
+ `})}function Y_($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let X=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
11843
12081
  <div data-island="${X}"
11844
12082
  data-strategy="only"
11845
12083
  class="stx-island stx-client-only">
@@ -11858,7 +12096,7 @@ else {
11858
12096
  }
11859
12097
  })();
11860
12098
  </script>
11861
- `})}function TX(){return`
12099
+ `})}function CX(){return`
11862
12100
  /* Island base styles */
11863
12101
  .stx-island {
11864
12102
  display: contents;
@@ -11899,11 +12137,11 @@ else {
11899
12137
  .stx-island.hydrated {
11900
12138
  opacity: 1;
11901
12139
  }
11902
- `}function IX($){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 DX($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function EX(){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 kX($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function bX($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function SX($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function yX($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
12140
+ `}function vX($){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 xX($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function fX(){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 gX($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function hX($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function dX($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function uX($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
11903
12141
  <script type="application/json" id="stx-island-manifest">
11904
12142
  ${JSON.stringify(Z)}
11905
12143
  </script>
11906
- `}var l_;var CX=b(()=>{l_={processPartialHydrationDirectives:MX,processStaticDirectives:SX,generatePartialHydrationCSS:TX,generateIslandManifest:yX,createIslandRegistry:NX,hydrateIsland:IX,hydrateByStrategy:DX,hydrateAll:EX,isHydrated:kX,onHydrated:bX}});var cX={};a(cX,{watchMultiple:()=>hX,watchEffect:()=>dX,watch:()=>gX,unref:()=>vX,toRefs:()=>xX,throttledComputed:()=>lX,stxWatchMultiple:()=>hX,stxWatchEffect:()=>dX,stxWatch:()=>gX,stxUnref:()=>vX,stxToRefs:()=>xX,stxThrottledComputed:()=>lX,stxShallowRef:()=>fX,stxRef:()=>S5,stxIsRef:()=>S1,stxDebouncedComputed:()=>pX,stxComputed:()=>R$,shallowRef:()=>fX,ref:()=>S5,processWatchDirectives:()=>mX,processComputedDirectives:()=>uX,isRef:()=>S1,default:()=>c_,debouncedComputed:()=>pX,computed:()=>R$});function S5($){let Z=$,Y=new Set,J={get value(){if(K1){let X=A$.get(J);if(!X)X=new Set,A$.set(J,X);X.add(K1)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,Y.forEach((G)=>G(X));let Q=A$.get(J);if(Q)Q.forEach((G)=>G())}},subscribe(X){return Y.add(X),()=>Y.delete(X)},peek(){return Z}};return J}function S1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function vX($){return S1($)?$.value:$}function xX($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=S5($[Y]);return Z}function fX($){return S5($)}function R$($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,X=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,W=new Set,q=()=>{if(G=!0,W.size>0){let j=U.value;W.forEach((_)=>_(j))}};function z(){K.clear();let j=K1;K1=q,K7.push(q);try{return Y()}finally{K7.pop(),K1=j}}let U={get value(){if(K1){let j=A$.get(U);if(!j)j=new Set,A$.set(U,j);j.add(K1)}if(G){let j=z();if(!X(Q,j))Q=j;G=!1}return Q},set value(j){if(J)J(j);else console.warn("Computed property is readonly")},subscribe(j){return W.add(j),()=>W.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function gX($,Z,Y={}){let{immediate:J=!1,deep:X=!1,flush:Q="pre",once:G=!1}=Y,K,W=!0,q=!1,z=()=>{if(S1($))return X?$5($.value):$.value;return $()},U=()=>{if(!W||q)return;let B=z();if(K!==void 0&&Object.is(K,B)&&!X)return;let H=()=>{if(Z(B,K),K=X?$5(B):B,G)_()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},j=null;if(S1($))j=$.subscribe(()=>U());else j=R$($).subscribe(()=>U());if(J)K=void 0,U();else K=z();let _=()=>{if(W=!1,j)j(),j=null};return _.pause=()=>{q=!0},_.resume=()=>{q=!1},_}function hX($,Z,Y={}){let{immediate:J=!1,once:X=!1}=Y,Q=$.map((U)=>S1(U)?U.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let U=$.map((j)=>S1(j)?j.value:void 0);if(Z(U,Q),Q=[...U],X)z()},q=$.map((U)=>{if(S1(U))return U.subscribe(()=>W());return()=>{}});if(J)W();let z=()=>{G=!1,q.forEach((U)=>U())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function dX($,Z={}){let{flush:Y="pre"}=Z,J,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(J)J();let W=K1;K1=G,K7.push(G);try{J=$()}finally{K7.pop(),K1=W}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(X=!1,J)J()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function uX($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(X,Q,G)=>{try{let W=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=W,`<!-- computed: ${Q} = ${W} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function mX($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(X,Q,G)=>{return`
12144
+ `}var J_;var pX=b(()=>{J_={processPartialHydrationDirectives:PX,processStaticDirectives:dX,generatePartialHydrationCSS:CX,generateIslandManifest:uX,createIslandRegistry:yX,hydrateIsland:vX,hydrateByStrategy:xX,hydrateAll:fX,isHydrated:gX,onHydrated:hX}});var $Q={};a($Q,{watchMultiple:()=>oX,watchEffect:()=>sX,watch:()=>nX,unref:()=>lX,toRefs:()=>cX,throttledComputed:()=>eX,stxWatchMultiple:()=>oX,stxWatchEffect:()=>sX,stxWatch:()=>nX,stxUnref:()=>lX,stxToRefs:()=>cX,stxThrottledComputed:()=>eX,stxShallowRef:()=>iX,stxRef:()=>y5,stxIsRef:()=>S1,stxDebouncedComputed:()=>tX,stxComputed:()=>N$,shallowRef:()=>iX,ref:()=>y5,processWatchDirectives:()=>aX,processComputedDirectives:()=>rX,isRef:()=>S1,default:()=>X_,debouncedComputed:()=>tX,computed:()=>N$});function y5($){let Z=$,Y=new Set,J={get value(){if(K1){let X=R$.get(J);if(!X)X=new Set,R$.set(J,X);X.add(K1)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,Y.forEach((G)=>G(X));let Q=R$.get(J);if(Q)Q.forEach((G)=>G())}},subscribe(X){return Y.add(X),()=>Y.delete(X)},peek(){return Z}};return J}function S1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function lX($){return S1($)?$.value:$}function cX($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=y5($[Y]);return Z}function iX($){return y5($)}function N$($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,X=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,W=new Set,q=()=>{if(G=!0,W.size>0){let j=U.value;W.forEach((B)=>B(j))}};function z(){K.clear();let j=K1;K1=q,z7.push(q);try{return Y()}finally{z7.pop(),K1=j}}let U={get value(){if(K1){let j=R$.get(U);if(!j)j=new Set,R$.set(U,j);j.add(K1)}if(G){let j=z();if(!X(Q,j))Q=j;G=!1}return Q},set value(j){if(J)J(j);else console.warn("Computed property is readonly")},subscribe(j){return W.add(j),()=>W.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function nX($,Z,Y={}){let{immediate:J=!1,deep:X=!1,flush:Q="pre",once:G=!1}=Y,K,W=!0,q=!1,z=()=>{if(S1($))return X?$5($.value):$.value;return $()},U=()=>{if(!W||q)return;let _=z();if(K!==void 0&&Object.is(K,_)&&!X)return;let H=()=>{if(Z(_,K),K=X?$5(_):_,G)B()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},j=null;if(S1($))j=$.subscribe(()=>U());else j=N$($).subscribe(()=>U());if(J)K=void 0,U();else K=z();let B=()=>{if(W=!1,j)j(),j=null};return B.pause=()=>{q=!0},B.resume=()=>{q=!1},B}function oX($,Z,Y={}){let{immediate:J=!1,once:X=!1}=Y,Q=$.map((U)=>S1(U)?U.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let U=$.map((j)=>S1(j)?j.value:void 0);if(Z(U,Q),Q=[...U],X)z()},q=$.map((U)=>{if(S1(U))return U.subscribe(()=>W());return()=>{}});if(J)W();let z=()=>{G=!1,q.forEach((U)=>U())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function sX($,Z={}){let{flush:Y="pre"}=Z,J,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(J)J();let W=K1;K1=G,z7.push(G);try{J=$()}finally{z7.pop(),K1=W}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(X=!1,J)J()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function rX($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(X,Q,G)=>{try{let W=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=W,`<!-- computed: ${Q} = ${W} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function aX($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(X,Q,G)=>{return`
11907
12145
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
11908
12146
  (function() {
11909
12147
  // Watch implementation for ${Q}
@@ -11915,9 +12153,9 @@ else {
11915
12153
  }
11916
12154
  })();
11917
12155
  </script>
11918
- `})}function $5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>$5(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set($5(X),$5(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add($5(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=$5($[Y]);return Z}function pX($,Z=100){let Y=S5($()),J=null,X=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return R$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}function lX($,Z=100){let Y=S5($()),J=0,X=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return R$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}var K1=null,K7,A$,c_;var iX=b(()=>{K7=[],A$=new WeakMap;c_={ref:S5,computed:R$,watch:gX,watchMultiple:hX,watchEffect:dX,isRef:S1,unref:vX,toRefs:xX,shallowRef:fX,debouncedComputed:pX,throttledComputed:lX,processComputedDirectives:uX,processWatchDirectives:mX}});var rX={};a(rX,{v:()=>i_,processHasErrorsDirective:()=>sX,processFormValidationDirectives:()=>o_,processErrorsDirective:()=>oX,processErrorDirective:()=>nX,defineForm:()=>n_,Validator:()=>y5});class y5{rules=[];defaultValue="";addRule($){let Z=new y5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Y}})}length($,Z,Y){let J=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:J,validate:(X)=>{if(!X)return!0;let Q=String(X).length;return Q>=$&&Q<=Z||J}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Y}})}between($,Z,Y){let J=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:J,validate:(X)=>{if(!X&&X!==0)return!0;let Q=Number(X);return Q>=$&&Q<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,X)=>{if(!X)return!0;return J===X[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return $.includes(J)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),J=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new y5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(X,Q)=>{if(!$(X,Q||{}))return!0;return J.validate(X,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new y5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let X=await J.validate($,Z);if(X!==!0)Y.push(X)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let X=J.validate($,Z);if(X!==!0)Y.push(X)}return Y}}function n_($,Z){let Y=Object.keys($),J={},X={},Q={},G={},K={};for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1,K[O]=!1;let W=!1;async function q(O){K[O]=!0;let V=await $[O].validate(J[O],J);return X[O]=V,K[O]=!1,V.length===0}async function z(){W=!0;let O=await Promise.all(Y.map(q));return W=!1,O.every(Boolean)}function U(){for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1}function j(O){for(let V of Y)if(V in O)J[V]=O[V],G[V]=!0}function _(O,V){J[O]=V,G[O]=!0}function B(O,V=!0){if(Q[O]=V,V)q(O)}function H(O){return{value:J[O],errors:X[O],touched:Q[O],dirty:G[O],valid:X[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)Q[A]=!0;if(await z())await O(J)}}return{values:J,errors:X,touched:Q,dirty:G,get isValid(){return Y.every((O)=>X[O].length===0)},get isValidating(){return W||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:z,validateField:q,reset:U,setValues:j,setFieldValue:_,setFieldTouched:B,getFieldState:H,handleSubmit:L}}function nX($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
11919
- `)}catch{return""}})}function oX($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((z)=>G.replace(/\{\{\s*message\s*\}\}/g,z)).join(`
11920
- `)}catch{return""}})}function sX($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return G}catch{return""}})}function o_($,Z,Y){let J=$;return J=nX(J,Z,Y),J=oX(J,Z,Y),J=sX(J,Z,Y),J}var i_;var aX=b(()=>{i_=new y5});var $Q={};a($Q,{processXElementDirectives:()=>s_,hasXElementDirectives:()=>eX,generateXElementRuntime:()=>tX});function tX(){return`<script data-stx-scoped data-stx-x-element-runtime>
12156
+ `})}function $5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>$5(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,X)=>Y.set($5(X),$5(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add($5(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=$5($[Y]);return Z}function tX($,Z=100){let Y=y5($()),J=null,X=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return N$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}function eX($,Z=100){let Y=y5($()),J=0,X=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return N$($).subscribe(()=>X()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}var K1=null,z7,R$,X_;var ZQ=b(()=>{z7=[],R$=new WeakMap;X_={ref:y5,computed:N$,watch:nX,watchMultiple:oX,watchEffect:sX,isRef:S1,unref:lX,toRefs:cX,shallowRef:iX,debouncedComputed:tX,throttledComputed:eX,processComputedDirectives:rX,processWatchDirectives:aX}});var QQ={};a(QQ,{v:()=>Q_,processHasErrorsDirective:()=>XQ,processFormValidationDirectives:()=>K_,processErrorsDirective:()=>JQ,processErrorDirective:()=>YQ,defineForm:()=>G_,Validator:()=>P5});class P5{rules=[];defaultValue="";addRule($){let Z=new P5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Y}})}length($,Z,Y){let J=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:J,validate:(X)=>{if(!X)return!0;let Q=String(X).length;return Q>=$&&Q<=Z||J}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Y}})}between($,Z,Y){let J=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:J,validate:(X)=>{if(!X&&X!==0)return!0;let Q=Number(X);return Q>=$&&Q<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,X)=>{if(!X)return!0;return J===X[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return $.includes(J)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),J=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(X)=>{if(!X)return!0;return new Date(String(X))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new P5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(X,Q)=>{if(!$(X,Q||{}))return!0;return J.validate(X,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new P5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let X=await J.validate($,Z);if(X!==!0)Y.push(X)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let X=J.validate($,Z);if(X!==!0)Y.push(X)}return Y}}function G_($,Z){let Y=Object.keys($),J={},X={},Q={},G={},K={};for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1,K[O]=!1;let W=!1;async function q(O){K[O]=!0;let F=await $[O].validate(J[O],J);return X[O]=F,K[O]=!1,F.length===0}async function z(){W=!0;let O=await Promise.all(Y.map(q));return W=!1,O.every(Boolean)}function U(){for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),X[O]=[],Q[O]=!1,G[O]=!1}function j(O){for(let F of Y)if(F in O)J[F]=O[F],G[F]=!0}function B(O,F){J[O]=F,G[O]=!0}function _(O,F=!0){if(Q[O]=F,F)q(O)}function H(O){return{value:J[O],errors:X[O],touched:Q[O],dirty:G[O],valid:X[O].length===0,validating:K[O]}}function L(O){return async(F)=>{F?.preventDefault?.();for(let A of Y)Q[A]=!0;if(await z())await O(J)}}return{values:J,errors:X,touched:Q,dirty:G,get isValid(){return Y.every((O)=>X[O].length===0)},get isValidating(){return W||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:z,validateField:q,reset:U,setValues:j,setFieldValue:B,setFieldTouched:_,getFieldState:H,handleSubmit:L}}function YQ($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
12157
+ `)}catch{return""}})}function JQ($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((z)=>G.replace(/\{\{\s*message\s*\}\}/g,z)).join(`
12158
+ `)}catch{return""}})}function XQ($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return G}catch{return""}})}function K_($,Z,Y){let J=$;return J=YQ(J,Z,Y),J=JQ(J,Z,Y),J=XQ(J,Z,Y),J}var Q_;var GQ=b(()=>{Q_=new P5});var qQ={};a(qQ,{processXElementDirectives:()=>W_,hasXElementDirectives:()=>WQ,generateXElementRuntime:()=>KQ});function KQ(){return`<script data-stx-scoped data-stx-x-element-runtime>
11921
12159
  (function() {
11922
12160
  'use strict';
11923
12161
 
@@ -12201,16 +12439,16 @@ else {
12201
12439
  // Expose for manual initialization
12202
12440
  window.XElement = XElement;
12203
12441
  })();
12204
- </script>`}function eX($){return/\bx-data(?:\s|=)/.test($)}function s_($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],J=Y.length>0?$.replace(Z,""):$;if(!eX(J))return J;let X=Y[0]?.trim()||tX(),Q=J.lastIndexOf("</body>");if(Q!==-1)return J.slice(0,Q)+X+`
12442
+ </script>`}function WQ($){return/\bx-data(?:\s|=)/.test($)}function W_($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],J=Y.length>0?$.replace(Z,""):$;if(!WQ(J))return J;let X=Y[0]?.trim()||KQ(),Q=J.lastIndexOf("</body>");if(Q!==-1)return J.slice(0,Q)+X+`
12205
12443
  `+J.slice(Q);return J+`
12206
- `+X}var ZQ={};a(ZQ,{rewriteImagesWithSiblings:()=>t_});import B1 from"path";async function t_($,Z){let Y=Z.formats??a_;if(!Z.publicDir)return $;let J=ZB($),X=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let U=K[0],j=U.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(YB(K.index,J))continue;G.push({idx:K.index,length:U.length,src:j[1],raw:U})}if(G.length===0)return $;let W=await Promise.all(G.map(async(U)=>{let j=await e_(U.src,Z.publicDir,Y);return{match:U,sources:j}}));for(let{match:U,sources:j}of W){if(j.length===0)continue;let B=`<picture>${j.map((H)=>`<source type="${H.mime}" srcset="${JB(H.url)}">`).join("")}${U.raw}</picture>`;X.push({start:U.idx,end:U.idx+U.length,replacement:B})}if(X.length===0)return $;let q="",z=0;for(let U of X)q+=$.slice(z,U.start),q+=U.replacement,z=U.end;return q+=$.slice(z),q}async function e_($,Z,Y){if(!$B($))return[];let J=B1.extname($).toLowerCase();if(!r_.has(J))return[];if(!$.startsWith("/"))return[];let X=B1.join(Z,$.slice(1)),Q=B1.dirname(X),G=B1.basename(X,J),K=B1.resolve(Q),W=B1.resolve(Z);if(!K.startsWith(W))return[];let q=B1.posix.dirname($),z=Y.map(async(j)=>{let _=B1.join(Q,`${G}${j.ext}`);if(!await Bun.file(_).exists())return null;return{url:B1.posix.join(q,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(z)).filter((j)=>j!==null)}function $B($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function ZB($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);return Z}function YB($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function JB($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var r_,a_;var YQ=b(()=>{r_=new Set([".jpg",".jpeg",".png",".gif"]),a_=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var JQ=()=>{};function Z9($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var XQ=b(()=>{JQ()});var QQ={};a(QQ,{injectPwaTags:()=>XB,generateThemeColorMeta:()=>KB,generateSwRegistrationScript:()=>QB,generatePwaTags:()=>W7,generateManifestLink:()=>GB});function W7($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=Z9($),Q=`
12444
+ `+X}var zQ={};a(zQ,{rewriteImagesWithSiblings:()=>U_});import _1 from"path";async function U_($,Z){let Y=Z.formats??z_;if(!Z.publicDir)return $;let J=__($),X=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let U=K[0],j=U.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(H_(K.index,J))continue;G.push({idx:K.index,length:U.length,src:j[1],raw:U})}if(G.length===0)return $;let W=await Promise.all(G.map(async(U)=>{let j=await j_(U.src,Z.publicDir,Y);return{match:U,sources:j}}));for(let{match:U,sources:j}of W){if(j.length===0)continue;let _=`<picture>${j.map((H)=>`<source type="${H.mime}" srcset="${O_(H.url)}">`).join("")}${U.raw}</picture>`;X.push({start:U.idx,end:U.idx+U.length,replacement:_})}if(X.length===0)return $;let q="",z=0;for(let U of X)q+=$.slice(z,U.start),q+=U.replacement,z=U.end;return q+=$.slice(z),q}async function j_($,Z,Y){if(!B_($))return[];let J=_1.extname($).toLowerCase();if(!q_.has(J))return[];if(!$.startsWith("/"))return[];let X=_1.join(Z,$.slice(1)),Q=_1.dirname(X),G=_1.basename(X,J),K=_1.resolve(Q),W=_1.resolve(Z);if(!K.startsWith(W))return[];let q=_1.posix.dirname($),z=Y.map(async(j)=>{let B=_1.join(Q,`${G}${j.ext}`);if(!await Bun.file(B).exists())return null;return{url:_1.posix.join(q,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(z)).filter((j)=>j!==null)}function B_($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function __($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);return Z}function H_($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function O_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var q_,z_;var UQ=b(()=>{q_=new Set([".jpg",".jpeg",".png",".gif"]),z_=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var jQ=()=>{};function X9($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var BQ=b(()=>{jQ()});var _Q={};a(_Q,{injectPwaTags:()=>L_,generateThemeColorMeta:()=>w_,generateSwRegistrationScript:()=>F_,generatePwaTags:()=>U7,generateManifestLink:()=>V_});function U7($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=X9($),Q=`
12207
12445
  <!-- stx PWA Meta Tags -->
12208
12446
  <link rel="manifest" href="/manifest.json">
12209
- <meta name="theme-color" content="${Y9(Y?.themeColor||"#000000")}">
12447
+ <meta name="theme-color" content="${Q9(Y?.themeColor||"#000000")}">
12210
12448
  <meta name="mobile-web-app-capable" content="yes">
12211
12449
  <meta name="apple-mobile-web-app-capable" content="yes">
12212
12450
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
12213
- <meta name="apple-mobile-web-app-title" content="${Y9(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)Q+=`
12451
+ <meta name="apple-mobile-web-app-title" content="${Q9(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)Q+=`
12214
12452
  <link rel="apple-touch-icon" href="${J}/apple-touch-icon.png">
12215
12453
  <link rel="apple-touch-icon" sizes="120x120" href="${J}/apple-touch-icon-120x120.png">
12216
12454
  <link rel="apple-touch-icon" sizes="152x152" href="${J}/apple-touch-icon-152x152.png">
@@ -12247,12 +12485,12 @@ if ('serviceWorker' in navigator) {
12247
12485
  });
12248
12486
  }
12249
12487
  </script>
12250
- <!-- End stx PWA -->`,Q}function XB($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1){let Q=W7(Z);return $.slice(0,X)+Q+`
12251
- `+$.slice(X)}return $+W7(Z)}let J=W7(Z);return $.replace("</head>",`${J}
12252
- </head>`)}function QB($){if(!$.pwa?.enabled)return"";return`<script>
12488
+ <!-- End stx PWA -->`,Q}function L_($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1){let Q=U7(Z);return $.slice(0,X)+Q+`
12489
+ `+$.slice(X)}return $+U7(Z)}let J=U7(Z);return $.replace("</head>",`${J}
12490
+ </head>`)}function F_($){if(!$.pwa?.enabled)return"";return`<script>
12253
12491
  if ('serviceWorker' in navigator) {
12254
12492
  window.addEventListener('load', function() {
12255
- navigator.serviceWorker.register('/${Z9($)}')
12493
+ navigator.serviceWorker.register('/${X9($)}')
12256
12494
  .then(function(registration) {
12257
12495
  console.log('[PWA] Service Worker registered:', registration.scope);
12258
12496
  })
@@ -12261,46 +12499,46 @@ if ('serviceWorker' in navigator) {
12261
12499
  });
12262
12500
  });
12263
12501
  }
12264
- </script>`}function GB(){return'<link rel="manifest" href="/manifest.json">'}function KB($){return`<meta name="theme-color" content="${Y9($)}">`}function Y9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var GQ=b(()=>{XQ()});import h0 from"path";import{deriveLayoutGroup as WB}from"stx-router/layout-metadata";function KQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qB($,Z){let Y=$.length,J=Z,X=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(J<Y){let K=$[J];if(G(J))return J;if(K==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
12502
+ </script>`}function V_(){return'<link rel="manifest" href="/manifest.json">'}function w_($){return`<meta name="theme-color" content="${Q9($)}">`}function Q9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var HQ=b(()=>{BQ()});import h0 from"path";import{deriveLayoutGroup as A_}from"stx-router/layout-metadata";function OQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function R_($,Z){let Y=$.length,J=Z,X=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(J<Y){let K=$[J];if(G(J))return J;if(K==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
12265
12503
  `,J+2),J===-1)return-1;J+=1,X=!0;continue}if(K==="/"&&$[J+1]==="*"){let W=$.indexOf("*/",J+2);if(W===-1)return-1;J=W+2,X=!0;continue}if(K==="/"&&X){let W=J+1,q=!1;while(W<Y){let z=$[W];if(z==="\\"){W+=2;continue}if(z==="[")q=!0;else if(z==="]")q=!1;else if(z==="/"&&!q){W++;break}else if(z===`
12266
12504
  `){W=-1;break}W++}if(W===-1){J++,X=!1;continue}while(W<Y&&/[a-z]/.test($[W]))W++;J=W,X=!1;continue}if(K==="'"||K==='"'){let W=K;J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]===W){J++;break}if($[J]===`
12267
- `)break;J++}X=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,X=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;J++}return-1}function q7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let X=J.index+J[0].length,Q=$.indexOf("</script>",X);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function WQ($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let Q=$.indexOf("-->",Y+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(Y),X=/^<style\b[^>]*>/i.exec(J);if(X){let Q=$.toLowerCase().indexOf("</style>",Y+X[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return Y;Z=Y+1}return-1}function zB($){let Z=q7($,"data-stx-runtime");if(!Z)return $;let Y=WQ($);if(Y===-1||Y===Z.start)return $;let J=$.slice(Z.start,Z.end),X=$.slice(0,Z.start)+$.slice(Z.end),Q=WQ(X);if(Q===-1)return J+`
12505
+ `)break;J++}X=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}if(Q.length===0)X=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,X=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,X=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))X=!1;else X=!0;J++}return-1}function j7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let X=J.index+J[0].length,Q=$.indexOf("</script>",X);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}function LQ($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let Q=$.indexOf("-->",Y+4);Z=Q===-1?$.length:Q+3;continue}let J=$.slice(Y),X=/^<style\b[^>]*>/i.exec(J);if(X){let Q=$.toLowerCase().indexOf("</style>",Y+X[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(J))return Y;Z=Y+1}return-1}function N_($){let Z=j7($,"data-stx-runtime");if(!Z)return $;let Y=LQ($);if(Y===-1||Y===Z.start)return $;let J=$.slice(Z.start,Z.end),X=$.slice(0,Z.start)+$.slice(Z.end),Q=LQ(X);if(Q===-1)return J+`
12268
12506
  `+X;return X.slice(0,Q)+J+`
12269
- `+X.slice(Q)}async function L0($,Z,Y,J,X){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;let Q=!Z.__stxProcessingDepth;if(Q)f9(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!G$()&&!b4())&&Y&&Y.endsWith(".stx"))G6($,Y);try{return await G8.timeAsync("template-processing",async()=>{let G=await UB($,Z,Y,J,X);if(Q)G=o6(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},q=(Z.__stx_runtime_head||null)??D7(),z=(Z.__stx_head_raw||"").trim(),U,j=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)U=j[1].trim(),z=z.replace(j[0],"").trim();let _=Z.__sections?.title,B=q.title||U||_,H={...K,...B&&{title:B},meta:[...K.meta||[],...q.meta||[]],link:[...K.link||[],...q.link||[]],script:[...K.script||[],...q.script||[]],headRaw:[K.headRaw,z].filter(Boolean).join(`
12270
- `),...q.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...q.htmlAttrs}},...q.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...q.bodyAttrs}}},L=c6(G);if(G=fJ(G,H,{...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)G=xJ(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=WB(V);G=G.replace("<head>",`<head>
12271
- <meta name="stx-layout" content="${KQ(V)}">
12272
- <meta name="stx-layout-group" content="${KQ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(Q){G=vJ(G);let K=J.app?.colorMode;if(K)G=PJ(G,K);G=zB(G)}if(Q)try{let{getStoreScript:K}=await t("stx/store-loader",()=>Promise.resolve().then(() => (nJ(),iJ))),W=J.storesDir,q=await K(W);if(q){let z=`<script data-stx-stores>${q}</script>`,U=q7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
12273
- `+z+G.slice(U.end)}}catch{}if(Q)try{let{getComposableScript:K}=await t("stx/composable-loader",()=>Promise.resolve().then(() => (rJ(),sJ))),W=J.composablesDir,q=await K(W);if(q){let z=`<script data-stx-composables>${q}</script>`,U=q7(G,"data-stx-stores")||q7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
12274
- `+z+G.slice(U.end)}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await z$(G,void 0,J.buildMode==="serve");if(Q)G=U8(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof C4)throw G;let K=G instanceof Error?G.message:String(G),W=new n1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(e0.log(W,{filePath:Y,context:Z}),P3.logDetailedError(W,{filePath:Y,template:$.substring(0,500)}),J.debug)throw W;return S3.createFallbackContent("Template Processing",W)}}async function UB($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!h0.isAbsolute(J.partialsDir)?h0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!h0.isAbsolute(J.componentsDir)?h0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!h0.isAbsolute(J.layoutsDir)?h0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,W=$;await BB(Y,Z),_B(Z,K),W=await F5(()=>FJ(W,Z,Y,K),W,(O)=>{e0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=J1(W,i5,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);W=q.output;let z=q.tokens,U=(O)=>z.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>z[Number(w)]??""),j="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,j),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),W=kJ(W),W=await uJ(W,Y,X);let _={};W=d6(W,_);let B={...Z.__sections||{}},H="",L=/@nolayout\b/.test(W);if(L)W=W.replace(/@nolayout\b\s*/g,"");let F=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(W),V=/@section\s*\(/.test(W);if(!O||V){let w="",A=h0.dirname(Y),R=K.layoutsDir?h0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let M=h0.join(A,"_layout.stx");if(await c(M)){w=M;break}let T=h0.dirname(A);if(T===A||T.length<R.length)break;A=T}if(w)H=w;else if(K.layoutsDir){let N=h0.isAbsolute(K.layoutsDir)?K.layoutsDir:h0.resolve(process.cwd(),K.layoutsDir),M=h0.join(N,`${K.defaultLayout}.stx`);if(await c(M))H=M}if(H&&!V)W=`@section('content')
12507
+ `+X.slice(Q)}async function L0($,Z,Y,J,X){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;let Q=!Z.__stxProcessingDepth;if(Q)d9(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!K$()&&!S4())&&Y&&Y.endsWith(".stx"))W6($,Y);try{return await q8.timeAsync("template-processing",async()=>{let G=await M_($,Z,Y,J,X);if(Q)G=a6(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},q=(Z.__stx_runtime_head||null)??k7(),z=(Z.__stx_head_raw||"").trim(),U,j=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)U=j[1].trim(),z=z.replace(j[0],"").trim();let B=Z.__sections?.title,_=q.title||U||B,H={...K,..._&&{title:_},meta:[...K.meta||[],...q.meta||[]],link:[...K.link||[],...q.link||[]],script:[...K.script||[],...q.script||[]],headRaw:[K.headRaw,z].filter(Boolean).join(`
12508
+ `),...q.htmlAttrs&&{htmlAttrs:mJ(K.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...q.bodyAttrs}}},L=o6(G);if(G=iJ(G,H,{...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)G=cJ(G,K),G=pJ(G,H.htmlAttrs);let V=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(V&&G.includes("<head")){let F=V[1],w=A_(F);G=G.replace("<head>",`<head>
12509
+ <meta name="stx-layout" content="${OQ(F)}">
12510
+ <meta name="stx-layout-group" content="${OQ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let F=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(F,"$1")}}if(Q){G=lJ(G);let K=J.app?.colorMode;if(K)G=gJ(G,K);G=hJ(G),G=N_(G)}if(Q)try{let{getStoreScript:K}=await t("stx/store-loader",()=>Promise.resolve().then(() => (YX(),ZX))),W=J.storesDir,q=await K(W);if(q){let z=`<script data-stx-stores>${q}</script>`,U=j7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
12511
+ `+z+G.slice(U.end)}}catch{}if(Q)try{let{getComposableScript:K}=await t("stx/composable-loader",()=>Promise.resolve().then(() => (QX(),XX))),W=J.composablesDir,q=await K(W);if(q){let z=`<script data-stx-composables>${q}</script>`,U=j7(G,"data-stx-stores")||j7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
12512
+ `+z+G.slice(U.end)}}catch{}if(Q&&Z.__stx_inject_css!==!1)G=await U$(G,void 0,J.buildMode==="serve");if(Q)G=_8(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof v4)throw G;let K=G instanceof Error?G.message:String(G),W=new n1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(e0.log(W,{filePath:Y,context:Z}),v3.logDetailedError(W,{filePath:Y,template:$.substring(0,500)}),J.debug)throw W;return P3.createFallbackContent("Template Processing",W)}}async function M_($,Z,Y,J,X){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!h0.isAbsolute(J.partialsDir)?h0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!h0.isAbsolute(J.componentsDir)?h0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!h0.isAbsolute(J.layoutsDir)?h0.resolve(Q,J.layoutsDir):J.layoutsDir},K=G,W=$;await D_(Y,Z),I_(Z,K),W=await F5(()=>NJ(W,Z,Y,K),W,(O)=>{e0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=J1(W,n5,(O,F)=>`\x00STX_HTML_COMMENT_${F}\x00`);W=q.output;let z=q.tokens,U=(O)=>z.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(F,w)=>z[Number(w)]??""),j="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,j),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(O,F)=>{return`{{ ${F} }}`}),W=CJ(W),W=await rJ(W,Y,X);let B={};W=m6(W,B);let _={...Z.__sections||{}},H="",L=/@nolayout\b/.test(W);if(L)W=W.replace(/@nolayout\b\s*/g,"");let V=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(V)H=V[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(W),F=/@section\s*\(/.test(W);if(!O||F){let w="",A=h0.dirname(Y),R=K.layoutsDir?h0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let T=h0.join(A,"_layout.stx");if(await c(T)){w=T;break}let M=h0.dirname(A);if(M===A||M.length<R.length)break;A=M}if(w)H=w;else if(K.layoutsDir){let N=h0.isAbsolute(K.layoutsDir)?K.layoutsDir:h0.resolve(process.cwd(),K.layoutsDir),T=h0.join(N,`${K.defaultLayout}.stx`);if(await c(T))H=T}if(H&&!F)W=`@section('content')
12275
12513
  ${W.trim()}
12276
- @endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return B[V]=w,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=Z0(w.trim(),Z);if(A===void 0)return O;return B[V]=String(A??""),""}catch{return O}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))B[V]=w.replace("@parent",Z5);else B[V]=w.trim();return""}),Z.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return B[V]||w||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=u6(W,_),H){let O=[],V=w1(W),w=J1(V.output,K5,(A,R)=>`\x00STX_ORPHAN_STYLE_${R}\x00`);if(W=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,R,N)=>{let M=R==="SCRIPT"?V.scripts[Number(N)]:w.tokens[Number(N)];if(M)O.push(M);return""}),O.length>0){let A=O.join(`
12277
- `);B.content=B.content?`${B.content}
12278
- ${A}`:A,Z.__sections=B}}if(H)try{let O;if(h0.isAbsolute(H))O=H,X.add(H);else O=await F5(()=>r7(H,Y,G,X),null,()=>{throw new n1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let M=`Layout not found: ${H} (referenced from ${Y})`;if(e0.log(Error(M),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new n1(M,Y);return W}let V=await F5(()=>Bun.file(O).text(),"",()=>{throw new n1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let M={},T=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,y,S)=>{return M[y]=S.trim(),""});for(let[D,y]of Object.entries(M))if(B[D]&&B[D].includes(Z5)){let S=B[D].indexOf(Z5);B[D]=B[D].slice(0,S)+y+B[D].slice(S+Z5.length)}else if(!B[D])B[D]=y;let I={...Z,__sections:B},E=`@layout('${w[1]}')${T}`;return await L0(E,I,O,G,X)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),R=d6(A,_),N={};return R=R.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,T,I)=>{return N[T]=I.trim(),`@slot('${T}')`}),R=R.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,T,I)=>{if(B[T]){let E=B[T];if(E.includes(Z5)){let D=N[T]||"",y=E.indexOf(Z5);E=E.slice(0,y)+D+E.slice(y+Z5.length)}return E}return I||""}),R=jB(R,B),R=R.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),R=u6(R,_),Z.__originalFilePath=Y,W=await qQ(R,Z,O,G,X),W=`<!-- stx-layout: ${H} -->
12279
- ${W}`,U(W)}catch(O){return e0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await qQ(W,Z,Y,G,X))}function jB($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,X)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function _B($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(Y)&&Q!==void 0)J[X]=Q;$.$env=J}async function BB($,Z){await F5(()=>NJ($,Z),void 0,(Y)=>{e0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function HB($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (e5(),g$)));await W(G,Z,Y,{preserveExisting:!0})}catch(W){let q=W instanceof Error?W:Error(String(W));e0.log(q,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${q.message}`)}}}async function OB($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await t("stx/expressions",()=>Promise.resolve().then(() => (X1(),Y8)));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return e0.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function qQ($,Z,Y,J,X){let Q=$,G=J;if(await HB(Q,Z,Y),Q=await OB(Q,Z,Y),Q=await jJ(Q,Z,Y),Q=await _J(Q,Z,Y),Q=await GY(Q,Z,Y,G),W5(Q))Q=l7(Q,Z),Q=i7(Q,Z);Q=c7(Q);let{processStreamDirectives:K}=await t("stx/streaming",()=>Promise.resolve().then(() => (Q6(),X6)));Q=K(Q,Z),Q=x6(Q,Z,Y,G),Q=await Z7(Q,Z,Y,G,X),Q=await SJ(Q,Z,Y,G,X),Q=B9(Q,Z,Y,G);let{processDeferDirectives:W}=await t("stx/defer",()=>Promise.resolve().then(() => tJ));Q=W(Q,Z,Y);let{processTeleportDirectives:q}=await t("stx/teleport",()=>Promise.resolve().then(() => $X));Q=q(Q,Z,Y);let{processTransitionDirectives:z,processTransitionAttributes:U}=await t("stx/transitions",()=>Promise.resolve().then(() => XX));Q=z(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:j}=await t("stx/error-boundaries",()=>Promise.resolve().then(() => GX));Q=j(Q,Z,Y);let{processSuspenseDirectives:_}=await t("stx/suspense",()=>Promise.resolve().then(() => KX));Q=_(Q,Z,Y);let{processAsyncDirectives:B}=await t("stx/async-components",()=>Promise.resolve().then(() => UX));Q=B(Q,Z,Y);let{processKeepAliveDirectives:H}=await t("stx/keep-alive",()=>Promise.resolve().then(() => _X));Q=H(Q,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await t("stx/virtual-scrolling",()=>Promise.resolve().then(() => (VX(),FX)));Q=L(Q,Z,Y),Q=F(Q,Z,Y),Q=O(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await t("stx/partial-hydration",()=>Promise.resolve().then(() => (CX(),PX)));Q=V(Q,Z,Y),Q=w(Q);let{processComputedDirectives:A,processWatchDirectives:R}=await t("stx/computed",()=>Promise.resolve().then(() => (iX(),cX)));Q=A(Q,Z,Y),Q=R(Q,Z,Y);let{processFormValidationDirectives:N}=await t("stx/forms-validation",()=>Promise.resolve().then(() => (aX(),rX)));Q=N(Q,Z,Y);let{processHeadDirective:M,processTitleDirective:T,processMetaDirective:I,resetHead:E}=await t("stx/head",()=>Promise.resolve().then(() => (t5(),k7)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=M(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
12280
- `;if(Q=T(Q,Z),Q=I(Q,Z),Q=AJ(Q),Q=c3(Q,Z),Q=XY(Q),Q=OJ(Q),Q=await h6(Q,Z,Y,G,X),Q=await Z7(Q,Z,Y,G,X),Z.__stxProcessingDepth===1)Q=h9(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=o6(Q),Q=r1(Q,Z,Y),Q=i3(Q,Z),Q=n3(Q,Z),Q=i4(Q,Z),Q=HY(Q,Z),Q=OY(Q,Z),Q=await i2(Q,Z,Y,G),Q=await $Z(Q,Z,Y),Q=await AY(Q,Z,Y,G),Q=K9(Q,Z,Y,G),Q=W2(Q,Z,Y,G),Q=q2(Q,Z,Y),Q=z2(Q,Z,Y,G),Q=ZY(Q,Z,Y,G),Q=i6(Q,Z),Q=n6(Q),Q=pJ(Q),!G.skipEventDirectives)Q=h2(Q,Z,Y);if(Q=l2(Q,Z,Y),G.debug){let n=/\bx-data\s*=/.test(Q),X0=$4($);if(n&&X0)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
12514
+ @endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,F,w)=>{return _[F]=w,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,F,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=Z0(w.trim(),Z);if(A===void 0)return O;return _[F]=String(A??""),""}catch{return O}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,F,w)=>{if(w.includes("@parent"))_[F]=w.replace("@parent",Z5);else _[F]=w.trim();return""}),Z.__sections=_,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,F,w)=>{return _[F]||w||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""});if(W=p6(W,B),H){let O=[],F=w1(W),w=J1(F.output,K5,(A,R)=>`\x00STX_ORPHAN_STYLE_${R}\x00`);if(W=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,R,N)=>{let T=R==="SCRIPT"?F.scripts[Number(N)]:w.tokens[Number(N)];if(T)O.push(T);return""}),O.length>0){let A=O.join(`
12515
+ `);_.content=_.content?`${_.content}
12516
+ ${A}`:A,Z.__sections=_}}if(H)try{let O;if(h0.isAbsolute(H))O=H,X.add(H);else O=await F5(()=>t7(H,Y,G,X),null,()=>{throw new n1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(e0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new n1(T,Y);return W}let F=await F5(()=>Bun.file(O).text(),"",()=>{throw new n1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,y,S)=>{return T[y]=S.trim(),""});for(let[D,y]of Object.entries(T))if(_[D]&&_[D].includes(Z5)){let S=_[D].indexOf(Z5);_[D]=_[D].slice(0,S)+y+_[D].slice(S+Z5.length)}else if(!_[D])_[D]=y;let I={...Z,__sections:_},E=`@layout('${w[1]}')${M}`;return await L0(E,I,O,G,X)}let A=F.replace(/\{\{--[\s\S]*?--\}\}/g,""),R=m6(A,B),N={};return R=R.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return N[M]=I.trim(),`@slot('${M}')`}),R=R.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(_[M]){let E=_[M];if(E.includes(Z5)){let D=N[M]||"",y=E.indexOf(Z5);E=E.slice(0,y)+D+E.slice(y+Z5.length)}return E}return I||""}),R=T_(R,_),R=R.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""}),R=p6(R,B),Z.__originalFilePath=Y,W=await FQ(R,Z,O,G,X),W=`<!-- stx-layout: ${H} -->
12517
+ ${W}`,U(W)}catch(O){return e0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await FQ(W,Z,Y,G,X))}function T_($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,X)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function I_($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(Y)&&Q!==void 0)J[X]=Q;$.$env=J}async function D_($,Z){await F5(()=>EJ($,Z),void 0,(Y)=>{e0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function E_($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X;while((X=J.exec($))!==null){let Q=X[1],G=X[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => ($$(),h$)));await W(G,Z,Y,{preserveExisting:!0})}catch(W){let q=W instanceof Error?W:Error(String(W));e0.log(q,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${q.message}`)}}}async function k_($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await t("stx/expressions",()=>Promise.resolve().then(() => (X1(),Q8)));return J($,Z,{skipServer:!0})}catch(J){let X=J instanceof Error?J:Error(String(J));return e0.log(X,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${X.message}`),$}}async function FQ($,Z,Y,J,X){let Q=$,G=J;if(await E_(Q,Z,Y),Q=await k_(Q,Z,Y),Q=await LJ(Q,Z,Y),Q=await FJ(Q,Z,Y),Q=await zY(Q,Z,Y,G),W5(Q))Q=i7(Q,Z),Q=o7(Q,Z);Q=n7(Q);let{processStreamDirectives:K}=await t("stx/streaming",()=>Promise.resolve().then(() => (K6(),G6)));Q=K(Q,Z),Q=g6(Q,Z,Y,G),Q=await Y7(Q,Z,Y,G,X),Q=await xJ(Q,Z,Y,G,X),Q=L9(Q,Z,Y,G);let{processDeferDirectives:W}=await t("stx/defer",()=>Promise.resolve().then(() => KX));Q=W(Q,Z,Y);let{processTeleportDirectives:q}=await t("stx/teleport",()=>Promise.resolve().then(() => qX));Q=q(Q,Z,Y);let{processTransitionDirectives:z,processTransitionAttributes:U}=await t("stx/transitions",()=>Promise.resolve().then(() => BX));Q=z(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:j}=await t("stx/error-boundaries",()=>Promise.resolve().then(() => HX));Q=j(Q,Z,Y);let{processSuspenseDirectives:B}=await t("stx/suspense",()=>Promise.resolve().then(() => OX));Q=B(Q,Z,Y);let{processAsyncDirectives:_}=await t("stx/async-components",()=>Promise.resolve().then(() => wX));Q=_(Q,Z,Y);let{processKeepAliveDirectives:H}=await t("stx/keep-alive",()=>Promise.resolve().then(() => RX));Q=H(Q,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:V,processInfiniteListDirectives:O}=await t("stx/virtual-scrolling",()=>Promise.resolve().then(() => (EX(),DX)));Q=L(Q,Z,Y),Q=V(Q,Z,Y),Q=O(Q,Z,Y);let{processPartialHydrationDirectives:F,processStaticDirectives:w}=await t("stx/partial-hydration",()=>Promise.resolve().then(() => (pX(),mX)));Q=F(Q,Z,Y),Q=w(Q);let{processComputedDirectives:A,processWatchDirectives:R}=await t("stx/computed",()=>Promise.resolve().then(() => (ZQ(),$Q)));Q=A(Q,Z,Y),Q=R(Q,Z,Y);let{processFormValidationDirectives:N}=await t("stx/forms-validation",()=>Promise.resolve().then(() => (GQ(),QQ)));Q=N(Q,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:E}=await t("stx/head",()=>Promise.resolve().then(() => (e5(),S7)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=T(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
12518
+ `;if(Q=M(Q,Z),Q=I(Q,Z),Q=IJ(Q),Q=n3(Q,Z),Q=WY(Q),Q=AJ(Q),Q=await u6(Q,Z,Y,G,X),Q=await Y7(Q,Z,Y,G,X),Z.__stxProcessingDepth===1)Q=m9(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=a6(Q),Q=r1(Q,Z,Y),Q=o3(Q,Z),Q=s3(Q,Z),Q=n4(Q,Z),Q=VY(Q,Z),Q=wY(Q,Z),Q=await r2(Q,Z,Y,G),Q=await XZ(Q,Z,Y),Q=await TY(Q,Z,Y,G),Q=z9(Q,Z,Y,G),Q=j2(Q,Z,Y,G),Q=B2(Q,Z,Y),Q=_2(Q,Z,Y,G),Q=QY(Q,Z,Y,G),Q=s6(Q,Z),Q=r6(Q),Q=tJ(Q),!G.skipEventDirectives)Q=p2(Q,Z,Y);if(Q=o2(Q,Z,Y),G.debug){let n=/\bx-data\s*=/.test(Q),X0=Z4($);if(n&&X0)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
12281
12519
  Both work on the same page, but they manage separate scopes.
12282
- Prefer signals (state/derived/effect) for new components.`)}Q=IJ(Q,Z),Q=await A1(Q,Z,Y),Q=lJ(Q),Q=cJ(Q),Q=b2(Q);let{processXElementDirectives:y}=await t("stx/x-element",()=>Promise.resolve().then(() => $Q));Q=y(Q);let S=Z.__originalFilePath||Y,k=p5(Z);if(Q=await n7(Q,G,S,k),Q=UY(Q,Z),Q=await VJ(Q,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:X0}=await t("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (YQ(),ZQ)));Q=await X0(Q,{publicDir:n})}if(G.seo?.enabled)Q=U2(Q,Z,G);let v=(n,X0,H0=!0)=>{if(!X0)return n;let D0=X0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),C=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(D0&&C){if(H0)n=n.replace(C[0],D0[0]);if(X0=X0.replace(D0[0],"").trim(),!X0)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${X0}
12520
+ Prefer signals (state/derived/effect) for new components.`)}Q=SJ(Q,Z),Q=await A1(Q,Z,Y),Q=eJ(Q),Q=$X(Q),Q=C2(Q);let{processXElementDirectives:y}=await t("stx/x-element",()=>Promise.resolve().then(() => qQ));Q=y(Q);let S=Z.__originalFilePath||Y,k=l5(Z);if(Q=await s7(Q,G,S,k),Q=HY(Q,Z),Q=await MJ(Q,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:X0}=await t("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (UQ(),zQ)));Q=await X0(Q,{publicDir:n})}if(G.seo?.enabled)Q=H2(Q,Z,G);let C=(n,X0,H0=!0)=>{if(!X0)return n;let D0=X0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),P=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(D0&&P){if(H0)n=n.replace(P[0],D0[0]);if(X0=X0.replace(D0[0],"").trim(),!X0)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${X0}
12283
12521
  </head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
12284
12522
  ${X0}`);if(/<html\b[^>]*>/i.test(n))return n.replace(/(<html\b[^>]*>)/i,`$1
12285
12523
  <head>
12286
12524
  ${X0}
12287
- </head>`);return n},{renderHead:g,getHead:f}=await t("stx/head",()=>Promise.resolve().then(() => (t5(),k7))),p=Z.__stx_runtime_head??f();if(p.title||p.meta?.length||p.link?.length){let n=g(p);if(n)Q=v(Q,n)}if(D.headContent)Q=v(Q,D.headContent,!p.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=e2(Q,G.csp,Z);if(G.analytics?.enabled)Q=y2(Q,G);if(G.heatmap?.enabled)Q=V9(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await t("stx/pwa/inject",()=>Promise.resolve().then(() => (GQ(),QQ)));Q=n(Q,G)}let Q0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),Y0=/\bSTX\.\w+/.test(Q),w0=/window\.STX\s*=/.test(Q);if(Q0&&Y0&&!w0){let X0=`<script data-stx-scoped>
12288
- ${I2()}
12289
- </script>`;if(Q.includes("</head>")){let H0=Q.indexOf("</head>"),C=Q.slice(0,H0).indexOf("<script");if(C!==-1){let P=Q.slice(0,C),x=Q.slice(C);Q=P+X0+`
12525
+ </head>`);return n},{renderHead:g,getHead:f}=await t("stx/head",()=>Promise.resolve().then(() => (e5(),S7))),p=Z.__stx_runtime_head??f();if(p.title||p.meta?.length||p.link?.length){let n=g(p);if(n)Q=C(Q,n)}if(D.headContent)Q=C(Q,D.headContent,!p.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=JY(Q,G.csp,Z);if(G.analytics?.enabled)Q=x2(Q,G);if(G.heatmap?.enabled)Q=R9(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await t("stx/pwa/inject",()=>Promise.resolve().then(() => (HQ(),_Q)));Q=n(Q,G)}let Q0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),Y0=/\bSTX\.\w+/.test(Q),w0=/window\.STX\s*=/.test(Q);if(Q0&&Y0&&!w0){let X0=`<script data-stx-scoped>
12526
+ ${b2()}
12527
+ </script>`;if(Q.includes("</head>")){let H0=Q.indexOf("</head>"),P=Q.slice(0,H0).indexOf("<script");if(P!==-1){let v=Q.slice(0,P),x=Q.slice(P);Q=v+X0+`
12290
12528
  `+x}else Q=Q.replace("</head>",`${X0}
12291
12529
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
12292
12530
  ${X0}`);else Q=X0+`
12293
- `+Q}{let{scanScriptTags:n}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (J$(),Z4))),X0=[];for(let H0 of n(Q)){if(!/\bserver\b/i.test(H0.attrs))continue;let D0=H0.start+H0.fullMatch.indexOf(">")+1,C=qB(Q,D0);if(C===-1)continue;let P=C+9;while(P<Q.length&&/\s/.test(Q[P]))P++;X0.push({start:H0.start,end:P})}for(let H0=X0.length-1;H0>=0;H0--){let{start:D0,end:C}=X0[H0];Q=Q.substring(0,D0)+Q.substring(C)}}let s=C$(Q,Y);if(s.hasScoped)Q=s.html;let G0=Z.__stx_event_bindings||[],b0=!1,o0=[],H1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:Y5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (J$(),Z4)));for(let n of Y5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))o0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:X0,content:H0}of o0){b0=!0;let D0=H0;r6(H0,Y,J.strict);let C=await l5(H0,{eventBindings:G0,attrs:X0,hasColonDirectives:H1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:k});Q=Q.replace(n,()=>C)}if(b0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=$Y(Q,Z.cspNonce);return Q}var Z5="<!--PARENT_CONTENT_PLACEHOLDER-->";var Q4=b(()=>{d4();g1();j7();D2();S2();P2();H7();_7();d2();c5();c2();n2();p4();YY();QY();WY();jY();U1();t5();X1();LY();RY();UJ();HJ();f6();a7();wJ();j5();RJ();C3();M0();MJ();DJ();bJ();yJ();T7();l6();gJ();J$();v6();mJ();s6();a6();A0();K6();F7();h5();s6();a6()});import V0 from"fs";import K0 from"path";import{matchRoute as hB,Router as IQ}from"stx-router";import{findErrorPage as mB,formatRoutes as pB,generateRouteManifest as lB,generateRouteTypes as cB,matchRoute as iB}from"stx-router";function U7($,Z={}){return new IQ($,Z).routes}Q4();import{createHash as LB}from"crypto";function FB($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var VB=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function wB($){return Bun.hash($).toString(16)}function zQ($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,J=$.replace(VB,(Q,G,K,W)=>{let q=W.trim();if(!q)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)q=FB(q);let z=wB(q);if(!Y.has(z))Y.set(z,q);let U=Z.integrity?` data-stx-integrity="sha384-${LB("sha384").update(q).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${z}.js"${U}${K}></script>`}),X=Array.from(Y,([Q,G])=>({hash:Q,code:G}));return{html:J,chunks:X}}var AB=new Set(["visible","idle"]);function UQ($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Y.exec($))!==null)Z.set(J[1],J[2]);let X=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(AB.has(Z.get(G[1])||""))X.add(G[2]);let K=$.lastIndexOf("</head>");if(X.size===0||K===-1)return $;let W=Array.from(X).filter((q)=>!$.includes(`rel="prefetch" href="${q}"`)).map((q)=>`<link rel="prefetch" href="${q}" as="script">`).join("");if(!W)return $;return $.slice(0,K)+W+$.slice(K)}s1();f5();d4();import{abortNavigation as yN,clearMiddleware as jQ,createClientCookieManager as PN,createMiddlewareContext as _Q,createRouteLocation as BQ,createServerCookieManager as CN,createStorageManager as vN,defineMiddleware as xN,getMiddleware as fN,getMiddlewareNames as HQ,hasMiddleware as gN,loadMiddlewareFromDirectory as OQ,navigateTo as hN,registerMiddleware as dN,runMiddleware as LQ}from"stx-router";class FQ{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=K0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,J]of Object.entries(Z))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await V0.promises.mkdir(this.cacheDir,{recursive:!0});let $=K0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,J]of this.cache)Z[Y]=J;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=V0.statSync($),J=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(V0.existsSync(Q)){let G=V0.statSync(Q);J+=`:${Q}:${G.mtimeMs}`}let X=0;for(let Q=0;Q<J.length;Q++){let G=J.charCodeAt(Q);X=(X<<5)-X+G,X=X&X}return Math.abs(X).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let J=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==J)return this.cache.delete($),null;return Y.html}set($,Z,Y,J){let X=this.getHash(Z,Y);this.cache.set($,{hash:X,html:J,generatedAt:Date.now(),dependencies:Y})}}class VQ{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return K0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await V0.promises.mkdir(K0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await V0.promises.unlink(Z)}async invalidatePattern($){let Z=K0.join(this.cacheDir,"isr");if(!V0.existsSync(Z))return;let Y=await V0.promises.readdir(Z);for(let J of Y){let X=J.replace(/_/g,"/").replace(".json","");if($.test(X))await V0.promises.unlink(K0.join(Z,J))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function RB($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let J=Y[1];if(!J.includes("getStaticPaths"))return null;let X=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!X)return null;return await Function(`
12531
+ `+Q}{let{scanScriptTags:n}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (X$(),Y4))),X0=[];for(let H0 of n(Q)){if(!/\bserver\b/i.test(H0.attrs))continue;let D0=H0.start+H0.fullMatch.indexOf(">")+1,P=R_(Q,D0);if(P===-1)continue;let v=P+9;while(v<Q.length&&/\s/.test(Q[v]))v++;X0.push({start:H0.start,end:v})}for(let H0=X0.length-1;H0>=0;H0--){let{start:D0,end:P}=X0[H0];Q=Q.substring(0,D0)+Q.substring(P)}}let r=v$(Q,Y);if(r.hasScoped)Q=r.html;let G0=Z.__stx_event_bindings||[],b0=!1,o0=[],H1=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:Y5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (X$(),Y4)));for(let n of Y5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))o0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:X0,content:H0}of o0){b0=!0;let D0=H0;e6(H0,Y,J.strict);let P=await c5(H0,{eventBindings:G0,attrs:X0,hasColonDirectives:H1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:k});Q=Q.replace(n,()=>P)}if(b0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=XY(Q,Z.cspNonce);return Q}var Z5="<!--PARENT_CONTENT_PLACEHOLDER-->";var G4=b(()=>{u4();g1();H7();S2();v2();f2();F7();O7();l2();i5();s2();a2();l4();GY();qY();jY();OY();U1();e5();X1();AY();IY();OJ();wJ();h6();e7();TJ();j5();DJ();x3();M0();kJ();yJ();vJ();fJ();D7();i6();nJ();X$();f6();aJ();t6();$9();A0();q6();A7();d5();t6();$9()});import V0 from"fs";import K0 from"path";import{matchRoute as t_,Router as vQ}from"stx-router";import{findErrorPage as ZH,formatRoutes as YH,generateRouteManifest as JH,generateRouteTypes as XH,matchRoute as QH}from"stx-router";function _7($,Z={}){return new vQ($,Z).routes}G4();import{createHash as b_}from"crypto";function S_($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var y_=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function P_($){return Bun.hash($).toString(16)}function VQ($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,J=$.replace(y_,(Q,G,K,W)=>{let q=W.trim();if(!q)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)q=S_(q);let z=P_(q);if(!Y.has(z))Y.set(z,q);let U=Z.integrity?` data-stx-integrity="sha384-${b_("sha384").update(q).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${z}.js"${U}${K}></script>`}),X=Array.from(Y,([Q,G])=>({hash:Q,code:G}));return{html:J,chunks:X}}var C_=new Set(["visible","idle"]);function wQ($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Y.exec($))!==null)Z.set(J[1],J[2]);let X=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(C_.has(Z.get(G[1])||""))X.add(G[2]);let K=$.lastIndexOf("</head>");if(X.size===0||K===-1)return $;let W=Array.from(X).filter((q)=>!$.includes(`rel="prefetch" href="${q}"`)).map((q)=>`<link rel="prefetch" href="${q}" as="script">`).join("");if(!W)return $;return $.slice(0,K)+W+$.slice(K)}s1();g5();u4();import{abortNavigation as nN,clearMiddleware as AQ,createClientCookieManager as oN,createMiddlewareContext as RQ,createRouteLocation as NQ,createServerCookieManager as sN,createStorageManager as rN,defineMiddleware as aN,getMiddleware as tN,getMiddlewareNames as MQ,hasMiddleware as eN,loadMiddlewareFromDirectory as TQ,navigateTo as $M,registerMiddleware as ZM,runMiddleware as IQ}from"stx-router";class DQ{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=K0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,J]of Object.entries(Z))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await V0.promises.mkdir(this.cacheDir,{recursive:!0});let $=K0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,J]of this.cache)Z[Y]=J;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=V0.statSync($),J=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(V0.existsSync(Q)){let G=V0.statSync(Q);J+=`:${Q}:${G.mtimeMs}`}let X=0;for(let Q=0;Q<J.length;Q++){let G=J.charCodeAt(Q);X=(X<<5)-X+G,X=X&X}return Math.abs(X).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let J=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==J)return this.cache.delete($),null;return Y.html}set($,Z,Y,J){let X=this.getHash(Z,Y);this.cache.set($,{hash:X,html:J,generatedAt:Date.now(),dependencies:Y})}}class EQ{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return K0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await V0.promises.mkdir(K0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await V0.promises.unlink(Z)}async invalidatePattern($){let Z=K0.join(this.cacheDir,"isr");if(!V0.existsSync(Z))return;let Y=await V0.promises.readdir(Z);for(let J of Y){let X=J.replace(/_/g,"/").replace(".json","");if($.test(X))await V0.promises.unlink(K0.join(Z,J))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function v_($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let J=Y[1];if(!J.includes("getStaticPaths"))return null;let X=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!X)return null;return await Function(`
12294
12532
  return (async function getStaticPaths() {
12295
12533
  ${X[1]}
12296
12534
  })()
12297
- `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function NB($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let Y=await RB($.filePath);if(!Y||Y.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let J of Y.paths){let X=$.pattern;for(let[Q,G]of Object.entries(J.params))X=X.replace(`:${Q}`,G).replace(`:${Q}*`,G);Z.push({url:X,params:J.params,props:J.props,revalidate:J.revalidate})}}return Z}async function MB($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Y of Z)if(await Bun.file(Y).exists())try{let J=await import(Y);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:X,...Q}=J;return Q}}catch(J){console.error(`Error loading data file ${Y}:`,J)}return null}async function TB($,Z,Y){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let X=J[1];if(!X.includes("getStaticProps"))return null;try{let Q=X.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!Q)return null;return await Function("params",`
12535
+ `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function x_($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let Y=await v_($.filePath);if(!Y||Y.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let J of Y.paths){let X=$.pattern;for(let[Q,G]of Object.entries(J.params))X=X.replace(`:${Q}`,G).replace(`:${Q}*`,G);Z.push({url:X,params:J.params,props:J.props,revalidate:J.revalidate})}}return Z}async function f_($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Y of Z)if(await Bun.file(Y).exists())try{let J=await import(Y);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:X,...Q}=J;return Q}}catch(J){console.error(`Error loading data file ${Y}:`,J)}return null}async function g_($,Z,Y){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let X=J[1];if(!X.includes("getStaticProps"))return null;try{let Q=X.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!Q)return null;return await Function("params",`
12298
12536
  return (async function getStaticProps() {
12299
12537
  ${Q[1]}
12300
12538
  })()
12301
- `)(Z)}catch(Q){return console.error(`Error executing getStaticProps in ${Y}:`,Q),null}}async function wQ($,Z,Y={},J,X){let Q=await Bun.file($.filePath).text(),G=await MB($.filePath),K=await TB(Q,Z,$.filePath),W={...G||{},...K||{},...Y,params:Z,$route:{path:$.pattern,params:Z}},q=new Set,z={...X,debug:!1,cache:!1,autoShell:!0},U=await L0(Q,W,$.filePath,z,q);if(Object.keys(Z).length>0){let j=`<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>",`${j}
12539
+ `)(Z)}catch(Q){return console.error(`Error executing getStaticProps in ${Y}:`,Q),null}}async function kQ($,Z,Y={},J,X){let Q=await Bun.file($.filePath).text(),G=await f_($.filePath),K=await g_(Q,Z,$.filePath),W={...G||{},...K||{},...Y,params:Z,$route:{path:$.pattern,params:Z}},q=new Set,z={...X,debug:!1,cache:!1,autoShell:!0},U=await L0(Q,W,$.filePath,z,q);if(Object.keys(Z).length>0){let j=`<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>",`${j}
12302
12540
  </head>`);else U=`${j}
12303
- ${U}`}if(U=await m7(U),U=await z$(U),J.minify!==!1)return{html:IB(U),dependencies:Array.from(q)};return{html:U,dependencies:Array.from(q)}}function IB($){let Z=[],Y=0,J=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,X;while((X=J.exec($))!==null){let G=$.slice(Y,X.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=X[1],W=X[2],q=X[3];W=W.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+W+q),Y=X.index+X[0].length}let Q=$.slice(Y);return Z.push(Q.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function DB($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function EB($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
12541
+ ${U}`}if(U=await l7(U),U=await U$(U),J.minify!==!1)return{html:h_(U),dependencies:Array.from(q)};return{html:U,dependencies:Array.from(q)}}function h_($){let Z=[],Y=0,J=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,X;while((X=J.exec($))!==null){let G=$.slice(Y,X.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=X[1],W=X[2],q=X[3];W=W.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+W+q),Y=X.index+X[0].length}let Q=$.slice(Y);return Z.push(Q.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function d_($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function u_($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
12304
12542
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
12305
12543
  ${$.map((J)=>{let X=new URL(J.loc,Z).href,Q=` <url>
12306
12544
  <loc>${Y1(X)}</loc>`;if(J.lastmod)Q+=`
@@ -12309,7 +12547,7 @@ ${$.map((J)=>{let X=new URL(J.loc,Z).href,Q=` <url>
12309
12547
  <priority>${J.priority}</priority>`;return Q+=`
12310
12548
  </url>`,Q}).join(`
12311
12549
  `)}
12312
- </urlset>`}function Y1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function kB($,Z){let Y=Z.map((J)=>{let X=" <item>";if(X+=`
12550
+ </urlset>`}function Y1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function m_($,Z){let Y=Z.map((J)=>{let X=" <item>";if(X+=`
12313
12551
  <title>${Y1(J.title)}</title>`,X+=`
12314
12552
  <link>${Y1(J.link)}</link>`,J.description)X+=`
12315
12553
  <description>${Y1(J.description)}</description>`;if(J.pubDate)X+=`
@@ -12330,10 +12568,10 @@ ${$.map((J)=>{let X=new URL(J.loc,Z).href,Q=` <url>
12330
12568
  ${Y.join(`
12331
12569
  `)}
12332
12570
  </channel>
12333
- </rss>`}async function bB($={}){let Z=Date.now(),Y=await j1(),J={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:$.domain||"http://localhost",revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||L1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},X={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,G=0,K={},W={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&V0.existsSync(J.outputDir))await V0.promises.rm(J.outputDir,{recursive:!0});await V0.promises.mkdir(J.outputDir,{recursive:!0});let z=new FQ(J.cacheDir);if(J.cache)await z.load();try{let{generateCrosswindCSS:V}=await Promise.resolve().then(() => (d4(),T2));await V('<div class="bg-black"></div>')}catch{}jQ();let U=Y?.routeMiddleware?.dir||"middleware";await OQ(process.cwd(),U);let j=HQ();if(j.length>0)console.log(`Loaded ${j.length} middleware: ${j.join(", ")}`);let _=Y?.routeMiddleware?.global||[],B=U7(".",{pagesDir:J.pagesDir});console.log(`Found ${B.length} routes`);let H=[];for(let V of B){let w=await NB(V);for(let A of w)H.push({route:V,url:A.url,params:A.params,props:A.props,revalidate:A.revalidate??J.revalidate})}X.totalPages=H.length,console.log(`Generating ${X.totalPages} pages...`);let L=[],F=[];for(let V=0;V<H.length;V+=J.concurrency)F.push(H.slice(V,V+J.concurrency));for(let V of F)await Promise.all(V.map(async(w)=>{let{route:A,url:R,params:N,props:M,revalidate:T}=w;try{await J.hooks.onPageStart?.(R);let I=await Bun.file(A.filePath).text(),E=CB(I),D=E?.middleware?Array.isArray(E.middleware)?E.middleware:[E.middleware]:[],y=[..._,...D];if(y.length>0){let d=BQ(R,N,E||{}),p=_Q(d,null),Q0=await LQ(y,p);if(Q0.redirect){let Y0=typeof Q0.redirect==="string"?Q0.redirect:Q0.redirect.path||Q0.redirect,w0=vB(String(Y0),R),s=xB(R,J);await V0.promises.mkdir(K0.dirname(s),{recursive:!0}),await Bun.write(s,w0),X.successCount++,X.pages.push({route:R,outputPath:s,size:Buffer.byteLength(w0),cached:!1}),L.push({loc:R,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${R} \u2192 redirect to ${Y0}`);return}if(Q0.abort){let Y0=typeof Q0.abort==="string"?Q0.abort:Q0.abort?.error?.message||"aborted";console.warn(` \u21B3 ${R} \u2014 middleware aborted: ${Y0}`);return}}let S=I.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(S)try{if(!await Function("route",`
12571
+ </rss>`}async function p_($={}){let Z=Date.now(),Y=await j1(),J={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:$.domain||"http://localhost",revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||L1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},X={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,G=0,K={},W={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&V0.existsSync(J.outputDir))await V0.promises.rm(J.outputDir,{recursive:!0});await V0.promises.mkdir(J.outputDir,{recursive:!0});let z=new DQ(J.cacheDir);if(J.cache)await z.load();try{let{generateCrosswindCSS:F}=await Promise.resolve().then(() => (u4(),k2));await F('<div class="bg-black"></div>')}catch{}AQ();let U=Y?.routeMiddleware?.dir||"middleware";await TQ(process.cwd(),U);let j=MQ();if(j.length>0)console.log(`Loaded ${j.length} middleware: ${j.join(", ")}`);let B=Y?.routeMiddleware?.global||[],_=_7(".",{pagesDir:J.pagesDir});console.log(`Found ${_.length} routes`);let H=[];for(let F of _){let w=await x_(F);for(let A of w)H.push({route:F,url:A.url,params:A.params,props:A.props,revalidate:A.revalidate??J.revalidate})}X.totalPages=H.length,console.log(`Generating ${X.totalPages} pages...`);let L=[],V=[];for(let F=0;F<H.length;F+=J.concurrency)V.push(H.slice(F,F+J.concurrency));for(let F of V)await Promise.all(F.map(async(w)=>{let{route:A,url:R,params:N,props:T,revalidate:M}=w;try{await J.hooks.onPageStart?.(R);let I=await Bun.file(A.filePath).text(),E=n_(I),D=E?.middleware?Array.isArray(E.middleware)?E.middleware:[E.middleware]:[],y=[...B,...D];if(y.length>0){let d=NQ(R,N,E||{}),p=RQ(d,null),Q0=await IQ(y,p);if(Q0.redirect){let Y0=typeof Q0.redirect==="string"?Q0.redirect:Q0.redirect.path||Q0.redirect,w0=o_(String(Y0),R),r=s_(R,J);await V0.promises.mkdir(K0.dirname(r),{recursive:!0}),await Bun.write(r,w0),X.successCount++,X.pages.push({route:R,outputPath:r,size:Buffer.byteLength(w0),cached:!1}),L.push({loc:R,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${R} \u2192 redirect to ${Y0}`);return}if(Q0.abort){let Y0=typeof Q0.abort==="string"?Q0.abort:Q0.abort?.error?.message||"aborted";console.warn(` \u21B3 ${R} \u2014 middleware aborted: ${Y0}`);return}}let S=I.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(S)try{if(!await Function("route",`
12334
12572
  const validate = ${S[1]};
12335
12573
  return validate(route);
12336
- `)({params:N})){console.warn(`Validation failed for ${R}, skipping...`);return}}catch{}let k=null,v=!1;if(J.cache){if(k=z.get(R,A.filePath),k)v=!0,X.cachedCount++}if(!k){let d=await wQ(A,N,M,J,Y);if(k=d.html,J.cache)z.set(R,A.filePath,d.dependencies,k)}let g;if(J.trailingSlash)g=K0.join(J.outputDir,R,"index.html");else g=R==="/"?K0.join(J.outputDir,"index.html"):K0.join(J.outputDir,`${R}.html`);if(J.chunkIslands){let{html:d,chunks:p}=zQ(k,{integrity:J.integrityIslands,minify:J.minify});if(p.length>0){let Q0=K0.join(J.outputDir,"_stx","islands");await V0.promises.mkdir(Q0,{recursive:!0});for(let Y0 of p){let w0=K0.join(Q0,`${Y0.hash}.js`);if(!await Bun.file(w0).exists())await Bun.write(w0,Y0.code);if(!Q.has(Y0.hash)){Q.add(Y0.hash);let s=Buffer.byteLength(Y0.code,"utf8");G+=s,K[Y0.hash]={bytes:s,file:`/_stx/islands/${Y0.hash}.js`}}}if(W[R]=p.map((Y0)=>Y0.hash),k=d,J.prefetchIslands)k=UQ(k)}}await V0.promises.mkdir(K0.dirname(g),{recursive:!0}),await Bun.write(g,k),L.push({loc:R,lastmod:new Date().toISOString().split("T")[0],priority:R==="/"?1:0.8});let f={route:R,outputPath:g,size:Buffer.byteLength(k,"utf8"),cached:v};if(T!==!1)f.revalidateAt=Date.now()+T*1000;X.pages.push(f),X.successCount++,await J.hooks.onPageEnd?.(R,k)}catch(I){X.failedCount++,X.errors.push({route:R,error:I}),await J.hooks.onError?.(I,R),console.error(`Error generating ${R}:`,I)}}));if(J.cache)await z.save();if(J.generate404){let V=K0.join(J.pagesDir,"404.stx");if(await Bun.file(V).exists()){let w=new Set,A={...Y,debug:!1,cache:!1},R=await L0(await Bun.file(V).text(),{},V,A,w);await Bun.write(K0.join(J.outputDir,"404.html"),R)}else await Bun.write(K0.join(J.outputDir,"404.html"),`<!DOCTYPE html>
12574
+ `)({params:N})){console.warn(`Validation failed for ${R}, skipping...`);return}}catch{}let k=null,C=!1;if(J.cache){if(k=z.get(R,A.filePath),k)C=!0,X.cachedCount++}if(!k){let d=await kQ(A,N,T,J,Y);if(k=d.html,J.cache)z.set(R,A.filePath,d.dependencies,k)}let g;if(J.trailingSlash)g=K0.join(J.outputDir,R,"index.html");else g=R==="/"?K0.join(J.outputDir,"index.html"):K0.join(J.outputDir,`${R}.html`);if(J.chunkIslands){let{html:d,chunks:p}=VQ(k,{integrity:J.integrityIslands,minify:J.minify});if(p.length>0){let Q0=K0.join(J.outputDir,"_stx","islands");await V0.promises.mkdir(Q0,{recursive:!0});for(let Y0 of p){let w0=K0.join(Q0,`${Y0.hash}.js`);if(!await Bun.file(w0).exists())await Bun.write(w0,Y0.code);if(!Q.has(Y0.hash)){Q.add(Y0.hash);let r=Buffer.byteLength(Y0.code,"utf8");G+=r,K[Y0.hash]={bytes:r,file:`/_stx/islands/${Y0.hash}.js`}}}if(W[R]=p.map((Y0)=>Y0.hash),k=d,J.prefetchIslands)k=wQ(k)}}await V0.promises.mkdir(K0.dirname(g),{recursive:!0}),await Bun.write(g,k),L.push({loc:R,lastmod:new Date().toISOString().split("T")[0],priority:R==="/"?1:0.8});let f={route:R,outputPath:g,size:Buffer.byteLength(k,"utf8"),cached:C};if(M!==!1)f.revalidateAt=Date.now()+M*1000;X.pages.push(f),X.successCount++,await J.hooks.onPageEnd?.(R,k)}catch(I){X.failedCount++,X.errors.push({route:R,error:I}),await J.hooks.onError?.(I,R),console.error(`Error generating ${R}:`,I)}}));if(J.cache)await z.save();if(J.generate404){let F=K0.join(J.pagesDir,"404.stx");if(await Bun.file(F).exists()){let w=new Set,A={...Y,debug:!1,cache:!1},R=await L0(await Bun.file(F).text(),{},F,A,w);await Bun.write(K0.join(J.outputDir,"404.html"),R)}else await Bun.write(K0.join(J.outputDir,"404.html"),`<!DOCTYPE html>
12337
12575
  <html lang="en">
12338
12576
  <head>
12339
12577
  <meta charset="UTF-8">
@@ -12354,7 +12592,7 @@ ${Y.join(`
12354
12592
  <a href="/">Go home</a>
12355
12593
  </div>
12356
12594
  </body>
12357
- </html>`)}for(let V of[500]){let w=K0.join(J.pagesDir,`${V}.stx`);if(await Bun.file(w).exists()){let A=new Set,R={...Y,debug:!1,cache:!1},N=await L0(await Bun.file(w).text(),{},w,R,A);await Bun.write(K0.join(J.outputDir,`${V}.html`),N)}}let O=K0.join(J.pagesDir,"error.stx");if(await Bun.file(O).exists()){let V=new Set,w={...Y,debug:!1,cache:!1},A=await L0(await Bun.file(O).text(),{},O,w,V);await Bun.write(K0.join(J.outputDir,"error.html"),A)}if(J.sitemap&&L.length>0){let V=EB(L,J.domain),w=K0.join(J.outputDir,"sitemap.xml");await Bun.write(w,V),X.sitemapPath=w,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(J.rss){let V=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},w=[];if(V.getItems)w=await V.getItems();let A=kB(V,w),R=K0.join(J.outputDir,"rss.xml");await Bun.write(R,A),X.rssPath=R,console.log(`Generated rss.xml with ${w.length} items`)}if(J.publicDir&&V0.existsSync(J.publicDir))await AQ(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`)}catch(z){throw await J.hooks.onError?.(z),z}if(X.buildTime=Date.now()-Z,Q.size>0){X.islandChunks={count:Q.size,totalBytes:G};let z={generatedChunks:Q.size,totalBytes:G,chunks:K,pages:W};await Bun.write(K0.join(J.outputDir,"_stx","islands-manifest.json"),JSON.stringify(z,null,2))}await J.hooks.onBuildEnd?.(X);let q=X.islandChunks?`
12595
+ </html>`)}for(let F of[500]){let w=K0.join(J.pagesDir,`${F}.stx`);if(await Bun.file(w).exists()){let A=new Set,R={...Y,debug:!1,cache:!1},N=await L0(await Bun.file(w).text(),{},w,R,A);await Bun.write(K0.join(J.outputDir,`${F}.html`),N)}}let O=K0.join(J.pagesDir,"error.stx");if(await Bun.file(O).exists()){let F=new Set,w={...Y,debug:!1,cache:!1},A=await L0(await Bun.file(O).text(),{},O,w,F);await Bun.write(K0.join(J.outputDir,"error.html"),A)}if(J.sitemap&&L.length>0){let F=u_(L,J.domain),w=K0.join(J.outputDir,"sitemap.xml");await Bun.write(w,F),X.sitemapPath=w,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(J.rss){let F=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},w=[];if(F.getItems)w=await F.getItems();let A=m_(F,w),R=K0.join(J.outputDir,"rss.xml");await Bun.write(R,A),X.rssPath=R,console.log(`Generated rss.xml with ${w.length} items`)}if(J.publicDir&&V0.existsSync(J.publicDir))await bQ(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`)}catch(z){throw await J.hooks.onError?.(z),z}if(X.buildTime=Date.now()-Z,Q.size>0){X.islandChunks={count:Q.size,totalBytes:G};let z={generatedChunks:Q.size,totalBytes:G,chunks:K,pages:W};await Bun.write(K0.join(J.outputDir,"_stx","islands-manifest.json"),JSON.stringify(z,null,2))}await J.hooks.onBuildEnd?.(X);let q=X.islandChunks?`
12358
12596
  Island chunks: ${X.islandChunks.count} (${(X.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
12359
12597
  Build complete!
12360
12598
  Total: ${X.totalPages} pages
@@ -12362,8 +12600,8 @@ Build complete!
12362
12600
  Cached: ${X.cachedCount}
12363
12601
  Failed: ${X.failedCount}
12364
12602
  Time: ${X.buildTime}ms${q}
12365
- `),X}async function AQ($,Z){let Y=await V0.promises.readdir($,{withFileTypes:!0});for(let J of Y){let X=K0.join($,J.name),Q=K0.join(Z,J.name);if(J.isDirectory())await V0.promises.mkdir(Q,{recursive:!0}),await AQ(X,Q);else await V0.promises.copyFile(X,Q)}}function SB($={}){let Z=$.cacheDir||L1(process.cwd(),"ssg-cache"),Y=new VQ(Z),J=$.revalidate||3600;return{async get(X){let Q=await Y.get(X);if(!Q)return null;if(Date.now()>Q.revalidateAfter)this.revalidate(X).catch(console.error);return{html:Q.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:Q.etag,"X-ISR-Generated":new Date(Q.generatedAt).toISOString(),...Q.headers}}},async revalidate(X){let G=U7(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return X.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${X}`);return}let K=X.match(G.regex),W={};if(K)G.params.forEach((U,j)=>{W[U]=K[j+1]});let q=await j1(),{html:z}=await wQ(G,W,{},$,q);await Y.set(X,{html:z,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:DB(z)}),console.log(`Revalidated: ${X}`)},async invalidate(X){if(typeof X==="string")await Y.invalidate(X);else await Y.invalidatePattern(X)}}}function yB($){return async()=>{return{paths:await $(),fallback:!1}}}function PB(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),Y=Z.match(/^---\n([\s\S]*?)\n---/),J={},X=Z;if(Y){let q=Y[1];X=Z.slice(Y[0].length).trim();for(let z of q.split(`
12366
- `)){let U=z.indexOf(":");if(U>0){let j=z.slice(0,U).trim(),_=z.slice(U+1).trim();if(_==="true")_=!0;else if(_==="false")_=!1;else if(/^\d+$/.test(_))_=parseInt(_,10);else if(/^\d+\.\d+$/.test(_))_=parseFloat(_);else if(_.startsWith("[")&&_.endsWith("]"))_=_.slice(1,-1).split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,""));J[j]=_}}}let Q=X.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),G=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,W;while((W=K.exec(Q))!==null){let q=parseInt(W[1],10),z=W[2],U=z.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:z,level:q})}return{content:Q,data:J,toc:G}}}}function CB($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function vB($,Z){return`<!DOCTYPE html>
12603
+ `),X}async function bQ($,Z){let Y=await V0.promises.readdir($,{withFileTypes:!0});for(let J of Y){let X=K0.join($,J.name),Q=K0.join(Z,J.name);if(J.isDirectory())await V0.promises.mkdir(Q,{recursive:!0}),await bQ(X,Q);else await V0.promises.copyFile(X,Q)}}function l_($={}){let Z=$.cacheDir||L1(process.cwd(),"ssg-cache"),Y=new EQ(Z),J=$.revalidate||3600;return{async get(X){let Q=await Y.get(X);if(!Q)return null;if(Date.now()>Q.revalidateAfter)this.revalidate(X).catch(console.error);return{html:Q.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:Q.etag,"X-ISR-Generated":new Date(Q.generatedAt).toISOString(),...Q.headers}}},async revalidate(X){let G=_7(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return X.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${X}`);return}let K=X.match(G.regex),W={};if(K)G.params.forEach((U,j)=>{W[U]=K[j+1]});let q=await j1(),{html:z}=await kQ(G,W,{},$,q);await Y.set(X,{html:z,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:d_(z)}),console.log(`Revalidated: ${X}`)},async invalidate(X){if(typeof X==="string")await Y.invalidate(X);else await Y.invalidatePattern(X)}}}function c_($){return async()=>{return{paths:await $(),fallback:!1}}}function i_(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),Y=Z.match(/^---\n([\s\S]*?)\n---/),J={},X=Z;if(Y){let q=Y[1];X=Z.slice(Y[0].length).trim();for(let z of q.split(`
12604
+ `)){let U=z.indexOf(":");if(U>0){let j=z.slice(0,U).trim(),B=z.slice(U+1).trim();if(B==="true")B=!0;else if(B==="false")B=!1;else if(/^\d+$/.test(B))B=parseInt(B,10);else if(/^\d+\.\d+$/.test(B))B=parseFloat(B);else if(B.startsWith("[")&&B.endsWith("]"))B=B.slice(1,-1).split(",").map((_)=>_.trim().replace(/^['"]|['"]$/g,""));J[j]=B}}}let Q=X.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),G=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,W;while((W=K.exec(Q))!==null){let q=parseInt(W[1],10),z=W[2],U=z.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:z,level:q})}return{content:Q,data:J,toc:G}}}}function n_($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function o_($,Z){return`<!DOCTYPE html>
12367
12605
  <html>
12368
12606
  <head>
12369
12607
  <meta charset="utf-8">
@@ -12375,4 +12613,4 @@ Build complete!
12375
12613
  <p>Redirecting to <a href="${$}">${$}</a>...</p>
12376
12614
  <script>window.location.replace('${$}')</script>
12377
12615
  </body>
12378
- </html>`}function xB($,Z){if($==="/"||$==="")return K0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return K0.join(Z.outputDir,Y,"index.html");return K0.join(Z.outputDir,`${Y}.html`)}var rN={generateStaticSite:bB,createISRHandler:SB,defineStaticPaths:yB,createMarkdownLoader:PB};export{bB as generateStaticSite,yB as defineStaticPaths,rN as default,PB as createMarkdownLoader,SB as createISRHandler};
12616
+ </html>`}function s_($,Z){if($==="/"||$==="")return K0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return K0.join(Z.outputDir,Y,"index.html");return K0.join(Z.outputDir,`${Y}.html`)}var UM={generateStaticSite:p_,createISRHandler:l_,defineStaticPaths:c_,createMarkdownLoader:i_};export{p_ as generateStaticSite,c_ as defineStaticPaths,UM as default,i_ as createMarkdownLoader,l_ as createISRHandler};